aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view
Commit message (Collapse)AuthorAgeFilesLines
* Fixes ActionMailer regression [#3059 state:resolved]Yehuda Katz2009-08-151-1/+1
|
* Got tests to pass with some more changes.Yehuda Katz2009-08-153-4/+16
| | | | | | | | | | | | | | | | * request.formats is much simpler now * For XHRs or Accept headers with a single item, we use the Accept header * For other requests, we use params[:format] or fallback to HTML * This is primarily to work around the fact that browsers provide completely broken Accept headers, so we have to whitelist the few cases we can specifically isolate and treat other requests as coming from the browser * For APIs, we can support single-item Accept headers, which disambiguates from the browsers * Requests to an action that only has an XML template from the browser will no longer find the template. This worked previously because most browsers provide a catch-all */*, but this was mostly accidental behavior. If you want to serve XML, either use the :xml format in links, or explicitly specify the XML template: render "template.xml".
* Caches and cache clearing seems to actually work, but the actual ↵Yehuda Katz2009-08-152-50/+89
| | | | architecture is kind of messy. Next: CLEAN UP.
* More cleanup of ActionView and reduction in need for blocks in some cases:Yehuda Katz2009-08-154-29/+11
| | | | | | | | * only one of partial_name or :as will be available as a local * `object` is removed * Simplify _layout_for in most cases. * Remove <% render :partial do |args| %> * <% render :partial do %> still works fine
* Clean up ActionView some:Yehuda Katz2009-08-155-64/+33
| | | | | | | | | | * Call _evaluate_assigns_and_ivars at the two entry points so we don't have to do a check at every render. * Make template.render viable without having to go through a wrapper method * Remove old TemplateHandler#render(template, local_assigns) path so we don't have to set self.template every time we render a template. * Move Template rescuing code to Template#render so it gets caught every time. * Pull in some tests from Pratik that test render @object in ActionView
* More perf work:Yehuda Katz2009-08-111-1/+0
| | | | | | | | | | | | | | * Move #set_cookie and #delete_cookie inline to optimize. These optimizations should almost certainly be sent back upstream to Rack. The optimization involves using an ivar for cookies instead of indexing into the headers each time. * Was able to use a bare Hash for headers now that cookies have their own joining semantics (some code assumed that the raw cookies were an Array). * Cache blankness of body on body= * Improve expand_cache_key for Arrays of a single element (common in our case) * Use a simple layout condition check unless conditions are used * Cache visible actions * Lazily load the UrlRewriter * Make etag an ivar that is set on prepare!
* Tentatively accept the ":as or :object, but not both" solutionYehuda Katz2009-08-111-22/+21
|
* Further experimentation. Was able to cut the cost of rendering 100 partials ↵Yehuda Katz2009-08-112-18/+51
| | | | | | | | | | in a collection in half. To discuss: What are the desired semantics (if any) for layouts in a collection. There are no tests for it at present, and I'm not sure if it's needed at all. Deprecated on this branch: `object` pointing at the current object in partials. You can still use the partial name, or use :as to achieve the same thing. This is obviously up for discussion.
* Add some more caching to the lookupYehuda Katz2009-08-111-12/+18
|
* This change causes some failing tests, but it should be possible to make ↵Yehuda Katz2009-08-111-2/+4
| | | | them pass with minimal performance impact.
* Introduce grouped_collection_select helper.codeape2009-08-091-0/+67
| | | | | | [#1249 state:committed] Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
* Make sure link_to generates the form with the specified :href if any [#2254 ↵Max Lapshin2009-08-101-1/+1
| | | | | | state:resolved] Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
* Fixed to_label_tag to accept id attribute without changing for attribute ↵Matt Duncan2009-08-091-0/+1
| | | | | | [#2660 status:resolved] Signed-off-by: José Valim <jose.valim@gmail.com>
* Support passing Redcloth options via textilize helper [#2973 state:resolved]rizwanreza2009-08-091-3/+11
| | | | Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
* Experimental: Improve performance of ActionView by preventing method cache ↵Yehuda Katz2009-08-091-13/+21
| | | | | | | | | | | | | | | | | | | | | | | | flushing due to runtime Kernel#extend: * The helper module adds a new _helper_serial property onto AbstractController subclasses * When #helper is used to add helpers to a class, the serial number is updated * An ActionView subclass is created and cached based on this serial number. * That subclass includes the helper module from the controller * Subsequent requests using the same controller with the same serial will result in reusing that subclass, rather than being forced to take an action (like include or extend) that will result in a global method cache flush on MRI and a flush of the entire AV class' cache on JRuby. * For now, this optimization is not applied to the RJS helpers, which results in a global method cache flush in MRI and a flush of the JavaScriptGenerator class in JRuby only when using RJS. * Since the effects are limited to using RJS, and would only affect JavaScriptGenerator in JRuby (as opposed to the entire view object), it seems worthwhile to apply this now. * This resulted in a significant performance improvement. I will have benchmarks in the next day or two that show the performance impact of the last several commits. * There is a small chance this could break existing code (although I'm not sure how). If that happens, please report it immediately.
* Cache controller_path on the AV instance to avoid needing to make additional ↵Yehuda Katz2009-08-091-1/+3
| | | | calls back into the controller for each attempt (this was done because these calls were adding up significantly in partial rendering and showing up on profiles)
* Rendering a template from ActionView will default to looking for partials ↵Yehuda Katz2009-08-092-2/+4
| | | | | | | | | only in the current mime type. * The old behavior was tested only as a side-effect of a different test--the original tests remain; a new template in the XML mime was added. * If you are relying on the current behavior and object to this change, please participate in http://groups.google.com/group/rubyonrails-core/browse_thread/thread/6ef25f3c108389bd
* Cache some more things to improve partial perfYehuda Katz2009-08-092-5/+9
|
* Went from 25% slower partials (vs. 2.3) to 10% faster. More to come.Yehuda Katz2009-08-092-5/+9
|
* Clean up partial object some more; replace passing around a block to a ↵Yehuda Katz2009-08-091-35/+39
| | | | single block ivar
* Clean up initializer and some of the internals of PartialRendererYehuda Katz2009-08-092-49/+45
|
* Ruby 1.9 compat: can't implicitly set instance var using block argJeremy Kemper2009-08-081-2/+2
|
* Don't call additional methods on builders passed to the atom_feed helper.Michael Koziarski2009-08-091-1/+1
| | | | | | Additionally, actually test that the atom_feed helper works with :xml as an option. [#1836 state:committed]
* Update truncate documentation / examples to more clearly demonstrate its ↵Steve St. Martin2009-08-081-8/+10
| | | | | | | | actual behavior [#3016 state:committed] Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
* Allow content_tag options to take an array [#1741 state:resolved] ↵rizwanreza2009-08-081-9/+7
| | | | | | | | | | [rizwanreza, Nick Quaranto] Example: content_tag('p', "limelight", :class => ["song", "play"]) # => <p class="song play">limelight</p> Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
* Allow radio buttons to work with booleans.José Valim2009-08-081-2/+2
| | | | Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
* Add :include_blank option for select_tag [#1987 status:resolved]rizwanreza2009-08-081-0/+7
| | | | | Signed-off-by: José Valim <jose.valim@gmail.com> Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
* First pass at making partial rendering an Object. More cleanup to come.Yehuda Katz2009-08-082-62/+83
|
* remove duplicate call to stringify_keys [#2587 status:resolved]Steve St. Martin2009-08-081-1/+1
| | | | Signed-off-by: José Valim <jose.valim@gmail.com>
* Fix number_to_precision rounding error [#2071 state:resolved]wmoxam2009-08-081-1/+1
| | | | Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
* Ruby 1.9.2: implicit argument passing of super from method defined by ↵Jeremy Kemper2009-08-071-3/+1
| | | | define_method() is not supported
* Rename find_by_parts and find_by_parts? to find and exists?Yehuda Katz2009-08-075-10/+10
|
* Get all ActionController partial rendering to use ActionView's partial code. ↵Yehuda Katz2009-08-071-0/+4
| | | | | | | | | | | | | | Consequences: * It is not possible to always pre-determine the layout before going to ActionView. This was *already* broken for render :partial => @object, :layout => true. This is now handled by overriding render_to_body in layouts.rb and manually injecting the partial's response. This needs to be done in ActionController since ActionController knows enough to get _layout_for_option. There is probably a better abstraction here. * As a result, all partial rendering can correctly restrict their layouts to the mime type of the rendered partial. This could have previously caused a bug in some edge cases. * If other layout-like options are added, they might need to add special code for the case of render :partial. We should try to think of an alternate solution, if possible, but this works for the cases we know of now.
* WhitespaceYehuda Katz2009-08-071-7/+7
|
* Continue reworking the partial path.Yehuda Katz2009-08-072-47/+22
| | | | * TODO: Review ActionController calling render_template for certain partials. Might we be able to save logic by always delegating to AV's render_partial?
* Modify various partial methods to carry along the block that can be passed ↵Yehuda Katz2009-08-073-44/+54
| | | | | | | | | | in with render * _render_single_template, which renders a template without layout * _render_partial_unknown_type, which renders a partial of unknown type (the entry method for most partial rendering; supports strings, objects, and collections) * _render_partial_object, which renders a partial for a single object. * extracted _render_partial_path so it can be used to render the spacer without going through the public render :partial
* Some more AV work:Yehuda Katz2009-08-072-26/+25
| | | | | | | | * rename _render_partial to _render_partial_unknown_type to reflect that for this call, we don't know the type. * Merge _render_partial_with_block and _render_partial_with_layout to _render_partial * TODO: Check to see if any more logic can be shared * TODO: See about streamlining block path so we can get rid of @_proc_for_layout * Remove @exempt_from_layout as it is no longer needed
* Replace _render_template_with_layout with _render_template since the layout ↵Yehuda Katz2009-08-073-13/+17
| | | | is optional
* Some more AV refactoring:Yehuda Katz2009-08-072-15/+6
| | | | | * remove no longer used _array_like_objects * _render_content_with_layout renamed to _render_content since layout it optional * remove check for optional layout before _render_content
* Start cleaning up partial pathYehuda Katz2009-08-072-9/+17
|
* This is handled by the resolver nowYehuda Katz2009-08-071-24/+5
|
* Clean up render @object a bit more.Yehuda Katz2009-08-071-6/+19
|
* Improve a path in _render_partialYehuda Katz2009-08-062-24/+27
|
* replace _render_*_from_controller with render_* as they are intended to be ↵Yehuda Katz2009-08-063-4/+4
| | | | public
* Make sure javascript_include_tag/stylesheet_link_tag does not append ".js" ↵Matthew Rudy Jacobs2009-08-051-10/+14
| | | | | | or ".css" onto external urls [#1664 state:resolved] Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
* Fix tag helpers so that all HTML element boolean attributes render according ↵Marc Love2009-07-302-2/+5
| | | | | | to the specs. Added all boolean attributes listed in the XHTML 1.0 specs (http://www.w3.org/TR/xhtml1/guidelines.html) and HTML 5 specs (http://www.whatwg.org/specs/web-apps/current-work). HTML 5 boolean attribute rendering was broken in commit 1e2d7229602f467cfdc0ef606b5ef8a5566a1501 / [#2864 state:resolved]. Signed-off-by: Yehuda Katz <wycats@gmail.com>
* Add support for error_messages_for(@obj)Yehuda Katz2009-07-281-6/+24
|
* Merge docrailsPratik Naik2009-07-254-77/+76
|
* First effort at new Ajax helpersYehuda Katz2009-07-202-0/+69
|
* Rename ActiveRecordHelper to ActiveModelHelperYehuda Katz2009-07-203-5/+3
|