diff options
Diffstat (limited to 'app/helpers')
-rw-r--r-- | app/helpers/application_helper.rb | 7 | ||||
-rw-r--r-- | app/helpers/wiki_helper.rb | 6 |
2 files changed, 8 insertions, 5 deletions
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 34f9d1285..8310a4972 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -930,6 +930,9 @@ module ApplicationHelper def labelled_form_for(*args, &proc) args << {} unless args.last.is_a?(Hash) options = args.last + if args.first.is_a?(Symbol) + options.merge!(:as => args.shift) + end options.merge!({:builder => Redmine::Views::LabelledFormBuilder}) form_for(*args, &proc) end @@ -1060,7 +1063,7 @@ module ApplicationHelper # +user+ can be a User or a string that will be scanned for an email address (eg. 'joe <joe@foo.bar>') def avatar(user, options = { }) if Setting.gravatar_enabled? - options.merge!({:ssl => (defined?(request) && request.ssl?), :default => Setting.gravatar_default}) + options.merge!({:ssl => (request && request.ssl?), :default => Setting.gravatar_default}) email = nil if user.respond_to?(:mail) email = user.mail @@ -1079,7 +1082,7 @@ module ApplicationHelper # Returns the javascript tags that are included in the html layout head def javascript_heads - tags = javascript_include_tag(:defaults) + tags = javascript_include_tag('prototype', 'effects', 'dragdrop', 'controls', 'rails', 'application') unless User.current.pref.warn_on_leaving_unsaved == '0' tags << "\n".html_safe + javascript_tag("Event.observe(window, 'load', function(){ new WarnLeavingUnsaved('#{escape_javascript( l(:text_warn_on_leaving_unsaved) )}'); });") end diff --git a/app/helpers/wiki_helper.rb b/app/helpers/wiki_helper.rb index 74bec7422..a6e38a12a 100644 --- a/app/helpers/wiki_helper.rb +++ b/app/helpers/wiki_helper.rb @@ -21,14 +21,14 @@ module WikiHelper def wiki_page_options_for_select(pages, selected = nil, parent = nil, level = 0) pages = pages.group_by(&:parent) unless pages.is_a?(Hash) - s = '' + s = ''.html_safe if pages.has_key?(parent) pages[parent].each do |page| attrs = "value='#{page.id}'" attrs << " selected='selected'" if selected == page - indent = (level > 0) ? (' ' * level * 2 + '» ') : nil + indent = (level > 0) ? (' ' * level * 2 + '» ') : '' - s << "<option #{attrs}>#{indent}#{h page.pretty_title}</option>\n" + + s << content_tag('option', (indent + h(page.pretty_title)).html_safe, :value => page.id.to_s, :selected => selected == page) + wiki_page_options_for_select(pages, selected, page, level + 1) end end |