@@ -0,0 +1,9 | |||
|
1 | #context-menu li.folder ul { left:auto; right:168px; } | |
|
2 | #context-menu li.folder>ul { left:auto; right:148px; } | |
|
3 | #context-menu li a.submenu { background:url("../images/bullet_arrow_left.png") left no-repeat; } | |
|
4 | ||
|
5 | #context-menu a { | |
|
6 | background-position: 100% 40%; | |
|
7 | padding-right: 20px; | |
|
8 | padding-left: 0px; | |
|
9 | } |
@@ -1,833 +1,838 | |||
|
1 | 1 | # redMine - project management software |
|
2 | 2 | # Copyright (C) 2006-2007 Jean-Philippe Lang |
|
3 | 3 | # |
|
4 | 4 | # This program is free software; you can redistribute it and/or |
|
5 | 5 | # modify it under the terms of the GNU General Public License |
|
6 | 6 | # as published by the Free Software Foundation; either version 2 |
|
7 | 7 | # of the License, or (at your option) any later version. |
|
8 | 8 | # |
|
9 | 9 | # This program is distributed in the hope that it will be useful, |
|
10 | 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 | 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 | 12 | # GNU General Public License for more details. |
|
13 | 13 | # |
|
14 | 14 | # You should have received a copy of the GNU General Public License |
|
15 | 15 | # along with this program; if not, write to the Free Software |
|
16 | 16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
17 | 17 | |
|
18 | 18 | require 'forwardable' |
|
19 | 19 | require 'cgi' |
|
20 | 20 | |
|
21 | 21 | module ApplicationHelper |
|
22 | 22 | include Redmine::WikiFormatting::Macros::Definitions |
|
23 | 23 | include Redmine::I18n |
|
24 | 24 | include GravatarHelper::PublicMethods |
|
25 | 25 | |
|
26 | 26 | extend Forwardable |
|
27 | 27 | def_delegators :wiki_helper, :wikitoolbar_for, :heads_for_wiki_formatter |
|
28 | 28 | |
|
29 | 29 | # Return true if user is authorized for controller/action, otherwise false |
|
30 | 30 | def authorize_for(controller, action) |
|
31 | 31 | User.current.allowed_to?({:controller => controller, :action => action}, @project) |
|
32 | 32 | end |
|
33 | 33 | |
|
34 | 34 | # Display a link if user is authorized |
|
35 | 35 | def link_to_if_authorized(name, options = {}, html_options = nil, *parameters_for_method_reference) |
|
36 | 36 | link_to(name, options, html_options, *parameters_for_method_reference) if authorize_for(options[:controller] || params[:controller], options[:action]) |
|
37 | 37 | end |
|
38 | 38 | |
|
39 | 39 | # Display a link to remote if user is authorized |
|
40 | 40 | def link_to_remote_if_authorized(name, options = {}, html_options = nil) |
|
41 | 41 | url = options[:url] || {} |
|
42 | 42 | link_to_remote(name, options, html_options) if authorize_for(url[:controller] || params[:controller], url[:action]) |
|
43 | 43 | end |
|
44 | 44 | |
|
45 | 45 | # Displays a link to user's account page if active |
|
46 | 46 | def link_to_user(user, options={}) |
|
47 | 47 | if user.is_a?(User) |
|
48 | 48 | name = h(user.name(options[:format])) |
|
49 | 49 | if user.active? |
|
50 | 50 | link_to name, :controller => 'users', :action => 'show', :id => user |
|
51 | 51 | else |
|
52 | 52 | name |
|
53 | 53 | end |
|
54 | 54 | else |
|
55 | 55 | h(user.to_s) |
|
56 | 56 | end |
|
57 | 57 | end |
|
58 | 58 | |
|
59 | 59 | # Displays a link to +issue+ with its subject. |
|
60 | 60 | # Examples: |
|
61 | 61 | # |
|
62 | 62 | # link_to_issue(issue) # => Defect #6: This is the subject |
|
63 | 63 | # link_to_issue(issue, :truncate => 6) # => Defect #6: This i... |
|
64 | 64 | # link_to_issue(issue, :subject => false) # => Defect #6 |
|
65 | 65 | # link_to_issue(issue, :project => true) # => Foo - Defect #6 |
|
66 | 66 | # |
|
67 | 67 | def link_to_issue(issue, options={}) |
|
68 | 68 | title = nil |
|
69 | 69 | subject = nil |
|
70 | 70 | if options[:subject] == false |
|
71 | 71 | title = truncate(issue.subject, :length => 60) |
|
72 | 72 | else |
|
73 | 73 | subject = issue.subject |
|
74 | 74 | if options[:truncate] |
|
75 | 75 | subject = truncate(subject, :length => options[:truncate]) |
|
76 | 76 | end |
|
77 | 77 | end |
|
78 | 78 | s = link_to "#{issue.tracker} ##{issue.id}", {:controller => "issues", :action => "show", :id => issue}, |
|
79 | 79 | :class => issue.css_classes, |
|
80 | 80 | :title => title |
|
81 | 81 | s << ": #{h subject}" if subject |
|
82 | 82 | s = "#{h issue.project} - " + s if options[:project] |
|
83 | 83 | s |
|
84 | 84 | end |
|
85 | 85 | |
|
86 | 86 | # Generates a link to an attachment. |
|
87 | 87 | # Options: |
|
88 | 88 | # * :text - Link text (default to attachment filename) |
|
89 | 89 | # * :download - Force download (default: false) |
|
90 | 90 | def link_to_attachment(attachment, options={}) |
|
91 | 91 | text = options.delete(:text) || attachment.filename |
|
92 | 92 | action = options.delete(:download) ? 'download' : 'show' |
|
93 | 93 | |
|
94 | 94 | link_to(h(text), {:controller => 'attachments', :action => action, :id => attachment, :filename => attachment.filename }, options) |
|
95 | 95 | end |
|
96 | 96 | |
|
97 | 97 | # Generates a link to a SCM revision |
|
98 | 98 | # Options: |
|
99 | 99 | # * :text - Link text (default to the formatted revision) |
|
100 | 100 | def link_to_revision(revision, project, options={}) |
|
101 | 101 | text = options.delete(:text) || format_revision(revision) |
|
102 | 102 | |
|
103 | 103 | link_to(text, {:controller => 'repositories', :action => 'revision', :id => project, :rev => revision}, :title => l(:label_revision_id, revision)) |
|
104 | 104 | end |
|
105 | 105 | |
|
106 | 106 | # Generates a link to a project if active |
|
107 | 107 | # Examples: |
|
108 | 108 | # |
|
109 | 109 | # link_to_project(project) # => link to the specified project overview |
|
110 | 110 | # link_to_project(project, :action=>'settings') # => link to project settings |
|
111 | 111 | # link_to_project(project, {:only_path => false}, :class => "project") # => 3rd arg adds html options |
|
112 | 112 | # link_to_project(project, {}, :class => "project") # => html options with default url (project overview) |
|
113 | 113 | # |
|
114 | 114 | def link_to_project(project, options={}, html_options = nil) |
|
115 | 115 | if project.active? |
|
116 | 116 | url = {:controller => 'projects', :action => 'show', :id => project}.merge(options) |
|
117 | 117 | link_to(h(project), url, html_options) |
|
118 | 118 | else |
|
119 | 119 | h(project) |
|
120 | 120 | end |
|
121 | 121 | end |
|
122 | 122 | |
|
123 | 123 | def toggle_link(name, id, options={}) |
|
124 | 124 | onclick = "Element.toggle('#{id}'); " |
|
125 | 125 | onclick << (options[:focus] ? "Form.Element.focus('#{options[:focus]}'); " : "this.blur(); ") |
|
126 | 126 | onclick << "return false;" |
|
127 | 127 | link_to(name, "#", :onclick => onclick) |
|
128 | 128 | end |
|
129 | 129 | |
|
130 | 130 | def image_to_function(name, function, html_options = {}) |
|
131 | 131 | html_options.symbolize_keys! |
|
132 | 132 | tag(:input, html_options.merge({ |
|
133 | 133 | :type => "image", :src => image_path(name), |
|
134 | 134 | :onclick => (html_options[:onclick] ? "#{html_options[:onclick]}; " : "") + "#{function};" |
|
135 | 135 | })) |
|
136 | 136 | end |
|
137 | 137 | |
|
138 | 138 | def prompt_to_remote(name, text, param, url, html_options = {}) |
|
139 | 139 | html_options[:onclick] = "promptToRemote('#{text}', '#{param}', '#{url_for(url)}'); return false;" |
|
140 | 140 | link_to name, {}, html_options |
|
141 | 141 | end |
|
142 | 142 | |
|
143 | 143 | def format_activity_title(text) |
|
144 | 144 | h(truncate_single_line(text, :length => 100)) |
|
145 | 145 | end |
|
146 | 146 | |
|
147 | 147 | def format_activity_day(date) |
|
148 | 148 | date == Date.today ? l(:label_today).titleize : format_date(date) |
|
149 | 149 | end |
|
150 | 150 | |
|
151 | 151 | def format_activity_description(text) |
|
152 | 152 | h(truncate(text.to_s, :length => 120).gsub(%r{[\r\n]*<(pre|code)>.*$}m, '...')).gsub(/[\r\n]+/, "<br />") |
|
153 | 153 | end |
|
154 | 154 | |
|
155 | 155 | def format_version_name(version) |
|
156 | 156 | if version.project == @project |
|
157 | 157 | h(version) |
|
158 | 158 | else |
|
159 | 159 | h("#{version.project} - #{version}") |
|
160 | 160 | end |
|
161 | 161 | end |
|
162 | 162 | |
|
163 | 163 | def due_date_distance_in_words(date) |
|
164 | 164 | if date |
|
165 | 165 | l((date < Date.today ? :label_roadmap_overdue : :label_roadmap_due_in), distance_of_date_in_words(Date.today, date)) |
|
166 | 166 | end |
|
167 | 167 | end |
|
168 | 168 | |
|
169 | 169 | def render_page_hierarchy(pages, node=nil) |
|
170 | 170 | content = '' |
|
171 | 171 | if pages[node] |
|
172 | 172 | content << "<ul class=\"pages-hierarchy\">\n" |
|
173 | 173 | pages[node].each do |page| |
|
174 | 174 | content << "<li>" |
|
175 | 175 | content << link_to(h(page.pretty_title), {:controller => 'wiki', :action => 'index', :id => page.project, :page => page.title}, |
|
176 | 176 | :title => (page.respond_to?(:updated_on) ? l(:label_updated_time, distance_of_time_in_words(Time.now, page.updated_on)) : nil)) |
|
177 | 177 | content << "\n" + render_page_hierarchy(pages, page.id) if pages[page.id] |
|
178 | 178 | content << "</li>\n" |
|
179 | 179 | end |
|
180 | 180 | content << "</ul>\n" |
|
181 | 181 | end |
|
182 | 182 | content |
|
183 | 183 | end |
|
184 | 184 | |
|
185 | 185 | # Renders flash messages |
|
186 | 186 | def render_flash_messages |
|
187 | 187 | s = '' |
|
188 | 188 | flash.each do |k,v| |
|
189 | 189 | s << content_tag('div', v, :class => "flash #{k}") |
|
190 | 190 | end |
|
191 | 191 | s |
|
192 | 192 | end |
|
193 | 193 | |
|
194 | 194 | # Renders tabs and their content |
|
195 | 195 | def render_tabs(tabs) |
|
196 | 196 | if tabs.any? |
|
197 | 197 | render :partial => 'common/tabs', :locals => {:tabs => tabs} |
|
198 | 198 | else |
|
199 | 199 | content_tag 'p', l(:label_no_data), :class => "nodata" |
|
200 | 200 | end |
|
201 | 201 | end |
|
202 | 202 | |
|
203 | 203 | # Renders the project quick-jump box |
|
204 | 204 | def render_project_jump_box |
|
205 | 205 | # Retrieve them now to avoid a COUNT query |
|
206 | 206 | projects = User.current.projects.all |
|
207 | 207 | if projects.any? |
|
208 | 208 | s = '<select onchange="if (this.value != \'\') { window.location = this.value; }">' + |
|
209 | 209 | "<option value=''>#{ l(:label_jump_to_a_project) }</option>" + |
|
210 | 210 | '<option value="" disabled="disabled">---</option>' |
|
211 | 211 | s << project_tree_options_for_select(projects, :selected => @project) do |p| |
|
212 | 212 | { :value => url_for(:controller => 'projects', :action => 'show', :id => p, :jump => current_menu_item) } |
|
213 | 213 | end |
|
214 | 214 | s << '</select>' |
|
215 | 215 | s |
|
216 | 216 | end |
|
217 | 217 | end |
|
218 | 218 | |
|
219 | 219 | def project_tree_options_for_select(projects, options = {}) |
|
220 | 220 | s = '' |
|
221 | 221 | project_tree(projects) do |project, level| |
|
222 | 222 | name_prefix = (level > 0 ? (' ' * 2 * level + '» ') : '') |
|
223 | 223 | tag_options = {:value => project.id} |
|
224 | 224 | if project == options[:selected] || (options[:selected].respond_to?(:include?) && options[:selected].include?(project)) |
|
225 | 225 | tag_options[:selected] = 'selected' |
|
226 | 226 | else |
|
227 | 227 | tag_options[:selected] = nil |
|
228 | 228 | end |
|
229 | 229 | tag_options.merge!(yield(project)) if block_given? |
|
230 | 230 | s << content_tag('option', name_prefix + h(project), tag_options) |
|
231 | 231 | end |
|
232 | 232 | s |
|
233 | 233 | end |
|
234 | 234 | |
|
235 | 235 | # Yields the given block for each project with its level in the tree |
|
236 | 236 | def project_tree(projects, &block) |
|
237 | 237 | ancestors = [] |
|
238 | 238 | projects.sort_by(&:lft).each do |project| |
|
239 | 239 | while (ancestors.any? && !project.is_descendant_of?(ancestors.last)) |
|
240 | 240 | ancestors.pop |
|
241 | 241 | end |
|
242 | 242 | yield project, ancestors.size |
|
243 | 243 | ancestors << project |
|
244 | 244 | end |
|
245 | 245 | end |
|
246 | 246 | |
|
247 | 247 | def project_nested_ul(projects, &block) |
|
248 | 248 | s = '' |
|
249 | 249 | if projects.any? |
|
250 | 250 | ancestors = [] |
|
251 | 251 | projects.sort_by(&:lft).each do |project| |
|
252 | 252 | if (ancestors.empty? || project.is_descendant_of?(ancestors.last)) |
|
253 | 253 | s << "<ul>\n" |
|
254 | 254 | else |
|
255 | 255 | ancestors.pop |
|
256 | 256 | s << "</li>" |
|
257 | 257 | while (ancestors.any? && !project.is_descendant_of?(ancestors.last)) |
|
258 | 258 | ancestors.pop |
|
259 | 259 | s << "</ul></li>\n" |
|
260 | 260 | end |
|
261 | 261 | end |
|
262 | 262 | s << "<li>" |
|
263 | 263 | s << yield(project).to_s |
|
264 | 264 | ancestors << project |
|
265 | 265 | end |
|
266 | 266 | s << ("</li></ul>\n" * ancestors.size) |
|
267 | 267 | end |
|
268 | 268 | s |
|
269 | 269 | end |
|
270 | 270 | |
|
271 | 271 | def principals_check_box_tags(name, principals) |
|
272 | 272 | s = '' |
|
273 | 273 | principals.sort.each do |principal| |
|
274 | 274 | s << "<label>#{ check_box_tag name, principal.id, false } #{h principal}</label>\n" |
|
275 | 275 | end |
|
276 | 276 | s |
|
277 | 277 | end |
|
278 | 278 | |
|
279 | 279 | # Truncates and returns the string as a single line |
|
280 | 280 | def truncate_single_line(string, *args) |
|
281 | 281 | truncate(string.to_s, *args).gsub(%r{[\r\n]+}m, ' ') |
|
282 | 282 | end |
|
283 | 283 | |
|
284 | 284 | # Truncates at line break after 250 characters or options[:length] |
|
285 | 285 | def truncate_lines(string, options={}) |
|
286 | 286 | length = options[:length] || 250 |
|
287 | 287 | if string.to_s =~ /\A(.{#{length}}.*?)$/m |
|
288 | 288 | "#{$1}..." |
|
289 | 289 | else |
|
290 | 290 | string |
|
291 | 291 | end |
|
292 | 292 | end |
|
293 | 293 | |
|
294 | 294 | def html_hours(text) |
|
295 | 295 | text.gsub(%r{(\d+)\.(\d+)}, '<span class="hours hours-int">\1</span><span class="hours hours-dec">.\2</span>') |
|
296 | 296 | end |
|
297 | 297 | |
|
298 | 298 | def authoring(created, author, options={}) |
|
299 | 299 | l(options[:label] || :label_added_time_by, :author => link_to_user(author), :age => time_tag(created)) |
|
300 | 300 | end |
|
301 | 301 | |
|
302 | 302 | def time_tag(time) |
|
303 | 303 | text = distance_of_time_in_words(Time.now, time) |
|
304 | 304 | if @project |
|
305 | 305 | link_to(text, {:controller => 'projects', :action => 'activity', :id => @project, :from => time.to_date}, :title => format_time(time)) |
|
306 | 306 | else |
|
307 | 307 | content_tag('acronym', text, :title => format_time(time)) |
|
308 | 308 | end |
|
309 | 309 | end |
|
310 | 310 | |
|
311 | 311 | def syntax_highlight(name, content) |
|
312 | 312 | Redmine::SyntaxHighlighting.highlight_by_filename(content, name) |
|
313 | 313 | end |
|
314 | 314 | |
|
315 | 315 | def to_path_param(path) |
|
316 | 316 | path.to_s.split(%r{[/\\]}).select {|p| !p.blank?} |
|
317 | 317 | end |
|
318 | 318 | |
|
319 | 319 | def pagination_links_full(paginator, count=nil, options={}) |
|
320 | 320 | page_param = options.delete(:page_param) || :page |
|
321 | 321 | per_page_links = options.delete(:per_page_links) |
|
322 | 322 | url_param = params.dup |
|
323 | 323 | # don't reuse query params if filters are present |
|
324 | 324 | url_param.merge!(:fields => nil, :values => nil, :operators => nil) if url_param.delete(:set_filter) |
|
325 | 325 | |
|
326 | 326 | html = '' |
|
327 | 327 | if paginator.current.previous |
|
328 | 328 | html << link_to_remote_content_update('« ' + l(:label_previous), url_param.merge(page_param => paginator.current.previous)) + ' ' |
|
329 | 329 | end |
|
330 | 330 | |
|
331 | 331 | html << (pagination_links_each(paginator, options) do |n| |
|
332 | 332 | link_to_remote_content_update(n.to_s, url_param.merge(page_param => n)) |
|
333 | 333 | end || '') |
|
334 | 334 | |
|
335 | 335 | if paginator.current.next |
|
336 | 336 | html << ' ' + link_to_remote_content_update((l(:label_next) + ' »'), url_param.merge(page_param => paginator.current.next)) |
|
337 | 337 | end |
|
338 | 338 | |
|
339 | 339 | unless count.nil? |
|
340 | 340 | html << " (#{paginator.current.first_item}-#{paginator.current.last_item}/#{count})" |
|
341 | 341 | if per_page_links != false && links = per_page_links(paginator.items_per_page) |
|
342 | 342 | html << " | #{links}" |
|
343 | 343 | end |
|
344 | 344 | end |
|
345 | 345 | |
|
346 | 346 | html |
|
347 | 347 | end |
|
348 | 348 | |
|
349 | 349 | def per_page_links(selected=nil) |
|
350 | 350 | url_param = params.dup |
|
351 | 351 | url_param.clear if url_param.has_key?(:set_filter) |
|
352 | 352 | |
|
353 | 353 | links = Setting.per_page_options_array.collect do |n| |
|
354 | 354 | n == selected ? n : link_to_remote(n, {:update => "content", |
|
355 | 355 | :url => params.dup.merge(:per_page => n), |
|
356 | 356 | :method => :get}, |
|
357 | 357 | {:href => url_for(url_param.merge(:per_page => n))}) |
|
358 | 358 | end |
|
359 | 359 | links.size > 1 ? l(:label_display_per_page, links.join(', ')) : nil |
|
360 | 360 | end |
|
361 | 361 | |
|
362 | 362 | def reorder_links(name, url) |
|
363 | 363 | link_to(image_tag('2uparrow.png', :alt => l(:label_sort_highest)), url.merge({"#{name}[move_to]" => 'highest'}), :method => :post, :title => l(:label_sort_highest)) + |
|
364 | 364 | link_to(image_tag('1uparrow.png', :alt => l(:label_sort_higher)), url.merge({"#{name}[move_to]" => 'higher'}), :method => :post, :title => l(:label_sort_higher)) + |
|
365 | 365 | link_to(image_tag('1downarrow.png', :alt => l(:label_sort_lower)), url.merge({"#{name}[move_to]" => 'lower'}), :method => :post, :title => l(:label_sort_lower)) + |
|
366 | 366 | link_to(image_tag('2downarrow.png', :alt => l(:label_sort_lowest)), url.merge({"#{name}[move_to]" => 'lowest'}), :method => :post, :title => l(:label_sort_lowest)) |
|
367 | 367 | end |
|
368 | 368 | |
|
369 | 369 | def breadcrumb(*args) |
|
370 | 370 | elements = args.flatten |
|
371 | 371 | elements.any? ? content_tag('p', args.join(' » ') + ' » ', :class => 'breadcrumb') : nil |
|
372 | 372 | end |
|
373 | 373 | |
|
374 | 374 | def other_formats_links(&block) |
|
375 | 375 | concat('<p class="other-formats">' + l(:label_export_to)) |
|
376 | 376 | yield Redmine::Views::OtherFormatsBuilder.new(self) |
|
377 | 377 | concat('</p>') |
|
378 | 378 | end |
|
379 | 379 | |
|
380 | 380 | def page_header_title |
|
381 | 381 | if @project.nil? || @project.new_record? |
|
382 | 382 | h(Setting.app_title) |
|
383 | 383 | else |
|
384 | 384 | b = [] |
|
385 | 385 | ancestors = (@project.root? ? [] : @project.ancestors.visible) |
|
386 | 386 | if ancestors.any? |
|
387 | 387 | root = ancestors.shift |
|
388 | 388 | b << link_to_project(root, {:jump => current_menu_item}, :class => 'root') |
|
389 | 389 | if ancestors.size > 2 |
|
390 | 390 | b << '…' |
|
391 | 391 | ancestors = ancestors[-2, 2] |
|
392 | 392 | end |
|
393 | 393 | b += ancestors.collect {|p| link_to_project(p, {:jump => current_menu_item}, :class => 'ancestor') } |
|
394 | 394 | end |
|
395 | 395 | b << h(@project) |
|
396 | 396 | b.join(' » ') |
|
397 | 397 | end |
|
398 | 398 | end |
|
399 | 399 | |
|
400 | 400 | def html_title(*args) |
|
401 | 401 | if args.empty? |
|
402 | 402 | title = [] |
|
403 | 403 | title << @project.name if @project |
|
404 | 404 | title += @html_title if @html_title |
|
405 | 405 | title << Setting.app_title |
|
406 | 406 | title.select {|t| !t.blank? }.join(' - ') |
|
407 | 407 | else |
|
408 | 408 | @html_title ||= [] |
|
409 | 409 | @html_title += args |
|
410 | 410 | end |
|
411 | 411 | end |
|
412 | 412 | |
|
413 | 413 | # Returns the theme, controller name, and action as css classes for the |
|
414 | 414 | # HTML body. |
|
415 | 415 | def body_css_classes |
|
416 | 416 | css = [] |
|
417 | 417 | if theme = Redmine::Themes.theme(Setting.ui_theme) |
|
418 | 418 | css << 'theme-' + theme.name |
|
419 | 419 | end |
|
420 | 420 | |
|
421 | 421 | css << 'controller-' + params[:controller] |
|
422 | 422 | css << 'action-' + params[:action] |
|
423 | 423 | css.join(' ') |
|
424 | 424 | end |
|
425 | 425 | |
|
426 | 426 | def accesskey(s) |
|
427 | 427 | Redmine::AccessKeys.key_for s |
|
428 | 428 | end |
|
429 | 429 | |
|
430 | 430 | # Formats text according to system settings. |
|
431 | 431 | # 2 ways to call this method: |
|
432 | 432 | # * with a String: textilizable(text, options) |
|
433 | 433 | # * with an object and one of its attribute: textilizable(issue, :description, options) |
|
434 | 434 | def textilizable(*args) |
|
435 | 435 | options = args.last.is_a?(Hash) ? args.pop : {} |
|
436 | 436 | case args.size |
|
437 | 437 | when 1 |
|
438 | 438 | obj = options[:object] |
|
439 | 439 | text = args.shift |
|
440 | 440 | when 2 |
|
441 | 441 | obj = args.shift |
|
442 | 442 | attr = args.shift |
|
443 | 443 | text = obj.send(attr).to_s |
|
444 | 444 | else |
|
445 | 445 | raise ArgumentError, 'invalid arguments to textilizable' |
|
446 | 446 | end |
|
447 | 447 | return '' if text.blank? |
|
448 | 448 | project = options[:project] || @project || (obj && obj.respond_to?(:project) ? obj.project : nil) |
|
449 | 449 | only_path = options.delete(:only_path) == false ? false : true |
|
450 | 450 | |
|
451 | 451 | text = Redmine::WikiFormatting.to_html(Setting.text_formatting, text, :object => obj, :attribute => attr) { |macro, args| exec_macro(macro, obj, args) } |
|
452 | 452 | |
|
453 | 453 | parse_non_pre_blocks(text) do |text| |
|
454 | 454 | [:parse_inline_attachments, :parse_wiki_links, :parse_redmine_links].each do |method_name| |
|
455 | 455 | send method_name, text, project, obj, attr, only_path, options |
|
456 | 456 | end |
|
457 | 457 | end |
|
458 | 458 | end |
|
459 | 459 | |
|
460 | 460 | def parse_non_pre_blocks(text) |
|
461 | 461 | s = StringScanner.new(text) |
|
462 | 462 | tags = [] |
|
463 | 463 | parsed = '' |
|
464 | 464 | while !s.eos? |
|
465 | 465 | s.scan(/(.*?)(<(\/)?(pre|code)(.*?)>|\z)/im) |
|
466 | 466 | text, full_tag, closing, tag = s[1], s[2], s[3], s[4] |
|
467 | 467 | if tags.empty? |
|
468 | 468 | yield text |
|
469 | 469 | end |
|
470 | 470 | parsed << text |
|
471 | 471 | if tag |
|
472 | 472 | if closing |
|
473 | 473 | if tags.last == tag.downcase |
|
474 | 474 | tags.pop |
|
475 | 475 | end |
|
476 | 476 | else |
|
477 | 477 | tags << tag.downcase |
|
478 | 478 | end |
|
479 | 479 | parsed << full_tag |
|
480 | 480 | end |
|
481 | 481 | end |
|
482 | 482 | # Close any non closing tags |
|
483 | 483 | while tag = tags.pop |
|
484 | 484 | parsed << "</#{tag}>" |
|
485 | 485 | end |
|
486 | 486 | parsed |
|
487 | 487 | end |
|
488 | 488 | |
|
489 | 489 | def parse_inline_attachments(text, project, obj, attr, only_path, options) |
|
490 | 490 | # when using an image link, try to use an attachment, if possible |
|
491 | 491 | if options[:attachments] || (obj && obj.respond_to?(:attachments)) |
|
492 | 492 | attachments = nil |
|
493 | 493 | text.gsub!(/src="([^\/"]+\.(bmp|gif|jpg|jpeg|png))"(\s+alt="([^"]*)")?/i) do |m| |
|
494 | 494 | filename, ext, alt, alttext = $1.downcase, $2, $3, $4 |
|
495 | 495 | attachments ||= (options[:attachments] || obj.attachments).sort_by(&:created_on).reverse |
|
496 | 496 | # search for the picture in attachments |
|
497 | 497 | if found = attachments.detect { |att| att.filename.downcase == filename } |
|
498 | 498 | image_url = url_for :only_path => only_path, :controller => 'attachments', :action => 'download', :id => found |
|
499 | 499 | desc = found.description.to_s.gsub('"', '') |
|
500 | 500 | if !desc.blank? && alttext.blank? |
|
501 | 501 | alt = " title=\"#{desc}\" alt=\"#{desc}\"" |
|
502 | 502 | end |
|
503 | 503 | "src=\"#{image_url}\"#{alt}" |
|
504 | 504 | else |
|
505 | 505 | m |
|
506 | 506 | end |
|
507 | 507 | end |
|
508 | 508 | end |
|
509 | 509 | end |
|
510 | 510 | |
|
511 | 511 | # Wiki links |
|
512 | 512 | # |
|
513 | 513 | # Examples: |
|
514 | 514 | # [[mypage]] |
|
515 | 515 | # [[mypage|mytext]] |
|
516 | 516 | # wiki links can refer other project wikis, using project name or identifier: |
|
517 | 517 | # [[project:]] -> wiki starting page |
|
518 | 518 | # [[project:|mytext]] |
|
519 | 519 | # [[project:mypage]] |
|
520 | 520 | # [[project:mypage|mytext]] |
|
521 | 521 | def parse_wiki_links(text, project, obj, attr, only_path, options) |
|
522 | 522 | text.gsub!(/(!)?(\[\[([^\]\n\|]+)(\|([^\]\n\|]+))?\]\])/) do |m| |
|
523 | 523 | link_project = project |
|
524 | 524 | esc, all, page, title = $1, $2, $3, $5 |
|
525 | 525 | if esc.nil? |
|
526 | 526 | if page =~ /^([^\:]+)\:(.*)$/ |
|
527 | 527 | link_project = Project.find_by_name($1) || Project.find_by_identifier($1) |
|
528 | 528 | page = $2 |
|
529 | 529 | title ||= $1 if page.blank? |
|
530 | 530 | end |
|
531 | 531 | |
|
532 | 532 | if link_project && link_project.wiki |
|
533 | 533 | # extract anchor |
|
534 | 534 | anchor = nil |
|
535 | 535 | if page =~ /^(.+?)\#(.+)$/ |
|
536 | 536 | page, anchor = $1, $2 |
|
537 | 537 | end |
|
538 | 538 | # check if page exists |
|
539 | 539 | wiki_page = link_project.wiki.find_page(page) |
|
540 | 540 | url = case options[:wiki_links] |
|
541 | 541 | when :local; "#{title}.html" |
|
542 | 542 | when :anchor; "##{title}" # used for single-file wiki export |
|
543 | 543 | else |
|
544 | 544 | url_for(:only_path => only_path, :controller => 'wiki', :action => 'index', :id => link_project, :page => Wiki.titleize(page), :anchor => anchor) |
|
545 | 545 | end |
|
546 | 546 | link_to((title || page), url, :class => ('wiki-page' + (wiki_page ? '' : ' new'))) |
|
547 | 547 | else |
|
548 | 548 | # project or wiki doesn't exist |
|
549 | 549 | all |
|
550 | 550 | end |
|
551 | 551 | else |
|
552 | 552 | all |
|
553 | 553 | end |
|
554 | 554 | end |
|
555 | 555 | end |
|
556 | 556 | |
|
557 | 557 | # Redmine links |
|
558 | 558 | # |
|
559 | 559 | # Examples: |
|
560 | 560 | # Issues: |
|
561 | 561 | # #52 -> Link to issue #52 |
|
562 | 562 | # Changesets: |
|
563 | 563 | # r52 -> Link to revision 52 |
|
564 | 564 | # commit:a85130f -> Link to scmid starting with a85130f |
|
565 | 565 | # Documents: |
|
566 | 566 | # document#17 -> Link to document with id 17 |
|
567 | 567 | # document:Greetings -> Link to the document with title "Greetings" |
|
568 | 568 | # document:"Some document" -> Link to the document with title "Some document" |
|
569 | 569 | # Versions: |
|
570 | 570 | # version#3 -> Link to version with id 3 |
|
571 | 571 | # version:1.0.0 -> Link to version named "1.0.0" |
|
572 | 572 | # version:"1.0 beta 2" -> Link to version named "1.0 beta 2" |
|
573 | 573 | # Attachments: |
|
574 | 574 | # attachment:file.zip -> Link to the attachment of the current object named file.zip |
|
575 | 575 | # Source files: |
|
576 | 576 | # source:some/file -> Link to the file located at /some/file in the project's repository |
|
577 | 577 | # source:some/file@52 -> Link to the file's revision 52 |
|
578 | 578 | # source:some/file#L120 -> Link to line 120 of the file |
|
579 | 579 | # source:some/file@52#L120 -> Link to line 120 of the file's revision 52 |
|
580 | 580 | # export:some/file -> Force the download of the file |
|
581 | 581 | # Forum messages: |
|
582 | 582 | # message#1218 -> Link to message with id 1218 |
|
583 | 583 | def parse_redmine_links(text, project, obj, attr, only_path, options) |
|
584 | 584 | text.gsub!(%r{([\s\(,\-\[\>]|^)(!)?(attachment|document|version|commit|source|export|message|project)?((#|r)(\d+)|(:)([^"\s<>][^\s<>]*?|"[^"]+?"))(?=(?=[[:punct:]]\W)|,|\s|\]|<|$)}) do |m| |
|
585 | 585 | leading, esc, prefix, sep, identifier = $1, $2, $3, $5 || $7, $6 || $8 |
|
586 | 586 | link = nil |
|
587 | 587 | if esc.nil? |
|
588 | 588 | if prefix.nil? && sep == 'r' |
|
589 | 589 | if project && (changeset = project.changesets.find_by_revision(identifier)) |
|
590 | 590 | link = link_to("r#{identifier}", {:only_path => only_path, :controller => 'repositories', :action => 'revision', :id => project, :rev => changeset.revision}, |
|
591 | 591 | :class => 'changeset', |
|
592 | 592 | :title => truncate_single_line(changeset.comments, :length => 100)) |
|
593 | 593 | end |
|
594 | 594 | elsif sep == '#' |
|
595 | 595 | oid = identifier.to_i |
|
596 | 596 | case prefix |
|
597 | 597 | when nil |
|
598 | 598 | if issue = Issue.visible.find_by_id(oid, :include => :status) |
|
599 | 599 | link = link_to("##{oid}", {:only_path => only_path, :controller => 'issues', :action => 'show', :id => oid}, |
|
600 | 600 | :class => issue.css_classes, |
|
601 | 601 | :title => "#{truncate(issue.subject, :length => 100)} (#{issue.status.name})") |
|
602 | 602 | end |
|
603 | 603 | when 'document' |
|
604 | 604 | if document = Document.find_by_id(oid, :include => [:project], :conditions => Project.visible_by(User.current)) |
|
605 | 605 | link = link_to h(document.title), {:only_path => only_path, :controller => 'documents', :action => 'show', :id => document}, |
|
606 | 606 | :class => 'document' |
|
607 | 607 | end |
|
608 | 608 | when 'version' |
|
609 | 609 | if version = Version.find_by_id(oid, :include => [:project], :conditions => Project.visible_by(User.current)) |
|
610 | 610 | link = link_to h(version.name), {:only_path => only_path, :controller => 'versions', :action => 'show', :id => version}, |
|
611 | 611 | :class => 'version' |
|
612 | 612 | end |
|
613 | 613 | when 'message' |
|
614 | 614 | if message = Message.find_by_id(oid, :include => [:parent, {:board => :project}], :conditions => Project.visible_by(User.current)) |
|
615 | 615 | link = link_to h(truncate(message.subject, :length => 60)), {:only_path => only_path, |
|
616 | 616 | :controller => 'messages', |
|
617 | 617 | :action => 'show', |
|
618 | 618 | :board_id => message.board, |
|
619 | 619 | :id => message.root, |
|
620 | 620 | :anchor => (message.parent ? "message-#{message.id}" : nil)}, |
|
621 | 621 | :class => 'message' |
|
622 | 622 | end |
|
623 | 623 | when 'project' |
|
624 | 624 | if p = Project.visible.find_by_id(oid) |
|
625 | 625 | link = link_to_project(p, {:only_path => only_path}, :class => 'project') |
|
626 | 626 | end |
|
627 | 627 | end |
|
628 | 628 | elsif sep == ':' |
|
629 | 629 | # removes the double quotes if any |
|
630 | 630 | name = identifier.gsub(%r{^"(.*)"$}, "\\1") |
|
631 | 631 | case prefix |
|
632 | 632 | when 'document' |
|
633 | 633 | if project && document = project.documents.find_by_title(name) |
|
634 | 634 | link = link_to h(document.title), {:only_path => only_path, :controller => 'documents', :action => 'show', :id => document}, |
|
635 | 635 | :class => 'document' |
|
636 | 636 | end |
|
637 | 637 | when 'version' |
|
638 | 638 | if project && version = project.versions.find_by_name(name) |
|
639 | 639 | link = link_to h(version.name), {:only_path => only_path, :controller => 'versions', :action => 'show', :id => version}, |
|
640 | 640 | :class => 'version' |
|
641 | 641 | end |
|
642 | 642 | when 'commit' |
|
643 | 643 | if project && (changeset = project.changesets.find(:first, :conditions => ["scmid LIKE ?", "#{name}%"])) |
|
644 | 644 | link = link_to h("#{name}"), {:only_path => only_path, :controller => 'repositories', :action => 'revision', :id => project, :rev => changeset.revision}, |
|
645 | 645 | :class => 'changeset', |
|
646 | 646 | :title => truncate_single_line(changeset.comments, :length => 100) |
|
647 | 647 | end |
|
648 | 648 | when 'source', 'export' |
|
649 | 649 | if project && project.repository |
|
650 | 650 | name =~ %r{^[/\\]*(.*?)(@([0-9a-f]+))?(#(L\d+))?$} |
|
651 | 651 | path, rev, anchor = $1, $3, $5 |
|
652 | 652 | link = link_to h("#{prefix}:#{name}"), {:controller => 'repositories', :action => 'entry', :id => project, |
|
653 | 653 | :path => to_path_param(path), |
|
654 | 654 | :rev => rev, |
|
655 | 655 | :anchor => anchor, |
|
656 | 656 | :format => (prefix == 'export' ? 'raw' : nil)}, |
|
657 | 657 | :class => (prefix == 'export' ? 'source download' : 'source') |
|
658 | 658 | end |
|
659 | 659 | when 'attachment' |
|
660 | 660 | attachments = options[:attachments] || (obj && obj.respond_to?(:attachments) ? obj.attachments : nil) |
|
661 | 661 | if attachments && attachment = attachments.detect {|a| a.filename == name } |
|
662 | 662 | link = link_to h(attachment.filename), {:only_path => only_path, :controller => 'attachments', :action => 'download', :id => attachment}, |
|
663 | 663 | :class => 'attachment' |
|
664 | 664 | end |
|
665 | 665 | when 'project' |
|
666 | 666 | if p = Project.visible.find(:first, :conditions => ["identifier = :s OR LOWER(name) = :s", {:s => name.downcase}]) |
|
667 | 667 | link = link_to_project(p, {:only_path => only_path}, :class => 'project') |
|
668 | 668 | end |
|
669 | 669 | end |
|
670 | 670 | end |
|
671 | 671 | end |
|
672 | 672 | leading + (link || "#{prefix}#{sep}#{identifier}") |
|
673 | 673 | end |
|
674 | 674 | end |
|
675 | 675 | |
|
676 | 676 | # Same as Rails' simple_format helper without using paragraphs |
|
677 | 677 | def simple_format_without_paragraph(text) |
|
678 | 678 | text.to_s. |
|
679 | 679 | gsub(/\r\n?/, "\n"). # \r\n and \r -> \n |
|
680 | 680 | gsub(/\n\n+/, "<br /><br />"). # 2+ newline -> 2 br |
|
681 | 681 | gsub(/([^\n]\n)(?=[^\n])/, '\1<br />') # 1 newline -> br |
|
682 | 682 | end |
|
683 | 683 | |
|
684 | 684 | def lang_options_for_select(blank=true) |
|
685 | 685 | (blank ? [["(auto)", ""]] : []) + |
|
686 | 686 | valid_languages.collect{|lang| [ ll(lang.to_s, :general_lang_name), lang.to_s]}.sort{|x,y| x.last <=> y.last } |
|
687 | 687 | end |
|
688 | 688 | |
|
689 | 689 | def label_tag_for(name, option_tags = nil, options = {}) |
|
690 | 690 | label_text = l(("field_"+field.to_s.gsub(/\_id$/, "")).to_sym) + (options.delete(:required) ? @template.content_tag("span", " *", :class => "required"): "") |
|
691 | 691 | content_tag("label", label_text) |
|
692 | 692 | end |
|
693 | 693 | |
|
694 | 694 | def labelled_tabular_form_for(name, object, options, &proc) |
|
695 | 695 | options[:html] ||= {} |
|
696 | 696 | options[:html][:class] = 'tabular' unless options[:html].has_key?(:class) |
|
697 | 697 | form_for(name, object, options.merge({ :builder => TabularFormBuilder, :lang => current_language}), &proc) |
|
698 | 698 | end |
|
699 | 699 | |
|
700 | 700 | def back_url_hidden_field_tag |
|
701 | 701 | back_url = params[:back_url] || request.env['HTTP_REFERER'] |
|
702 | 702 | back_url = CGI.unescape(back_url.to_s) |
|
703 | 703 | hidden_field_tag('back_url', CGI.escape(back_url)) unless back_url.blank? |
|
704 | 704 | end |
|
705 | 705 | |
|
706 | 706 | def check_all_links(form_name) |
|
707 | 707 | link_to_function(l(:button_check_all), "checkAll('#{form_name}', true)") + |
|
708 | 708 | " | " + |
|
709 | 709 | link_to_function(l(:button_uncheck_all), "checkAll('#{form_name}', false)") |
|
710 | 710 | end |
|
711 | 711 | |
|
712 | 712 | def progress_bar(pcts, options={}) |
|
713 | 713 | pcts = [pcts, pcts] unless pcts.is_a?(Array) |
|
714 | 714 | pcts = pcts.collect(&:round) |
|
715 | 715 | pcts[1] = pcts[1] - pcts[0] |
|
716 | 716 | pcts << (100 - pcts[1] - pcts[0]) |
|
717 | 717 | width = options[:width] || '100px;' |
|
718 | 718 | legend = options[:legend] || '' |
|
719 | 719 | content_tag('table', |
|
720 | 720 | content_tag('tr', |
|
721 | 721 | (pcts[0] > 0 ? content_tag('td', '', :style => "width: #{pcts[0]}%;", :class => 'closed') : '') + |
|
722 | 722 | (pcts[1] > 0 ? content_tag('td', '', :style => "width: #{pcts[1]}%;", :class => 'done') : '') + |
|
723 | 723 | (pcts[2] > 0 ? content_tag('td', '', :style => "width: #{pcts[2]}%;", :class => 'todo') : '') |
|
724 | 724 | ), :class => 'progress', :style => "width: #{width};") + |
|
725 | 725 | content_tag('p', legend, :class => 'pourcent') |
|
726 | 726 | end |
|
727 | 727 | |
|
728 | 728 | def checked_image(checked=true) |
|
729 | 729 | if checked |
|
730 | 730 | image_tag 'toggle_check.png' |
|
731 | 731 | end |
|
732 | 732 | end |
|
733 | 733 | |
|
734 | 734 | def context_menu(url) |
|
735 | 735 | unless @context_menu_included |
|
736 | 736 | content_for :header_tags do |
|
737 | 737 | javascript_include_tag('context_menu') + |
|
738 | 738 | stylesheet_link_tag('context_menu') |
|
739 | 739 | end |
|
740 | if l(:direction) == 'rtl' | |
|
741 | content_for :header_tags do | |
|
742 | stylesheet_link_tag('context_menu_rtl') | |
|
743 | end | |
|
744 | end | |
|
740 | 745 | @context_menu_included = true |
|
741 | 746 | end |
|
742 | 747 | javascript_tag "new ContextMenu('#{ url_for(url) }')" |
|
743 | 748 | end |
|
744 | 749 | |
|
745 | 750 | def context_menu_link(name, url, options={}) |
|
746 | 751 | options[:class] ||= '' |
|
747 | 752 | if options.delete(:selected) |
|
748 | 753 | options[:class] << ' icon-checked disabled' |
|
749 | 754 | options[:disabled] = true |
|
750 | 755 | end |
|
751 | 756 | if options.delete(:disabled) |
|
752 | 757 | options.delete(:method) |
|
753 | 758 | options.delete(:confirm) |
|
754 | 759 | options.delete(:onclick) |
|
755 | 760 | options[:class] << ' disabled' |
|
756 | 761 | url = '#' |
|
757 | 762 | end |
|
758 | 763 | link_to name, url, options |
|
759 | 764 | end |
|
760 | 765 | |
|
761 | 766 | def calendar_for(field_id) |
|
762 | 767 | include_calendar_headers_tags |
|
763 | 768 | image_tag("calendar.png", {:id => "#{field_id}_trigger",:class => "calendar-trigger"}) + |
|
764 | 769 | javascript_tag("Calendar.setup({inputField : '#{field_id}', ifFormat : '%Y-%m-%d', button : '#{field_id}_trigger' });") |
|
765 | 770 | end |
|
766 | 771 | |
|
767 | 772 | def include_calendar_headers_tags |
|
768 | 773 | unless @calendar_headers_tags_included |
|
769 | 774 | @calendar_headers_tags_included = true |
|
770 | 775 | content_for :header_tags do |
|
771 | 776 | start_of_week = case Setting.start_of_week.to_i |
|
772 | 777 | when 1 |
|
773 | 778 | 'Calendar._FD = 1;' # Monday |
|
774 | 779 | when 7 |
|
775 | 780 | 'Calendar._FD = 0;' # Sunday |
|
776 | 781 | else |
|
777 | 782 | '' # use language |
|
778 | 783 | end |
|
779 | 784 | |
|
780 | 785 | javascript_include_tag('calendar/calendar') + |
|
781 | 786 | javascript_include_tag("calendar/lang/calendar-#{current_language.to_s.downcase}.js") + |
|
782 | 787 | javascript_tag(start_of_week) + |
|
783 | 788 | javascript_include_tag('calendar/calendar-setup') + |
|
784 | 789 | stylesheet_link_tag('calendar') |
|
785 | 790 | end |
|
786 | 791 | end |
|
787 | 792 | end |
|
788 | 793 | |
|
789 | 794 | def content_for(name, content = nil, &block) |
|
790 | 795 | @has_content ||= {} |
|
791 | 796 | @has_content[name] = true |
|
792 | 797 | super(name, content, &block) |
|
793 | 798 | end |
|
794 | 799 | |
|
795 | 800 | def has_content?(name) |
|
796 | 801 | (@has_content && @has_content[name]) || false |
|
797 | 802 | end |
|
798 | 803 | |
|
799 | 804 | # Returns the avatar image tag for the given +user+ if avatars are enabled |
|
800 | 805 | # +user+ can be a User or a string that will be scanned for an email address (eg. 'joe <joe@foo.bar>') |
|
801 | 806 | def avatar(user, options = { }) |
|
802 | 807 | if Setting.gravatar_enabled? |
|
803 | 808 | options.merge!({:ssl => Setting.protocol == 'https', :default => Setting.gravatar_default}) |
|
804 | 809 | email = nil |
|
805 | 810 | if user.respond_to?(:mail) |
|
806 | 811 | email = user.mail |
|
807 | 812 | elsif user.to_s =~ %r{<(.+?)>} |
|
808 | 813 | email = $1 |
|
809 | 814 | end |
|
810 | 815 | return gravatar(email.to_s.downcase, options) unless email.blank? rescue nil |
|
811 | 816 | end |
|
812 | 817 | end |
|
813 | 818 | |
|
814 | 819 | def favicon |
|
815 | 820 | "<link rel='shortcut icon' href='#{image_path('/favicon.ico')}' />" |
|
816 | 821 | end |
|
817 | 822 | |
|
818 | 823 | private |
|
819 | 824 | |
|
820 | 825 | def wiki_helper |
|
821 | 826 | helper = Redmine::WikiFormatting.helper_for(Setting.text_formatting) |
|
822 | 827 | extend helper |
|
823 | 828 | return self |
|
824 | 829 | end |
|
825 | 830 | |
|
826 | 831 | def link_to_remote_content_update(text, url_params) |
|
827 | 832 | link_to_remote(text, |
|
828 | 833 | {:url => url_params, :method => :get, :update => 'content', :complete => 'window.scrollTo(0,0)'}, |
|
829 | 834 | {:href => url_for(:params => url_params)} |
|
830 | 835 | ) |
|
831 | 836 | end |
|
832 | 837 | |
|
833 | 838 | end |
@@ -1,133 +1,134 | |||
|
1 | 1 | <%= render :partial => 'action_menu' %> |
|
2 | 2 | |
|
3 | 3 | <h2><%= @issue.tracker.name %> #<%= @issue.id %></h2> |
|
4 | 4 | |
|
5 | 5 | <div class="<%= @issue.css_classes %> details"> |
|
6 | 6 | <%= avatar(@issue.author, :size => "50") %> |
|
7 | 7 | |
|
8 | 8 | <div class="subject"> |
|
9 | 9 | <%= render_issue_subject_with_tree(@issue) %> |
|
10 | 10 | </div> |
|
11 | 11 | <p class="author"> |
|
12 | 12 | <%= authoring @issue.created_on, @issue.author %>. |
|
13 | 13 | <% if @issue.created_on != @issue.updated_on %> |
|
14 | 14 | <%= l(:label_updated_time, time_tag(@issue.updated_on)) %>. |
|
15 | 15 | <% end %> |
|
16 | 16 | </p> |
|
17 | 17 | |
|
18 | 18 | <table class="attributes"> |
|
19 | 19 | <tr> |
|
20 | 20 | <th class="status"><%=l(:field_status)%>:</th><td class="status"><%= @issue.status.name %></td> |
|
21 | 21 | <th class="start-date"><%=l(:field_start_date)%>:</th><td class="start-date"><%= format_date(@issue.start_date) %></td> |
|
22 | 22 | </tr> |
|
23 | 23 | <tr> |
|
24 | 24 | <th class="priority"><%=l(:field_priority)%>:</th><td class="priority"><%= @issue.priority.name %></td> |
|
25 | 25 | <th class="due-date"><%=l(:field_due_date)%>:</th><td class="due-date"><%= format_date(@issue.due_date) %></td> |
|
26 | 26 | </tr> |
|
27 | 27 | <tr> |
|
28 | 28 | <th class="assigned-to"><%=l(:field_assigned_to)%>:</th><td class="assigned-to"><%= avatar(@issue.assigned_to, :size => "14") %><%= @issue.assigned_to ? link_to_user(@issue.assigned_to) : "-" %></td> |
|
29 | 29 | <th class="progress"><%=l(:field_done_ratio)%>:</th><td class="progress"><%= progress_bar @issue.done_ratio, :width => '80px', :legend => "#{@issue.done_ratio}%" %></td> |
|
30 | 30 | </tr> |
|
31 | 31 | <tr> |
|
32 | 32 | <th class="category"><%=l(:field_category)%>:</th><td class="category"><%=h @issue.category ? @issue.category.name : "-" %></td> |
|
33 | 33 | <% if User.current.allowed_to?(:view_time_entries, @project) %> |
|
34 | 34 | <th class="spent-time"><%=l(:label_spent_time)%>:</th> |
|
35 | 35 | <td class="spent-time"><%= @issue.spent_hours > 0 ? (link_to l_hours(@issue.spent_hours), {:controller => 'timelog', :action => 'details', :project_id => @project, :issue_id => @issue}) : "-" %></td> |
|
36 | 36 | <% end %> |
|
37 | 37 | </tr> |
|
38 | 38 | <tr> |
|
39 | 39 | <th class="fixed-version"><%=l(:field_fixed_version)%>:</th><td class="fixed-version"><%= @issue.fixed_version ? link_to_version(@issue.fixed_version) : "-" %></td> |
|
40 | 40 | <% if @issue.estimated_hours %> |
|
41 | 41 | <th class="estimated-hours"><%=l(:field_estimated_hours)%>:</th><td class="estimated-hours"><%= l_hours(@issue.estimated_hours) %></td> |
|
42 | 42 | <% end %> |
|
43 | 43 | </tr> |
|
44 | 44 | <%= render_custom_fields_rows(@issue) %> |
|
45 | 45 | <%= call_hook(:view_issues_show_details_bottom, :issue => @issue) %> |
|
46 | 46 | </table> |
|
47 | 47 | <hr /> |
|
48 | 48 | |
|
49 | 49 | <div class="contextual"> |
|
50 | 50 | <%= link_to_remote_if_authorized(l(:button_quote), { :url => {:action => 'reply', :id => @issue} }, :class => 'icon icon-comment') unless @issue.description.blank? %> |
|
51 | 51 | </div> |
|
52 | 52 | |
|
53 | 53 | <p><strong><%=l(:field_description)%></strong></p> |
|
54 | 54 | <div class="wiki"> |
|
55 | 55 | <%= textilizable @issue, :description, :attachments => @issue.attachments %> |
|
56 | 56 | </div> |
|
57 | 57 | |
|
58 | 58 | <%= link_to_attachments @issue %> |
|
59 | 59 | |
|
60 | 60 | <%= call_hook(:view_issues_show_description_bottom, :issue => @issue) %> |
|
61 | 61 | |
|
62 | 62 | <% if !@issue.leaf? || User.current.allowed_to?(:manage_subtasks, @project) %> |
|
63 | 63 | <hr /> |
|
64 | 64 | <div id="issue_tree"> |
|
65 | 65 | <div class="contextual"> |
|
66 | 66 | <%= link_to(l(:button_add), {:controller => 'issues', :action => 'new', :project_id => @project, :issue => {:parent_issue_id => @issue}}) if User.current.allowed_to?(:manage_subtasks, @project) %> |
|
67 | 67 | </div> |
|
68 | 68 | <p><strong><%=l(:label_subtask_plural)%></strong></p> |
|
69 | 69 | <%= render_descendants_tree(@issue) unless @issue.leaf? %> |
|
70 | 70 | </div> |
|
71 | 71 | <% end %> |
|
72 | 72 | |
|
73 | 73 | <% if authorize_for('issue_relations', 'new') || @issue.relations.present? %> |
|
74 | 74 | <hr /> |
|
75 | 75 | <div id="relations"> |
|
76 | 76 | <%= render :partial => 'relations' %> |
|
77 | 77 | </div> |
|
78 | 78 | <% end %> |
|
79 | 79 | |
|
80 | 80 | </div> |
|
81 | 81 | |
|
82 | 82 | <% if @changesets.present? %> |
|
83 | 83 | <div id="issue-changesets"> |
|
84 | 84 | <h3><%=l(:label_associated_revisions)%></h3> |
|
85 | 85 | <%= render :partial => 'changesets', :locals => { :changesets => @changesets} %> |
|
86 | 86 | </div> |
|
87 | 87 | <% end %> |
|
88 | 88 | |
|
89 | 89 | <% if @journals.present? %> |
|
90 | 90 | <div id="history"> |
|
91 | 91 | <h3><%=l(:label_history)%></h3> |
|
92 | 92 | <%= render :partial => 'history', :locals => { :issue => @issue, :journals => @journals } %> |
|
93 | 93 | </div> |
|
94 | 94 | <% end %> |
|
95 | 95 | |
|
96 | 96 | |
|
97 | 97 | <div style="clear: both;"></div> |
|
98 | 98 | <%= render :partial => 'action_menu', :locals => {:replace_watcher => 'watcher2' } %> |
|
99 | 99 | |
|
100 | 100 | <div style="clear: both;"></div> |
|
101 | 101 | <% if authorize_for('issues', 'edit') %> |
|
102 | 102 | <div id="update" style="display:none;"> |
|
103 | 103 | <h3><%= l(:button_update) %></h3> |
|
104 | 104 | <%= render :partial => 'edit' %> |
|
105 | 105 | </div> |
|
106 | 106 | <% end %> |
|
107 | 107 | |
|
108 | 108 | <% other_formats_links do |f| %> |
|
109 | 109 | <%= f.link_to 'Atom', :url => {:key => User.current.rss_key} %> |
|
110 | 110 | <%= f.link_to 'PDF' %> |
|
111 | 111 | <% end %> |
|
112 | 112 | |
|
113 | 113 | <% html_title "#{@issue.tracker.name} ##{@issue.id}: #{@issue.subject}" %> |
|
114 | 114 | |
|
115 | 115 | <% content_for :sidebar do %> |
|
116 | 116 | <%= render :partial => 'issues/sidebar' %> |
|
117 | 117 | |
|
118 | 118 | <% if User.current.allowed_to?(:add_issue_watchers, @project) || |
|
119 | 119 | (@issue.watchers.present? && User.current.allowed_to?(:view_issue_watchers, @project)) %> |
|
120 | 120 | <div id="watchers"> |
|
121 | 121 | <%= render :partial => 'watchers/watchers', :locals => {:watched => @issue} %> |
|
122 | 122 | </div> |
|
123 | 123 | <% end %> |
|
124 | 124 | <% end %> |
|
125 | 125 | |
|
126 | 126 | <% content_for :header_tags do %> |
|
127 | 127 | <%= auto_discovery_link_tag(:atom, {:format => 'atom', :key => User.current.rss_key}, :title => "#{@issue.project} - #{@issue.tracker} ##{@issue.id}: #{@issue.subject}") %> |
|
128 | 128 | <%= stylesheet_link_tag 'scm' %> |
|
129 | 129 | <%= javascript_include_tag 'context_menu' %> |
|
130 | 130 | <%= stylesheet_link_tag 'context_menu' %> |
|
131 | <%= stylesheet_link_tag 'context_menu_rtl' if l(:direction) == 'rtl' %> | |
|
131 | 132 | <% end %> |
|
132 | 133 | <div id="context-menu" style="display: none;"></div> |
|
133 | 134 | <%= javascript_tag "new ContextMenu('#{issues_context_menu_path}')" %> |
@@ -1,66 +1,62 | |||
|
1 | 1 | body, #wrapper { direction: rtl;} |
|
2 | 2 | |
|
3 | 3 | #quick-search { float: left; } |
|
4 | 4 | #main-menu { margin-left: -500px; left: auto; right: 6px; margin-right: 0px;} |
|
5 | 5 | #main-menu li { float: right; } |
|
6 | 6 | #top-menu ul { float: right; } |
|
7 | 7 | #account { float: left; } |
|
8 | 8 | #top-menu #loggedas { float: left; } |
|
9 | 9 | #top-menu li { float: right; } |
|
10 | 10 | .tabular label.floating |
|
11 | 11 | { |
|
12 | 12 | margin-right: 0; |
|
13 | 13 | margin-left: auto; |
|
14 | 14 | text-align: right; |
|
15 | 15 | } |
|
16 | 16 | .tabular label |
|
17 | 17 | { |
|
18 | 18 | float: right; |
|
19 | 19 | margin-left: auto; |
|
20 | 20 | } |
|
21 | 21 | .tabular p |
|
22 | 22 | { |
|
23 | 23 | clear: right; |
|
24 | 24 | } |
|
25 | 25 | .tabular label.block { text-align: right; } |
|
26 | 26 | .icon |
|
27 | 27 | { |
|
28 | 28 | background-position: 100% 40%; |
|
29 | 29 | padding-right: 20px; |
|
30 | 30 | padding-left: 0px; |
|
31 | 31 | } |
|
32 | 32 | div#activity dt, #search-results dt |
|
33 | 33 | { |
|
34 | 34 | background-position: 100% 50%; |
|
35 | 35 | padding-right: 20px; |
|
36 | 36 | padding-left: 0px; |
|
37 | 37 | } |
|
38 | 38 | #content .tabs ul li { float: right; } |
|
39 | 39 | #content .tabs ul { padding-left: auto; padding-right: 1em; } |
|
40 | 40 | table.progress { float: right; } |
|
41 | 41 | .contextual { float: left; } |
|
42 | 42 | .icon22 { background-position: 100% 40%; padding-right: 26px; padding-left: auto; } |
|
43 | 43 | h3, .wiki h2 { padding: 10px 2px 1px 0; } |
|
44 | 44 | .tooltip span.tip { text-align: right; } |
|
45 | 45 | tr.issue td.subject { text-align: right; } |
|
46 | 46 | tr.time-entry td.subject, tr.time-entry td.comments { text-align: right; } |
|
47 | 47 | #sidebar { float: left; } |
|
48 | 48 | #main.nosidebar #content { border-width: 1px; border-style: solid; border-color: #D7D7D7 #BBBBBB #BBBBBB #D7D7D7;} |
|
49 | 49 | .tabular.settings label { margin-left: auto; } |
|
50 | 50 | .splitcontentleft { float: right; } |
|
51 | 51 | .splitcontentright { float: left; } |
|
52 | 52 | p.progress-info { clear: right; } |
|
53 | 53 | table.list td.buttons a { padding-right: 20px; } |
|
54 | 54 | .filecontent { direction: ltr; } |
|
55 | 55 | .entries { direction: ltr; } |
|
56 | 56 | .changeset-changes { direction: ltr; padding-left: 2em } |
|
57 | 57 | .changesets { direction: ltr; } |
|
58 | 58 | div#issue-changesets { float: left; margin-right: 1em; margin-left: 0 } |
|
59 | 59 | #activity dt, .journal { clear: right; } |
|
60 | 60 | .journal-link { float: left; } |
|
61 | 61 | div.wiki pre { direction: ltr; } |
|
62 | 62 | |
|
63 | #context-menu li.folder ul { left:auto; right:168px; } | |
|
64 | #context-menu li.folder>ul { left:auto; right:148px; } | |
|
65 | ||
|
66 | #context-menu li a.submenu { background:url("../images/bullet_arrow_left.png") left no-repeat; } |
General Comments 0
You need to be logged in to leave comments.
Login now