From 1ad0b378cc081937c117577ab628f2160fcc448d Mon Sep 17 00:00:00 2001 From: Vijay Dev Date: Wed, 23 May 2012 22:43:08 +0530 Subject: Revert "Remove blank trailing comments" This reverts commit fa6d921e11363e9b8c4bc10f7aed0b9faffdc33a. Reason: Not a fan of such massive changes. We usually close such changes if made to Rails master as a pull request. Following the same principle here and reverting. [ci skip] --- .../helpers/asset_tag_helpers/stylesheet_tag_helpers.rb | 1 + actionpack/lib/action_view/helpers/capture_helper.rb | 1 + actionpack/lib/action_view/helpers/form_helper.rb | 11 +++++++++++ actionpack/lib/action_view/helpers/form_options_helper.rb | 3 +++ actionpack/lib/action_view/helpers/form_tag_helper.rb | 3 +++ actionpack/lib/action_view/helpers/number_helper.rb | 1 + actionpack/lib/action_view/helpers/output_safety_helper.rb | 1 + actionpack/lib/action_view/helpers/record_tag_helper.rb | 2 ++ actionpack/lib/action_view/helpers/rendering_helper.rb | 1 + actionpack/lib/action_view/helpers/sanitize_helper.rb | 12 ++++++++++++ actionpack/lib/action_view/helpers/tags/select.rb | 1 + actionpack/lib/action_view/helpers/url_helper.rb | 1 + 12 files changed, 38 insertions(+) (limited to 'actionpack/lib/action_view/helpers') diff --git a/actionpack/lib/action_view/helpers/asset_tag_helpers/stylesheet_tag_helpers.rb b/actionpack/lib/action_view/helpers/asset_tag_helpers/stylesheet_tag_helpers.rb index d7df9ea0d5..57b0627225 100644 --- a/actionpack/lib/action_view/helpers/asset_tag_helpers/stylesheet_tag_helpers.rb +++ b/actionpack/lib/action_view/helpers/asset_tag_helpers/stylesheet_tag_helpers.rb @@ -139,6 +139,7 @@ module ActionView # you have too many stylesheets for IE to load. # # stylesheet_link_tag :all, :concat => true + # def stylesheet_link_tag(*sources) @stylesheet_include ||= StylesheetIncludeTag.new(config, asset_paths) @stylesheet_include.include_tag(*sources) diff --git a/actionpack/lib/action_view/helpers/capture_helper.rb b/actionpack/lib/action_view/helpers/capture_helper.rb index c1f47a2eac..397738dd98 100644 --- a/actionpack/lib/action_view/helpers/capture_helper.rb +++ b/actionpack/lib/action_view/helpers/capture_helper.rb @@ -33,6 +33,7 @@ module ActionView # # <%= @greeting %> # + # def capture(*args) value = nil buffer = with_output_buffer { value = yield(*args) } diff --git a/actionpack/lib/action_view/helpers/form_helper.rb b/actionpack/lib/action_view/helpers/form_helper.rb index 12576ecd01..fc81bcea80 100644 --- a/actionpack/lib/action_view/helpers/form_helper.rb +++ b/actionpack/lib/action_view/helpers/form_helper.rb @@ -763,6 +763,7 @@ module ActionView # # text_field(:snippet, :code, :size => 20, :class => 'code_input') # # => + # def text_field(object_name, method, options = {}) Tags::TextField.new(object_name, method, self, options).render end @@ -784,6 +785,7 @@ module ActionView # # password_field(:account, :pin, :size => 20, :class => 'form_input') # # => + # def password_field(object_name, method, options = {}) Tags::PasswordField.new(object_name, method, self, options).render end @@ -822,6 +824,7 @@ module ActionView # # file_field(:attachment, :file, :class => 'file_input') # # => + # def file_field(object_name, method, options = {}) Tags::FileField.new(object_name, method, self, options).render end @@ -910,6 +913,7 @@ module ActionView # check_box("eula", "accepted", { :class => 'eula_check' }, "yes", "no") # # => # # + # def check_box(object_name, method, options = {}, checked_value = "1", unchecked_value = "0") Tags::CheckBox.new(object_name, method, self, checked_value, unchecked_value, options).render end @@ -962,6 +966,7 @@ module ActionView # # telephone_field("user", "phone") # # => + # def telephone_field(object_name, method, options = {}) Tags::TelField.new(object_name, method, self, options).render end @@ -980,6 +985,7 @@ module ActionView # @user.born_on = Date.new(1984, 1, 27) # date_field("user", "born_on", value: "1984-05-12") # # => + # def date_field(object_name, method, options = {}) Tags::DateField.new(object_name, method, self, options).render end @@ -996,6 +1002,7 @@ module ActionView # === Example # time_field("task", "started_at") # # => + # def time_field(object_name, method, options = {}) Tags::TimeField.new(object_name, method, self, options).render end @@ -1004,6 +1011,7 @@ module ActionView # # url_field("user", "homepage") # # => + # def url_field(object_name, method, options = {}) Tags::UrlField.new(object_name, method, self, options).render end @@ -1012,6 +1020,7 @@ module ActionView # # email_field("user", "address") # # => + # def email_field(object_name, method, options = {}) Tags::EmailField.new(object_name, method, self, options).render end @@ -1191,6 +1200,7 @@ module ActionView # submit: # post: # create: "Add %{model}" + # def submit(value=nil, options={}) value, options = nil, value if value.is_a?(Hash) value ||= submit_default_value @@ -1223,6 +1233,7 @@ module ActionView # submit: # post: # create: "Add %{model}" + # def button(value=nil, options={}) value, options = nil, value if value.is_a?(Hash) value ||= submit_default_value diff --git a/actionpack/lib/action_view/helpers/form_options_helper.rb b/actionpack/lib/action_view/helpers/form_options_helper.rb index 90fa1f3520..eef426703d 100644 --- a/actionpack/lib/action_view/helpers/form_options_helper.rb +++ b/actionpack/lib/action_view/helpers/form_options_helper.rb @@ -98,6 +98,7 @@ module ActionView # # # + # module FormOptionsHelper # ERB::Util can mask some helpers like textilize. Make sure to include them. include TextHelper @@ -153,6 +154,7 @@ module ActionView # key in the query string, that works for ordinary forms. # # In case if you don't want the helper to generate this hidden field you can specify :include_blank => false option. + # def select(object, method, choices, options = {}, html_options = {}) Tags::Select.new(object, method, self, choices, options, html_options).render end @@ -239,6 +241,7 @@ module ActionView # # # + # def grouped_collection_select(object, method, collection, group_method, group_label_method, option_key_method, option_value_method, options = {}, html_options = {}) Tags::GroupedCollectionSelect.new(object, method, self, collection, group_method, group_label_method, option_key_method, option_value_method, options, html_options).render end diff --git a/actionpack/lib/action_view/helpers/form_tag_helper.rb b/actionpack/lib/action_view/helpers/form_tag_helper.rb index 07453c4b50..e65b4e3e95 100644 --- a/actionpack/lib/action_view/helpers/form_tag_helper.rb +++ b/actionpack/lib/action_view/helpers/form_tag_helper.rb @@ -63,6 +63,7 @@ module ActionView # # form_tag('http://far.away.com/form', :authenticity_token => "cf50faa3fe97702ca1ae") # # form with custom authenticity token + # def form_tag(url_for_options = {}, options = {}, &block) html_options = html_options_for_form(url_for_options, options) if block_given? @@ -408,6 +409,7 @@ module ActionView # # submit_tag "Save", :confirm => "Are you sure?" # # => + # def submit_tag(value = "Save changes", options = {}) options = options.stringify_keys @@ -444,6 +446,7 @@ module ActionView # # => + # def button_tag(content_or_options = nil, options = nil, &block) options = content_or_options if block_given? && content_or_options.is_a?(Hash) options ||= {} diff --git a/actionpack/lib/action_view/helpers/number_helper.rb b/actionpack/lib/action_view/helpers/number_helper.rb index 9e43a1faf1..dfc26acfad 100644 --- a/actionpack/lib/action_view/helpers/number_helper.rb +++ b/actionpack/lib/action_view/helpers/number_helper.rb @@ -514,6 +514,7 @@ module ActionView # number_to_human(343, :units => :distance, :precision => 1) # => "300 meters" # number_to_human(1, :units => :distance) # => "1 meter" # number_to_human(0.34, :units => :distance) # => "34 centimeters" + # def number_to_human(number, options = {}) options = options.symbolize_keys diff --git a/actionpack/lib/action_view/helpers/output_safety_helper.rb b/actionpack/lib/action_view/helpers/output_safety_helper.rb index 891dd859fa..2e7e9dc50c 100644 --- a/actionpack/lib/action_view/helpers/output_safety_helper.rb +++ b/actionpack/lib/action_view/helpers/output_safety_helper.rb @@ -26,6 +26,7 @@ module ActionView #:nodoc: # # safe_join(["

foo

".html_safe, "

bar

".html_safe], "
".html_safe) # # => "

foo


bar

" + # def safe_join(array, sep=$,) sep = ERB::Util.html_escape(sep) diff --git a/actionpack/lib/action_view/helpers/record_tag_helper.rb b/actionpack/lib/action_view/helpers/record_tag_helper.rb index 8734136f39..9b35f076e5 100644 --- a/actionpack/lib/action_view/helpers/record_tag_helper.rb +++ b/actionpack/lib/action_view/helpers/record_tag_helper.rb @@ -29,6 +29,7 @@ module ActionView # #
Joe Bloggs
#
Jane Bloggs
+ # def div_for(record, *args, &block) content_tag_for(:div, record, *args, &block) end @@ -78,6 +79,7 @@ module ActionView # produces: # #
  • ... + # def content_tag_for(tag_name, single_or_multiple_records, prefix = nil, options = nil, &block) options, prefix = prefix, nil if prefix.is_a?(Hash) diff --git a/actionpack/lib/action_view/helpers/rendering_helper.rb b/actionpack/lib/action_view/helpers/rendering_helper.rb index 55fb443929..626e1a1ab7 100644 --- a/actionpack/lib/action_view/helpers/rendering_helper.rb +++ b/actionpack/lib/action_view/helpers/rendering_helper.rb @@ -75,6 +75,7 @@ module ActionView # # Hello David # + # def _layout_for(*args, &block) name = args.first diff --git a/actionpack/lib/action_view/helpers/sanitize_helper.rb b/actionpack/lib/action_view/helpers/sanitize_helper.rb index ba74217c12..a727b910e5 100644 --- a/actionpack/lib/action_view/helpers/sanitize_helper.rb +++ b/actionpack/lib/action_view/helpers/sanitize_helper.rb @@ -55,6 +55,7 @@ module ActionView # resulting markup is valid (conforming to a document type) or even well-formed. # The output may still contain e.g. unescaped '<', '>', '&' characters and # confuse browsers. + # def sanitize(html, options = {}) self.class.white_list_sanitizer.sanitize(html, options).try(:html_safe) end @@ -143,6 +144,7 @@ module ActionView # class Application < Rails::Application # config.action_view.full_sanitizer = MySpecialSanitizer.new # end + # def full_sanitizer @full_sanitizer ||= HTML::FullSanitizer.new end @@ -153,6 +155,7 @@ module ActionView # class Application < Rails::Application # config.action_view.link_sanitizer = MySpecialSanitizer.new # end + # def link_sanitizer @link_sanitizer ||= HTML::LinkSanitizer.new end @@ -163,6 +166,7 @@ module ActionView # class Application < Rails::Application # config.action_view.white_list_sanitizer = MySpecialSanitizer.new # end + # def white_list_sanitizer @white_list_sanitizer ||= HTML::WhiteListSanitizer.new end @@ -172,6 +176,7 @@ module ActionView # class Application < Rails::Application # config.action_view.sanitized_uri_attributes = 'lowsrc', 'target' # end + # def sanitized_uri_attributes=(attributes) HTML::WhiteListSanitizer.uri_attributes.merge(attributes) end @@ -181,6 +186,7 @@ module ActionView # class Application < Rails::Application # config.action_view.sanitized_bad_tags = 'embed', 'object' # end + # def sanitized_bad_tags=(attributes) HTML::WhiteListSanitizer.bad_tags.merge(attributes) end @@ -190,6 +196,7 @@ module ActionView # class Application < Rails::Application # config.action_view.sanitized_allowed_tags = 'table', 'tr', 'td' # end + # def sanitized_allowed_tags=(attributes) HTML::WhiteListSanitizer.allowed_tags.merge(attributes) end @@ -199,6 +206,7 @@ module ActionView # class Application < Rails::Application # config.action_view.sanitized_allowed_attributes = 'onclick', 'longdesc' # end + # def sanitized_allowed_attributes=(attributes) HTML::WhiteListSanitizer.allowed_attributes.merge(attributes) end @@ -208,6 +216,7 @@ module ActionView # class Application < Rails::Application # config.action_view.sanitized_allowed_css_properties = 'expression' # end + # def sanitized_allowed_css_properties=(attributes) HTML::WhiteListSanitizer.allowed_css_properties.merge(attributes) end @@ -217,6 +226,7 @@ module ActionView # class Application < Rails::Application # config.action_view.sanitized_allowed_css_keywords = 'expression' # end + # def sanitized_allowed_css_keywords=(attributes) HTML::WhiteListSanitizer.allowed_css_keywords.merge(attributes) end @@ -226,6 +236,7 @@ module ActionView # class Application < Rails::Application # config.action_view.sanitized_shorthand_css_properties = 'expression' # end + # def sanitized_shorthand_css_properties=(attributes) HTML::WhiteListSanitizer.shorthand_css_properties.merge(attributes) end @@ -235,6 +246,7 @@ module ActionView # class Application < Rails::Application # config.action_view.sanitized_allowed_protocols = 'ssh', 'feed' # end + # def sanitized_allowed_protocols=(attributes) HTML::WhiteListSanitizer.allowed_protocols.merge(attributes) end diff --git a/actionpack/lib/action_view/helpers/tags/select.rb b/actionpack/lib/action_view/helpers/tags/select.rb index 4d94ee2c23..53a108b7e6 100644 --- a/actionpack/lib/action_view/helpers/tags/select.rb +++ b/actionpack/lib/action_view/helpers/tags/select.rb @@ -31,6 +31,7 @@ module ActionView # # [nil, []] # { nil => [] } + # def grouped_choices? !@choices.empty? && @choices.first.respond_to?(:last) && Array === @choices.first.last end diff --git a/actionpack/lib/action_view/helpers/url_helper.rb b/actionpack/lib/action_view/helpers/url_helper.rb index 2e45a2ae0f..7e69547dab 100644 --- a/actionpack/lib/action_view/helpers/url_helper.rb +++ b/actionpack/lib/action_view/helpers/url_helper.rb @@ -586,6 +586,7 @@ module ActionView # # current_page?(:controller => 'product', :action => 'index') # # => false + # def current_page?(options) unless request raise "You cannot use helpers that need to determine the current " \ -- cgit v1.2.3