1
0
mirror of https://github.com/meineerde/redmine.git synced 2025-12-19 15:01:14 +00:00

Move journal action links above the notes.

git-svn-id: http://svn.redmine.org/redmine/trunk@16900 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2017-07-27 17:14:47 +00:00
parent ccba924df9
commit 0e2931fff2
3 changed files with 27 additions and 20 deletions

View File

@ -25,19 +25,19 @@ module JournalsHelper
ids.any? ? Attachment.where(:id => ids).select(&:thumbnailable?) : [] ids.any? ? Attachment.where(:id => ids).select(&:thumbnailable?) : []
end end
def render_notes(issue, journal, options={}) # Returns the action links for an issue journal
content = '' def render_journal_actions(issue, journal, options={})
css_classes = "wiki"
links = [] links = []
if journal.notes.present? if journal.notes.present?
links << link_to(l(:button_quote), if options[:reply_links]
quoted_issue_path(issue, :journal_id => journal), links << link_to(l(:button_quote),
:remote => true, quoted_issue_path(issue, :journal_id => journal),
:method => 'post', :remote => true,
:title => l(:button_quote), :method => 'post',
:class => 'icon-only icon-comment' :title => l(:button_quote),
) if options[:reply_links] :class => 'icon-only icon-comment'
)
end
if journal.editable_by?(User.current) if journal.editable_by?(User.current)
links << link_to(l(:button_edit), links << link_to(l(:button_edit),
edit_journal_path(journal), edit_journal_path(journal),
@ -53,12 +53,13 @@ module JournalsHelper
:title => l(:button_delete), :title => l(:button_delete),
:class => 'icon-only icon-del' :class => 'icon-only icon-del'
) )
css_classes << " editable"
end end
end end
content << content_tag('div', links.join(' ').html_safe, :class => 'contextual') unless links.empty? safe_join(links, ' ')
content << textilizable(journal, :notes) end
content_tag('div', content.html_safe, :id => "journal-#{journal.id}-notes", :class => css_classes)
def render_notes(issue, journal, options={})
content_tag('div', textilizable(journal, :notes), :id => "journal-#{journal.id}-notes", :class => "wiki")
end end
def render_private_notes_indicator(journal) def render_private_notes_indicator(journal)

View File

@ -2,10 +2,15 @@
<% for journal in journals %> <% for journal in journals %>
<div id="change-<%= journal.id %>" class="<%= journal.css_classes %>"> <div id="change-<%= journal.id %>" class="<%= journal.css_classes %>">
<div id="note-<%= journal.indice %>"> <div id="note-<%= journal.indice %>">
<h4><a href="#note-<%= journal.indice %>" class="journal-link">#<%= journal.indice %></a> <div class="contextual">
<%= avatar(journal.user, :size => "24") %> <span class="journal-actions"><%= render_journal_actions(issue, journal, :reply_links => reply_links) %></span>
<%= authoring journal.created_on, journal.user, :label => :label_updated_time_by %> <a href="#note-<%= journal.indice %>" class="journal-link">#<%= journal.indice %></a>
<%= render_private_notes_indicator(journal) %></h4> </div>
<h4>
<%= avatar(journal.user, :size => "24") %>
<%= authoring journal.created_on, journal.user, :label => :label_updated_time_by %>
<%= render_private_notes_indicator(journal) %>
</h4>
<% if journal.details.any? %> <% if journal.details.any? %>
<ul class="details"> <ul class="details">

View File

@ -2,8 +2,9 @@
$("#change-<%= @journal.id %>").remove(); $("#change-<%= @journal.id %>").remove();
<% else %> <% else %>
$("#change-<%= @journal.id %>").attr('class', '<%= @journal.css_classes %>'); $("#change-<%= @journal.id %>").attr('class', '<%= @journal.css_classes %>');
$("#journal-<%= @journal.id %>-notes").replaceWith('<%= escape_javascript(render_notes(@journal.issue, @journal, :reply_links => authorize_for('issues', 'edit'))) %>'); $("#change-<%= @journal.id %> .journal-actions").html('<%= escape_javascript(render_journal_actions(@journal.issue, @journal, :reply_links => authorize_for('issues', 'edit'))) %>');
$("#journal-<%= @journal.id %>-private_notes").replaceWith('<%= escape_javascript(render_private_notes_indicator(@journal)) %>'); $("#journal-<%= @journal.id %>-private_notes").replaceWith('<%= escape_javascript(render_private_notes_indicator(@journal)) %>');
$("#journal-<%= @journal.id %>-notes").replaceWith('<%= escape_javascript(render_notes(@journal.issue, @journal, :reply_links => authorize_for('issues', 'edit'))) %>');
$("#journal-<%= @journal.id %>-notes").show(); $("#journal-<%= @journal.id %>-notes").show();
$("#journal-<%= @journal.id %>-form").remove(); $("#journal-<%= @journal.id %>-form").remove();
<% end %> <% end %>