@@ -1,343 +1,353 | |||||
1 | # redMine - project management software |
|
1 | # redMine - project management software | |
2 | # Copyright (C) 2006-2007 Jean-Philippe Lang |
|
2 | # Copyright (C) 2006-2007 Jean-Philippe Lang | |
3 | # |
|
3 | # | |
4 | # This program is free software; you can redistribute it and/or |
|
4 | # This program is free software; you can redistribute it and/or | |
5 | # modify it under the terms of the GNU General Public License |
|
5 | # modify it under the terms of the GNU General Public License | |
6 | # as published by the Free Software Foundation; either version 2 |
|
6 | # as published by the Free Software Foundation; either version 2 | |
7 | # of the License, or (at your option) any later version. |
|
7 | # of the License, or (at your option) any later version. | |
8 | # |
|
8 | # | |
9 | # This program is distributed in the hope that it will be useful, |
|
9 | # This program is distributed in the hope that it will be useful, | |
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | # GNU General Public License for more details. |
|
12 | # GNU General Public License for more details. | |
13 | # |
|
13 | # | |
14 | # You should have received a copy of the GNU General Public License |
|
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 |
|
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. |
|
16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
17 |
|
17 | |||
18 | module ApplicationHelper |
|
18 | module ApplicationHelper | |
19 |
|
19 | |||
20 | def current_role |
|
20 | def current_role | |
21 | @current_role ||= User.current.role_for_project(@project) |
|
21 | @current_role ||= User.current.role_for_project(@project) | |
22 | end |
|
22 | end | |
23 |
|
23 | |||
24 | # Return true if user is authorized for controller/action, otherwise false |
|
24 | # Return true if user is authorized for controller/action, otherwise false | |
25 | def authorize_for(controller, action) |
|
25 | def authorize_for(controller, action) | |
26 | User.current.allowed_to?({:controller => controller, :action => action}, @project) |
|
26 | User.current.allowed_to?({:controller => controller, :action => action}, @project) | |
27 | end |
|
27 | end | |
28 |
|
28 | |||
29 | # Display a link if user is authorized |
|
29 | # Display a link if user is authorized | |
30 | def link_to_if_authorized(name, options = {}, html_options = nil, *parameters_for_method_reference) |
|
30 | def link_to_if_authorized(name, options = {}, html_options = nil, *parameters_for_method_reference) | |
31 | link_to(name, options, html_options, *parameters_for_method_reference) if authorize_for(options[:controller] || params[:controller], options[:action]) |
|
31 | link_to(name, options, html_options, *parameters_for_method_reference) if authorize_for(options[:controller] || params[:controller], options[:action]) | |
32 | end |
|
32 | end | |
33 |
|
33 | |||
34 | # Display a link to user's account page |
|
34 | # Display a link to user's account page | |
35 | def link_to_user(user) |
|
35 | def link_to_user(user) | |
36 | link_to user.name, :controller => 'account', :action => 'show', :id => user |
|
36 | link_to user.name, :controller => 'account', :action => 'show', :id => user | |
37 | end |
|
37 | end | |
38 |
|
38 | |||
39 | def link_to_issue(issue) |
|
39 | def link_to_issue(issue) | |
40 | link_to "#{issue.tracker.name} ##{issue.id}", :controller => "issues", :action => "show", :id => issue |
|
40 | link_to "#{issue.tracker.name} ##{issue.id}", :controller => "issues", :action => "show", :id => issue | |
41 | end |
|
41 | end | |
42 |
|
42 | |||
43 | def toggle_link(name, id, options={}) |
|
43 | def toggle_link(name, id, options={}) | |
44 | onclick = "Element.toggle('#{id}'); " |
|
44 | onclick = "Element.toggle('#{id}'); " | |
45 | onclick << (options[:focus] ? "Form.Element.focus('#{options[:focus]}'); " : "this.blur(); ") |
|
45 | onclick << (options[:focus] ? "Form.Element.focus('#{options[:focus]}'); " : "this.blur(); ") | |
46 | onclick << "return false;" |
|
46 | onclick << "return false;" | |
47 | link_to(name, "#", :onclick => onclick) |
|
47 | link_to(name, "#", :onclick => onclick) | |
48 | end |
|
48 | end | |
49 |
|
49 | |||
50 | def show_and_goto_link(name, id, options={}) |
|
50 | def show_and_goto_link(name, id, options={}) | |
51 | onclick = "Element.show('#{id}'); " |
|
51 | onclick = "Element.show('#{id}'); " | |
52 | onclick << (options[:focus] ? "Form.Element.focus('#{options[:focus]}'); " : "this.blur(); ") |
|
52 | onclick << (options[:focus] ? "Form.Element.focus('#{options[:focus]}'); " : "this.blur(); ") | |
53 | onclick << "location.href='##{id}-anchor'; " |
|
53 | onclick << "location.href='##{id}-anchor'; " | |
54 | onclick << "return false;" |
|
54 | onclick << "return false;" | |
55 | link_to(name, "#", options.merge(:onclick => onclick)) |
|
55 | link_to(name, "#", options.merge(:onclick => onclick)) | |
56 | end |
|
56 | end | |
57 |
|
57 | |||
58 | def image_to_function(name, function, html_options = {}) |
|
58 | def image_to_function(name, function, html_options = {}) | |
59 | html_options.symbolize_keys! |
|
59 | html_options.symbolize_keys! | |
60 | tag(:input, html_options.merge({ |
|
60 | tag(:input, html_options.merge({ | |
61 | :type => "image", :src => image_path(name), |
|
61 | :type => "image", :src => image_path(name), | |
62 | :onclick => (html_options[:onclick] ? "#{html_options[:onclick]}; " : "") + "#{function};" |
|
62 | :onclick => (html_options[:onclick] ? "#{html_options[:onclick]}; " : "") + "#{function};" | |
63 | })) |
|
63 | })) | |
64 | end |
|
64 | end | |
65 |
|
65 | |||
66 | def prompt_to_remote(name, text, param, url, html_options = {}) |
|
66 | def prompt_to_remote(name, text, param, url, html_options = {}) | |
67 | html_options[:onclick] = "promptToRemote('#{text}', '#{param}', '#{url_for(url)}'); return false;" |
|
67 | html_options[:onclick] = "promptToRemote('#{text}', '#{param}', '#{url_for(url)}'); return false;" | |
68 | link_to name, {}, html_options |
|
68 | link_to name, {}, html_options | |
69 | end |
|
69 | end | |
70 |
|
70 | |||
71 | def format_date(date) |
|
71 | def format_date(date) | |
72 | return nil unless date |
|
72 | return nil unless date | |
73 | @date_format ||= (Setting.date_format.to_i == 0 ? l(:general_fmt_date) : date.strftime("%Y-%m-%d")) |
|
73 | @date_format ||= (Setting.date_format.to_i == 0 ? l(:general_fmt_date) : date.strftime("%Y-%m-%d")) | |
74 | date.strftime(@date_format) |
|
74 | date.strftime(@date_format) | |
75 | end |
|
75 | end | |
76 |
|
76 | |||
77 | def format_time(time) |
|
77 | def format_time(time) | |
78 | return nil unless time |
|
78 | return nil unless time | |
79 | @date_format_setting ||= Setting.date_format.to_i |
|
79 | @date_format_setting ||= Setting.date_format.to_i | |
80 | time = time.to_time if time.is_a?(String) |
|
80 | time = time.to_time if time.is_a?(String) | |
81 | @date_format_setting == 0 ? l_datetime(time) : (time.strftime("%Y-%m-%d") + ' ' + l_time(time)) |
|
81 | @date_format_setting == 0 ? l_datetime(time) : (time.strftime("%Y-%m-%d") + ' ' + l_time(time)) | |
82 | end |
|
82 | end | |
83 |
|
83 | |||
84 | def authoring(created, author) |
|
84 | def authoring(created, author) | |
85 | time_tag = content_tag('acronym', distance_of_time_in_words(Time.now, created), :title => format_time(created)) |
|
85 | time_tag = content_tag('acronym', distance_of_time_in_words(Time.now, created), :title => format_time(created)) | |
86 | l(:label_added_time_by, author.name, time_tag) |
|
86 | l(:label_added_time_by, author.name, time_tag) | |
87 | end |
|
87 | end | |
88 |
|
88 | |||
89 | def day_name(day) |
|
89 | def day_name(day) | |
90 | l(:general_day_names).split(',')[day-1] |
|
90 | l(:general_day_names).split(',')[day-1] | |
91 | end |
|
91 | end | |
92 |
|
92 | |||
93 | def month_name(month) |
|
93 | def month_name(month) | |
94 | l(:actionview_datehelper_select_month_names).split(',')[month-1] |
|
94 | l(:actionview_datehelper_select_month_names).split(',')[month-1] | |
95 | end |
|
95 | end | |
96 |
|
96 | |||
97 | def pagination_links_full(paginator, options={}, html_options={}) |
|
97 | def pagination_links_full(paginator, options={}, html_options={}) | |
98 | page_param = options.delete(:page_param) || :page |
|
98 | page_param = options.delete(:page_param) || :page | |
99 |
|
99 | |||
100 | html = '' |
|
100 | html = '' | |
101 | html << link_to_remote(('« ' + l(:label_previous)), |
|
101 | html << link_to_remote(('« ' + l(:label_previous)), | |
102 | {:update => "content", :url => options.merge(page_param => paginator.current.previous)}, |
|
102 | {:update => "content", :url => options.merge(page_param => paginator.current.previous)}, | |
103 | {:href => url_for(:params => options.merge(page_param => paginator.current.previous))}) + ' ' if paginator.current.previous |
|
103 | {:href => url_for(:params => options.merge(page_param => paginator.current.previous))}) + ' ' if paginator.current.previous | |
104 |
|
104 | |||
105 | html << (pagination_links_each(paginator, options) do |n| |
|
105 | html << (pagination_links_each(paginator, options) do |n| | |
106 | link_to_remote(n.to_s, |
|
106 | link_to_remote(n.to_s, | |
107 | {:url => {:params => options.merge(page_param => n)}, :update => 'content'}, |
|
107 | {:url => {:params => options.merge(page_param => n)}, :update => 'content'}, | |
108 | {:href => url_for(:params => options.merge(page_param => n))}) |
|
108 | {:href => url_for(:params => options.merge(page_param => n))}) | |
109 | end || '') |
|
109 | end || '') | |
110 |
|
110 | |||
111 | html << ' ' + link_to_remote((l(:label_next) + ' »'), |
|
111 | html << ' ' + link_to_remote((l(:label_next) + ' »'), | |
112 | {:update => "content", :url => options.merge(page_param => paginator.current.next)}, |
|
112 | {:update => "content", :url => options.merge(page_param => paginator.current.next)}, | |
113 | {:href => url_for(:params => options.merge(page_param => paginator.current.next))}) if paginator.current.next |
|
113 | {:href => url_for(:params => options.merge(page_param => paginator.current.next))}) if paginator.current.next | |
114 | html |
|
114 | html | |
115 | end |
|
115 | end | |
116 |
|
116 | |||
117 | def set_html_title(text) |
|
117 | def set_html_title(text) | |
118 | @html_header_title = text |
|
118 | @html_header_title = text | |
119 | end |
|
119 | end | |
120 |
|
120 | |||
121 | def html_title |
|
121 | def html_title | |
122 | title = [] |
|
122 | title = [] | |
123 | title << @project.name if @project |
|
123 | title << @project.name if @project | |
124 | title << @html_header_title |
|
124 | title << @html_header_title | |
125 | title << Setting.app_title |
|
125 | title << Setting.app_title | |
126 | title.compact.join(' - ') |
|
126 | title.compact.join(' - ') | |
127 | end |
|
127 | end | |
128 |
|
128 | |||
|
129 | ACCESSKEYS = {:edit => 'e', | |||
|
130 | :preview => 'r', | |||
|
131 | :quick_search => 'f', | |||
|
132 | :search => '4', | |||
|
133 | }.freeze | |||
|
134 | ||||
|
135 | def accesskey(s) | |||
|
136 | ACCESSKEYS[s] | |||
|
137 | end | |||
|
138 | ||||
129 | # format text according to system settings |
|
139 | # format text according to system settings | |
130 | def textilizable(text, options = {}) |
|
140 | def textilizable(text, options = {}) | |
131 | return "" if text.blank? |
|
141 | return "" if text.blank? | |
132 |
|
142 | |||
133 | # when using an image link, try to use an attachment, if possible |
|
143 | # when using an image link, try to use an attachment, if possible | |
134 | attachments = options[:attachments] |
|
144 | attachments = options[:attachments] | |
135 | if attachments |
|
145 | if attachments | |
136 | text = text.gsub(/!([<>=]*)(\S+\.(gif|jpg|jpeg|png))!/) do |m| |
|
146 | text = text.gsub(/!([<>=]*)(\S+\.(gif|jpg|jpeg|png))!/) do |m| | |
137 | align = $1 |
|
147 | align = $1 | |
138 | filename = $2 |
|
148 | filename = $2 | |
139 | rf = Regexp.new(filename, Regexp::IGNORECASE) |
|
149 | rf = Regexp.new(filename, Regexp::IGNORECASE) | |
140 | # search for the picture in attachments |
|
150 | # search for the picture in attachments | |
141 | if found = attachments.detect { |att| att.filename =~ rf } |
|
151 | if found = attachments.detect { |att| att.filename =~ rf } | |
142 | image_url = url_for :controller => 'attachments', :action => 'download', :id => found.id |
|
152 | image_url = url_for :controller => 'attachments', :action => 'download', :id => found.id | |
143 | "!#{align}#{image_url}!" |
|
153 | "!#{align}#{image_url}!" | |
144 | else |
|
154 | else | |
145 | "!#{align}#{filename}!" |
|
155 | "!#{align}#{filename}!" | |
146 | end |
|
156 | end | |
147 | end |
|
157 | end | |
148 | end |
|
158 | end | |
149 |
|
159 | |||
150 | text = (Setting.text_formatting == 'textile') ? |
|
160 | text = (Setting.text_formatting == 'textile') ? | |
151 | Redmine::WikiFormatting.to_html(text) : simple_format(auto_link(h(text))) |
|
161 | Redmine::WikiFormatting.to_html(text) : simple_format(auto_link(h(text))) | |
152 |
|
162 | |||
153 | # different methods for formatting wiki links |
|
163 | # different methods for formatting wiki links | |
154 | case options[:wiki_links] |
|
164 | case options[:wiki_links] | |
155 | when :local |
|
165 | when :local | |
156 | # used for local links to html files |
|
166 | # used for local links to html files | |
157 | format_wiki_link = Proc.new {|project, title| "#{title}.html" } |
|
167 | format_wiki_link = Proc.new {|project, title| "#{title}.html" } | |
158 | when :anchor |
|
168 | when :anchor | |
159 | # used for single-file wiki export |
|
169 | # used for single-file wiki export | |
160 | format_wiki_link = Proc.new {|project, title| "##{title}" } |
|
170 | format_wiki_link = Proc.new {|project, title| "##{title}" } | |
161 | else |
|
171 | else | |
162 | format_wiki_link = Proc.new {|project, title| url_for :controller => 'wiki', :action => 'index', :id => project, :page => title } |
|
172 | format_wiki_link = Proc.new {|project, title| url_for :controller => 'wiki', :action => 'index', :id => project, :page => title } | |
163 | end |
|
173 | end | |
164 |
|
174 | |||
165 | project = options[:project] || @project |
|
175 | project = options[:project] || @project | |
166 |
|
176 | |||
167 | # turn wiki links into html links |
|
177 | # turn wiki links into html links | |
168 | # example: |
|
178 | # example: | |
169 | # [[mypage]] |
|
179 | # [[mypage]] | |
170 | # [[mypage|mytext]] |
|
180 | # [[mypage|mytext]] | |
171 | # wiki links can refer other project wikis, using project name or identifier: |
|
181 | # wiki links can refer other project wikis, using project name or identifier: | |
172 | # [[project:]] -> wiki starting page |
|
182 | # [[project:]] -> wiki starting page | |
173 | # [[project:|mytext]] |
|
183 | # [[project:|mytext]] | |
174 | # [[project:mypage]] |
|
184 | # [[project:mypage]] | |
175 | # [[project:mypage|mytext]] |
|
185 | # [[project:mypage|mytext]] | |
176 | text = text.gsub(/\[\[([^\]\|]+)(\|([^\]\|]+))?\]\]/) do |m| |
|
186 | text = text.gsub(/\[\[([^\]\|]+)(\|([^\]\|]+))?\]\]/) do |m| | |
177 | link_project = project |
|
187 | link_project = project | |
178 | page = $1 |
|
188 | page = $1 | |
179 | title = $3 |
|
189 | title = $3 | |
180 | if page =~ /^([^\:]+)\:(.*)$/ |
|
190 | if page =~ /^([^\:]+)\:(.*)$/ | |
181 | link_project = Project.find_by_name($1) || Project.find_by_identifier($1) |
|
191 | link_project = Project.find_by_name($1) || Project.find_by_identifier($1) | |
182 | page = title || $2 |
|
192 | page = title || $2 | |
183 | title = $1 if page.blank? |
|
193 | title = $1 if page.blank? | |
184 | end |
|
194 | end | |
185 |
|
195 | |||
186 | if link_project && link_project.wiki |
|
196 | if link_project && link_project.wiki | |
187 | # check if page exists |
|
197 | # check if page exists | |
188 | wiki_page = link_project.wiki.find_page(page) |
|
198 | wiki_page = link_project.wiki.find_page(page) | |
189 | link_to((title || page), format_wiki_link.call(link_project, Wiki.titleize(page)), |
|
199 | link_to((title || page), format_wiki_link.call(link_project, Wiki.titleize(page)), | |
190 | :class => ('wiki-page' + (wiki_page ? '' : ' new'))) |
|
200 | :class => ('wiki-page' + (wiki_page ? '' : ' new'))) | |
191 | else |
|
201 | else | |
192 | # project or wiki doesn't exist |
|
202 | # project or wiki doesn't exist | |
193 | title || page |
|
203 | title || page | |
194 | end |
|
204 | end | |
195 | end |
|
205 | end | |
196 |
|
206 | |||
197 | # turn issue and revision ids into links |
|
207 | # turn issue and revision ids into links | |
198 | # example: |
|
208 | # example: | |
199 | # #52 -> <a href="/issues/show/52">#52</a> |
|
209 | # #52 -> <a href="/issues/show/52">#52</a> | |
200 | # r52 -> <a href="/repositories/revision/6?rev=52">r52</a> (project.id is 6) |
|
210 | # r52 -> <a href="/repositories/revision/6?rev=52">r52</a> (project.id is 6) | |
201 | text = text.gsub(%r{([\s,-^])(#|r)(\d+)(?=[[:punct:]]|\s|<|$)}) do |m| |
|
211 | text = text.gsub(%r{([\s,-^])(#|r)(\d+)(?=[[:punct:]]|\s|<|$)}) do |m| | |
202 | leading, otype, oid = $1, $2, $3 |
|
212 | leading, otype, oid = $1, $2, $3 | |
203 | link = nil |
|
213 | link = nil | |
204 | if otype == 'r' |
|
214 | if otype == 'r' | |
205 | if project && (changeset = project.changesets.find_by_revision(oid)) |
|
215 | if project && (changeset = project.changesets.find_by_revision(oid)) | |
206 | link = link_to("r#{oid}", {:controller => 'repositories', :action => 'revision', :id => project.id, :rev => oid}, :class => 'changeset', |
|
216 | link = link_to("r#{oid}", {:controller => 'repositories', :action => 'revision', :id => project.id, :rev => oid}, :class => 'changeset', | |
207 | :title => truncate(changeset.comments, 100)) |
|
217 | :title => truncate(changeset.comments, 100)) | |
208 | end |
|
218 | end | |
209 | else |
|
219 | else | |
210 | if issue = Issue.find_by_id(oid.to_i, :include => [:project, :status], :conditions => Project.visible_by(User.current)) |
|
220 | if issue = Issue.find_by_id(oid.to_i, :include => [:project, :status], :conditions => Project.visible_by(User.current)) | |
211 | link = link_to("##{oid}", {:controller => 'issues', :action => 'show', :id => oid}, :class => 'issue', |
|
221 | link = link_to("##{oid}", {:controller => 'issues', :action => 'show', :id => oid}, :class => 'issue', | |
212 | :title => "#{truncate(issue.subject, 100)} (#{issue.status.name})") |
|
222 | :title => "#{truncate(issue.subject, 100)} (#{issue.status.name})") | |
213 | link = content_tag('del', link) if issue.closed? |
|
223 | link = content_tag('del', link) if issue.closed? | |
214 | end |
|
224 | end | |
215 | end |
|
225 | end | |
216 | leading + (link || "#{otype}#{oid}") |
|
226 | leading + (link || "#{otype}#{oid}") | |
217 | end |
|
227 | end | |
218 |
|
228 | |||
219 | text |
|
229 | text | |
220 | end |
|
230 | end | |
221 |
|
231 | |||
222 | # Same as Rails' simple_format helper without using paragraphs |
|
232 | # Same as Rails' simple_format helper without using paragraphs | |
223 | def simple_format_without_paragraph(text) |
|
233 | def simple_format_without_paragraph(text) | |
224 | text.to_s. |
|
234 | text.to_s. | |
225 | gsub(/\r\n?/, "\n"). # \r\n and \r -> \n |
|
235 | gsub(/\r\n?/, "\n"). # \r\n and \r -> \n | |
226 | gsub(/\n\n+/, "<br /><br />"). # 2+ newline -> 2 br |
|
236 | gsub(/\n\n+/, "<br /><br />"). # 2+ newline -> 2 br | |
227 | gsub(/([^\n]\n)(?=[^\n])/, '\1<br />') # 1 newline -> br |
|
237 | gsub(/([^\n]\n)(?=[^\n])/, '\1<br />') # 1 newline -> br | |
228 | end |
|
238 | end | |
229 |
|
239 | |||
230 | def error_messages_for(object_name, options = {}) |
|
240 | def error_messages_for(object_name, options = {}) | |
231 | options = options.symbolize_keys |
|
241 | options = options.symbolize_keys | |
232 | object = instance_variable_get("@#{object_name}") |
|
242 | object = instance_variable_get("@#{object_name}") | |
233 | if object && !object.errors.empty? |
|
243 | if object && !object.errors.empty? | |
234 | # build full_messages here with controller current language |
|
244 | # build full_messages here with controller current language | |
235 | full_messages = [] |
|
245 | full_messages = [] | |
236 | object.errors.each do |attr, msg| |
|
246 | object.errors.each do |attr, msg| | |
237 | next if msg.nil? |
|
247 | next if msg.nil? | |
238 | msg = msg.first if msg.is_a? Array |
|
248 | msg = msg.first if msg.is_a? Array | |
239 | if attr == "base" |
|
249 | if attr == "base" | |
240 | full_messages << l(msg) |
|
250 | full_messages << l(msg) | |
241 | else |
|
251 | else | |
242 | full_messages << "« " + (l_has_string?("field_" + attr) ? l("field_" + attr) : object.class.human_attribute_name(attr)) + " » " + l(msg) unless attr == "custom_values" |
|
252 | full_messages << "« " + (l_has_string?("field_" + attr) ? l("field_" + attr) : object.class.human_attribute_name(attr)) + " » " + l(msg) unless attr == "custom_values" | |
243 | end |
|
253 | end | |
244 | end |
|
254 | end | |
245 | # retrieve custom values error messages |
|
255 | # retrieve custom values error messages | |
246 | if object.errors[:custom_values] |
|
256 | if object.errors[:custom_values] | |
247 | object.custom_values.each do |v| |
|
257 | object.custom_values.each do |v| | |
248 | v.errors.each do |attr, msg| |
|
258 | v.errors.each do |attr, msg| | |
249 | next if msg.nil? |
|
259 | next if msg.nil? | |
250 | msg = msg.first if msg.is_a? Array |
|
260 | msg = msg.first if msg.is_a? Array | |
251 | full_messages << "« " + v.custom_field.name + " » " + l(msg) |
|
261 | full_messages << "« " + v.custom_field.name + " » " + l(msg) | |
252 | end |
|
262 | end | |
253 | end |
|
263 | end | |
254 | end |
|
264 | end | |
255 | content_tag("div", |
|
265 | content_tag("div", | |
256 | content_tag( |
|
266 | content_tag( | |
257 | options[:header_tag] || "span", lwr(:gui_validation_error, full_messages.length) + ":" |
|
267 | options[:header_tag] || "span", lwr(:gui_validation_error, full_messages.length) + ":" | |
258 | ) + |
|
268 | ) + | |
259 | content_tag("ul", full_messages.collect { |msg| content_tag("li", msg) }), |
|
269 | content_tag("ul", full_messages.collect { |msg| content_tag("li", msg) }), | |
260 | "id" => options[:id] || "errorExplanation", "class" => options[:class] || "errorExplanation" |
|
270 | "id" => options[:id] || "errorExplanation", "class" => options[:class] || "errorExplanation" | |
261 | ) |
|
271 | ) | |
262 | else |
|
272 | else | |
263 | "" |
|
273 | "" | |
264 | end |
|
274 | end | |
265 | end |
|
275 | end | |
266 |
|
276 | |||
267 | def lang_options_for_select(blank=true) |
|
277 | def lang_options_for_select(blank=true) | |
268 | (blank ? [["(auto)", ""]] : []) + |
|
278 | (blank ? [["(auto)", ""]] : []) + | |
269 | GLoc.valid_languages.collect{|lang| [ ll(lang.to_s, :general_lang_name), lang.to_s]}.sort{|x,y| x.first <=> y.first } |
|
279 | GLoc.valid_languages.collect{|lang| [ ll(lang.to_s, :general_lang_name), lang.to_s]}.sort{|x,y| x.first <=> y.first } | |
270 | end |
|
280 | end | |
271 |
|
281 | |||
272 | def label_tag_for(name, option_tags = nil, options = {}) |
|
282 | def label_tag_for(name, option_tags = nil, options = {}) | |
273 | label_text = l(("field_"+field.to_s.gsub(/\_id$/, "")).to_sym) + (options.delete(:required) ? @template.content_tag("span", " *", :class => "required"): "") |
|
283 | label_text = l(("field_"+field.to_s.gsub(/\_id$/, "")).to_sym) + (options.delete(:required) ? @template.content_tag("span", " *", :class => "required"): "") | |
274 | content_tag("label", label_text) |
|
284 | content_tag("label", label_text) | |
275 | end |
|
285 | end | |
276 |
|
286 | |||
277 | def labelled_tabular_form_for(name, object, options, &proc) |
|
287 | def labelled_tabular_form_for(name, object, options, &proc) | |
278 | options[:html] ||= {} |
|
288 | options[:html] ||= {} | |
279 | options[:html].store :class, "tabular" |
|
289 | options[:html].store :class, "tabular" | |
280 | form_for(name, object, options.merge({ :builder => TabularFormBuilder, :lang => current_language}), &proc) |
|
290 | form_for(name, object, options.merge({ :builder => TabularFormBuilder, :lang => current_language}), &proc) | |
281 | end |
|
291 | end | |
282 |
|
292 | |||
283 | def check_all_links(form_name) |
|
293 | def check_all_links(form_name) | |
284 | link_to_function(l(:button_check_all), "checkAll('#{form_name}', true)") + |
|
294 | link_to_function(l(:button_check_all), "checkAll('#{form_name}', true)") + | |
285 | " | " + |
|
295 | " | " + | |
286 | link_to_function(l(:button_uncheck_all), "checkAll('#{form_name}', false)") |
|
296 | link_to_function(l(:button_uncheck_all), "checkAll('#{form_name}', false)") | |
287 | end |
|
297 | end | |
288 |
|
298 | |||
289 | def calendar_for(field_id) |
|
299 | def calendar_for(field_id) | |
290 | image_tag("calendar.png", {:id => "#{field_id}_trigger",:class => "calendar-trigger"}) + |
|
300 | image_tag("calendar.png", {:id => "#{field_id}_trigger",:class => "calendar-trigger"}) + | |
291 | javascript_tag("Calendar.setup({inputField : '#{field_id}', ifFormat : '%Y-%m-%d', button : '#{field_id}_trigger' });") |
|
301 | javascript_tag("Calendar.setup({inputField : '#{field_id}', ifFormat : '%Y-%m-%d', button : '#{field_id}_trigger' });") | |
292 | end |
|
302 | end | |
293 |
|
303 | |||
294 | def wikitoolbar_for(field_id) |
|
304 | def wikitoolbar_for(field_id) | |
295 | return '' unless Setting.text_formatting == 'textile' |
|
305 | return '' unless Setting.text_formatting == 'textile' | |
296 | javascript_include_tag('jstoolbar') + javascript_tag("var toolbar = new jsToolBar($('#{field_id}')); toolbar.draw();") |
|
306 | javascript_include_tag('jstoolbar') + javascript_tag("var toolbar = new jsToolBar($('#{field_id}')); toolbar.draw();") | |
297 | end |
|
307 | end | |
298 |
|
308 | |||
299 | def content_for(name, content = nil, &block) |
|
309 | def content_for(name, content = nil, &block) | |
300 | @has_content ||= {} |
|
310 | @has_content ||= {} | |
301 | @has_content[name] = true |
|
311 | @has_content[name] = true | |
302 | super(name, content, &block) |
|
312 | super(name, content, &block) | |
303 | end |
|
313 | end | |
304 |
|
314 | |||
305 | def has_content?(name) |
|
315 | def has_content?(name) | |
306 | (@has_content && @has_content[name]) || false |
|
316 | (@has_content && @has_content[name]) || false | |
307 | end |
|
317 | end | |
308 | end |
|
318 | end | |
309 |
|
319 | |||
310 | class TabularFormBuilder < ActionView::Helpers::FormBuilder |
|
320 | class TabularFormBuilder < ActionView::Helpers::FormBuilder | |
311 | include GLoc |
|
321 | include GLoc | |
312 |
|
322 | |||
313 | def initialize(object_name, object, template, options, proc) |
|
323 | def initialize(object_name, object, template, options, proc) | |
314 | set_language_if_valid options.delete(:lang) |
|
324 | set_language_if_valid options.delete(:lang) | |
315 | @object_name, @object, @template, @options, @proc = object_name, object, template, options, proc |
|
325 | @object_name, @object, @template, @options, @proc = object_name, object, template, options, proc | |
316 | end |
|
326 | end | |
317 |
|
327 | |||
318 | (field_helpers - %w(radio_button hidden_field) + %w(date_select)).each do |selector| |
|
328 | (field_helpers - %w(radio_button hidden_field) + %w(date_select)).each do |selector| | |
319 | src = <<-END_SRC |
|
329 | src = <<-END_SRC | |
320 | def #{selector}(field, options = {}) |
|
330 | def #{selector}(field, options = {}) | |
321 | return super if options.delete :no_label |
|
331 | return super if options.delete :no_label | |
322 | label_text = l(options[:label]) if options[:label] |
|
332 | label_text = l(options[:label]) if options[:label] | |
323 | label_text ||= l(("field_"+field.to_s.gsub(/\_id$/, "")).to_sym) |
|
333 | label_text ||= l(("field_"+field.to_s.gsub(/\_id$/, "")).to_sym) | |
324 | label_text << @template.content_tag("span", " *", :class => "required") if options.delete(:required) |
|
334 | label_text << @template.content_tag("span", " *", :class => "required") if options.delete(:required) | |
325 | label = @template.content_tag("label", label_text, |
|
335 | label = @template.content_tag("label", label_text, | |
326 | :class => (@object && @object.errors[field] ? "error" : nil), |
|
336 | :class => (@object && @object.errors[field] ? "error" : nil), | |
327 | :for => (@object_name.to_s + "_" + field.to_s)) |
|
337 | :for => (@object_name.to_s + "_" + field.to_s)) | |
328 | label + super |
|
338 | label + super | |
329 | end |
|
339 | end | |
330 | END_SRC |
|
340 | END_SRC | |
331 | class_eval src, __FILE__, __LINE__ |
|
341 | class_eval src, __FILE__, __LINE__ | |
332 | end |
|
342 | end | |
333 |
|
343 | |||
334 | def select(field, choices, options = {}, html_options = {}) |
|
344 | def select(field, choices, options = {}, html_options = {}) | |
335 | label_text = l(("field_"+field.to_s.gsub(/\_id$/, "")).to_sym) + (options.delete(:required) ? @template.content_tag("span", " *", :class => "required"): "") |
|
345 | label_text = l(("field_"+field.to_s.gsub(/\_id$/, "")).to_sym) + (options.delete(:required) ? @template.content_tag("span", " *", :class => "required"): "") | |
336 | label = @template.content_tag("label", label_text, |
|
346 | label = @template.content_tag("label", label_text, | |
337 | :class => (@object && @object.errors[field] ? "error" : nil), |
|
347 | :class => (@object && @object.errors[field] ? "error" : nil), | |
338 | :for => (@object_name.to_s + "_" + field.to_s)) |
|
348 | :for => (@object_name.to_s + "_" + field.to_s)) | |
339 | label + super |
|
349 | label + super | |
340 | end |
|
350 | end | |
341 |
|
351 | |||
342 | end |
|
352 | end | |
343 |
|
353 |
@@ -1,36 +1,36 | |||||
1 | <div class="contextual"> |
|
1 | <div class="contextual"> | |
2 | <%= link_to_if_authorized l(:button_edit), {:controller => 'documents', :action => 'edit', :id => @document}, :class => 'icon icon-edit' %> |
|
2 | <%= link_to_if_authorized l(:button_edit), {:controller => 'documents', :action => 'edit', :id => @document}, :class => 'icon icon-edit', :accesskey => accesskey(:edit) %> | |
3 | <%= link_to_if_authorized l(:button_delete), {:controller => 'documents', :action => 'destroy', :id => @document}, :confirm => l(:text_are_you_sure), :method => :post, :class => 'icon icon-del' %> |
|
3 | <%= link_to_if_authorized l(:button_delete), {:controller => 'documents', :action => 'destroy', :id => @document}, :confirm => l(:text_are_you_sure), :method => :post, :class => 'icon icon-del' %> | |
4 | </div> |
|
4 | </div> | |
5 |
|
5 | |||
6 | <h2><%= @document.title %></h2> |
|
6 | <h2><%= @document.title %></h2> | |
7 |
|
7 | |||
8 | <p><em><%= @document.category.name %><br /> |
|
8 | <p><em><%= @document.category.name %><br /> | |
9 | <%= format_date @document.created_on %></em></p> |
|
9 | <%= format_date @document.created_on %></em></p> | |
10 | <%= textilizable @document.description, :attachments => @document.attachments %> |
|
10 | <%= textilizable @document.description, :attachments => @document.attachments %> | |
11 | <br /> |
|
11 | <br /> | |
12 |
|
12 | |||
13 | <h3><%= l(:label_attachment_plural) %></h3> |
|
13 | <h3><%= l(:label_attachment_plural) %></h3> | |
14 | <ul class="documents"> |
|
14 | <ul class="documents"> | |
15 | <% for attachment in @attachments %> |
|
15 | <% for attachment in @attachments %> | |
16 | <li> |
|
16 | <li> | |
17 | <div class="contextual"> |
|
17 | <div class="contextual"> | |
18 | <%= link_to_if_authorized l(:button_delete), {:controller => 'documents', :action => 'destroy_attachment', :id => @document, :attachment_id => attachment}, :confirm => l(:text_are_you_sure), :method => :post, :class => 'icon icon-del' %> |
|
18 | <%= link_to_if_authorized l(:button_delete), {:controller => 'documents', :action => 'destroy_attachment', :id => @document, :attachment_id => attachment}, :confirm => l(:text_are_you_sure), :method => :post, :class => 'icon icon-del' %> | |
19 | </div> |
|
19 | </div> | |
20 | <%= link_to attachment.filename, :action => 'download', :id => @document, :attachment_id => attachment %> |
|
20 | <%= link_to attachment.filename, :action => 'download', :id => @document, :attachment_id => attachment %> | |
21 | (<%= number_to_human_size attachment.filesize %>)<br /> |
|
21 | (<%= number_to_human_size attachment.filesize %>)<br /> | |
22 | <span class="author"><%= authoring attachment.created_on, attachment.author %></span><br /> |
|
22 | <span class="author"><%= authoring attachment.created_on, attachment.author %></span><br /> | |
23 | <%= lwr(:label_download, attachment.downloads) %> |
|
23 | <%= lwr(:label_download, attachment.downloads) %> | |
24 | </li> |
|
24 | </li> | |
25 | <% end %> |
|
25 | <% end %> | |
26 | </ul> |
|
26 | </ul> | |
27 | <br /> |
|
27 | <br /> | |
28 |
|
28 | |||
29 |
|
29 | |||
30 | <% if authorize_for('documents', 'add_attachment') %> |
|
30 | <% if authorize_for('documents', 'add_attachment') %> | |
31 | <p><%= toggle_link l(:label_attachment_new), "add_attachment_form" %></p> |
|
31 | <p><%= toggle_link l(:label_attachment_new), "add_attachment_form" %></p> | |
32 | <% form_tag({ :controller => 'documents', :action => 'add_attachment', :id => @document }, :multipart => true, :class => "tabular", :id => "add_attachment_form", :style => "display:none;") do %> |
|
32 | <% form_tag({ :controller => 'documents', :action => 'add_attachment', :id => @document }, :multipart => true, :class => "tabular", :id => "add_attachment_form", :style => "display:none;") do %> | |
33 | <%= render :partial => 'attachments/form' %> |
|
33 | <%= render :partial => 'attachments/form' %> | |
34 | <%= submit_tag l(:button_add) %> |
|
34 | <%= submit_tag l(:button_add) %> | |
35 | <% end %> |
|
35 | <% end %> | |
36 | <% end %> |
|
36 | <% end %> |
@@ -1,122 +1,122 | |||||
1 | <div class="contextual"> |
|
1 | <div class="contextual"> | |
2 | <%= show_and_goto_link(l(:label_add_note), 'add-note', :class => 'icon icon-note') if authorize_for('issues', 'add_note') %> |
|
2 | <%= show_and_goto_link(l(:label_add_note), 'add-note', :class => 'icon icon-note') if authorize_for('issues', 'add_note') %> | |
3 | <%= link_to_if_authorized l(:button_edit), {:controller => 'issues', :action => 'edit', :id => @issue}, :class => 'icon icon-edit' %> |
|
3 | <%= link_to_if_authorized l(:button_edit), {:controller => 'issues', :action => 'edit', :id => @issue}, :class => 'icon icon-edit', :accesskey => accesskey(:edit) %> | |
4 | <%= link_to_if_authorized l(:button_log_time), {:controller => 'timelog', :action => 'edit', :issue_id => @issue}, :class => 'icon icon-time' %> |
|
4 | <%= link_to_if_authorized l(:button_log_time), {:controller => 'timelog', :action => 'edit', :issue_id => @issue}, :class => 'icon icon-time' %> | |
5 | <%= watcher_tag(@issue, User.current) %> |
|
5 | <%= watcher_tag(@issue, User.current) %> | |
6 | <%= link_to_if_authorized l(:button_move), {:controller => 'projects', :action => 'move_issues', :id => @project, "issue_ids[]" => @issue.id }, :class => 'icon icon-move' %> |
|
6 | <%= link_to_if_authorized l(:button_move), {:controller => 'projects', :action => 'move_issues', :id => @project, "issue_ids[]" => @issue.id }, :class => 'icon icon-move' %> | |
7 | <%= link_to_if_authorized l(:button_delete), {:controller => 'issues', :action => 'destroy', :id => @issue}, :confirm => l(:text_are_you_sure), :method => :post, :class => 'icon icon-del' %> |
|
7 | <%= link_to_if_authorized l(:button_delete), {:controller => 'issues', :action => 'destroy', :id => @issue}, :confirm => l(:text_are_you_sure), :method => :post, :class => 'icon icon-del' %> | |
8 | </div> |
|
8 | </div> | |
9 |
|
9 | |||
10 | <h2><%= @issue.tracker.name %> #<%= @issue.id %></h2> |
|
10 | <h2><%= @issue.tracker.name %> #<%= @issue.id %></h2> | |
11 |
|
11 | |||
12 | <div class="issue"> |
|
12 | <div class="issue"> | |
13 | <h3><%=h @issue.subject %></h3> |
|
13 | <h3><%=h @issue.subject %></h3> | |
14 | <p class="author"> |
|
14 | <p class="author"> | |
15 | <%= authoring @issue.created_on, @issue.author %>. |
|
15 | <%= authoring @issue.created_on, @issue.author %>. | |
16 | <%= l(:label_updated_time, distance_of_time_in_words(Time.now, @issue.updated_on)) if @issue.created_on != @issue.updated_on %>. |
|
16 | <%= l(:label_updated_time, distance_of_time_in_words(Time.now, @issue.updated_on)) if @issue.created_on != @issue.updated_on %>. | |
17 | </p> |
|
17 | </p> | |
18 |
|
18 | |||
19 | <table width="100%"> |
|
19 | <table width="100%"> | |
20 | <tr> |
|
20 | <tr> | |
21 | <td style="width:15%"><b><%=l(:field_status)%> :</b></td><td style="width:35%"><%= @issue.status.name %></td> |
|
21 | <td style="width:15%"><b><%=l(:field_status)%> :</b></td><td style="width:35%"><%= @issue.status.name %></td> | |
22 | <td style="width:15%"><b><%=l(:field_start_date)%> :</b></td><td style="width:35%"><%= format_date(@issue.start_date) %></td> |
|
22 | <td style="width:15%"><b><%=l(:field_start_date)%> :</b></td><td style="width:35%"><%= format_date(@issue.start_date) %></td> | |
23 | </tr> |
|
23 | </tr> | |
24 | <tr> |
|
24 | <tr> | |
25 | <td><b><%=l(:field_priority)%> :</b></td><td><%= @issue.priority.name %></td> |
|
25 | <td><b><%=l(:field_priority)%> :</b></td><td><%= @issue.priority.name %></td> | |
26 | <td><b><%=l(:field_due_date)%> :</b></td><td><%= format_date(@issue.due_date) %></td> |
|
26 | <td><b><%=l(:field_due_date)%> :</b></td><td><%= format_date(@issue.due_date) %></td> | |
27 | </tr> |
|
27 | </tr> | |
28 | <tr> |
|
28 | <tr> | |
29 | <td><b><%=l(:field_assigned_to)%> :</b></td><td><%= @issue.assigned_to ? link_to_user(@issue.assigned_to) : "-" %></td> |
|
29 | <td><b><%=l(:field_assigned_to)%> :</b></td><td><%= @issue.assigned_to ? link_to_user(@issue.assigned_to) : "-" %></td> | |
30 | <td><b><%=l(:field_done_ratio)%> :</b></td><td><%= @issue.done_ratio %> %</td> |
|
30 | <td><b><%=l(:field_done_ratio)%> :</b></td><td><%= @issue.done_ratio %> %</td> | |
31 | </tr> |
|
31 | </tr> | |
32 | <tr> |
|
32 | <tr> | |
33 | <td><b><%=l(:field_category)%> :</b></td><td><%=h @issue.category ? @issue.category.name : "-" %></td> |
|
33 | <td><b><%=l(:field_category)%> :</b></td><td><%=h @issue.category ? @issue.category.name : "-" %></td> | |
34 | <% if User.current.allowed_to?(:view_time_entries, @project) %> |
|
34 | <% if User.current.allowed_to?(:view_time_entries, @project) %> | |
35 | <td><b><%=l(:label_spent_time)%> :</b></td> |
|
35 | <td><b><%=l(:label_spent_time)%> :</b></td> | |
36 | <td><%= @issue.spent_hours > 0 ? (link_to lwr(:label_f_hour, @issue.spent_hours), {:controller => 'timelog', :action => 'details', :issue_id => @issue}, :class => 'icon icon-time') : "-" %></td> |
|
36 | <td><%= @issue.spent_hours > 0 ? (link_to lwr(:label_f_hour, @issue.spent_hours), {:controller => 'timelog', :action => 'details', :issue_id => @issue}, :class => 'icon icon-time') : "-" %></td> | |
37 | <% end %> |
|
37 | <% end %> | |
38 | </tr> |
|
38 | </tr> | |
39 | <tr> |
|
39 | <tr> | |
40 | <td><b><%=l(:field_fixed_version)%> :</b></td><td><%= @issue.fixed_version ? link_to_version(@issue.fixed_version) : "-" %></td> |
|
40 | <td><b><%=l(:field_fixed_version)%> :</b></td><td><%= @issue.fixed_version ? link_to_version(@issue.fixed_version) : "-" %></td> | |
41 | <% if @issue.estimated_hours %> |
|
41 | <% if @issue.estimated_hours %> | |
42 | <td><b><%=l(:field_estimated_hours)%> :</b></td><td><%= lwr(:label_f_hour, @issue.estimated_hours) %></td> |
|
42 | <td><b><%=l(:field_estimated_hours)%> :</b></td><td><%= lwr(:label_f_hour, @issue.estimated_hours) %></td> | |
43 | <% end %> |
|
43 | <% end %> | |
44 | </tr> |
|
44 | </tr> | |
45 | <tr> |
|
45 | <tr> | |
46 | <% n = 0 |
|
46 | <% n = 0 | |
47 | for custom_value in @custom_values %> |
|
47 | for custom_value in @custom_values %> | |
48 | <td valign="top"><b><%= custom_value.custom_field.name %> :</b></td><td valign="top"><%= simple_format(h(show_value(custom_value))) %></td> |
|
48 | <td valign="top"><b><%= custom_value.custom_field.name %> :</b></td><td valign="top"><%= simple_format(h(show_value(custom_value))) %></td> | |
49 | <% n = n + 1 |
|
49 | <% n = n + 1 | |
50 | if (n > 1) |
|
50 | if (n > 1) | |
51 | n = 0 %> |
|
51 | n = 0 %> | |
52 | </tr><tr> |
|
52 | </tr><tr> | |
53 | <%end |
|
53 | <%end | |
54 | end %> |
|
54 | end %> | |
55 | </tr> |
|
55 | </tr> | |
56 | </table> |
|
56 | </table> | |
57 | <hr /> |
|
57 | <hr /> | |
58 |
|
58 | |||
59 | <% if @issue.changesets.any? %> |
|
59 | <% if @issue.changesets.any? %> | |
60 | <div style="float:right;"> |
|
60 | <div style="float:right;"> | |
61 | <em><%= l(:label_revision_plural) %>: <%= @issue.changesets.collect{|changeset| link_to(changeset.revision, :controller => 'repositories', :action => 'revision', :id => @project, :rev => changeset.revision)}.join(", ") %></em> |
|
61 | <em><%= l(:label_revision_plural) %>: <%= @issue.changesets.collect{|changeset| link_to(changeset.revision, :controller => 'repositories', :action => 'revision', :id => @project, :rev => changeset.revision)}.join(", ") %></em> | |
62 | </div> |
|
62 | </div> | |
63 | <% end %> |
|
63 | <% end %> | |
64 |
|
64 | |||
65 | <p><strong><%=l(:field_description)%></strong></p> |
|
65 | <p><strong><%=l(:field_description)%></strong></p> | |
66 | <%= textilizable @issue.description, :attachments => @issue.attachments %> |
|
66 | <%= textilizable @issue.description, :attachments => @issue.attachments %> | |
67 |
|
67 | |||
68 | <% if @issue.attachments.any? %> |
|
68 | <% if @issue.attachments.any? %> | |
69 | <%= link_to_attachments @issue.attachments, :delete_url => (authorize_for('issues', 'destroy_attachment') ? {:controller => 'issues', :action => 'destroy_attachment', :id => @issue} : nil) %> |
|
69 | <%= link_to_attachments @issue.attachments, :delete_url => (authorize_for('issues', 'destroy_attachment') ? {:controller => 'issues', :action => 'destroy_attachment', :id => @issue} : nil) %> | |
70 | <% end %> |
|
70 | <% end %> | |
71 |
|
71 | |||
72 | <% if authorize_for('issue_relations', 'new') || @issue.relations.any? %> |
|
72 | <% if authorize_for('issue_relations', 'new') || @issue.relations.any? %> | |
73 | <hr /> |
|
73 | <hr /> | |
74 | <div id="relations"> |
|
74 | <div id="relations"> | |
75 | <%= render :partial => 'relations' %> |
|
75 | <%= render :partial => 'relations' %> | |
76 | </div> |
|
76 | </div> | |
77 | <% end %> |
|
77 | <% end %> | |
78 |
|
78 | |||
79 | </div> |
|
79 | </div> | |
80 |
|
80 | |||
81 | <% if authorize_for('issues', 'change_status') and @status_options and !@status_options.empty? %> |
|
81 | <% if authorize_for('issues', 'change_status') and @status_options and !@status_options.empty? %> | |
82 | <% form_tag({:controller => 'issues', :action => 'change_status', :id => @issue}) do %> |
|
82 | <% form_tag({:controller => 'issues', :action => 'change_status', :id => @issue}) do %> | |
83 | <p><%=l(:label_change_status)%> : |
|
83 | <p><%=l(:label_change_status)%> : | |
84 | <select name="new_status_id"> |
|
84 | <select name="new_status_id"> | |
85 | <%= options_from_collection_for_select @status_options, "id", "name" %> |
|
85 | <%= options_from_collection_for_select @status_options, "id", "name" %> | |
86 | </select> |
|
86 | </select> | |
87 | <%= submit_tag l(:button_change) %></p> |
|
87 | <%= submit_tag l(:button_change) %></p> | |
88 | <% end %> |
|
88 | <% end %> | |
89 | <% end %> |
|
89 | <% end %> | |
90 |
|
90 | |||
91 | <% if @journals.any? %> |
|
91 | <% if @journals.any? %> | |
92 | <div id="history"> |
|
92 | <div id="history"> | |
93 | <h3><%=l(:label_history)%></h3> |
|
93 | <h3><%=l(:label_history)%></h3> | |
94 | <%= render :partial => 'history', :locals => { :journals => @journals } %> |
|
94 | <%= render :partial => 'history', :locals => { :journals => @journals } %> | |
95 | </div> |
|
95 | </div> | |
96 | <% end %> |
|
96 | <% end %> | |
97 |
|
97 | |||
98 | <% if authorize_for('issues', 'add_note') %> |
|
98 | <% if authorize_for('issues', 'add_note') %> | |
99 | <a name="add-note-anchor"></a> |
|
99 | <a name="add-note-anchor"></a> | |
100 | <div id="add-note" class="box" style="display:none;"> |
|
100 | <div id="add-note" class="box" style="display:none;"> | |
101 | <h3><%= l(:label_add_note) %></h3> |
|
101 | <h3><%= l(:label_add_note) %></h3> | |
102 | <% form_tag({:controller => 'issues', :action => 'add_note', :id => @issue}, :class => "tabular", :multipart => true) do %> |
|
102 | <% form_tag({:controller => 'issues', :action => 'add_note', :id => @issue}, :class => "tabular", :multipart => true) do %> | |
103 | <p><label for="notes"><%=l(:field_notes)%></label> |
|
103 | <p><label for="notes"><%=l(:field_notes)%></label> | |
104 | <%= text_area_tag 'notes', '', :cols => 60, :rows => 10, :class => 'wiki-edit' %></p> |
|
104 | <%= text_area_tag 'notes', '', :cols => 60, :rows => 10, :class => 'wiki-edit' %></p> | |
105 | <%= wikitoolbar_for 'notes' %> |
|
105 | <%= wikitoolbar_for 'notes' %> | |
106 | <%= render :partial => 'attachments/form' %> |
|
106 | <%= render :partial => 'attachments/form' %> | |
107 | <%= submit_tag l(:button_add) %> |
|
107 | <%= submit_tag l(:button_add) %> | |
108 | <%= toggle_link l(:button_cancel), 'add-note' %> |
|
108 | <%= toggle_link l(:button_cancel), 'add-note' %> | |
109 | <% end %> |
|
109 | <% end %> | |
110 | </div> |
|
110 | </div> | |
111 | <% end %> |
|
111 | <% end %> | |
112 |
|
112 | |||
113 | <div class="contextual"> |
|
113 | <div class="contextual"> | |
114 | <%= l(:label_export_to) %><%= link_to 'PDF', {:action => 'export_pdf', :id => @issue}, :class => 'icon icon-pdf' %> |
|
114 | <%= l(:label_export_to) %><%= link_to 'PDF', {:action => 'export_pdf', :id => @issue}, :class => 'icon icon-pdf' %> | |
115 | </div> |
|
115 | </div> | |
116 | |
|
116 | | |
117 |
|
117 | |||
118 | <% set_html_title "#{@issue.tracker.name} ##{@issue.id}: #{@issue.subject}" %> |
|
118 | <% set_html_title "#{@issue.tracker.name} ##{@issue.id}: #{@issue.subject}" %> | |
119 |
|
119 | |||
120 | <% content_for :sidebar do %> |
|
120 | <% content_for :sidebar do %> | |
121 | <%= render :partial => 'issues/sidebar' %> |
|
121 | <%= render :partial => 'issues/sidebar' %> | |
122 | <% end %> |
|
122 | <% end %> |
@@ -1,79 +1,80 | |||||
1 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> |
|
1 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> | |
2 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> |
|
2 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> | |
3 | <head> |
|
3 | <head> | |
4 | <title><%=h html_title %></title> |
|
4 | <title><%=h html_title %></title> | |
5 | <meta http-equiv="content-type" content="text/html; charset=utf-8" /> |
|
5 | <meta http-equiv="content-type" content="text/html; charset=utf-8" /> | |
6 | <meta name="description" content="<%= Redmine::Info.app_name %>" /> |
|
6 | <meta name="description" content="<%= Redmine::Info.app_name %>" /> | |
7 | <meta name="keywords" content="issue,bug,tracker" /> |
|
7 | <meta name="keywords" content="issue,bug,tracker" /> | |
8 | <%= stylesheet_link_tag 'application', :media => 'all' %> |
|
8 | <%= stylesheet_link_tag 'application', :media => 'all' %> | |
9 | <%= javascript_include_tag :defaults %> |
|
9 | <%= javascript_include_tag :defaults %> | |
10 | <%= stylesheet_link_tag 'jstoolbar' %> |
|
10 | <%= stylesheet_link_tag 'jstoolbar' %> | |
11 | <!--[if IE]> |
|
11 | <!--[if IE]> | |
12 | <style type="text/css"> |
|
12 | <style type="text/css"> | |
13 | * html body{ width: expression( document.documentElement.clientWidth < 900 ? '900px' : '100%' ); } |
|
13 | * html body{ width: expression( document.documentElement.clientWidth < 900 ? '900px' : '100%' ); } | |
14 | body {behavior: url(<%= stylesheet_path "csshover.htc" %>);} |
|
14 | body {behavior: url(<%= stylesheet_path "csshover.htc" %>);} | |
15 | </style> |
|
15 | </style> | |
16 | <![endif]--> |
|
16 | <![endif]--> | |
17 |
|
17 | |||
18 | <!-- page specific tags --><%= yield :header_tags %> |
|
18 | <!-- page specific tags --><%= yield :header_tags %> | |
19 | </head> |
|
19 | </head> | |
20 | <body> |
|
20 | <body> | |
21 | <div id="top-menu"> |
|
21 | <div id="top-menu"> | |
22 | <div id="account"> |
|
22 | <div id="account"> | |
23 | <% if User.current.logged? %> |
|
23 | <% if User.current.logged? %> | |
24 | <%=l(:label_logged_as)%> <%= User.current.login %> - |
|
24 | <%=l(:label_logged_as)%> <%= User.current.login %> - | |
25 | <%= link_to l(:label_my_account), { :controller => 'my', :action => 'account' } %> |
|
25 | <%= link_to l(:label_my_account), { :controller => 'my', :action => 'account' } %> | |
26 | <%= link_to l(:label_logout), { :controller => 'account', :action => 'logout' } %> |
|
26 | <%= link_to l(:label_logout), { :controller => 'account', :action => 'logout' } %> | |
27 | <% else %> |
|
27 | <% else %> | |
28 | <%= link_to l(:label_login), { :controller => 'account', :action => 'login' } %> |
|
28 | <%= link_to l(:label_login), { :controller => 'account', :action => 'login' } %> | |
29 | <%= link_to(l(:label_register), :controller => 'account',:action => 'register') if Setting.self_registration? %> |
|
29 | <%= link_to(l(:label_register), :controller => 'account',:action => 'register') if Setting.self_registration? %> | |
30 | <% end %> |
|
30 | <% end %> | |
31 | </div> |
|
31 | </div> | |
32 | <%= link_to l(:label_home), home_url %> |
|
32 | <%= link_to l(:label_home), home_url %> | |
33 | <%= link_to l(:label_my_page), { :controller => 'my', :action => 'page'} if User.current.logged? %> |
|
33 | <%= link_to l(:label_my_page), { :controller => 'my', :action => 'page'} if User.current.logged? %> | |
34 | <%= link_to l(:label_project_plural), { :controller => 'projects' } %> |
|
34 | <%= link_to l(:label_project_plural), { :controller => 'projects' } %> | |
35 | <%= link_to l(:label_administration), { :controller => 'admin' } if User.current.admin? %> |
|
35 | <%= link_to l(:label_administration), { :controller => 'admin' } if User.current.admin? %> | |
36 | </div> |
|
36 | </div> | |
37 |
|
37 | |||
38 | <div id="header"> |
|
38 | <div id="header"> | |
39 | <div id="quick-search"> |
|
39 | <div id="quick-search"> | |
40 | <% form_tag({:controller => 'search', :action => 'index', :id => @project}, :method => :get ) do %> |
|
40 | <% form_tag({:controller => 'search', :action => 'index', :id => @project}, :method => :get ) do %> | |
41 |
<%= link_to l(:label_search), :controller => 'search', :action => 'index', :id => @project |
|
41 | <%= link_to l(:label_search), {:controller => 'search', :action => 'index', :id => @project}, :accesskey => accesskey(:search) %>: | |
|
42 | <%= text_field_tag 'q', @question, :size => 20, :class => 'small', :accesskey => accesskey(:quick_search) %> | |||
42 | <% end %> |
|
43 | <% end %> | |
43 | <%= render :partial => 'layouts/project_selector' if User.current.memberships.any? %> |
|
44 | <%= render :partial => 'layouts/project_selector' if User.current.memberships.any? %> | |
44 | </div> |
|
45 | </div> | |
45 |
|
46 | |||
46 | <h1><%= h(@project ? @project.name : Setting.app_title) %></h1> |
|
47 | <h1><%= h(@project ? @project.name : Setting.app_title) %></h1> | |
47 |
|
48 | |||
48 | <div id="main-menu"> |
|
49 | <div id="main-menu"> | |
49 | <ul> |
|
50 | <ul> | |
50 | <% Redmine::MenuManager.allowed_items(:project_menu, User.current, @project).each do |item| %> |
|
51 | <% Redmine::MenuManager.allowed_items(:project_menu, User.current, @project).each do |item| %> | |
51 | <% unless item.condition && !item.condition.call(@project) %> |
|
52 | <% unless item.condition && !item.condition.call(@project) %> | |
52 | <li><%= link_to l(item.name), {item.param => @project}.merge(item.url) %></li> |
|
53 | <li><%= link_to l(item.name), {item.param => @project}.merge(item.url) %></li> | |
53 | <% end %> |
|
54 | <% end %> | |
54 | <% end if @project && !@project.new_record? %> |
|
55 | <% end if @project && !@project.new_record? %> | |
55 | </ul> |
|
56 | </ul> | |
56 | </div> |
|
57 | </div> | |
57 | </div> |
|
58 | </div> | |
58 |
|
59 | |||
59 | <%= tag('div', {:id => 'main', :class => (has_content?(:sidebar) ? '' : 'nosidebar')}, true) %> |
|
60 | <%= tag('div', {:id => 'main', :class => (has_content?(:sidebar) ? '' : 'nosidebar')}, true) %> | |
60 | <div id="sidebar"> |
|
61 | <div id="sidebar"> | |
61 | <%= yield :sidebar %> |
|
62 | <%= yield :sidebar %> | |
62 | </div> |
|
63 | </div> | |
63 |
|
64 | |||
64 | <div id="content"> |
|
65 | <div id="content"> | |
65 | <div id="flash"> |
|
66 | <div id="flash"> | |
66 | <%= content_tag('div', flash[:error], :class => 'error') if flash[:error] %> |
|
67 | <%= content_tag('div', flash[:error], :class => 'error') if flash[:error] %> | |
67 | <%= content_tag('div', flash[:notice], :class => 'notice') if flash[:notice] %> |
|
68 | <%= content_tag('div', flash[:notice], :class => 'notice') if flash[:notice] %> | |
68 | </div> |
|
69 | </div> | |
69 | <%= yield %> |
|
70 | <%= yield %> | |
70 | </div> |
|
71 | </div> | |
71 | </div> |
|
72 | </div> | |
72 |
|
73 | |||
73 | <div id="ajax-indicator" style="display:none;"><span><%= l(:label_loading) %></span></div> |
|
74 | <div id="ajax-indicator" style="display:none;"><span><%= l(:label_loading) %></span></div> | |
74 |
|
75 | |||
75 | <div id="footer"> |
|
76 | <div id="footer"> | |
76 | Powered by <%= link_to Redmine::Info.app_name, Redmine::Info.url %> <%= Redmine::VERSION %> © 2006-2007 Jean-Philippe Lang |
|
77 | Powered by <%= link_to Redmine::Info.app_name, Redmine::Info.url %> <%= Redmine::VERSION %> © 2006-2007 Jean-Philippe Lang | |
77 | </div> |
|
78 | </div> | |
78 | </body> |
|
79 | </body> | |
79 | </html> |
|
80 | </html> |
@@ -1,42 +1,43 | |||||
1 | <div class="contextual"> |
|
1 | <div class="contextual"> | |
2 | <%= link_to_if_authorized l(:button_edit), |
|
2 | <%= link_to_if_authorized l(:button_edit), | |
3 | {:controller => 'news', :action => 'edit', :id => @news}, |
|
3 | {:controller => 'news', :action => 'edit', :id => @news}, | |
4 | :class => 'icon icon-edit', |
|
4 | :class => 'icon icon-edit', | |
|
5 | :accesskey => accesskey(:edit), | |||
5 | :onclick => 'Element.show("edit-news"); return false;' %> |
|
6 | :onclick => 'Element.show("edit-news"); return false;' %> | |
6 | <%= link_to_if_authorized l(:button_delete), {:controller => 'news', :action => 'destroy', :id => @news}, :confirm => l(:text_are_you_sure), :method => :post, :class => 'icon icon-del' %> |
|
7 | <%= link_to_if_authorized l(:button_delete), {:controller => 'news', :action => 'destroy', :id => @news}, :confirm => l(:text_are_you_sure), :method => :post, :class => 'icon icon-del' %> | |
7 | </div> |
|
8 | </div> | |
8 |
|
9 | |||
9 | <h2><%=h @news.title %></h2> |
|
10 | <h2><%=h @news.title %></h2> | |
10 |
|
11 | |||
11 | <div id="edit-news" style="display:none;"> |
|
12 | <div id="edit-news" style="display:none;"> | |
12 | <% labelled_tabular_form_for :news, @news, :url => { :action => "edit", :id => @news } do |f| %> |
|
13 | <% labelled_tabular_form_for :news, @news, :url => { :action => "edit", :id => @news } do |f| %> | |
13 | <%= render :partial => 'form', :locals => { :f => f } %> |
|
14 | <%= render :partial => 'form', :locals => { :f => f } %> | |
14 | <%= submit_tag l(:button_save) %> |
|
15 | <%= submit_tag l(:button_save) %> | |
15 | <%= link_to l(:button_cancel), "#", :onclick => 'Element.hide("edit-news")' %> |
|
16 | <%= link_to l(:button_cancel), "#", :onclick => 'Element.hide("edit-news")' %> | |
16 | <% end %> |
|
17 | <% end %> | |
17 | </div> |
|
18 | </div> | |
18 |
|
19 | |||
19 | <p><em><% unless @news.summary.empty? %><%=h @news.summary %><br /><% end %> |
|
20 | <p><em><% unless @news.summary.empty? %><%=h @news.summary %><br /><% end %> | |
20 | <span class="author"><%= authoring @news.created_on, @news.author %></span></em></p> |
|
21 | <span class="author"><%= authoring @news.created_on, @news.author %></span></em></p> | |
21 | <%= textilizable(@news.description) %> |
|
22 | <%= textilizable(@news.description) %> | |
22 | <br /> |
|
23 | <br /> | |
23 |
|
24 | |||
24 | <div id="comments" style="margin-bottom:16px;"> |
|
25 | <div id="comments" style="margin-bottom:16px;"> | |
25 | <h3 class="icon22 icon22-comment"><%= l(:label_comment_plural) %></h3> |
|
26 | <h3 class="icon22 icon22-comment"><%= l(:label_comment_plural) %></h3> | |
26 | <% @news.comments.each do |comment| %> |
|
27 | <% @news.comments.each do |comment| %> | |
27 | <% next if comment.new_record? %> |
|
28 | <% next if comment.new_record? %> | |
28 | <h4><%= format_time(comment.created_on) %> - <%= comment.author.name %></h4> |
|
29 | <h4><%= format_time(comment.created_on) %> - <%= comment.author.name %></h4> | |
29 | <div class="contextual"> |
|
30 | <div class="contextual"> | |
30 | <%= link_to_if_authorized l(:button_delete), {:controller => 'news', :action => 'destroy_comment', :id => @news, :comment_id => comment}, :confirm => l(:text_are_you_sure), :method => :post, :class => 'icon icon-del' %> |
|
31 | <%= link_to_if_authorized l(:button_delete), {:controller => 'news', :action => 'destroy_comment', :id => @news, :comment_id => comment}, :confirm => l(:text_are_you_sure), :method => :post, :class => 'icon icon-del' %> | |
31 | </div> |
|
32 | </div> | |
32 | <%= simple_format(auto_link(h comment.comments))%> |
|
33 | <%= simple_format(auto_link(h comment.comments))%> | |
33 | <% end if @news.comments_count > 0 %> |
|
34 | <% end if @news.comments_count > 0 %> | |
34 | </div> |
|
35 | </div> | |
35 |
|
36 | |||
36 | <% if authorize_for 'news', 'add_comment' %> |
|
37 | <% if authorize_for 'news', 'add_comment' %> | |
37 | <p><%= toggle_link l(:label_comment_add), "add_comment_form", :focus => "comment_comments" %></p> |
|
38 | <p><%= toggle_link l(:label_comment_add), "add_comment_form", :focus => "comment_comments" %></p> | |
38 | <% form_tag({:action => 'add_comment', :id => @news}, :id => "add_comment_form", :style => "display:none;") do %> |
|
39 | <% form_tag({:action => 'add_comment', :id => @news}, :id => "add_comment_form", :style => "display:none;") do %> | |
39 | <%= text_area 'comment', 'comments', :cols => 60, :rows => 6 %> |
|
40 | <%= text_area 'comment', 'comments', :cols => 60, :rows => 6 %> | |
40 | <p><%= submit_tag l(:button_add) %></p> |
|
41 | <p><%= submit_tag l(:button_add) %></p> | |
41 | <% end %> |
|
42 | <% end %> | |
42 | <% end %> |
|
43 | <% end %> |
@@ -1,31 +1,31 | |||||
1 | <h2><%= @page.pretty_title %></h2> |
|
1 | <h2><%= @page.pretty_title %></h2> | |
2 |
|
2 | |||
3 | <% form_for :content, @content, :url => {:action => 'edit', :page => @page.title}, :html => {:id => 'wiki_form'} do |f| %> |
|
3 | <% form_for :content, @content, :url => {:action => 'edit', :page => @page.title}, :html => {:id => 'wiki_form'} do |f| %> | |
4 | <%= f.hidden_field :version %> |
|
4 | <%= f.hidden_field :version %> | |
5 | <%= error_messages_for 'content' %> |
|
5 | <%= error_messages_for 'content' %> | |
6 | <div class="contextual"> |
|
6 | <div class="contextual"> | |
7 | <%= l(:setting_text_formatting) %>: |
|
7 | <%= l(:setting_text_formatting) %>: | |
8 | <%= link_to l(:label_help), {:controller => 'help', :ctrl => 'wiki', :page => 'syntax' }, |
|
8 | <%= link_to l(:label_help), {:controller => 'help', :ctrl => 'wiki', :page => 'syntax' }, | |
9 | :onclick => "window.open('#{ url_for :controller => 'help', :ctrl => 'wiki', :page => 'syntax' }', '', 'resizable=yes, location=no, width=300, height=500, menubar=no, status=no, scrollbars=yes'); return false;" %> |
|
9 | :onclick => "window.open('#{ url_for :controller => 'help', :ctrl => 'wiki', :page => 'syntax' }', '', 'resizable=yes, location=no, width=300, height=500, menubar=no, status=no, scrollbars=yes'); return false;" %> | |
10 | </div> |
|
10 | </div> | |
11 | <p><%= f.text_area :text, :cols => 100, :rows => 25, :class => 'wiki-edit' %></p> |
|
11 | <p><%= f.text_area :text, :cols => 100, :rows => 25, :class => 'wiki-edit', :accesskey => accesskey(:edit) %></p> | |
12 | <p><label><%= l(:field_comments) %></label><br /><%= f.text_field :comments, :size => 120 %></p> |
|
12 | <p><label><%= l(:field_comments) %></label><br /><%= f.text_field :comments, :size => 120 %></p> | |
13 | <p><%= submit_tag l(:button_save) %> |
|
13 | <p><%= submit_tag l(:button_save) %> | |
14 | <%= link_to_remote l(:label_preview), |
|
14 | <%= link_to_remote l(:label_preview), | |
15 | { :url => { :controller => 'wiki', :action => 'preview', :id => @project, :page => @page.title }, |
|
15 | { :url => { :controller => 'wiki', :action => 'preview', :id => @project, :page => @page.title }, | |
16 | :method => 'post', |
|
16 | :method => 'post', | |
17 | :update => 'preview', |
|
17 | :update => 'preview', | |
18 | :with => "Form.serialize('wiki_form')", |
|
18 | :with => "Form.serialize('wiki_form')", | |
19 | :complete => "location.href='#preview-top'" |
|
19 | :complete => "location.href='#preview-top'" | |
20 | } %></p> |
|
20 | }, :accesskey => accesskey(:preview) %></p> | |
21 | <%= wikitoolbar_for 'content_text' %> |
|
21 | <%= wikitoolbar_for 'content_text' %> | |
22 | <% end %> |
|
22 | <% end %> | |
23 |
|
23 | |||
24 | <a name="preview-top"></a> |
|
24 | <a name="preview-top"></a> | |
25 | <div id="preview" class="wiki"></div> |
|
25 | <div id="preview" class="wiki"></div> | |
26 |
|
26 | |||
27 | <% content_for :header_tags do %> |
|
27 | <% content_for :header_tags do %> | |
28 | <%= stylesheet_link_tag 'scm' %> |
|
28 | <%= stylesheet_link_tag 'scm' %> | |
29 | <% end %> |
|
29 | <% end %> | |
30 |
|
30 | |||
31 | <% set_html_title @page.pretty_title %> |
|
31 | <% set_html_title @page.pretty_title %> |
@@ -1,49 +1,49 | |||||
1 | <div class="contextual"> |
|
1 | <div class="contextual"> | |
2 | <%= link_to_if_authorized(l(:button_edit), {:action => 'edit', :page => @page.title}, :class => 'icon icon-edit') if @content.version == @page.content.version %> |
|
2 | <%= link_to_if_authorized(l(:button_edit), {:action => 'edit', :page => @page.title}, :class => 'icon icon-edit', :accesskey => accesskey(:edit)) if @content.version == @page.content.version %> | |
3 | <%= link_to_if_authorized(l(:button_rename), {:action => 'rename', :page => @page.title}, :class => 'icon icon-move') if @content.version == @page.content.version %> |
|
3 | <%= link_to_if_authorized(l(:button_rename), {:action => 'rename', :page => @page.title}, :class => 'icon icon-move') if @content.version == @page.content.version %> | |
4 | <%= link_to_if_authorized(l(:button_delete), {:action => 'destroy', :page => @page.title}, :method => :post, :confirm => l(:text_are_you_sure), :class => 'icon icon-del') %> |
|
4 | <%= link_to_if_authorized(l(:button_delete), {:action => 'destroy', :page => @page.title}, :method => :post, :confirm => l(:text_are_you_sure), :class => 'icon icon-del') %> | |
5 | <%= link_to_if_authorized(l(:button_rollback), {:action => 'edit', :page => @page.title, :version => @content.version }, :class => 'icon icon-cancel') if @content.version < @page.content.version %> |
|
5 | <%= link_to_if_authorized(l(:button_rollback), {:action => 'edit', :page => @page.title, :version => @content.version }, :class => 'icon icon-cancel') if @content.version < @page.content.version %> | |
6 | <%= link_to(l(:label_history), {:action => 'history', :page => @page.title}, :class => 'icon icon-history') %> |
|
6 | <%= link_to(l(:label_history), {:action => 'history', :page => @page.title}, :class => 'icon icon-history') %> | |
7 | </div> |
|
7 | </div> | |
8 |
|
8 | |||
9 | <% if @content.version != @page.content.version %> |
|
9 | <% if @content.version != @page.content.version %> | |
10 | <p> |
|
10 | <p> | |
11 | <%= link_to(('« ' + l(:label_previous)), :action => 'index', :page => @page.title, :version => (@content.version - 1)) + " - " if @content.version > 1 %> |
|
11 | <%= link_to(('« ' + l(:label_previous)), :action => 'index', :page => @page.title, :version => (@content.version - 1)) + " - " if @content.version > 1 %> | |
12 | <%= "#{l(:label_version)} #{@content.version}/#{@page.content.version}" %> |
|
12 | <%= "#{l(:label_version)} #{@content.version}/#{@page.content.version}" %> | |
13 | <%= '(' + link_to('diff', :controller => 'wiki', :action => 'diff', :page => @page.title, :version => @content.version) + ')' if @content.version > 1 %> - |
|
13 | <%= '(' + link_to('diff', :controller => 'wiki', :action => 'diff', :page => @page.title, :version => @content.version) + ')' if @content.version > 1 %> - | |
14 | <%= link_to((l(:label_next) + ' »'), :action => 'index', :page => @page.title, :version => (@content.version + 1)) + " - " if @content.version < @page.content.version %> |
|
14 | <%= link_to((l(:label_next) + ' »'), :action => 'index', :page => @page.title, :version => (@content.version + 1)) + " - " if @content.version < @page.content.version %> | |
15 | <%= link_to(l(:label_current_version), :action => 'index', :page => @page.title) %> |
|
15 | <%= link_to(l(:label_current_version), :action => 'index', :page => @page.title) %> | |
16 | <br /> |
|
16 | <br /> | |
17 | <em><%= @content.author ? @content.author.name : "anonyme" %>, <%= format_time(@content.updated_on) %> </em><br /> |
|
17 | <em><%= @content.author ? @content.author.name : "anonyme" %>, <%= format_time(@content.updated_on) %> </em><br /> | |
18 | <%=h @content.comments %> |
|
18 | <%=h @content.comments %> | |
19 | </p> |
|
19 | </p> | |
20 | <hr /> |
|
20 | <hr /> | |
21 | <% end %> |
|
21 | <% end %> | |
22 |
|
22 | |||
23 | <%= render(:partial => "wiki/content", :locals => {:content => @content}) %> |
|
23 | <%= render(:partial => "wiki/content", :locals => {:content => @content}) %> | |
24 |
|
24 | |||
25 | <%= link_to_attachments @page.attachments, :delete_url => (authorize_for('wiki', 'destroy_attachment') ? {:controller => 'wiki', :action => 'destroy_attachment', :page => @page.title} : nil) %> |
|
25 | <%= link_to_attachments @page.attachments, :delete_url => (authorize_for('wiki', 'destroy_attachment') ? {:controller => 'wiki', :action => 'destroy_attachment', :page => @page.title} : nil) %> | |
26 |
|
26 | |||
27 | <div class="contextual"> |
|
27 | <div class="contextual"> | |
28 | <%= l(:label_export_to) %> |
|
28 | <%= l(:label_export_to) %> | |
29 | <%= link_to 'HTML', {:page => @page.title, :export => 'html', :version => @content.version}, :class => 'icon icon-html' %>, |
|
29 | <%= link_to 'HTML', {:page => @page.title, :export => 'html', :version => @content.version}, :class => 'icon icon-html' %>, | |
30 | <%= link_to 'TXT', {:page => @page.title, :export => 'txt', :version => @content.version}, :class => 'icon icon-txt' %> |
|
30 | <%= link_to 'TXT', {:page => @page.title, :export => 'txt', :version => @content.version}, :class => 'icon icon-txt' %> | |
31 | </div> |
|
31 | </div> | |
32 |
|
32 | |||
33 | <% if authorize_for('wiki', 'add_attachment') %> |
|
33 | <% if authorize_for('wiki', 'add_attachment') %> | |
34 | <p><%= toggle_link l(:label_attachment_new), "add_attachment_form" %></p> |
|
34 | <p><%= toggle_link l(:label_attachment_new), "add_attachment_form" %></p> | |
35 | <% form_tag({ :controller => 'wiki', :action => 'add_attachment', :page => @page.title }, :multipart => true, :class => "tabular", :id => "add_attachment_form", :style => "display:none;") do %> |
|
35 | <% form_tag({ :controller => 'wiki', :action => 'add_attachment', :page => @page.title }, :multipart => true, :class => "tabular", :id => "add_attachment_form", :style => "display:none;") do %> | |
36 | <%= render :partial => 'attachments/form' %> |
|
36 | <%= render :partial => 'attachments/form' %> | |
37 | <%= submit_tag l(:button_add) %> |
|
37 | <%= submit_tag l(:button_add) %> | |
38 | <% end %> |
|
38 | <% end %> | |
39 | <% end %> |
|
39 | <% end %> | |
40 |
|
40 | |||
41 | <% content_for :header_tags do %> |
|
41 | <% content_for :header_tags do %> | |
42 | <%= stylesheet_link_tag 'scm' %> |
|
42 | <%= stylesheet_link_tag 'scm' %> | |
43 | <% end %> |
|
43 | <% end %> | |
44 |
|
44 | |||
45 | <% content_for :sidebar do %> |
|
45 | <% content_for :sidebar do %> | |
46 | <%= render :partial => 'sidebar' %> |
|
46 | <%= render :partial => 'sidebar' %> | |
47 | <% end %> |
|
47 | <% end %> | |
48 |
|
48 | |||
49 | <% set_html_title @page.pretty_title %> |
|
49 | <% set_html_title @page.pretty_title %> |
General Comments 0
You need to be logged in to leave comments.
Login now