@@ -27,9 +27,9 module JournalsHelper | |||||
27 |
|
27 | |||
28 | def render_notes(issue, journal, options={}) |
|
28 | def render_notes(issue, journal, options={}) | |
29 | content = '' |
|
29 | content = '' | |
30 | 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))) |
|
30 | css_classes = "wiki" | |
31 | links = [] |
|
31 | links = [] | |
32 |
if |
|
32 | if journal.notes.present? | |
33 | links << link_to(l(:button_quote), |
|
33 | links << link_to(l(:button_quote), | |
34 | quoted_issue_path(issue, :journal_id => journal), |
|
34 | quoted_issue_path(issue, :journal_id => journal), | |
35 | :remote => true, |
|
35 | :remote => true, | |
@@ -37,25 +37,27 module JournalsHelper | |||||
37 | :title => l(:button_quote), |
|
37 | :title => l(:button_quote), | |
38 | :class => 'icon-only icon-comment' |
|
38 | :class => 'icon-only icon-comment' | |
39 | ) if options[:reply_links] |
|
39 | ) if options[:reply_links] | |
40 | links << link_to(l(:button_edit), |
|
40 | ||
41 | edit_journal_path(journal), |
|
41 | if journal.editable_by?(User.current) | |
42 | :remote => true, |
|
42 | links << link_to(l(:button_edit), | |
43 |
|
|
43 | edit_journal_path(journal), | |
44 |
|
|
44 | :remote => true, | |
45 |
|
|
45 | :method => 'get', | |
46 |
) |
|
46 | :title => l(:button_edit), | |
47 | links << link_to(l(:button_delete), |
|
47 | :class => 'icon-only icon-edit' | |
48 | journal_path(journal, :journal => {:notes => ""}), |
|
48 | ) | |
49 | :remote => true, |
|
49 | links << link_to(l(:button_delete), | |
50 | :method => 'put', :data => {:confirm => l(:text_are_you_sure)}, |
|
50 | journal_path(journal, :journal => {:notes => ""}), | |
51 |
|
|
51 | :remote => true, | |
52 | :class => 'icon-only icon-del' |
|
52 | :method => 'put', :data => {:confirm => l(:text_are_you_sure)}, | |
53 |
) |
|
53 | :title => l(:button_delete), | |
|
54 | :class => 'icon-only icon-del' | |||
|
55 | ) | |||
|
56 | css_classes << " editable" | |||
|
57 | end | |||
54 | end |
|
58 | end | |
55 | content << content_tag('div', links.join(' ').html_safe, :class => 'contextual') unless links.empty? |
|
59 | content << content_tag('div', links.join(' ').html_safe, :class => 'contextual') unless links.empty? | |
56 | content << textilizable(journal, :notes) |
|
60 | content << textilizable(journal, :notes) | |
57 | css_classes = "wiki" |
|
|||
58 | css_classes << " editable" if editable |
|
|||
59 | content_tag('div', content.html_safe, :id => "journal-#{journal.id}-notes", :class => css_classes) |
|
61 | content_tag('div', content.html_safe, :id => "journal-#{journal.id}-notes", :class => css_classes) | |
60 | end |
|
62 | end | |
61 |
|
63 |
General Comments 0
You need to be logged in to leave comments.
Login now