Mercurial > hg > soundsoftware-site
comparison app/helpers/.svn/text-base/journals_helper.rb.svn-base @ 0:513646585e45
* Import Redmine trunk SVN rev 3859
author | Chris Cannam |
---|---|
date | Fri, 23 Jul 2010 15:52:44 +0100 |
parents | |
children | 1d32c0a0efbf |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:513646585e45 |
---|---|
1 # redMine - project management software | |
2 # Copyright (C) 2006-2008 Jean-Philippe Lang | |
3 # | |
4 # This program is free software; you can redistribute it and/or | |
5 # modify it under the terms of the GNU General Public License | |
6 # as published by the Free Software Foundation; either version 2 | |
7 # of the License, or (at your option) any later version. | |
8 # | |
9 # This program is distributed in the hope that it will be useful, | |
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 # GNU General Public License for more details. | |
13 # | |
14 # You should have received a copy of the GNU General Public License | |
15 # along with this program; if not, write to the Free Software | |
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
17 | |
18 module JournalsHelper | |
19 def render_notes(issue, journal, options={}) | |
20 content = '' | |
21 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))) | |
22 links = [] | |
23 if !journal.notes.blank? | |
24 links << link_to_remote(image_tag('comment.png'), | |
25 { :url => {:controller => 'issues', :action => 'reply', :id => issue, :journal_id => journal} }, | |
26 :title => l(:button_quote)) if options[:reply_links] | |
27 links << link_to_in_place_notes_editor(image_tag('edit.png'), "journal-#{journal.id}-notes", | |
28 { :controller => 'journals', :action => 'edit', :id => journal }, | |
29 :title => l(:button_edit)) if editable | |
30 end | |
31 content << content_tag('div', links.join(' '), :class => 'contextual') unless links.empty? | |
32 content << textilizable(journal, :notes) | |
33 css_classes = "wiki" | |
34 css_classes << " editable" if editable | |
35 content_tag('div', content, :id => "journal-#{journal.id}-notes", :class => css_classes) | |
36 end | |
37 | |
38 def link_to_in_place_notes_editor(text, field_id, url, options={}) | |
39 onclick = "new Ajax.Request('#{url_for(url)}', {asynchronous:true, evalScripts:true, method:'get'}); return false;" | |
40 link_to text, '#', options.merge(:onclick => onclick) | |
41 end | |
42 end |