##// END OF EJS Templates
html_safe for Rails3...
Jean-Philippe Lang -
r8149:8269e9a990cd
parent child
Show More
@@ -1,44 +1,44
1 1 # encoding: utf-8
2 2 #
3 3 # Redmine - project management software
4 4 # Copyright (C) 2006-2011 Jean-Philippe Lang
5 5 #
6 6 # This program is free software; you can redistribute it and/or
7 7 # modify it under the terms of the GNU General Public License
8 8 # as published by the Free Software Foundation; either version 2
9 9 # of the License, or (at your option) any later version.
10 10 #
11 11 # This program is distributed in the hope that it will be useful,
12 12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 14 # GNU General Public License for more details.
15 15 #
16 16 # You should have received a copy of the GNU General Public License
17 17 # along with this program; if not, write to the Free Software
18 18 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 19
20 20 module JournalsHelper
21 21 def render_notes(issue, journal, options={})
22 22 content = ''
23 23 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)))
24 24 links = []
25 25 if !journal.notes.blank?
26 26 links << link_to_remote(image_tag('comment.png'),
27 27 { :url => {:controller => 'journals', :action => 'new', :id => issue, :journal_id => journal} },
28 28 :title => l(:button_quote)) if options[:reply_links]
29 29 links << link_to_in_place_notes_editor(image_tag('edit.png'), "journal-#{journal.id}-notes",
30 30 { :controller => 'journals', :action => 'edit', :id => journal },
31 31 :title => l(:button_edit)) if editable
32 32 end
33 33 content << content_tag('div', links.join(' '), :class => 'contextual') unless links.empty?
34 34 content << textilizable(journal, :notes)
35 35 css_classes = "wiki"
36 36 css_classes << " editable" if editable
37 content_tag('div', content, :id => "journal-#{journal.id}-notes", :class => css_classes)
37 content_tag('div', content.html_safe, :id => "journal-#{journal.id}-notes", :class => css_classes)
38 38 end
39 39
40 40 def link_to_in_place_notes_editor(text, field_id, url, options={})
41 41 onclick = "new Ajax.Request('#{url_for(url)}', {asynchronous:true, evalScripts:true, method:'get'}); return false;"
42 42 link_to text, '#', options.merge(:onclick => onclick)
43 43 end
44 44 end
General Comments 0
You need to be logged in to leave comments. Login now