From c61488b4adf987979e229ebcfb3ed78814efd32a Mon Sep 17 00:00:00 2001 From: Stan Lo Date: Sun, 19 Feb 2017 22:58:35 +0800 Subject: Unfreeze interpolated string because it's useless. --- actionview/lib/action_view/template.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'actionview/lib') diff --git a/actionview/lib/action_view/template.rb b/actionview/lib/action_view/template.rb index c067031d2d..b0e2f1e54e 100644 --- a/actionview/lib/action_view/template.rb +++ b/actionview/lib/action_view/template.rb @@ -345,7 +345,7 @@ module ActionView end def instrument(action, &block) # :doc: - ActiveSupport::Notifications.instrument("#{action}.action_view".freeze, instrument_payload, &block) + ActiveSupport::Notifications.instrument("#{action}.action_view", instrument_payload, &block) end def instrument_render_template(&block) -- cgit v1.2.3 From 3bf47b018be912fc7946342315e67b2ac6c33eaf Mon Sep 17 00:00:00 2001 From: Andrew White Date: Mon, 20 Feb 2017 20:22:42 +0000 Subject: Add custom polymorphic mapping Allow the use of `direct` to specify custom mappings for polymorphic_url, e.g: resource :basket direct(class: "Basket") { [:basket] } This will then generate the following: >> link_to "Basket", @basket => Basket More importantly it will generate the correct url when used with `form_for`. Fixes #1769. --- actionview/lib/action_view/test_case.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'actionview/lib') diff --git a/actionview/lib/action_view/test_case.rb b/actionview/lib/action_view/test_case.rb index 2b981caa65..ae4fec4337 100644 --- a/actionview/lib/action_view/test_case.rb +++ b/actionview/lib/action_view/test_case.rb @@ -124,6 +124,10 @@ module ActionView @_rendered_views ||= RenderedViewsCollection.new end + def _routes + @controller._routes if @controller.respond_to?(:_routes) + end + # Need to experiment if this priority is the best one: rendered => output_buffer class RenderedViewsCollection def initialize @@ -258,10 +262,6 @@ module ActionView end] end - def _routes - @controller._routes if @controller.respond_to?(:_routes) - end - def method_missing(selector, *args) begin routes = @controller.respond_to?(:_routes) && @controller._routes -- cgit v1.2.3 From f4acdd83ff76e2338895073ed914c525e7bb33b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Mendon=C3=A7a=20Fran=C3=A7a?= Date: Thu, 23 Feb 2017 14:53:12 -0500 Subject: Preparing for 5.1.0.beta1 release --- actionview/lib/action_view/gem_version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'actionview/lib') diff --git a/actionview/lib/action_view/gem_version.rb b/actionview/lib/action_view/gem_version.rb index 5fc4f3f1b9..662a85f191 100644 --- a/actionview/lib/action_view/gem_version.rb +++ b/actionview/lib/action_view/gem_version.rb @@ -8,7 +8,7 @@ module ActionView MAJOR = 5 MINOR = 1 TINY = 0 - PRE = "alpha" + PRE = "beta1" STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".") end -- cgit v1.2.3 From 504a9715ee60f0bc1bf67d6e81640e9bb6f29dfc Mon Sep 17 00:00:00 2001 From: Andrew Hood Date: Mon, 27 Feb 2017 10:51:26 -0800 Subject: Remove `encode_special_chars` option from `strip_tags` --- actionview/lib/action_view/helpers/sanitize_helper.rb | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'actionview/lib') diff --git a/actionview/lib/action_view/helpers/sanitize_helper.rb b/actionview/lib/action_view/helpers/sanitize_helper.rb index 1e9b813d3d..0abd5bc5dc 100644 --- a/actionview/lib/action_view/helpers/sanitize_helper.rb +++ b/actionview/lib/action_view/helpers/sanitize_helper.rb @@ -13,6 +13,7 @@ module ActionView # It also strips href/src attributes with unsafe protocols like # javascript:, while also protecting against attempts to use Unicode, # ASCII, and hex character references to work around these protocol filters. + # All special characters will be escaped. # # The default sanitizer is Rails::Html::WhiteListSanitizer. See {Rails HTML # Sanitizers}[https://github.com/rails/rails-html-sanitizer] for more information. @@ -20,8 +21,7 @@ module ActionView # Custom sanitization rules can also be provided. # # Please note that sanitizing user-provided text does not guarantee that the - # resulting markup is valid or even well-formed. For example, the output may still - # contain unescaped characters like <, >, or &. + # resulting markup is valid or even well-formed. # # ==== Options # @@ -86,7 +86,7 @@ module ActionView self.class.white_list_sanitizer.sanitize_css(style) end - # Strips all HTML tags from +html+, including comments. + # Strips all HTML tags from +html+, including comments and special characters. # # strip_tags("Strip these tags!") # # => Strip these tags! @@ -96,8 +96,11 @@ module ActionView # # strip_tags("
Welcome to my website!
") # # => Welcome to my website! + # + # strip_tags("> A quote from Smith & Wesson") + # # => > A quote from Smith & Wesson def strip_tags(html) - self.class.full_sanitizer.sanitize(html, encode_special_chars: false) + self.class.full_sanitizer.sanitize(html) end # Strips all link tags from +html+ leaving just the link text. @@ -110,6 +113,9 @@ module ActionView # # strip_links('Blog: Visit.') # # => Blog: Visit. + # + # strip_links('<malformed & link') + # # => <malformed & link def strip_links(html) self.class.link_sanitizer.sanitize(html) end -- cgit v1.2.3 From 328ae33d78103de242e9d64fa471c64a76aae348 Mon Sep 17 00:00:00 2001 From: adamgamble Date: Thu, 16 Mar 2017 12:38:20 -0500 Subject: Fix typo in actionview error message --- actionview/lib/action_view/helpers/url_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'actionview/lib') diff --git a/actionview/lib/action_view/helpers/url_helper.rb b/actionview/lib/action_view/helpers/url_helper.rb index a306903c60..304db38060 100644 --- a/actionview/lib/action_view/helpers/url_helper.rb +++ b/actionview/lib/action_view/helpers/url_helper.rb @@ -622,7 +622,7 @@ module ActionView def to_form_params(attribute, namespace = nil) attribute = if attribute.respond_to?(:permitted?) unless attribute.permitted? - raise ArgumentError, "Attempting to generate a buttom from non-sanitized request parameters!" \ + raise ArgumentError, "Attempting to generate a button from non-sanitized request parameters!" \ " Whitelist and sanitize passed parameters to be secure." end -- cgit v1.2.3 From 6c08d480f13d3332c878ca8a120a03fcd78f7ba2 Mon Sep 17 00:00:00 2001 From: Matthew Draper Date: Wed, 22 Mar 2017 10:11:39 +1030 Subject: Start Rails 5.2 development --- actionview/lib/action_view/gem_version.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'actionview/lib') diff --git a/actionview/lib/action_view/gem_version.rb b/actionview/lib/action_view/gem_version.rb index 662a85f191..92e21d7a4f 100644 --- a/actionview/lib/action_view/gem_version.rb +++ b/actionview/lib/action_view/gem_version.rb @@ -6,9 +6,9 @@ module ActionView module VERSION MAJOR = 5 - MINOR = 1 + MINOR = 2 TINY = 0 - PRE = "beta1" + PRE = "alpha" STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".") end -- cgit v1.2.3 From bb048147912d7ea8c301acd6468e9f869dd0acad Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Wed, 22 Mar 2017 18:09:16 +0100 Subject: Stop complaining about not being able to digest dynamic template partial names and simplify error logging to a single line when not --- actionview/lib/action_view/digestor.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'actionview/lib') diff --git a/actionview/lib/action_view/digestor.rb b/actionview/lib/action_view/digestor.rb index 0658d8601d..ba189e23fe 100644 --- a/actionview/lib/action_view/digestor.rb +++ b/actionview/lib/action_view/digestor.rb @@ -62,8 +62,10 @@ module ActionView node end else - logger.error " '#{name}' file doesn't exist, so no dependencies" - logger.error " Couldn't find template for digesting: #{name}" + unless name.include?('#') # Dynamic template partial names can never be tracked + logger.error " Couldn't find template for digesting: #{name}" + end + seen[name] ||= Missing.new(name, logical_name, nil) end end -- cgit v1.2.3