diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2016-07-10 11:03:41 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2016-07-10 11:03:41 +0000 |
commit | fc9a99fe36f317f940129bc78abfb97c91486543 (patch) | |
tree | c65db3fac9cf1e89a093e450d737430447c52602 | |
parent | 1f9bbd6b42b377c9ab3906293c2d166b4e2fb138 (diff) | |
download | redmine-fc9a99fe36f317f940129bc78abfb97c91486543.tar.gz redmine-fc9a99fe36f317f940129bc78abfb97c91486543.zip |
Code cleanup (#22575).
git-svn-id: http://svn.redmine.org/redmine/trunk@15622 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r-- | app/helpers/journals_helper.rb | 38 |
1 files changed, 20 insertions, 18 deletions
diff --git a/app/helpers/journals_helper.rb b/app/helpers/journals_helper.rb index 0cf863648..92b4f35fb 100644 --- a/app/helpers/journals_helper.rb +++ b/app/helpers/journals_helper.rb @@ -27,9 +27,9 @@ module JournalsHelper def render_notes(issue, journal, options={}) content = '' - editable = User.current.logged? && (User.current.allowed_to?(:edit_issue_notes, issue.project) || (journal.user == User.current && User.current.allowed_to?(:edit_own_issue_notes, issue.project))) + css_classes = "wiki" links = [] - if !journal.notes.blank? + if journal.notes.present? links << link_to(l(:button_quote), quoted_issue_path(issue, :journal_id => journal), :remote => true, @@ -37,25 +37,27 @@ module JournalsHelper :title => l(:button_quote), :class => 'icon-only icon-comment' ) if options[:reply_links] - links << link_to(l(:button_edit), - edit_journal_path(journal), - :remote => true, - :method => 'get', - :title => l(:button_edit), - :class => 'icon-only icon-edit' - ) if editable - links << link_to(l(:button_delete), - journal_path(journal, :journal => {:notes => ""}), - :remote => true, - :method => 'put', :data => {:confirm => l(:text_are_you_sure)}, - :title => l(:button_delete), - :class => 'icon-only icon-del' - ) if editable + + if journal.editable_by?(User.current) + links << link_to(l(:button_edit), + edit_journal_path(journal), + :remote => true, + :method => 'get', + :title => l(:button_edit), + :class => 'icon-only icon-edit' + ) + links << link_to(l(:button_delete), + journal_path(journal, :journal => {:notes => ""}), + :remote => true, + :method => 'put', :data => {:confirm => l(:text_are_you_sure)}, + :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) - css_classes = "wiki" - css_classes << " editable" if editable content_tag('div', content.html_safe, :id => "journal-#{journal.id}-notes", :class => css_classes) end |