actionview 5.2.3

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of actionview might be problematic. Click here for more details.

Files changed (108) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +142 -0
  3. data/MIT-LICENSE +21 -0
  4. data/README.rdoc +38 -0
  5. data/lib/action_view.rb +97 -0
  6. data/lib/action_view/base.rb +215 -0
  7. data/lib/action_view/buffers.rb +52 -0
  8. data/lib/action_view/context.rb +36 -0
  9. data/lib/action_view/dependency_tracker.rb +175 -0
  10. data/lib/action_view/digestor.rb +134 -0
  11. data/lib/action_view/flows.rb +76 -0
  12. data/lib/action_view/gem_version.rb +17 -0
  13. data/lib/action_view/helpers.rb +68 -0
  14. data/lib/action_view/helpers/active_model_helper.rb +55 -0
  15. data/lib/action_view/helpers/asset_tag_helper.rb +511 -0
  16. data/lib/action_view/helpers/asset_url_helper.rb +469 -0
  17. data/lib/action_view/helpers/atom_feed_helper.rb +205 -0
  18. data/lib/action_view/helpers/cache_helper.rb +263 -0
  19. data/lib/action_view/helpers/capture_helper.rb +212 -0
  20. data/lib/action_view/helpers/controller_helper.rb +36 -0
  21. data/lib/action_view/helpers/csp_helper.rb +24 -0
  22. data/lib/action_view/helpers/csrf_helper.rb +35 -0
  23. data/lib/action_view/helpers/date_helper.rb +1156 -0
  24. data/lib/action_view/helpers/debug_helper.rb +36 -0
  25. data/lib/action_view/helpers/form_helper.rb +2337 -0
  26. data/lib/action_view/helpers/form_options_helper.rb +887 -0
  27. data/lib/action_view/helpers/form_tag_helper.rb +917 -0
  28. data/lib/action_view/helpers/javascript_helper.rb +94 -0
  29. data/lib/action_view/helpers/number_helper.rb +451 -0
  30. data/lib/action_view/helpers/output_safety_helper.rb +70 -0
  31. data/lib/action_view/helpers/record_tag_helper.rb +23 -0
  32. data/lib/action_view/helpers/rendering_helper.rb +99 -0
  33. data/lib/action_view/helpers/sanitize_helper.rb +177 -0
  34. data/lib/action_view/helpers/tag_helper.rb +313 -0
  35. data/lib/action_view/helpers/tags.rb +44 -0
  36. data/lib/action_view/helpers/tags/base.rb +192 -0
  37. data/lib/action_view/helpers/tags/check_box.rb +66 -0
  38. data/lib/action_view/helpers/tags/checkable.rb +18 -0
  39. data/lib/action_view/helpers/tags/collection_check_boxes.rb +36 -0
  40. data/lib/action_view/helpers/tags/collection_helpers.rb +119 -0
  41. data/lib/action_view/helpers/tags/collection_radio_buttons.rb +31 -0
  42. data/lib/action_view/helpers/tags/collection_select.rb +30 -0
  43. data/lib/action_view/helpers/tags/color_field.rb +27 -0
  44. data/lib/action_view/helpers/tags/date_field.rb +15 -0
  45. data/lib/action_view/helpers/tags/date_select.rb +74 -0
  46. data/lib/action_view/helpers/tags/datetime_field.rb +32 -0
  47. data/lib/action_view/helpers/tags/datetime_local_field.rb +21 -0
  48. data/lib/action_view/helpers/tags/datetime_select.rb +10 -0
  49. data/lib/action_view/helpers/tags/email_field.rb +10 -0
  50. data/lib/action_view/helpers/tags/file_field.rb +10 -0
  51. data/lib/action_view/helpers/tags/grouped_collection_select.rb +31 -0
  52. data/lib/action_view/helpers/tags/hidden_field.rb +10 -0
  53. data/lib/action_view/helpers/tags/label.rb +81 -0
  54. data/lib/action_view/helpers/tags/month_field.rb +15 -0
  55. data/lib/action_view/helpers/tags/number_field.rb +20 -0
  56. data/lib/action_view/helpers/tags/password_field.rb +14 -0
  57. data/lib/action_view/helpers/tags/placeholderable.rb +24 -0
  58. data/lib/action_view/helpers/tags/radio_button.rb +33 -0
  59. data/lib/action_view/helpers/tags/range_field.rb +10 -0
  60. data/lib/action_view/helpers/tags/search_field.rb +27 -0
  61. data/lib/action_view/helpers/tags/select.rb +43 -0
  62. data/lib/action_view/helpers/tags/tel_field.rb +10 -0
  63. data/lib/action_view/helpers/tags/text_area.rb +24 -0
  64. data/lib/action_view/helpers/tags/text_field.rb +34 -0
  65. data/lib/action_view/helpers/tags/time_field.rb +15 -0
  66. data/lib/action_view/helpers/tags/time_select.rb +10 -0
  67. data/lib/action_view/helpers/tags/time_zone_select.rb +22 -0
  68. data/lib/action_view/helpers/tags/translator.rb +44 -0
  69. data/lib/action_view/helpers/tags/url_field.rb +10 -0
  70. data/lib/action_view/helpers/tags/week_field.rb +15 -0
  71. data/lib/action_view/helpers/text_helper.rb +486 -0
  72. data/lib/action_view/helpers/translation_helper.rb +141 -0
  73. data/lib/action_view/helpers/url_helper.rb +676 -0
  74. data/lib/action_view/layouts.rb +433 -0
  75. data/lib/action_view/locale/en.yml +56 -0
  76. data/lib/action_view/log_subscriber.rb +96 -0
  77. data/lib/action_view/lookup_context.rb +274 -0
  78. data/lib/action_view/model_naming.rb +14 -0
  79. data/lib/action_view/path_set.rb +100 -0
  80. data/lib/action_view/railtie.rb +82 -0
  81. data/lib/action_view/record_identifier.rb +112 -0
  82. data/lib/action_view/renderer/abstract_renderer.rb +55 -0
  83. data/lib/action_view/renderer/partial_renderer.rb +552 -0
  84. data/lib/action_view/renderer/partial_renderer/collection_caching.rb +57 -0
  85. data/lib/action_view/renderer/renderer.rb +56 -0
  86. data/lib/action_view/renderer/streaming_template_renderer.rb +105 -0
  87. data/lib/action_view/renderer/template_renderer.rb +102 -0
  88. data/lib/action_view/rendering.rb +151 -0
  89. data/lib/action_view/routing_url_for.rb +145 -0
  90. data/lib/action_view/tasks/cache_digests.rake +25 -0
  91. data/lib/action_view/template.rb +361 -0
  92. data/lib/action_view/template/error.rb +141 -0
  93. data/lib/action_view/template/handlers.rb +66 -0
  94. data/lib/action_view/template/handlers/builder.rb +25 -0
  95. data/lib/action_view/template/handlers/erb.rb +74 -0
  96. data/lib/action_view/template/handlers/erb/erubi.rb +83 -0
  97. data/lib/action_view/template/handlers/html.rb +11 -0
  98. data/lib/action_view/template/handlers/raw.rb +11 -0
  99. data/lib/action_view/template/html.rb +34 -0
  100. data/lib/action_view/template/resolver.rb +391 -0
  101. data/lib/action_view/template/text.rb +33 -0
  102. data/lib/action_view/template/types.rb +57 -0
  103. data/lib/action_view/test_case.rb +300 -0
  104. data/lib/action_view/testing/resolvers.rb +54 -0
  105. data/lib/action_view/version.rb +10 -0
  106. data/lib/action_view/view_paths.rb +105 -0
  107. data/lib/assets/compiled/rails-ujs.js +720 -0
  108. metadata +255 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: afb542680a6bdea85297d58343a24da1754f7893189439ead02c8b566de24d27
4
+ data.tar.gz: 53438d080b42df0f88a29b45f9f2a4dfb2afa1129dbe366a612bf47c25645fea
5
+ SHA512:
6
+ metadata.gz: 985967fad7c02691fca261d82a25bf1b409071c5ee422127bec7bde426b03a8bac3024736861149c8aa4a80de0240e393c4e98b18f52c2041bbe16223d409f59
7
+ data.tar.gz: b5965f912d6ef4a64764370c17adc1f24bdc960fb8a4e549930d54f2d708dde433a1e9495f35d5fbbc66c3e5bee57d66a3b42107fada1bd708d1201cb657d04e
@@ -0,0 +1,142 @@
1
+ ## Rails 5.2.3 (March 27, 2019) ##
2
+
3
+ * Prevent non-primary mouse keys from triggering Rails UJS click handlers.
4
+ Firefox fires click events even if the click was triggered by non-primary mouse keys such as right- or scroll-wheel-clicks.
5
+ For example, right-clicking a link such as the one described below (with an underlying ajax request registered on click) should not cause that request to occur.
6
+
7
+ ```
8
+ <%= link_to 'Remote', remote_path, class: 'remote', remote: true, data: { type: :json } %>
9
+ ```
10
+
11
+ Fixes #34541
12
+
13
+ *Wolfgang Hobmaier*
14
+
15
+
16
+ ## Rails 5.2.2.1 (March 11, 2019) ##
17
+
18
+ * No changes.
19
+
20
+
21
+ ## Rails 5.2.2 (December 04, 2018) ##
22
+
23
+ * No changes.
24
+
25
+
26
+ ## Rails 5.2.1.1 (November 27, 2018) ##
27
+
28
+ * No changes.
29
+
30
+
31
+ ## Rails 5.2.1 (August 07, 2018) ##
32
+
33
+ * Fix leak of `skip_default_ids` and `allow_method_names_outside_object` options
34
+ to HTML attributes.
35
+
36
+ *Yurii Cherniavskyi*
37
+
38
+ * Fix issue with `button_to`'s `to_form_params`
39
+
40
+ `button_to` was throwing exception when invoked with `params` hash that
41
+ contains symbol and string keys. The reason for the exception was that
42
+ `to_form_params` was comparing the given symbol and string keys.
43
+
44
+ The issue is fixed by turning all keys to strings inside
45
+ `to_form_params` before comparing them.
46
+
47
+ *Georgi Georgiev*
48
+
49
+ * Fix JavaScript views rendering does not work with Firefox when using
50
+ Content Security Policy.
51
+
52
+ Fixes #32577.
53
+
54
+ *Yuji Yaginuma*
55
+
56
+ * Add the `nonce: true` option for `javascript_include_tag` helper to
57
+ support automatic nonce generation for Content Security Policy.
58
+ Works the same way as `javascript_tag nonce: true` does.
59
+
60
+ *Yaroslav Markin*
61
+
62
+
63
+ ## Rails 5.2.0 (April 09, 2018) ##
64
+
65
+ * Pass the `:skip_pipeline` option in `image_submit_tag` when calling `path_to_image`.
66
+
67
+ Fixes #32248.
68
+
69
+ *Andrew White*
70
+
71
+ * Allow the use of callable objects as group methods for grouped selects.
72
+
73
+ Until now, the `option_groups_from_collection_for_select` method was only able to
74
+ handle method names as `group_method` and `group_label_method` parameters,
75
+ it is now able to receive procs and other callable objects too.
76
+
77
+ *Jérémie Bonal*
78
+
79
+ * Add `preload_link_tag` helper.
80
+
81
+ This helper that allows to the browser to initiate early fetch of resources
82
+ (different to the specified in `javascript_include_tag` and `stylesheet_link_tag`).
83
+ Additionally, this sends Early Hints if supported by browser.
84
+
85
+ *Guillermo Iguaran*
86
+
87
+ * Change `form_with` to generates ids by default.
88
+
89
+ When `form_with` was introduced we disabled the automatic generation of ids
90
+ that was enabled in `form_for`. This usually is not an good idea since labels don't work
91
+ when the input doesn't have an id and it made harder to test with Capybara.
92
+
93
+ You can still disable the automatic generation of ids setting `config.action_view.form_with_generates_ids`
94
+ to `false.`
95
+
96
+ *Nick Pezza*
97
+
98
+ * Fix issues with `field_error_proc` wrapping `optgroup` and select divider `option`.
99
+
100
+ Fixes #31088
101
+
102
+ *Matthias Neumayr*
103
+
104
+ * Remove deprecated Erubis ERB handler.
105
+
106
+ *Rafael Mendonça França*
107
+
108
+ * Remove default `alt` text generation.
109
+
110
+ Fixes #30096
111
+
112
+ *Cameron Cundiff*
113
+
114
+ * Add `srcset` option to `image_tag` helper.
115
+
116
+ *Roberto Miranda*
117
+
118
+ * Fix issues with scopes and engine on `current_page?` method.
119
+
120
+ Fixes #29401.
121
+
122
+ *Nikita Savrov*
123
+
124
+ * Generate field ids in `collection_check_boxes` and `collection_radio_buttons`.
125
+
126
+ This makes sure that the labels are linked up with the fields.
127
+
128
+ Fixes #29014.
129
+
130
+ *Yuji Yaginuma*
131
+
132
+ * Add `:json` type to `auto_discovery_link_tag` to support [JSON Feeds](https://jsonfeed.org/version/1).
133
+
134
+ *Mike Gunderloy*
135
+
136
+ * Update `distance_of_time_in_words` helper to display better error messages
137
+ for bad input.
138
+
139
+ *Jay Hayes*
140
+
141
+
142
+ Please check [5-1-stable](https://github.com/rails/rails/blob/5-1-stable/actionview/CHANGELOG.md) for previous changes.
@@ -0,0 +1,21 @@
1
+ Copyright (c) 2004-2018 David Heinemeier Hansson
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
+
@@ -0,0 +1,38 @@
1
+ = Action View
2
+
3
+ Action View is a framework for handling view template lookup and rendering, and provides
4
+ view helpers that assist when building HTML forms, Atom feeds and more.
5
+ Template formats that Action View handles are ERB (embedded Ruby, typically
6
+ used to inline short Ruby snippets inside HTML), and XML Builder.
7
+
8
+ == Download and installation
9
+
10
+ The latest version of Action View can be installed with RubyGems:
11
+
12
+ $ gem install actionview
13
+
14
+ Source code can be downloaded as part of the Rails project on GitHub:
15
+
16
+ * https://github.com/rails/rails/tree/5-2-stable/actionview
17
+
18
+
19
+ == License
20
+
21
+ Action View is released under the MIT license:
22
+
23
+ * https://opensource.org/licenses/MIT
24
+
25
+
26
+ == Support
27
+
28
+ API documentation is at
29
+
30
+ * http://api.rubyonrails.org
31
+
32
+ Bug reports for the Ruby on Rails project can be filed here:
33
+
34
+ * https://github.com/rails/rails/issues
35
+
36
+ Feature requests should be discussed on the rails-core mailing list here:
37
+
38
+ * https://groups.google.com/forum/?fromgroups#!forum/rubyonrails-core
@@ -0,0 +1,97 @@
1
+ # frozen_string_literal: true
2
+
3
+ #--
4
+ # Copyright (c) 2004-2018 David Heinemeier Hansson
5
+ #
6
+ # Permission is hereby granted, free of charge, to any person obtaining
7
+ # a copy of this software and associated documentation files (the
8
+ # "Software"), to deal in the Software without restriction, including
9
+ # without limitation the rights to use, copy, modify, merge, publish,
10
+ # distribute, sublicense, and/or sell copies of the Software, and to
11
+ # permit persons to whom the Software is furnished to do so, subject to
12
+ # the following conditions:
13
+ #
14
+ # The above copyright notice and this permission notice shall be
15
+ # included in all copies or substantial portions of the Software.
16
+ #
17
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
21
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
22
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
23
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24
+ #++
25
+
26
+ require "active_support"
27
+ require "active_support/rails"
28
+ require "action_view/version"
29
+
30
+ module ActionView
31
+ extend ActiveSupport::Autoload
32
+
33
+ ENCODING_FLAG = '#.*coding[:=]\s*(\S+)[ \t]*'
34
+
35
+ eager_autoload do
36
+ autoload :Base
37
+ autoload :Context
38
+ autoload :CompiledTemplates, "action_view/context"
39
+ autoload :Digestor
40
+ autoload :Helpers
41
+ autoload :LookupContext
42
+ autoload :Layouts
43
+ autoload :PathSet
44
+ autoload :RecordIdentifier
45
+ autoload :Rendering
46
+ autoload :RoutingUrlFor
47
+ autoload :Template
48
+ autoload :ViewPaths
49
+
50
+ autoload_under "renderer" do
51
+ autoload :Renderer
52
+ autoload :AbstractRenderer
53
+ autoload :PartialRenderer
54
+ autoload :TemplateRenderer
55
+ autoload :StreamingTemplateRenderer
56
+ end
57
+
58
+ autoload_at "action_view/template/resolver" do
59
+ autoload :Resolver
60
+ autoload :PathResolver
61
+ autoload :OptimizedFileSystemResolver
62
+ autoload :FallbackFileSystemResolver
63
+ end
64
+
65
+ autoload_at "action_view/buffers" do
66
+ autoload :OutputBuffer
67
+ autoload :StreamingBuffer
68
+ end
69
+
70
+ autoload_at "action_view/flows" do
71
+ autoload :OutputFlow
72
+ autoload :StreamingFlow
73
+ end
74
+
75
+ autoload_at "action_view/template/error" do
76
+ autoload :MissingTemplate
77
+ autoload :ActionViewError
78
+ autoload :EncodingError
79
+ autoload :TemplateError
80
+ autoload :WrongEncodingError
81
+ end
82
+ end
83
+
84
+ autoload :TestCase
85
+
86
+ def self.eager_load!
87
+ super
88
+ ActionView::Helpers.eager_load!
89
+ ActionView::Template.eager_load!
90
+ end
91
+ end
92
+
93
+ require "active_support/core_ext/string/output_safety"
94
+
95
+ ActiveSupport.on_load(:i18n) do
96
+ I18n.load_path << File.expand_path("action_view/locale/en.yml", __dir__)
97
+ end
@@ -0,0 +1,215 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "active_support/core_ext/module/attr_internal"
4
+ require "active_support/core_ext/module/attribute_accessors"
5
+ require "active_support/ordered_options"
6
+ require "action_view/log_subscriber"
7
+ require "action_view/helpers"
8
+ require "action_view/context"
9
+ require "action_view/template"
10
+ require "action_view/lookup_context"
11
+
12
+ module ActionView #:nodoc:
13
+ # = Action View Base
14
+ #
15
+ # Action View templates can be written in several ways.
16
+ # If the template file has a <tt>.erb</tt> extension, then it uses the erubi[https://rubygems.org/gems/erubi]
17
+ # template system which can embed Ruby into an HTML document.
18
+ # If the template file has a <tt>.builder</tt> extension, then Jim Weirich's Builder::XmlMarkup library is used.
19
+ #
20
+ # == ERB
21
+ #
22
+ # You trigger ERB by using embeddings such as <tt><% %></tt>, <tt><% -%></tt>, and <tt><%= %></tt>. The <tt><%= %></tt> tag set is used when you want output. Consider the
23
+ # following loop for names:
24
+ #
25
+ # <b>Names of all the people</b>
26
+ # <% @people.each do |person| %>
27
+ # Name: <%= person.name %><br/>
28
+ # <% end %>
29
+ #
30
+ # The loop is setup in regular embedding tags <tt><% %></tt>, and the name is written using the output embedding tag <tt><%= %></tt>. Note that this
31
+ # is not just a usage suggestion. Regular output functions like print or puts won't work with ERB templates. So this would be wrong:
32
+ #
33
+ # <%# WRONG %>
34
+ # Hi, Mr. <% puts "Frodo" %>
35
+ #
36
+ # If you absolutely must write from within a function use +concat+.
37
+ #
38
+ # When on a line that only contains whitespaces except for the tag, <tt><% %></tt> suppresses leading and trailing whitespace,
39
+ # including the trailing newline. <tt><% %></tt> and <tt><%- -%></tt> are the same.
40
+ # Note however that <tt><%= %></tt> and <tt><%= -%></tt> are different: only the latter removes trailing whitespaces.
41
+ #
42
+ # === Using sub templates
43
+ #
44
+ # Using sub templates allows you to sidestep tedious replication and extract common display structures in shared templates. The
45
+ # classic example is the use of a header and footer (even though the Action Pack-way would be to use Layouts):
46
+ #
47
+ # <%= render "shared/header" %>
48
+ # Something really specific and terrific
49
+ # <%= render "shared/footer" %>
50
+ #
51
+ # As you see, we use the output embeddings for the render methods. The render call itself will just return a string holding the
52
+ # result of the rendering. The output embedding writes it to the current template.
53
+ #
54
+ # But you don't have to restrict yourself to static includes. Templates can share variables amongst themselves by using instance
55
+ # variables defined using the regular embedding tags. Like this:
56
+ #
57
+ # <% @page_title = "A Wonderful Hello" %>
58
+ # <%= render "shared/header" %>
59
+ #
60
+ # Now the header can pick up on the <tt>@page_title</tt> variable and use it for outputting a title tag:
61
+ #
62
+ # <title><%= @page_title %></title>
63
+ #
64
+ # === Passing local variables to sub templates
65
+ #
66
+ # You can pass local variables to sub templates by using a hash with the variable names as keys and the objects as values:
67
+ #
68
+ # <%= render "shared/header", { headline: "Welcome", person: person } %>
69
+ #
70
+ # These can now be accessed in <tt>shared/header</tt> with:
71
+ #
72
+ # Headline: <%= headline %>
73
+ # First name: <%= person.first_name %>
74
+ #
75
+ # The local variables passed to sub templates can be accessed as a hash using the <tt>local_assigns</tt> hash. This lets you access the
76
+ # variables as:
77
+ #
78
+ # Headline: <%= local_assigns[:headline] %>
79
+ #
80
+ # This is useful in cases where you aren't sure if the local variable has been assigned. Alternatively, you could also use
81
+ # <tt>defined? headline</tt> to first check if the variable has been assigned before using it.
82
+ #
83
+ # === Template caching
84
+ #
85
+ # By default, Rails will compile each template to a method in order to render it. When you alter a template,
86
+ # Rails will check the file's modification time and recompile it in development mode.
87
+ #
88
+ # == Builder
89
+ #
90
+ # Builder templates are a more programmatic alternative to ERB. They are especially useful for generating XML content. An XmlMarkup object
91
+ # named +xml+ is automatically made available to templates with a <tt>.builder</tt> extension.
92
+ #
93
+ # Here are some basic examples:
94
+ #
95
+ # xml.em("emphasized") # => <em>emphasized</em>
96
+ # xml.em { xml.b("emph & bold") } # => <em><b>emph &amp; bold</b></em>
97
+ # xml.a("A Link", "href" => "http://onestepback.org") # => <a href="http://onestepback.org">A Link</a>
98
+ # xml.target("name" => "compile", "option" => "fast") # => <target option="fast" name="compile"\>
99
+ # # NOTE: order of attributes is not specified.
100
+ #
101
+ # Any method with a block will be treated as an XML markup tag with nested markup in the block. For example, the following:
102
+ #
103
+ # xml.div do
104
+ # xml.h1(@person.name)
105
+ # xml.p(@person.bio)
106
+ # end
107
+ #
108
+ # would produce something like:
109
+ #
110
+ # <div>
111
+ # <h1>David Heinemeier Hansson</h1>
112
+ # <p>A product of Danish Design during the Winter of '79...</p>
113
+ # </div>
114
+ #
115
+ # Here is a full-length RSS example actually used on Basecamp:
116
+ #
117
+ # xml.rss("version" => "2.0", "xmlns:dc" => "http://purl.org/dc/elements/1.1/") do
118
+ # xml.channel do
119
+ # xml.title(@feed_title)
120
+ # xml.link(@url)
121
+ # xml.description "Basecamp: Recent items"
122
+ # xml.language "en-us"
123
+ # xml.ttl "40"
124
+ #
125
+ # @recent_items.each do |item|
126
+ # xml.item do
127
+ # xml.title(item_title(item))
128
+ # xml.description(item_description(item)) if item_description(item)
129
+ # xml.pubDate(item_pubDate(item))
130
+ # xml.guid(@person.firm.account.url + @recent_items.url(item))
131
+ # xml.link(@person.firm.account.url + @recent_items.url(item))
132
+ #
133
+ # xml.tag!("dc:creator", item.author_name) if item_has_creator?(item)
134
+ # end
135
+ # end
136
+ # end
137
+ # end
138
+ #
139
+ # For more information on Builder please consult the {source
140
+ # code}[https://github.com/jimweirich/builder].
141
+ class Base
142
+ include Helpers, ::ERB::Util, Context
143
+
144
+ # Specify the proc used to decorate input tags that refer to attributes with errors.
145
+ cattr_accessor :field_error_proc, default: Proc.new { |html_tag, instance| "<div class=\"field_with_errors\">#{html_tag}</div>".html_safe }
146
+
147
+ # How to complete the streaming when an exception occurs.
148
+ # This is our best guess: first try to close the attribute, then the tag.
149
+ cattr_accessor :streaming_completion_on_exception, default: %("><script>window.location = "/500.html"</script></html>)
150
+
151
+ # Specify whether rendering within namespaced controllers should prefix
152
+ # the partial paths for ActiveModel objects with the namespace.
153
+ # (e.g., an Admin::PostsController would render @post using /admin/posts/_post.erb)
154
+ cattr_accessor :prefix_partial_path_with_controller_namespace, default: true
155
+
156
+ # Specify default_formats that can be rendered.
157
+ cattr_accessor :default_formats
158
+
159
+ # Specify whether an error should be raised for missing translations
160
+ cattr_accessor :raise_on_missing_translations, default: false
161
+
162
+ # Specify whether submit_tag should automatically disable on click
163
+ cattr_accessor :automatically_disable_submit_tag, default: true
164
+
165
+ class_attribute :_routes
166
+ class_attribute :logger
167
+
168
+ class << self
169
+ delegate :erb_trim_mode=, to: "ActionView::Template::Handlers::ERB"
170
+
171
+ def cache_template_loading
172
+ ActionView::Resolver.caching?
173
+ end
174
+
175
+ def cache_template_loading=(value)
176
+ ActionView::Resolver.caching = value
177
+ end
178
+
179
+ def xss_safe? #:nodoc:
180
+ true
181
+ end
182
+ end
183
+
184
+ attr_accessor :view_renderer
185
+ attr_internal :config, :assigns
186
+
187
+ delegate :lookup_context, to: :view_renderer
188
+ delegate :formats, :formats=, :locale, :locale=, :view_paths, :view_paths=, to: :lookup_context
189
+
190
+ def assign(new_assigns) # :nodoc:
191
+ @_assigns = new_assigns.each { |key, value| instance_variable_set("@#{key}", value) }
192
+ end
193
+
194
+ def initialize(context = nil, assigns = {}, controller = nil, formats = nil) #:nodoc:
195
+ @_config = ActiveSupport::InheritableOptions.new
196
+
197
+ if context.is_a?(ActionView::Renderer)
198
+ @view_renderer = context
199
+ else
200
+ lookup_context = context.is_a?(ActionView::LookupContext) ?
201
+ context : ActionView::LookupContext.new(context)
202
+ lookup_context.formats = formats if formats
203
+ lookup_context.prefixes = controller._prefixes if controller
204
+ @view_renderer = ActionView::Renderer.new(lookup_context)
205
+ end
206
+
207
+ @cache_hit = {}
208
+ assign(assigns)
209
+ assign_controller(controller)
210
+ _prepare_context
211
+ end
212
+
213
+ ActiveSupport.run_load_hooks(:action_view, self)
214
+ end
215
+ end