aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/lib/action_view
Commit message (Collapse)AuthorAgeFilesLines
* Fix example for css_class_attribute and fix indentationPrathamesh Sonpatki2016-04-201-6/+6
|
* [ci skip] Small grammar fixAbhishek Jain2016-04-201-1/+1
|
* Merge pull request #20625 from Envek/add_country_zones_methodJeremy Daer2016-04-191-4/+5
|\ | | | | | | Add ActiveSupport::TimeZone.country_zones helper
* \ Merge pull request #24225 from ↵Rafael Mendonça França2016-04-201-3/+19
|\ \ | | | | | | | | | | | | | | | neumayr/date_select_helper_with_css_classes_accept_hash date_select helper with_css_classes option also accept a hash
| * | date_select helper with_css_classes option also accept a hashneumayr2016-04-051-3/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `date_select` helper `:with_css_classes` option now accepts a hash of strings for `:year`, `:month`, `:day`, `:hour`, `:minute`, `:second` that will extend the select type with the given css class value. ```erb <%= f.date_select :birthday, with_css_classes: { month: "my-month", year: "my-year" } %> ``` ```html <select id="user_birthday_3i" name="user[birthday(3i)]">…</select> <select id="user_birthday_2i" name="user[birthday(2i)]" class="my-month">…</select> <select id="user_birthday_1i" name="user[birthday(1i)]" class="my-year">…</select> ``` Optional, add global `html_options` to modify every select tag in the set. ```erb <%= f.date_select :birthday, with_css_classes: { month: "my-month", year: "my-year" }, { class: "my-date optional" } %> ``` Supported DateHelper methods: `select_day`, `select_month`, `select_year`, `select_hour`, `select_minute`, `select_second`, `select_datetime`, `select_time`, `time_select`, `date_select` and `datetime_select`. `:with_css_classes` option was added to the `date_select` with #7975.
* | | Merge pull request #23869 from oreoshake/to-sentence-html-safetyRafael França2016-04-201-0/+30
|\ \ \ | | | | | | | | Add html_safe support to ActionView Array#OutputSafetyHelper
| * | | mimic ActiveSupport's Array#to_sentence in an html_safe-aware wayNeil Matatall2016-03-151-0/+30
| | | |
* | | | Ensure Cache#inspect doesn't block concurrent cache writesJeremy Daer2016-04-191-0/+4
| |_|/ |/| | | | | | | | | | | | | | | | | Object#inspect recursively inspects instance variables, exposing all internal state, including sensitive internal cache objects. Override Cache#inspect to give a high-level summary that never interferes with concurrent cache writes.
* | | Improved ActionView flows.rb documention [ci skip]Alex Mirkhaydarov2016-04-111-5/+4
| |/ |/|
* | `number_to_phone` formats number with regexpPan GaoYong2016-04-021-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | By default, this method formats US number. This commit extends its functionality to format number for other countries with a custom regular expression. number_to_phone(18812345678, pattern: /(\d{3})(\d{4})(\d{4})/) # => 188-1234-5678 The output phone number is divided into three groups, so the regexp should also match three groups of numbers.
* | Merge pull request #24379 from Gaurav2728/sanitizer-helper-update-docKasper Timm Hansen2016-03-311-1/+1
|\ \ | | | | | | sanitiser helper may be remove in 5.1, update doc [ci skip]
| * | sanitiser helper may be remove in 5.1, update doc [ci skip]Gaurav Sharma2016-03-311-1/+1
| | | | | | | | | using `rails-html-sanitizer` gem still Rails providing strip_tags, strip_links features. May be remove in 5.1
* | | Deprecate `datetime_field` and `datetime_field_tag` helpers.Wojciech Wnętrzak2016-03-312-0/+8
|/ / | | | | | | | | Datetime input type was removed from HTML specification. One can use `datetime_local_field` and `datetime_local_field_tag` instead.
* | set in no more used in ActionView::Template::TypesGaurav Sharma2016-03-251-1/+0
| | | | | | | | | | initially set is used for template type https://github.com/rails/rails/commit/67f55e28 after this commit https://github.com/rails/rails/commit/91f2ad36 it’s not require
* | fix a comment in atom_feed_helper.rb白井 健太2016-03-161-1/+1
| |
* | Break up a circular require between AP/AVSean Griffin2016-03-111-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Right now referencing the constant `AbstractController::Rendering` causes `ActionView::Base` to be loaded, and thus the load hooks for action_view are run. If that load hook references any part of action view that then references action controller (such as `ActionView::TestCase`), the constant `AbstractController::Rendering` will attempt to be autoloaded and blow up. With this change, `ActionView::LoadPaths` no longer requires `ActionView::Base` (which it had no reason to require). There was a needed class from `AbstractController::Base` in the Rendering module, which I've moved into its own file so we don't need to load all of `AbstractController::Base` there. This commit fixes https://github.com/rails/rails-controller-testing/issues/21
* | Rename dependencies.rake to cache_digests.rakeDharam Gollapudi2016-03-092-1/+1
| | | | | | | | | | | | | | As the tasks are related to cache_digests and as they are already namespaced under cache_digests, renaming to cache_digests.rake makes it to know where to find these tasks.
* | Revert "Merge pull request #24125 from dharamgollapudi/patch-3"Matthew Draper2016-03-101-0/+0
| | | | | | | | | | This reverts commit b3c487515c11c367855eda7742bda4a3d680b740, reversing changes made to 4b43651884309c0f5be4dbdd11ea4d16fb880c30.
* | Rename dependencies.rake to cache_digests.rakeDharam Gollapudi2016-03-091-0/+0
| | | | | | | | | | | | As the tasks are related to cache_digests and as they are already namespaced under cache_digests, renaming to cache_digests.rake makes it to know where to find these tasks.
* | - Freeze strings in frequent used private methodStan Lo2016-03-081-11/+11
| | | | | | | | | | reduce string allocation. - Use freezed empty string instead of create one every time we need to return it
* | Revert "Merge pull request #22764 from ↵Rafael Mendonça França2016-03-051-2/+0
| | | | | | | | | | | | | | | | | | | | stevenspiel/titleize_model_name_for_default_submit_button_value" This reverts commit 4158974c60d817c9bc1e2aecb342161295f2ac0d, reversing changes made to 3d590add45b7ff1de972d99b076cb504d5208935. Reason: This break i18n in some languages. See https://github.com/rails/rails/issues/791#issuecomment-192724640
* | We're not using $2 from this RegexpAkira Matsuda2016-03-051-1/+1
| | | | | | | | https://github.com/rails/rails/pull/24052/files#r55083975
* | Fix partial rendering with dot in filenameBenjamin Quorning2016-03-041-1/+1
| | | | | | | | | | | | | | | | When rendering a collection with a partial whose filename contains a dot, e.g. "customer.mobile", we would set a `locals[:'customer.mobile']` variable instead of, as in earlier versions of Rails, `locals[:customer]`. This bug was introduced in da9038eaa5d19c77c734a044c6b35d7bfac01104.
* | Support `:any` variants lookup in `PathResolver`Godfrey Chan2016-03-011-2/+6
| | | | | | | | | | | | | | | | `OptimizedFileSystemResolver` (which most Rails apps use), but did not implement the feature on the more generic `PathResolver`, which is often used in tests etc. Fixes #23881
* | Update to use Subscriber#start insteadPrem Sichanugrist2016-02-262-7/+15
| | | | | | | | | | | | | | | | We don't need to instrument another event as `ActiveSupport::LogSubscriber` already tracks when the instrumentation starts. Close #23717
* | Added log "Rendering ...", when starting to render a template, to log that ↵Vipul A M2016-02-262-0/+10
| | | | | | | | | | | | | | | | we have started to render something, at the very beginning. This helps to easily identify queries from controller vs views Fixes #23710
* | Lock down new `ImplicitRender` behavior for 5.0 RCGodfrey Chan2016-02-254-4/+39
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1. Conceptually revert #20276 The feature was implemented for the `responders` gem. In the end, they did not need that feature, and have found a better fix (see plataformatec/responders#131). `ImplicitRender` is the place where Rails specifies our default policies for the case where the user did not explicitly tell us what to render, essentially describing a set of heuristics. If the gem (or the user) knows exactly what they want, they could just perform the correct `render` to avoid falling through to here, as `responders` did (the user called `respond_with`). Reverting the patch allows us to avoid exploding the complexity and defining “the fallback for a fallback” policies. 2. `respond_to` and templates are considered exhaustive enumerations If the user specified a list of formats/variants in a `respond_to` block, anything that is not explicitly included should result in an `UnknownFormat` error (which is then caught upstream to mean “406 Not Acceptable” by default). This is already how it works before this commit. Same goes for templates – if the user defined a set of templates (usually in the file system), that set is now considered exhaustive, which means that “missing” templates are considered `UnknownFormat` errors (406). 3. To keep API endpoints simple, the implicit render behavior for actions with no templates defined at all (regardless of formats, locales, variants, etc) are defaulted to “204 No Content”. This is a strictly narrower version of the feature landed in #19036 and #19377. 4. To avoid confusion when interacting in the browser, these actions will raise an `UnknownFormat` error for “interactive” requests instead. (The precise definition of “interactive” requests might change – the spirit here is to give helpful messages and avoid confusions.) Closes #20666, #23062, #23077, #23564 [Godfrey Chan, Jon Moss, Kasper Timm Hansen, Mike Clark, Matthew Draper]
* Merge branch 'master' into treewipAaron Patterson2016-02-2411-135/+70
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * master: (113 commits) remove useless method Updated file documentation [ci skip] changes caching guide to add note on weak etags Don't put config.action_mailer.perform_caching entry twice in development.rb Fix wording and wrong reference Add Ruby formatting to CHANGELOG entry Fix ActionView's cache section reference Do not define methods in the included block Add caching guide in ActionMailer basics Add ActionMailer configuration options Preparing for 5.0.0.beta3 release Update 5.0 release notes Enable tmp_restart plugin for puma Prep release for Rails 5 beta3 [ci skip] Move collection caching changelog entry. Ensure `drop_table` even if tests failure or interrupted :bomb: run the test @rafaelfranca :angry: Remove changelog entry for reverted commit Add CHANGELOG for https://github.com/rails/rails/pull/23734 [ci skip] No need CHANGELOG entry for #23849. ...
| * remove useless methodAaron Patterson2016-02-241-2/+0
| |
| * Prep release for Rails 5 beta3eileencodes2016-02-241-1/+1
| |
| * We are calling `to_s` in the method so we can call downcase nowRafael Mendonça França2016-02-221-3/+3
| |
| * Make per form token work when method is not providedRafael Mendonça França2016-02-221-1/+2
| | | | | | | | | | | | When `button_to 'Botton', url` form was being used the per form token was not correct because the method that is was being used to generate it was an empty string.
| * Do not pass more options that are needed.Rafael Mendonça França2016-02-221-1/+1
| | | | | | | | | | We only need action and method so pass them explicitly instead of merging the hash with HTML options.
| * Merge pull request #23752 from vipulnsward/23524-fix-button_to_deleteRafael Mendonça França2016-02-221-1/+1
| |\ | | | | | | | | | Fixed passing of delete method on button_to tag, creating wrong form csrf token
| | * Refactored Request Forgery CSRF PerFormTokensController tests and DRY'ed ↵Vipul A M2016-02-221-1/+1
| | | | | | | | | | | | them up.
| | * Fixed passing of delete method on button_to tag, creating wrong form csrf tokenVipul A M2016-02-211-2/+2
| | | | | | | | | | | | Fixes #23524
| * | [ci skip] Document collection caching better.Kasper Timm Hansen2016-02-211-2/+15
| | | | | | | | | | | | | | | | | | | | | | | | Why are we here? Where did we come from? Where are we going... in 5 minutes? These questions are not answered in this documentation. Instead collection caching is better clarified. How it works, how it can share caches with individual templates.
| * | Merge pull request #23695 from kaspth/remove-automatic-collection-cachingKasper Timm Hansen2016-02-207-133/+56
| |\ \ | | |/ | |/| Make collection caching explicit.
| | * Instrument cached collection renders.Kasper Timm Hansen2016-02-204-17/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Augments the collection caching with some instrumentation that's logged. For collections that have been cached like: ```ruby <%= render partial: 'notifications/notification', collection: @notifications, cached: true %> ``` We'll output a line showing how many cache hits we had when rendering it: ``` Rendered collection of notifications/_notification.html.erb [0 / 100 cache hits] (3396.5ms) ```
| | * Make collection caching explicit.Kasper Timm Hansen2016-02-205-116/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Having collection caching that wraps templates and automatically tries to infer if they are cachable proved to be too much of a hassle. We'd rather have it be something you explicitly turn on. This removes much of the code and docs to explain the previous automatic behavior. This change also removes scoped cache keys and passing cache_options.
* | | Merge branch 'master' into treewipAaron Patterson2016-02-191-2/+38
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * master: eliminate warnings about multiple primary keys on habtm join tables Add methods to array delegation from `Relation` Fix button_to's params option to support nested names. Dependencies clean up Deprecate AC::Parameters#== with a Hash Fix AC::Parameters#== with other AC::Parameters Tests for AC::Parameters#== better docs for ActiveSupport::TestCase#assert_nothing_raised remove needless `debug_exception_response_format` config [ci skip] partial pass over the API guide [ci skip] Fix `unsubscribed` server side behavior Use a semaphore to signal message availability Fix master build Remove github gems from the master bug report templates Truncate ActionCable broadcast message to 300 chars Remove unused require
| * | Merge pull request #17043 from jcoleman/fix-nested-params-in-button-toRafael França2016-02-191-2/+38
| |\ \ | | |/ | |/| Fix button_to's params option to support nested names.
| | * Fix button_to's params option to support nested names.James Coleman2016-02-191-2/+38
| | | | | | | | | | | | | | | | | | In e6e0579defcfcf94ef1c4c1c7659f374a5335cdb the `params` option was added to the `button_to` helper. However, the patch doesn't support nested hashes so `{a: {b: 'c'}}` for example gets turned into a hidden form input with the name 'a' and the value being the string representation of the `{b: 'c'}` nested hash. Since Rails supports nested hashes everywhere else (and even in the URL params of link_to and button_to), I believe this to be a bug/unfinished feature.
* | | push partial name regexp upAaron Patterson2016-02-181-2/+2
| | | | | | | | | | | | | | | we know that all child templates will be considered as "partials", so the only one that needs detection by name is the root node
* | | push injected dependencies up to the `digest` methodAaron Patterson2016-02-181-7/+7
| | | | | | | | | | | | | | | | | | Only the root node has injected dependencies, so we don't need to care about them at lower levels. This change pushes the injected dependencies up to where the user passed them in.
* | | cache all subnodes in the digest cacheAaron Patterson2016-02-181-8/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | this is for backwards compatibility. We should remove this after 5-0-stable is created because digest calculation should be amortized. Caching digests of subtrees will speed up digests for other trees that share the same children. However, this will also increase memory, and after the app warms up, then those subtrees will never be reused which means that memory is wasted.
* | | Merge branch 'master' into treewipAaron Patterson2016-02-182-10/+19
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * master: (27 commits) move digest cache on to the DetailsKey object remove object `hash` cache [ci skip] fix suggested change-replace 'an' with 'the in Rails engine guide' Missing documentation about hash algorithm option for MessageVerifier [ci skip] set `skip_listen` option to dummy appplication Fix the language in engines guide Add accidentally removed `#` [ci skip] fields_for_style needs to test for AC::Parameters Fix indentation for code block in changelog Remove accidentally duplicated change log title [ci skip] partially revert 69009f4473637a44ade26d954ef5ddea6ff903f2 Remove needless `case_insensitive_comparison` in mysql2 adapter modify to `error` also abort when specify fail fast option Implement ActionController::Parameters#inspect remove unused method Remove unused Journey code Add Action Cable CHANGELOG in release notes [ci skip] Show proper error message when a non-relation object is passed to AR::Relation#or Fix semantics of test names for finish option in batches_test Fix typo ... Conflicts: actionview/lib/action_view/digestor.rb
| * | move digest cache on to the DetailsKey objectAaron Patterson2016-02-182-9/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This moves digest calculation cache on to the details key object. Before, the digest cache was a class level ivar, and one of the keys was the hash value of the details key object: https://github.com/rails/rails/blob/13c4cc3b5aea02716b7459c0da641438077f5236/actionview/lib/action_view/digestor.rb#L28 An object's hash value is not unique, so it's possible for this cache key to produce colliding keys with no resolution. This commit move cache on to the details key object itself, so we know that the digests are always unique per details key object.
| * | remove object `hash` cacheAaron Patterson2016-02-181-6/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I don't think caching this method makes any difference on Ruby 2.0: ``` require 'benchmark/ips' class Foo alias :object_hash :hash attr_reader :hash def initialize @hash = object_hash end end class Bar end hash = {} foo = Foo.new bar = Bar.new Benchmark.ips do |x| x.report("foo") { hash[foo] } x.report("bar") { hash[bar] } x.report("foo.hash") { foo.hash } x.report("bar.hash") { bar.hash } end __END__ [aaron@TC ruby (trunk)]$ ruby test.rb Warming up -------------------------------------- foo 118.361k i/100ms bar 118.637k i/100ms Calculating ------------------------------------- foo 7.944M (± 3.1%) i/s - 39.769M bar 7.931M (± 3.4%) i/s - 39.625M [aaron@TC ruby (trunk)]$ ruby test.rb Warming up -------------------------------------- foo 122.180k i/100ms bar 120.492k i/100ms foo.hash 123.397k i/100ms bar.hash 119.312k i/100ms Calculating ------------------------------------- foo 8.002M (± 4.2%) i/s - 39.953M bar 8.037M (± 4.5%) i/s - 40.124M foo.hash 8.819M (± 3.9%) i/s - 44.053M bar.hash 7.856M (± 4.1%) i/s - 39.254M ```
* | | convert `digest` to only use kwargsAaron Patterson2016-02-171-4/+2
| | |