diff --git a/app/helpers/journals_helper.rb b/app/helpers/journals_helper.rb index 990bfb1e574944cdd7e728c7a06656b5088db10a..c8d53f253beda17770dedb6dcc5c446162fa1b82 100644 --- a/app/helpers/journals_helper.rb +++ b/app/helpers/journals_helper.rb @@ -39,11 +39,4 @@ module JournalsHelper onclick = "new Ajax.Request('#{url_for(url)}', {asynchronous:true, evalScripts:true, method:'get'}); return false;" link_to text, '#', options.merge(:onclick => onclick) end - - def css_journal_classes(journal) - s = 'journal' - s << ' has-notes' unless journal.notes.blank? - s << ' has-details' unless journal.details.blank? - s - end end diff --git a/app/models/journal.rb b/app/models/journal.rb index a0e1ae8779ef4f6d7e16529df7aaefce55b8aa86..3e846aeb89c2ce88766aab69768f0082272c22a2 100644 --- a/app/models/journal.rb +++ b/app/models/journal.rb @@ -65,4 +65,12 @@ class Journal < ActiveRecord::Base def attachments journalized.respond_to?(:attachments) ? journalized.attachments : nil end + + # Returns a string of css classes + def css_classes + s = 'journal' + s << ' has-notes' unless notes.blank? + s << ' has-details' unless details.blank? + s + end end diff --git a/app/views/issues/_history.rhtml b/app/views/issues/_history.rhtml index 4ea2dd2ac3917993a2f201db180206691db8facd..4851e5f228baf225e7fe198f59e2f8c57eb6ddbd 100644 --- a/app/views/issues/_history.rhtml +++ b/app/views/issues/_history.rhtml @@ -1,6 +1,6 @@ <% reply_links = authorize_for('issues', 'edit') -%> <% for journal in journals %> - <div id="change-<%= journal.id %>" class="<%= css_journal_classes(journal) %>"> + <div id="change-<%= journal.id %>" class="<%= journal.css_classes %>"> <h4><div class="journal-link"><%= link_to "##{journal.indice}", :anchor => "note-#{journal.indice}" %></div> <%= avatar(journal.user, :size => "24") %> <%= content_tag('a', '', :name => "note-#{journal.indice}")%>