aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/lib/action_view/rendering.rb
Commit message (Collapse)AuthorAgeFilesLines
* Enable `Layout/EmptyLinesAroundAccessModifier` copRyuta Kamizono2019-06-131-1/+0
| | | | | | | | | | | We sometimes say "✂️ newline after `private`" in a code review (e.g. https://github.com/rails/rails/pull/18546#discussion_r23188776, https://github.com/rails/rails/pull/34832#discussion_r244847195). Now `Layout/EmptyLinesAroundAccessModifier` cop have new enforced style `EnforcedStyle: only_before` (https://github.com/rubocop-hq/rubocop/pull/7059). That cop and enforced style will reduce the our code review cost.
* Avoid assigning [nil] to formatsJohn Hawthorn2019-03-191-1/+1
|
* Create templates with format=nilJohn Hawthorn2019-02-261-1/+2
|
* Ensure that rendered templates always have a formatAaron Patterson2019-02-221-2/+1
| | | | | This removes one call to `lookup_context` and also eliminates a conditional in `_render_template`.
* Deprecate LookupContext#rendered_formatAaron Patterson2019-02-191-6/+9
| | | | | We no longer depend on `rendered_format` side effects, so we can remove this method now. 🎉
* Return rendered template information instead of just stringsAaron Patterson2019-02-191-2/+7
| | | | | | | | | | | | This commit introduces "rendered template" and "rendered collection" objects. The template renderers can now return a more complex object than just strings. This allows the framework to get more information about the templates that were rendered. In this commit we use the rendered template object to set the "rendered_format" on the lookup context in the controller rather than all the way in the template renderer. That means we don't need to check the "rendered_format" every time we render a template, we just do it once after all templates have been rendered.
* Turn lookup context in to a stack, push and pop if formats changeAaron Patterson2019-02-111-2/+2
| | | | | | | | | | | This commit keeps a stack of lookup contexts on the ActionView::Base instance. If a format is passed to render, we instantiate a new lookup context and push it on the stack, that way any child calls to "render" will use the same format information as the parent. This also isolates "sibling" calls to render (multiple calls to render in the same template). Fixes #35222 #34138
* Split digest cache from details identity cacheAaron Patterson2019-02-081-0/+1
| | | | | This commit splits the digest cache from the "details identity" cache. Now both caches can be managed independently.
* Rename method so it is more descriptiveAaron Patterson2019-02-061-3/+3
|
* Regenerate AV::Base subclass when DetailsKey gets clearedAaron Patterson2019-02-061-2/+23
|
* Move templates to an anonymous subclass of AV::BaseAaron Patterson2019-02-061-15/+6
| | | | | Now we can throw away the subclass and the generated methods will get GC'd too
* Only cache the view_context_class in one placeAaron Patterson2019-01-181-3/+1
| | | | | | | This patch removes the instance writer of view_context_class. Subclasses may override it, but it doesn't need to be written. This also eliminates the need to cache the return value of the class level `view_context_class` method.
* Fix `View.new` method call with arguments syntaxRyuta Kamizono2018-12-181-1/+1
| | | [ci skip]
* Fix doc formattingT.J. Schuck2018-12-171-4/+5
| | | | [ci skip]
* [Action View] require_relative => requireAkira Matsuda2017-10-211-1/+1
| | | | This basically reverts c4d1a4efeec6f0b5b58222993aa0bec85a19b6a8
* Remove `:api:` tag that has leaked on the doc directly [ci skip]Ryuta Kamizono2017-09-301-5/+1
| | | | | | | | | | | | Currently `:api:` tag has leaked on the doc directly since RDoc doesn't support `:api:` tag directive. http://api.rubyonrails.org/v5.1/classes/AbstractController/Rendering.html So `:api: private` doesn't work as expected. We are using `:nodoc:` for the purpose. Related #13989.
* Use frozen string literal in actionview/Kir Shatrov2017-07-241-0/+2
|
* [Action View] require => require_relativeAkira Matsuda2017-07-011-1/+1
|
* make `render` work with AC::Paramsyuuji.yaginuma2017-01-151-1/+5
| | | | | | | | In 4.2, since AC::Params inherited `Hash`, processing in the case of `Hash` was done. But in 5.x, since AC::Params does not inherit `Hash`, need to add care for AC::Params. Related to 00285e7cf75c96553719072a27c27e4ab7d25b40
* No need to nodoc private methodsAkira Matsuda2016-12-241-2/+2
|
* Add more rubocop rules about whitespacesRafael Mendonça França2016-10-291-1/+1
|
* Remove ActionView dependence on ActionPack's Mime implementationJon Moss2016-01-171-1/+1
|
* Pull `plain` content type handling up to `render`Aaron Patterson2015-08-261-1/+1
| | | | | `render` is the only possible source for the `plain` option. Pulling the conditional up to the `render` method removes far away conditionals
* stop passing the options hash to `_process_format`Aaron Patterson2015-08-261-1/+1
| | | | | | We don't need to pass the full hash just to pull one value out. It's better to just pass the value that the method needs to know about so that we can abstract it away from "options"
* [skip ci] Lookup can be a noun but it is not a verbJon Atack2015-07-171-1/+1
| | | | Various grammar corrections and wrap to 80 characters.
* [ci skip] Add '.'yui-knk2015-06-141-1/+1
|
* Support `:assigns` option when rendering with controllers/mailers.brainopia2015-01-221-2/+5
|
* let mailer templates generate URLs by default [Xavier Noria, Richard Schneeman]Xavier Noria2014-11-241-2/+2
|
* Revert "Revert "Merge pull request #16888 from jejacks0n/render_template""Godfrey Chan2014-09-261-2/+2
| | | | This reverts commit 585e75696b31395aee895e5366e331c07c3f5ee1.
* Revert "Merge pull request #16888 from jejacks0n/render_template"Godfrey Chan2014-09-231-2/+2
| | | | | | | This reverts commit 07635a74b5ee08dcba3f6617def6230d8f114fe5, reversing changes made to 1b5f61a025b6ce1ee52b7148e3ed2a9acbde28b9. Reason: it's not ready :bomb:, see https://github.com/rails/rails/pull/16888#issuecomment-56400816
* Changes default render behavior from file to template.jejacks0n2014-09-111-2/+2
|
* Deprecate `*_path` methods in mailers@schneems and @sgrif2014-07-301-2/+3
| | | | | | | | | | | Email does not support relative links since there is no implicit host. Therefore all links inside of emails must be fully qualified URLs. All path helpers are now deprecated. When removed, the error will give early indication to developers to use `*_url` methods instead. Currently if a developer uses a `*_path` helper, their tests and `mail_view` will not catch the mistake. The only way to see the error is by sending emails in production. Preventing sending out emails with non-working path's is the desired end goal of this PR. Currently path helpers are mixed-in to controllers (the ActionMailer::Base acts as a controller). All `*_url` and `*_path` helpers are made available through the same module. This PR separates this behavior into two modules so we can extend the `*_path` methods to add a Deprecation to them. Once deprecated we can use this same area to raise a NoMethodError and add an informative message directing the developer to use `*_url` instead. The module with warnings is only mixed in when a controller returns false from the newly added `supports_relative_path?`. Paired @sgrif & @schneems
* documentation fixGaurav Sharma2014-05-241-2/+2
|
* Do note remove `Content-Type` when `render :body`Prem Sichanugrist2014-03-051-5/+0
| | | | | | | | | | | | | `render :body` should just not set the `Content-Type` header. By removing the header, it breaks the compatibility with other parts. After this commit, `render :body` will returns `text/html` content type, sets by default from `ActionDispatch::Response`, and it will preserve the overridden content type if you override it. Fixes #14197, #14238 This partially reverts commit 3047376870d4a7adc7ff15c3cb4852e073c8f1da.
* Add `#no_content_type` attribute to `AD::Response`Prem Sichanugrist2014-02-181-0/+5
| | | | | Setting this attribute to `true` will remove the content type header from the request. This is use in `render :body` feature.
* Introduce `render :body` for render raw contentPrem Sichanugrist2014-02-181-1/+1
| | | | | | | | | | | | This is an option for sending a raw content back to browser. Note that this rendering option will unset the default content type and does not include "Content-Type" header back in the response. You should only use this option if you are expecting the "Content-Type" header to not be set. More information on "Content-Type" header can be found on RFC 2616, section 7.2.1. Please see #12374 for more detail.
* Variant negotiationLukasz Strzalkowski2014-02-131-1/+1
| | | | | | | | | | | | | | Allow setting `request.variant` as an array - an order in which they will be rendered. For example: request.variant = [:tablet, :phone] respond_to do |format| format.html.none format.html.phone # this gets rendered end
* Action Pack VariantsŁukasz Strzałkowski2013-12-041-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | By default, variants in the templates will be picked up if a variant is set and there's a match. The format will be: app/views/projects/show.html.erb app/views/projects/show.html+tablet.erb app/views/projects/show.html+phone.erb If request.variant = :tablet is set, we'll automatically be rendering the html+tablet template. In the controller, we can also tailer to the variants with this syntax: class ProjectsController < ActionController::Base def show respond_to do |format| format.html do |html| @stars = @project.stars html.tablet { @notifications = @project.notifications } html.phone { @chat_heads = @project.chat_heads } end format.js format.atom end end end The variant itself is nil by default, but can be set in before filters, like so: class ApplicationController < ActionController::Base before_action do if request.user_agent =~ /iPad/ request.variant = :tablet end end end This is modeled loosely on custom mime types, but it's specifically not intended to be used together. If you're going to make a custom mime type, you don't need a variant. Variants are for variations on a single mime types.
* Renderer#_render_template should be privateRafael Mendonça França2013-11-191-7/+7
| | | | Closes #12831
* Remove remaining coupling with AV in MimeRespondsJosé Valim2013-09-091-0/+7
|
* Remove BasicRendering and remove template functionality from AbsC::RenderingJosé Valim2013-09-091-7/+5
|
* Move skeleton methods from AV to AbsCŁukasz Strzałkowski2013-09-031-22/+0
| | | | | | | | | | The methods: * #render_to_body * #render_to_string * #_normalize_render Haven't had anything specyfic to ActionView. This was common code which should belong to AbstractController
* Return to using protected_instance_variables in AVŁukasz Strzałkowski2013-09-021-4/+0
|
* Fist stab on basic renderingŁukasz Strzałkowski2013-08-251-2/+0
|
* Add #rendered_format method to controllersŁukasz Strzałkowski2013-08-251-0/+4
|
* Add missing requires inside AVŁukasz Strzałkowski2013-08-251-0/+1
|
* Revert "Move setting content_type to AV"Łukasz Strzałkowski2013-08-251-2/+0
| | | | This reverts commit f4d602aff6cec80304b131ecfcc2676d0304f0cc.
* Move setting content_type to AVŁukasz Strzałkowski2013-08-251-0/+2
|
* Use concat to avoid allocating additional arrayŁukasz Strzałkowski2013-08-251-1/+1
|
* Pass args to render's super methodŁukasz Strzałkowski2013-08-251-1/+2
|