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