]> source.dussan.org Git - redmine.git/commitdiff
Move journal action links above the notes.
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Thu, 27 Jul 2017 17:14:47 +0000 (17:14 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Thu, 27 Jul 2017 17:14:47 +0000 (17:14 +0000)
git-svn-id: http://svn.redmine.org/redmine/trunk@16900 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/helpers/journals_helper.rb
app/views/issues/_history.html.erb
app/views/journals/update.js.erb

index b1d8774c41cd9be88a04bdceb811667f8440a80a..5e817e86278a15af1309d3f0467c285ebfafa1d3 100644 (file)
@@ -25,19 +25,19 @@ module JournalsHelper
     ids.any? ? Attachment.where(:id => ids).select(&:thumbnailable?) : []
   end
 
-  def render_notes(issue, journal, options={})
-    content = ''
-    css_classes = "wiki"
+  # Returns the action links for an issue journal
+  def render_journal_actions(issue, journal, options={})
     links = []
     if journal.notes.present?
-      links << link_to(l(:button_quote),
-                       quoted_issue_path(issue, :journal_id => journal),
-                       :remote => true,
-                       :method => 'post',
-                       :title => l(:button_quote),
-                       :class => 'icon-only icon-comment'
-                      ) if options[:reply_links]
-
+      if options[:reply_links]
+        links << link_to(l(:button_quote),
+                         quoted_issue_path(issue, :journal_id => journal),
+                         :remote => true,
+                         :method => 'post',
+                         :title => l(:button_quote),
+                         :class => 'icon-only icon-comment'
+                        )
+      end
       if journal.editable_by?(User.current)
         links << link_to(l(:button_edit),
                          edit_journal_path(journal),
@@ -53,12 +53,13 @@ module JournalsHelper
                          :title => l(:button_delete),
                          :class => 'icon-only icon-del'
                         )
-        css_classes << " editable"
       end
     end
-    content << content_tag('div', links.join(' ').html_safe, :class => 'contextual') unless links.empty?
-    content << textilizable(journal, :notes)
-    content_tag('div', content.html_safe, :id => "journal-#{journal.id}-notes", :class => css_classes)
+    safe_join(links, ' ')
+  end
+
+  def render_notes(issue, journal, options={})
+    content_tag('div', textilizable(journal, :notes), :id => "journal-#{journal.id}-notes", :class => "wiki")
   end
 
   def render_private_notes_indicator(journal)
index 31df3b81d4efcd9eebd3856ab7457eb78f5f46c6..aa8ecbf806eafbd1a54a41fcfd351d636af9ca1d 100644 (file)
@@ -2,10 +2,15 @@
 <% for journal in journals %>
   <div id="change-<%= journal.id %>" class="<%= journal.css_classes %>">
     <div id="note-<%= journal.indice %>">
-    <h4><a href="#note-<%= journal.indice %>" class="journal-link">#<%= journal.indice %></a>
-    <%= avatar(journal.user, :size => "24") %>
-    <%= authoring journal.created_on, journal.user, :label => :label_updated_time_by %>
-    <%= render_private_notes_indicator(journal) %></h4>
+    <div class="contextual">
+      <span class="journal-actions"><%= render_journal_actions(issue, journal, :reply_links => reply_links) %></span>
+      <a href="#note-<%= journal.indice %>" class="journal-link">#<%= journal.indice %></a>
+    </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? %>
     <ul class="details">
index 6a297bb96b24e97cab53e71f7158a3843189a7fc..47dfdebec2575f6404bf3bb1308946b188159b1c 100644 (file)
@@ -2,8 +2,9 @@
   $("#change-<%= @journal.id %>").remove();
 <% else %>
   $("#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 %>-notes").replaceWith('<%= escape_javascript(render_notes(@journal.issue, @journal, :reply_links => authorize_for('issues', 'edit'))) %>');
   $("#journal-<%= @journal.id %>-notes").show();
   $("#journal-<%= @journal.id %>-form").remove();
 <% end %>