comparison app/helpers/application_helper.rb @ 1120:55944e901e9e redmine-2.2-integration

fixed a syntax error on an if/else statement.
author luisf <luis.figueira@eecs.qmul.ac.uk>
date Tue, 08 Jan 2013 16:04:52 +0000
parents bb32da3bea34
children a3cb7444c9bd
comparison
equal deleted inserted replaced
1119:22d81bd0b62c 1120:55944e901e9e
307 end 307 end
308 308
309 def principals_check_box_tags(name, principals) 309 def principals_check_box_tags(name, principals)
310 s = '' 310 s = ''
311 principals.sort.each do |principal| 311 principals.sort.each do |principal|
312 312
313 if principal.type == "User": 313 if principal.type == "User"
314 s << "<label>#{ check_box_tag name, principal.id, false } #{link_to_user principal}</label>\n" 314 s << "<label>#{ check_box_tag name, principal.id, false } #{link_to_user principal}</label>\n"
315 else 315 else
316 s << "<label>#{ check_box_tag name, principal.id, false } #{h principal} (Group)</label>\n" 316 s << "<label>#{ check_box_tag name, principal.id, false } #{h principal} (Group)</label>\n"
317 end 317 end
318 318
319 end 319 end
320 s.html_safe 320 s.html_safe
321 end 321 end
322 322
323 # Returns a string for users/groups option tags 323 # Returns a string for users/groups option tags
486 ancestors = (@project.root? ? [] : @project.ancestors.visible.all) 486 ancestors = (@project.root? ? [] : @project.ancestors.visible.all)
487 if ancestors.any? 487 if ancestors.any?
488 root = ancestors.shift 488 root = ancestors.shift
489 b << link_to_project(root, {:jump => current_menu_item}, :class => 'root') 489 b << link_to_project(root, {:jump => current_menu_item}, :class => 'root')
490 if ancestors.size > 2 490 if ancestors.size > 2
491 b << '&#8230;' 491 b << '&#8230;'
492 ancestors = ancestors[-2, 2] 492 ancestors = ancestors[-2, 2]
493 end 493 end
494 b += ancestors.collect {|p| link_to_project(p, {:jump => current_menu_item}, :class => 'ancestor') } 494 b += ancestors.collect {|p| link_to_project(p, {:jump => current_menu_item}, :class => 'ancestor') }
495 b = b.join(' &#187; ') 495 b = b.join(' &#187; ')
496 b << (' &#187;') 496 b << (' &#187;')
667 when :local; "#{page.present? ? Wiki.titleize(page) : ''}.html" + (anchor.present? ? "##{anchor}" : '') 667 when :local; "#{page.present? ? Wiki.titleize(page) : ''}.html" + (anchor.present? ? "##{anchor}" : '')
668 when :anchor; "##{page.present? ? Wiki.titleize(page) : title}" + (anchor.present? ? "_#{anchor}" : '') # used for single-file wiki export 668 when :anchor; "##{page.present? ? Wiki.titleize(page) : title}" + (anchor.present? ? "_#{anchor}" : '') # used for single-file wiki export
669 else 669 else
670 wiki_page_id = page.present? ? Wiki.titleize(page) : nil 670 wiki_page_id = page.present? ? Wiki.titleize(page) : nil
671 parent = wiki_page.nil? && obj.is_a?(WikiContent) && obj.page && project == link_project ? obj.page.title : nil 671 parent = wiki_page.nil? && obj.is_a?(WikiContent) && obj.page && project == link_project ? obj.page.title : nil
672 url_for(:only_path => only_path, :controller => 'wiki', :action => 'show', :project_id => link_project, 672 url_for(:only_path => only_path, :controller => 'wiki', :action => 'show', :project_id => link_project,
673 :id => wiki_page_id, :version => nil, :anchor => anchor, :parent => parent) 673 :id => wiki_page_id, :version => nil, :anchor => anchor, :parent => parent)
674 end 674 end
675 end 675 end
676 link_to(title.present? ? title.html_safe : h(page), url, :class => ('wiki-page' + (wiki_page ? '' : ' new'))) 676 link_to(title.present? ? title.html_safe : h(page), url, :class => ('wiki-page' + (wiki_page ? '' : ' new')))
677 else 677 else
1027 html << "<li>#{h error}</li>\n" 1027 html << "<li>#{h error}</li>\n"
1028 end 1028 end
1029 html << "</ul></div>\n" 1029 html << "</ul></div>\n"
1030 end 1030 end
1031 html.html_safe 1031 html.html_safe
1032 end 1032 end
1033 1033
1034 def delete_link(url, options={}) 1034 def delete_link(url, options={})
1035 options = { 1035 options = {
1036 :method => :delete, 1036 :method => :delete,
1037 :data => {:confirm => l(:text_are_you_sure)}, 1037 :data => {:confirm => l(:text_are_you_sure)},
1041 link_to l(:button_delete), url, options 1041 link_to l(:button_delete), url, options
1042 end 1042 end
1043 1043
1044 def preview_link(url, form, target='preview', options={}) 1044 def preview_link(url, form, target='preview', options={})
1045 content_tag 'a', l(:label_preview), { 1045 content_tag 'a', l(:label_preview), {
1046 :href => "#", 1046 :href => "#",
1047 :onclick => %|submitPreview("#{escape_javascript url_for(url)}", "#{escape_javascript form}", "#{escape_javascript target}"); return false;|, 1047 :onclick => %|submitPreview("#{escape_javascript url_for(url)}", "#{escape_javascript form}", "#{escape_javascript target}"); return false;|,
1048 :accesskey => accesskey(:preview) 1048 :accesskey => accesskey(:preview)
1049 }.merge(options) 1049 }.merge(options)
1050 end 1050 end
1051 1051
1052 def link_to_function(name, function, html_options={}) 1052 def link_to_function(name, function, html_options={})
1130 # JQuery uses 0..6 (sunday..saturday), 7 needs to be changed to 0 1130 # JQuery uses 0..6 (sunday..saturday), 7 needs to be changed to 0
1131 start_of_week = start_of_week.to_i % 7 1131 start_of_week = start_of_week.to_i % 7
1132 1132
1133 tags = javascript_tag( 1133 tags = javascript_tag(
1134 "var datepickerOptions={dateFormat: 'yy-mm-dd', firstDay: #{start_of_week}, " + 1134 "var datepickerOptions={dateFormat: 'yy-mm-dd', firstDay: #{start_of_week}, " +
1135 "showOn: 'button', buttonImageOnly: true, buttonImage: '" + 1135 "showOn: 'button', buttonImageOnly: true, buttonImage: '" +
1136 path_to_image('/images/calendar.png') + 1136 path_to_image('/images/calendar.png') +
1137 "', showButtonPanel: true};") 1137 "', showButtonPanel: true};")
1138 jquery_locale = l('jquery.locale', :default => current_language.to_s) 1138 jquery_locale = l('jquery.locale', :default => current_language.to_s)
1139 unless jquery_locale == 'en' 1139 unless jquery_locale == 'en'
1140 tags << javascript_include_tag("i18n/jquery.ui.datepicker-#{jquery_locale}.js") 1140 tags << javascript_include_tag("i18n/jquery.ui.datepicker-#{jquery_locale}.js")
1141 end 1141 end
1142 tags 1142 tags
1143 end 1143 end
1144 end 1144 end
1145 end 1145 end