From 0990c1309dfa1751c1e1a48b48bfcb994ab68db0 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Sun, 12 Dec 2004 11:31:54 +0000 Subject: Fixed all helpers so that they use XHTML compliant double quotes for values instead of single quotes [htonl/bitsweat] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@114 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/lib/action_view/helpers/active_record_helper.rb | 11 ++++++----- actionpack/lib/action_view/helpers/date_helper.rb | 8 ++++---- actionpack/lib/action_view/helpers/tag_helper.rb | 14 ++++++-------- 3 files changed, 16 insertions(+), 17 deletions(-) (limited to 'actionpack/lib') diff --git a/actionpack/lib/action_view/helpers/active_record_helper.rb b/actionpack/lib/action_view/helpers/active_record_helper.rb index eee8b6b970..4f7d66d8f7 100644 --- a/actionpack/lib/action_view/helpers/active_record_helper.rb +++ b/actionpack/lib/action_view/helpers/active_record_helper.rb @@ -52,12 +52,13 @@ module ActionView def form(record_name, options = {}) record = instance_eval("@#{record_name}") action = url_for(:action => options[:action] || (record.new_record? ? "create" : "update")) + submit_value = options[:submit_value] || action.gsub(/[^\w]/, '').capitalize + id_field = record.new_record? ? "" : InstanceTag.new(record_name, "id", self).to_input_field_tag("hidden") - - "
" + - id_field + all_input_tags(record, record_name, options) + - "" + - "
" + + %(
#{id_field}) + + all_input_tags(record, record_name, options) + + %(
) end # Returns a string containing the error message attached to the +method+ on the +object+, if one exists. diff --git a/actionpack/lib/action_view/helpers/date_helper.rb b/actionpack/lib/action_view/helpers/date_helper.rb index 5526c3eef4..8af3afb034 100755 --- a/actionpack/lib/action_view/helpers/date_helper.rb +++ b/actionpack/lib/action_view/helpers/date_helper.rb @@ -143,8 +143,8 @@ module ActionView end month_options << ((date.kind_of?(Fixnum) ? date : date.month) == month_number ? - "\n" : - "\n" + %(\n) : + %(\n) ) end @@ -172,9 +172,9 @@ module ActionView private def select_html(type, options, prefix = nil, include_blank = false, discard_type = false) - select_html = "\n" diff --git a/actionpack/lib/action_view/helpers/tag_helper.rb b/actionpack/lib/action_view/helpers/tag_helper.rb index 13aa9297ca..6139943567 100644 --- a/actionpack/lib/action_view/helpers/tag_helper.rb +++ b/actionpack/lib/action_view/helpers/tag_helper.rb @@ -10,7 +10,7 @@ module ActionView # * tag("br") =>
# * tag("input", { "type" => "text"}) => def tag(name, options = {}, open = false) - "<#{name + tag_options(options)}" + (open ? ">" : " />") + "<#{name}#{tag_options(options)}" + (open ? ">" : " />") end # Examples: @@ -18,7 +18,7 @@ module ActionView # * content_tag("div", content_tag("p", "Hello world!"), "class" => "strong") => #

Hello world!

def content_tag(name, content, options = {}) - "<#{name + tag_options(options)}>#{content}" + "<#{name}#{tag_options(options)}>#{content}" end # Starts a form tag that points the action to an url configured with url_for_options just like @@ -46,12 +46,10 @@ module ActionView private def tag_options(options) - if options.empty? - "" - else - " " + options.collect { |pair| - "#{pair.first}=\"#{html_escape(pair.last)}\"" - }.sort.join(" ") + unless options.empty? + " " + options.map { |key, value| + %(#{key}="#{html_escape(value)}") + }.sort.join(" ") end end end -- cgit v1.2.3