Commit Graph

2154 Commits

Author SHA1 Message Date
wycats ffe001f19d Changes made while working on upgrading cells to Rails 3 2010-06-02 22:56:41 +02:00
Xavier Noria 315e8952df revises the documentation of String#truncate and the truncate helper 2010-06-02 01:35:04 +02:00
David Heinemeier Hansson d57397c4b6 Extracted String#truncate from TextHelper#truncate [DHH] 2010-06-01 16:38:42 -05:00
David Heinemeier Hansson ea037ff557 Base options cant live in lazy loaded helpers as they then wont be available to set for config 2010-05-31 13:48:47 -05:00
wycats 0078df6b54 Update template to allow handlers to more cleanly handle encodings (ht: nex3) 2010-05-30 11:37:35 +02:00
Michael Koziarski 668f7dd5d0 Merge commit 'mislav/auto_link' 2010-05-29 14:05:56 +12:00
David Chelimsky e02db06ece In AV::TC, move protect_against_forgery? from the test_case to the
_helper module included in the view.

- ensures that protect_against_forgery? is present when a helper
  included in a partial that is rendered by the template under test
  calls it (which happens in FormTagHelper#extra_tags_for_form, for
  example).

[#4700 state:resolved]

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-05-26 15:59:03 +02:00
David Chelimsky 163152bfd0 Support configuration of controller.controller_path on instances of
ActionView::TestCase::TestController without stubs. Just say:

  @controller.controller_path = "path/i/need/for/this/test"

[#4697 state:resolved]

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-05-26 08:49:57 +02:00
Jeremy Kemper f53a6d8149 i18n: t() handles single keys returning an Array, also 2010-05-24 20:30:21 -07:00
Jeremy Kemper d8d38bedfd HTML safety: fix textarea with nil content 2010-05-24 20:18:25 -07:00
Santiago Pastorino b5f9c8822d translate method doesn't support arrays anymore and is optimized to be used with strings or symbols
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-05-24 23:42:20 +02:00
Santiago Pastorino 2b8eb5404e Revert "translation method for arrays on TranslationHelper module returns an array where values for keys of the form (.|_)html keys are html_safe"
This reverts commit 05c95b5c58.

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-05-24 23:41:55 +02:00
David Chelimsky 8e583b69e8 Move AV::TC to AV::TC::Behavior [#4678 state:resolved]
- enables alternative testing frameworks to include AV::TC::Behavior
  instead of subclassing AV::TC
- also added tests and code for:
  - test view delegates :notice to request.flash
    - useful since generators generate views that use notice
  - test case doesn't try to include modules that are actually
    classes

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-05-24 22:58:46 +02:00
Santiago Pastorino 05c95b5c58 translation method for arrays on TranslationHelper module returns an array where values for keys of the form (.|_)html keys are html_safe
[#4675]

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-05-24 20:12:43 +02:00
Mislav Marohnić 8f0b2138ee avoid auto_linking already linked emails; more robust detection of linked URLs
References #1523  [#1862 state:resolved]  [#3591 state:resolved]

Add test that shows how link text can contain HTML if needed:
the trick is using block form in combination with `raw`.
Let link text be automatically HTML-escaped

[#2017 state:resolved]
2010-05-24 11:25:24 +02:00
Mislav Marohnić 133ada6ab0 auto_link: support arbitrary URI schemes like "ftp:" and "file:"
recognizes all URI scheme allowed characters, such as colon and period.

[#3494 state:resolved]
2010-05-24 11:25:24 +02:00
Santiago Pastorino aacf2581cd refactor evals and adds some __FILE__ and __LINE__
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-05-20 15:18:57 +02:00
Xavier Noria 7f07cc364a Merge remote branch 'rails/master' 2010-05-19 23:29:39 +02:00
Santiago Pastorino 59c7b0c23a Avoid instance variable @output_buffer not initialized
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-05-19 12:59:29 +02:00
Marius Nuennerich aa4fe9fb33 fix documentation typo
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
2010-05-18 19:29:17 -03:00
wycats f09d8f3e68 Merge remote branch 'origin/master' 2010-05-17 19:51:30 +04:00
wycats 02c36cf5cb Make sure encoding changes don't break 1.8 2010-05-17 19:39:38 +04:00
Santiago Pastorino c7e6777961 Added default currency values to NumberHelper and pass them to I18n.translate
[#4604 state:committed]

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-05-17 17:39:33 +02:00
Rizwan Reza d148a6f6ba Merge branch 'master' of git://github.com/rails/rails 2010-05-17 02:40:15 +04:30
Jeremy Kemper ade756fe42 Moved encoding work in progress to a feature branch.
This reverts commits af0d1a8815 and 64d109e353.
2010-05-16 13:55:29 -07:00
wycats 64d109e353 Significantly improved internal encoding heuristics and support.
* Default Encoding.default_internal to UTF-8
* Eliminated the use of file-wide magic comments to coerce code evaluated inside the file
* Read templates as BINARY, use default_external or template-wide magic comments
  inside the Template to set the initial encoding
  * This means that template handlers in Ruby 1.9 will receive Strings encoded
    in default_internal (UTF-8 by default)
* Create a better Exception for encoding issues, and use it when the template
  source has bytes that are not compatible with the specified encoding
* Allow template handlers to opt-into handling BINARY. If they do so, they
  need to do some of their own manual encoding work
* Added a "Configuration Gotchas" section to the intro Rails Guide instructing
  users to use UTF-8 for everything
* Use config.encoding= in Ruby 1.8, and raise if a value that is an invalid
  $KCODE value is used

Also:
* Fixed a few tests that were assert() rather than assert_equal() and
  were caught by Minitest requiring a String for the message
* Fixed a test where an assert_select was misformed, also caught by
  Minitest being more restrictive
* Fixed a test where a Rack response was returning a String rather
  than an Enumerable
2010-05-16 22:44:43 +04:00
wycats af0d1a8815 Initial work to improve the state of encodings for templates 2010-05-16 22:43:35 +04:00
Simon Jefford f58bdae1f7 Check blocks are not incorrectly detected when compiling erubis templates [#4575 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-05-16 15:05:07 +02:00
pleax 2dc1402417 added support for html attributes in options_for_select [#2165]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-05-16 14:33:04 +02:00
Jeff Dean 6617d01893 Sending :id => nil to form helpers now properly omits the "id" html element [#4559 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-05-15 22:30:21 +02:00
José Valim f055bc05d5 Optimize the code added in fa99de0bd0 2010-05-15 21:55:03 +02:00
Jeff Kreeftmeijer da90fe9466 make sure `as` is set before trying to build an #{as}_counter. [#2804 state:resolved]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-05-15 11:19:41 -07:00
Jeff Kreeftmeijer fa99de0bd0 partial counters with :as [#2804 state:resolved]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-05-15 10:32:23 -07:00
Jeroen van Dijk f45714bb4a Added extra documentation for content_for helper 2010-05-15 15:33:30 +02:00
Marc-Andre Lafortune 9869ee77cd Accept :alt => nil on image_tag [#4558 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-05-15 09:43:15 +02:00
José Valim d18a2742e0 Improve previous patch a bit [#3645 state:resolved] 2010-05-15 09:08:40 +02:00
Stephen Celis 6e69b42b21 Let label helpers accept blocks.
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-05-15 08:59:08 +02:00
José Valim 6c2d974e15 Use annoted source code in Template:Error to avoid special cases in the show exceptions middleware. 2010-05-09 12:52:30 +03:00
Lawrence Pit 9bd91b00b8 Favor %{} in all code instead of (deprecated) {{}} as interpolation syntax for I18n
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-05-03 13:37:32 +02:00
José Valim 8ae9b05fa0 Make backtrace_cleaner work as expected. Prior to this patch, the Full Trace rarely showed the full trace. Also, increase performance considerably. 2010-05-03 12:59:48 +02:00
David Chelimsky 8672a97e11 add NullResolver
[#4523 state:resolved]

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-05-02 22:45:54 +02:00
David Chelimsky 91125f9927 move FixtureResolver to a file that is accessible outside Rails' own tests
[#4522 state:resolved]

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-05-02 22:45:54 +02:00
Justin George 731d4392e4 Change event namespace ordering to most-significant first [#4504 state:resolved]
More work still needs to be done on some of these names
(render_template.action_view and render_template!.action_view particularly)
but this allows (for example) /^sql/ to subscribe to all
the various ORMs without further modification

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-05-02 22:45:54 +02:00
José Valim a61a6d206b Speed up I18n helpers in views and add entry to CHANGELOG. 2010-05-01 22:38:57 +02:00
José Valim 13867a3f5f Use %{} syntax in I18n (faster) instead of {{}}. 2010-05-01 12:54:52 +02:00
wycats 0fe8827bf3 Merge branch 'master' of github.com:rails/rails 2010-04-30 11:17:58 -07:00
Neeraj Singh a003a39bac removing the extra assignment statement [#4432 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-04-30 13:20:14 +02:00
Neeraj Singh 68c96fad55 Fix form builder and form helpers inconsistencies [#4432 state:resolved]
* datetime_select and select_datetime should be consistent as much as possible
* date_select and select_date should be consistent as much as possible
* time_select and select_time should be consistent as much as possible

Signed-off-by: José Valim <jose.valim@gmail.com>
2010-04-29 13:40:55 +02:00
Jeremy Kemper fe93cd8bc5 Fix prototype grep depending on JSON encoding regexp as JavaScript regexp 2010-04-27 22:52:37 -07:00
Nathan Weizenbaum ef5dadaf93 Only run load hooks once a file has been fully loaded.
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-04-27 21:37:40 -07:00
wycats 91963e9e33 Merge branch 'master' of github.com:rails/rails 2010-04-26 23:32:30 -07:00
Jeremy Kemper 72a3e4b77b Rename fieldWithErrors style to field_with_errors. Remove unused alert style. 2010-04-24 15:02:12 -07:00
Nicolas Sanguinetti d5d717161d Allow :remote => false to be passed to link_to
And add tests for `button_to` and `form_tag` which currently behave as
expected, so we avoid a regression.

Signed-off-by: wycats <wycats@gmail.com>
2010-04-22 15:29:59 -07:00
Santiago Pastorino ebf9820f7e HWIA symbolize_keys now returns a hash so no need to do this anymore
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-04-22 09:07:53 -07:00
José Valim 4163ccec23 Clean up the config object in ActionPack. Create config_accessor which just delegates to the config object, reducing the number of deprecations and add specific tests. 2010-04-22 12:00:13 +02:00
Santiago Pastorino 5c9c30ac65 url_for now works with HashWithIndifferentAccess ht jay [#4391 state:committed]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-04-21 17:09:14 -07:00
Carl Lerche eb83c9cf42 Merge remote branch 'spastorino/master' 2010-04-18 13:04:04 -07:00
Carl Lerche d32a4cbaa5 Merge branch 'master' of github.com:rails/rails 2010-04-18 13:02:37 -07:00
Santiago Pastorino 9c4ac84e49 perform_caching should be accessed through the controller here 2010-04-17 23:40:03 -03:00
wycats 457f7709e9 Missing requires 2010-04-16 21:59:09 -04:00
Sam Elliott c16c248912 mail_to with :encode => :javascript now outputs safe html
Signed-off-by: Carl Lerche <carllerche@mac.com>
2010-04-16 15:53:55 -07:00
Kieran Pilkington 001ca893c6 Mark the result of grouped_options_for_select as HTML safe [#4322 state:committed]
Signed-off-by: Xavier Noria <fxn@hashref.com>
2010-04-16 15:05:41 -07:00
Santiago Pastorino and Carl Lerche 0ea434e2f4 Make perform_caching work again, with the tests passing and backward compatible 2010-04-15 18:25:08 -03:00
Santiago Pastorino a618ad358a Make use of config.perform_caching 2010-04-14 22:35:13 -07:00
Craig Davey 5208cc3cf5 Changed translate helper so that it doesn’t mark every translation as safe HTML. Only keys with a "_html" suffix and keys named "html" are considered to be safe HTML. All other translations are left untouched.
Signed-off-by: David Heinemeier Hansson <david@loudthinking.com>
2010-04-13 17:35:10 -07:00
Craig R Webster 54533d28ef Fix a typo in the documentation. [#4318 state:resolved]
Signed-off-by: wycats <wycats@gmail.com>
2010-04-12 21:45:39 -07:00
José Valim 3eda7cf090 Let capture handle the yielding. 2010-04-12 10:55:43 +02:00
José Valim 3fc609ee41 Fix ActionMailer test broken in 99d5459921 2010-04-12 10:50:27 +02:00
Ryan Bates e5f392ce8f fields_for returns block result when outside ERB
Signed-off-by: wycats <wycats@gmail.com>
2010-04-11 19:26:00 -07:00
Xavier Noria fb4b454de1 your beloved typo only spotted in github diff no matter how careful you were before pushing 2010-04-11 02:56:19 -07:00
Xavier Noria 9111f4268b second pass to the intro rdoc of form_helper.rb 2010-04-11 02:50:07 -07:00
Xavier Noria b7d8f5a329 removes some duplication in previous edit 2010-04-10 16:53:25 -07:00
Xavier Noria ef2ec071de makes a pass to the intro rdoc of form_helper.rb, will revise form_for tomorrow 2010-04-10 16:49:39 -07:00
Santiago Pastorino 95d13cca7b form_for :as rubydoc and tidy up a bit the form_for doc 2010-04-10 15:32:20 -07:00
José Valim 55d159b25d Remove error_messages_for data from locale. 2010-04-10 11:50:09 +02:00
José Valim ece157e950 Move verification to a plugin as well: http://github.com/rails/verification.git 2010-04-10 11:47:20 +02:00
José Valim cd79a46174 Remove input, form, error_messages_for and error_message_on from the framework. If you think you will miss them, feel free to use the dynamic_form plugin available at http://github.com/rails/dynamic_form 2010-04-10 10:53:05 +02:00
Santiago Pastorino 13e00ce606 fix stack trace lines on class_eval
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-04-09 21:28:49 +02:00
Xavier Noria 8b2266a8da image_path -> path_to_image in a couple of places, plus motivation for path_to_image in rdoc 2010-04-09 11:10:26 -07:00
David Heinemeier Hansson 38f1d3543e Stray carrier returns 2010-04-09 11:05:26 -07:00
Jeremy Kemper 19e6006636 Layout contents are html-safe 2010-04-09 09:14:02 -07:00
Xavier Noria fd7202a756 adds #favicon_link_tag back, rdoc explains why it is useful, and how to get a link for Mobile Safari with it 2010-04-08 18:13:23 -07:00
Carl Lerche 99d5459921 Fixed that default locale templates should be used if the current locale template is missing [DHH] 2010-04-08 18:11:26 -07:00
David Heinemeier Hansson 5f808b865c Consistently use lowercase instead of camelCase for all JS class names in Rails 2010-04-08 12:17:46 -07:00
David Heinemeier Hansson 00ee9b3369 Revert "adds #favicon_link_tag and #apple_touch_icon_link_tag" -- these tags are too specific.
This reverts commit 6891f46d10, ec8610cfdc, and  d18ff1b7ef.
2010-04-08 11:49:34 -07:00
Jeremy Kemper e7f0d37c91 Remove superfluous condition 2010-04-08 11:38:25 -07:00
Xavier Noria ec8610cfdc adds a default source to #apple_touch_icon_link_tag 2010-04-07 13:20:52 -07:00
Xavier Noria d18ff1b7ef new helpers #favicon_link_tag and #apple_touch_icon_link_tag 2010-04-07 13:04:52 -07:00
Xavier Noria 4c4fd1a60f Merge commit 'rails/master' 2010-04-06 15:38:05 -07:00
David Heinemeier Hansson f8730e5ce6 Added all the new HTML5 form types as individual form tag methods (search, url, number, etc) (Closes #3646) [Stephen Celis] 2010-04-05 16:07:44 -07:00
Santiago Pastorino d270da569e changed from :object_name to :as on form_for api 2010-04-05 18:55:37 -03:00
Santiago Pastorino c6746ffaf4 deprecate form_for(symbol_or_string, ...) in favor of :object_name option 2010-04-05 17:47:02 -03:00
Xavier Noria 9ed919eb0b revises some <%= in rdoc 2010-04-05 02:51:26 -07:00
Xavier Noria 43d02dffcb <% yield to <%= yield in rdoc of _layout_for, and copy-edits it now that we are on it 2010-04-05 02:16:24 -07:00
Rizwan Reza 181e4aac52 We don't need explicit :url => { :action => "create" } in form_for when following Rails conventions. 2010-04-05 06:45:15 +04:30
Xavier Noria 723e91e9fd Merge commit 'docrails/master' 2010-04-04 13:36:15 -07:00
Andrew White 00884a5901 Merge branch 'master' of github.com:lifo/docrails 2010-04-04 17:34:23 +01:00
Andrew White 48b2451142 Update various documentation examples to use new routing DSL 2010-04-04 17:34:13 +01:00
Aman Gupta af89c58696 Use a constant proc to generate ActionView::Template finalizers. For some strange reason, finalizers created via ActionView::Template.finalizer_for cause Template instances to leak on MRI.
Signed-off-by: wycats <wycats@gmail.com>
2010-04-04 02:10:21 -07:00
wycats ab8bf9e152 * Change the object used in routing constraints to be an instance of
ActionDispatch::Request rather than Rack::Request.

* Changed ActionDispatch::Request#method to return a String, to be
  compatible with the Rack::Request superclass.

* Changed ActionDispatch::Request#method to return the original
  method in the case of methodoverride and #request_method not to,
  to be compatible with Rack::Request
2010-04-03 20:24:30 -07:00
Santiago Pastorino 8f9becb426 :action => "create" added to form_for with name only to show appropiate behavior 2010-04-03 18:36:29 -03:00
Santiago Pastorino 10ad15861f :action => "update" used in a non RESTful way confuses 2010-04-03 18:22:58 -03:00
wycats 3eb97531b8 Refactored url_for in AV to have its own instances of the helpers instead of proxying back to the controller. This potentially allows for more standalone usage of AV. It also kicked up a lot of dust in the tests, which were mocking out controllers to get this behavior. By moving it to the view, it made a lot of the tests more standalone (a win) 2010-04-03 02:44:02 -07:00
wycats b29e893688 Fix memory leak in dev mode 2010-04-02 19:21:19 -07:00
Jeremy Kemper ee7605ecf0 Key partial name cache on controller and object class *names* to avoid memory leaks in dev mode 2010-04-02 15:54:38 -07:00
Bernardo de Pádua 81e6933246 Fix error in number_with_precision with :significant option and zero value [#4306 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-04-01 07:25:14 +02:00
Jeremy Kemper 3859828d89 HTML safety: give a deprecation warning if an array of option tags is passed to select tag. Be sure to join the tag yourself and mark them .html_safe 2010-03-31 19:51:54 -07:00
José Valim 05337f61f9 yield always return an array, so we don't need to use .key? 2010-03-31 16:02:59 +02:00
wycats 4aded43b73 Replace the placeholder base_hook API with on_load. To specify some code that
should run during framework load do:

ActiveSupport.on_load(:action_controller) do
  # Code run in the context of AC::Base
end
2010-03-29 17:08:50 -07:00
wycats 201e8986b1 Updated asset_template_path to asset_path and have it also support a String [#4247 state:resolved] 2010-03-28 18:46:18 -07:00
Craig R Webster 49bc6a249e Allow customisation of asset path generation using a proc.
Set config.action_controller.asset_path_template to a proc that takes one
argument - the direct, unchanged asset path - and returns a path to that asset
using the scheme that your assets require.

This is useful if you have a setup which scales by introducing new application
servers where the mtime of the asset files may not be the same as those of the
asset files on your previous servers, but it does require your web servers to
have knowledge of the asset template paths that you rewrite to so it's not
suitable for out-of-the-box use. An example of configuring asset path
generation and rewriting these paths using Apache is included in
actionpack/lib/action_view/helpers/asset_tag_helper.rb.

Signed-off-by: wycats <wycats@gmail.com>
2010-03-28 18:35:05 -07:00
Paco Guzman 878a9e02f6 html_tag option to wrap error_message_on text [#4283 state:resolved]
Signed-off-by: wycats <wycats@gmail.com>
2010-03-28 17:27:10 -07:00
Xavier Noria 76f024ac8d adds missing requires for Object#blank? and Object#present? 2010-03-28 14:15:02 +02:00
José Valim a09e99259c Ensure details are frozen after @details_keys lookup. The implementation waits to freeze until the last required moment, to avoid duping hashes. 2010-03-27 20:52:11 +01:00
wycats fdebc7f55b Missing require 2010-03-27 12:39:28 -07:00
wycats 0a352056a4 Fixes a bug where error_messages_for was returning an empty div [#4048 state:resolved] (ht: Geoff Garside) 2010-03-27 03:10:05 -07:00
Daniel Rodríguez Troitiño 334983eca0 Recovers error_messages for ActiveRecordInstanceTag. [#4078 state:resolved]
Signed-off-by: wycats <wycats@gmail.com>
2010-03-27 01:56:20 -07:00
Sam Elliott and Ryan Bigg 62937b8fb0 Use ActiveSupport::Autoload for view helpers. [#4237 state:resolved]
Signed-off-by: wycats <wycats@gmail.com>
2010-03-27 01:13:45 -07:00
wycats 197904341f Merge branch 'master' into docrails 2010-03-26 15:10:24 -07:00
José Valim 395d6648ce Move application configuration to the application configuration object, remove railtie_name and engine_name and allow to set the configuration object. 2010-03-26 18:47:55 +01:00
José Valim 4c7c406155 Remove reference to unexistent methods and fix typo. 2010-03-26 01:12:24 +01:00
retr0h cbdb4aa287 Updated ActionController::Base.asset_host example
The example provided contrived.  It is not useful when wanting to use
1-based asset hosts (since it would generate a random asset host for
the same asset).

Signed-off-by: Rizwan Reza <rizwanreza@gmail.com>
2010-03-25 21:55:21 +04:30
José Valim c53f77f3be Rename unsignificant to insignificant. 2010-03-23 00:26:12 +01:00
Bernardo de Pádua a4090bca6a NumberHelper methods should now return html_safe strings (when the inputs are valid numbers or are html_safe). Also adds :raise => true (used internaly) to make the number helpers throw InvalidNumberError when the given number is invalid.
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-03-22 21:19:49 +01:00
Bernardo de Pádua 75904c566e Adds number_to_human and several improvements in NumberHelper. [#4239 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-03-22 21:19:49 +01:00
Denis Odorcic b7adec3563 Remove data-url support from url_helper [#4236 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-03-21 19:31:59 +01:00
wycats 9f92563892 Eliminate an error from an implicit dependency on AV::Base 2010-03-19 11:50:03 -07:00
José Valim ae499b53ef Merge branch 'master' of gitproxy:rails/rails 2010-03-19 17:23:44 +01:00
José Valim f28d856cec Improve performance of the rendering stack by freezing formats as a sign that they shouldn't be further modified. 2010-03-19 17:20:20 +01:00
Xavier Noria f3743362c2 cleans a bit #compute_public_path
[#4232 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-03-19 07:32:41 -07:00
Carlhuda a5d80f84d2 Each controller class has it's own view context subclass. This removes the need for ActionView::Base.for_controller 2010-03-18 18:14:54 -07:00
Carlhuda 71c9337f45 All tests pass without memoizing view_context 2010-03-18 15:52:43 -07:00
José Valim 191a2f78b1 Sending the partial as info is no longer required. 2010-03-18 12:12:07 +01:00
Jeremy Kemper 41af6d9a78 Use Array.wrap not Array() 2010-03-17 22:27:48 -07:00
Carlhuda d9375f3f30 Modify assert_template to use notifications. Also, remove ActionController::Base#template since it is no longer needed. 2010-03-17 16:29:35 -07:00
José Valim a6dc227167 Mark bang instrumentations as something that you shuold not be listening to. 2010-03-17 23:44:03 +01:00
Carlhuda 6416a35f4b Remove unneeded AV::Base and AV::Template monkey-patches 2010-03-17 14:29:18 -07:00
Carlhuda 947f86c699 Modify assert_template to use instrumentation 2010-03-17 14:29:18 -07:00
wycats a5587efc19 Remove some 1.9 warnings (resulting in some fixed bugs). Remaining AM warnings are in dependencies. 2010-03-17 00:20:09 -07:00
wycats cd9ffd11e1 Eliminate warnings for AM on 1.8 2010-03-16 23:24:00 -07:00
Joshua Peek d69e5616e8 link_to_function is here to stay 2010-03-16 22:06:16 -05:00
wycats 55aac2c696 Fix missing require 2010-03-16 17:32:42 -07:00
Santiago Pastorino 0c1ac36ccb scope_key_by_partial fix for Ruby 1.9 when there's virtual_path [#4202 state:resolved]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-03-16 16:20:10 -07:00
Carl Lerche 23b6def0eb Do not always include the named URL helpers into AC::Base and AV::Base. 2010-03-16 15:47:49 -07:00
José Valim 56fb60ebfe Fix rendering of HTML partials inside JS templates [#4197 status:resolved] 2010-03-16 23:36:29 +01:00
Santiago Pastorino 12bf636461 translation method of TranslationHelper module returns always SafeBuffer [#4194 status:resolved]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-03-16 13:49:13 -07:00
Carlhuda c61ed70b00 Some more tweaks on <% %>.
* The cache helper is now semantically "mark this region for caching"
  * As a result, <% x = cache do %> no longer works
2010-03-16 11:43:04 -07:00
Santiago Pastorino e13c179499 Change array entries to safe doesn't worth then the array is joined as a string losing the safe property of his entries [#4134 status:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-03-16 11:10:31 +01:00
Jeremy Kemper b3b6ff48df Fix link_to with block 2010-03-15 23:26:48 -07:00
Jeremy Kemper 9e1e95f70a link_to_remote -> link_to :remote => true 2010-03-15 23:05:12 -07:00
José Valim 8dd731bc50 Move more normalization up to the lookup context, so it does not have to repeat in every resolver. 2010-03-16 02:09:16 +01:00
Carlhuda 9de83050d3 Add deprecation notices for <% %>.
* The approach is to compile <% %> into a method call that checks whether
    the value returned from a block is a String. If it is, it concats to the buffer and
    prints a deprecation warning.
  * <%= %> uses exactly the same logic to compile the template, which first checks
    to see whether it's compiling a block.
  * This should have no impact on other uses of block in templates. For instance, in
    <% [1,2,3].each do |i| %><%= i %><% end %>, the call to each returns an Array,
    not a String, so the result is not concatenated
  * In two cases (#capture and #cache), a String can be returned that should *never*
    be concatenated. We have temporarily created a String subclass called NonConcattingString
    which behaves (and is serialized) identically to String, but is not concatenated
    by the code that handles deprecated <% %> block helpers. Once we remove support
    for <% %> block helpers, we can remove NonConcattingString.
2010-03-15 14:50:43 -07:00
Pratik Naik 03a62f4afe Merge remote branch 'mainstream/master' 2010-03-15 19:46:03 +00:00
Xavier Noria a594a22267 with_output_buffer cannot assume there's an output_buffer
[#4182 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-03-15 11:26:51 -07:00
Santiago Pastorino beeb02076a Making escaped things more readable 2010-03-14 12:07:15 -05:00
José Valim 3da9a08a73 Optimize DetailsKey generation. 2010-03-14 10:25:29 +01:00
Jeroen van Dijk d252766d03 Update of block helpers examples in form_helper.rb 2010-03-13 17:30:30 +01:00
José Valim ee4c89627a Remove formats setters from render template, speeding up partial and collection renderings. 2010-03-13 09:15:13 +01:00
Denis Odorcic e484d4ae56 Made asset_tag_helper use config.perform_caching instead of ActionController::Base.perform_caching
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-03-12 21:33:39 +01:00
José Valim f2c0a353ae Finish cleaning up rendering stack from views and move assigns evaluation to controller (so plugins and/or controllers can overwrite just one method). 2010-03-12 20:39:53 +01:00
Jeroen van Dijk 20eb1ca77e Updated documentation for block helpers in render/layouts.rb 2010-03-12 17:15:21 +01:00
Pratik Naik e68bfaf1fe Merge remote branch 'mainstream/master'
Conflicts:
	activerecord/lib/active_record/base.rb
	railties/lib/rails/configuration.rb
	railties/lib/rails/log_subscriber.rb
2010-03-12 16:00:01 +00:00
Jeroen van Dijk ef6462c730 Updated documentation for block helpers in render/partials.rb 2010-03-12 16:50:15 +01:00
Jeroen van Dijk 67de0af604 Updated documentation for block helpers in form_tag_helper.rb 2010-03-12 16:50:14 +01:00
Jeroen van Dijk a098720719 Updated documentation for block helpers in javascript_helper.rb 2010-03-12 16:50:14 +01:00
Jeroen van Dijk 363616572d Updated documentation for block helpers in prototype_helper.rb 2010-03-12 16:50:14 +01:00
Jeroen van Dijk e8d2f48cff Updated documentation for block helpers in record_tag_helper.rb 2010-03-12 16:50:14 +01:00
Jeroen van Dijk 04963f16c2 Updated documentation for block helpers in tag_helper.rb 2010-03-12 16:50:14 +01:00
Jeroen van Dijk e98474096a Updated documentation for block helpers in url_helper.rb 2010-03-12 16:50:14 +01:00
José Valim 2a12686832 Allow anything that responds to render to be given as :template and use find_template instead of find in views. 2010-03-12 14:25:10 +01:00
José Valim 4840acd485 %= works for content_tag and does not require parenthesis on method call 2010-03-12 12:08:23 +01:00
José Valim 839362fa07 Make all AP tests pass for Ruby 1.9.1. 2010-03-12 11:50:45 +01:00
Jeremy Kemper 698312de87 Delegate #encoding to SafeBuffer too 2010-03-11 17:42:27 -08:00
Eaden McKee b27376773e simplify alt tag generation for images
[#2837 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-03-11 17:33:41 -08:00
José Valim 6c027443b0 Add tests for lookup context. 2010-03-11 13:23:14 +01:00
wycats 4745b53bcd Merge branch 'master' of github.com:rails/rails 2010-03-10 13:28:52 -08:00
José Valim 07cf49aadf Optimize and clean up how details key get expired. 2010-03-10 22:13:29 +01:00
wycats 7b622786fc Make form helpers work with <%= 2010-03-09 23:44:12 -08:00
Carlhuda 4464b8e87b Deprecate block_called_from_erb? pending a solution for getting it into apps 2010-03-09 23:44:12 -08:00
José Valim 00d6271d2b Clean up the API required from ActionView::Template. 2010-03-09 13:12:11 +01:00
José Valim 8f082ff421 Clean LookupContext API. 2010-03-08 23:25:16 +01:00
José Valim 7942e90960 Merge master. 2010-03-08 21:06:26 +01:00
José Valim 36eb1a686c Bring AM up to date with new rendering stack. 2010-03-08 20:57:33 +01:00
José Valim bdf5096816 Move details to lookup_context and make resolvers use the cache key. 2010-03-08 20:39:15 +01:00
José Valim 68cda695da Speed up performance in resolvers by adding fallbacks just when required. 2010-03-08 16:32:40 +01:00
José Valim 44ebab96da Rename Template::Lookup to LookupContext. 2010-03-08 15:19:03 +01:00
José Valim ea68fe59c6 More refactoring on the views side of rendering. 2010-03-08 14:46:57 +01:00
José Valim 0a85380966 Finally moved the find template logic to the views. 2010-03-08 11:32:01 +01:00
José Valim 4bae77a89b More cleanup on the layouts side. 2010-03-08 02:58:16 +01:00
José Valim ffd8d753f1 Move layout lookup to views. 2010-03-08 02:04:18 +01:00
José Valim c7564d74e8 Added template lookup responsible to hold all information used in template lookup. 2010-03-07 19:41:58 +01:00
wycats 39d6f9e112 Make many parts of Rails lazy. In order to facilitate this,
add lazy_load_hooks.rb, which allows us to declare code that
should be run at some later time. For instance, this allows
us to defer requiring ActiveRecord::Base at boot time purely
to apply configuration. Instead, we register a hook that should
apply configuration once ActiveRecord::Base is loaded.

With these changes, brings down total boot time of a
new app to 300ms in production and 400ms in dev.

TODO: rename base_hook
2010-03-07 06:24:30 -08:00
José Valim 6e0443fd43 First take on ViewPaths clean up. 2010-03-07 12:49:27 +01:00
Santiago Pastorino e472f76e4c Adds disable option to date_helpers generated hidden fields when html_options specifies it. ht by Marc Schütz
[#3807 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-03-05 13:49:04 -08:00
Jose Fernandez a04b44910e Solved a problem that prevented render :file => work in layouts
Signed-off-by: wycats <wycats@gmail.com>
2010-03-05 08:52:10 -08:00
Xavier Shay 8da026cb79 Remove some of the blank rescues from number helper. This makes the code easier to understand, as you're not left wondering what the rescue is actually doing. This does not change documented/tested behaviour.
Signed-off-by: wycats <wycats@gmail.com>
2010-03-05 08:50:01 -08:00
José Valim 7d4d97e22a Actually, revert previous commit. Having a lot of information is better than having no information at all. 2010-03-05 15:49:36 +01:00
José Valim 80715cee73 Define to_s method in ActionView::Resolver, so I'm not required to write it in inherited classes. 2010-03-05 15:40:06 +01:00
Carl Lerche ad2e6ee4ec Fix a bunch of failing AP / AM specs created from the previous AbstractController configuration refactor. 2010-03-04 01:01:21 -08:00
Carl Lerche 7dbf5c820b Tweak how ActionPack handles InheritableOptions 2010-03-03 21:29:26 -08:00
Carlhuda b160663bd1 Start refactoring the method of configuring ActionView 2010-03-03 21:24:01 -08:00
Carl Lerche fb14b8c6fd ActionDispatch::Request deprecates #request_uri
* Refactored ActionPatch to use fullpath instead
2010-03-03 21:24:00 -08:00
Carlhuda 5e0a05b8cb Tweak the semantic of various URL related methods of ActionDispatch::Request 2010-03-03 21:23:34 -08:00
Carlhuda bcfb77782b Work on deprecating ActionController::Base.relative_url_root 2010-03-03 15:49:52 -08:00
Carlhuda d78e3fe73f Fix failing Action Pack tests 2010-03-02 14:41:12 -08:00
Jeremy Kemper ea4fd64133 Revert orphaned SharedTestRoutes 2010-03-01 23:22:11 -08:00
Carlhuda b85ea58eb5 Change AV formats so they can delegate to the controller. Now users (or plugins) can override details_for_render in their controllers and add appropriate additional details. Now if only they could *do* something with those details... 2010-03-01 14:37:05 -08:00
Carlhuda 8fbbdda526 Delegate formats to the controller 2010-03-01 14:10:53 -08:00
Ryan Bigg 2f3eefcdca Nitpick: the first value should be odd, second is even. 2010-02-27 09:29:51 +11:00
Carlhuda fc4582fb66 Final pass at removing the router from a global constant 2010-02-25 17:53:29 -08:00
Carlhuda 226dfc2681 WIP: Remove the global router 2010-02-25 17:53:00 -08:00
Jeremy Kemper 66d537852b Bump i18n for new public I18n.normalize_keys 2010-02-25 15:06:11 -08:00
Santiago Pastorino f76eaa4b7c add time_separator for minutes only if minutes aren't hidden
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-02-25 08:31:02 -08:00
José Valim df85ab41c1 Renamed LocalizedCache to DetailsCache. 2010-02-24 22:17:26 +01:00
Yehuda Katz ae933a093d Fix render :file => "#{Rails.root}/public/404.html", :status => :not_found. Closes #8994 2010-02-23 22:45:42 -08:00
José Valim 35e0975af8 Rename erubis_implementation to erb_implementation. 2010-02-22 13:58:29 +01:00
José Valim d92e855492 Include missing modules. 2010-02-22 13:13:26 +01:00
Martin Schürrer 6bc24d40d5 Use ActionDispatch::Routing everywhere 2010-02-21 13:43:51 -08:00
José Valim 250c809246 Require persisted? in ActiveModel::Lint and remove new_record? and destroyed? methods. ActionPack does not care if the resource is new or if it was destroyed, it cares only if it's persisted somewhere or not. 2010-02-21 11:12:14 +01:00
Dirkjan Bussink a0a01d0c98 Remove empty line and trailing hash, breaks documentation generation
Signed-off-by: Yehuda Katz <yehudakatz@YK.local>
2010-02-19 13:10:01 -08:00
Santiago Pastorino e2806929ec ruby 1.9 array.to_s returns a string representing an escaped array
Signed-off-by: Yehuda Katz <yehudakatz@YK.local>
2010-02-18 17:11:32 -08:00
Santiago Pastorino af05420d6b i18n translate with arrays issue solved
Signed-off-by: Yehuda Katz <yehudakatz@YK.local>
2010-02-18 16:41:00 -08:00
Prem Sichanugrist f0523f72b4 Rename Rails::Subscriber to Rails::LogSubscriber 2010-02-16 22:36:15 +01:00
Santiago Pastorino and José Ignacio Costa 98a5bf8ff2 Explicit html_escape removed when not needed
Signed-off-by: Yehuda Katz <yehudakatz@YK.local>
2010-02-14 12:03:39 -08:00
Santiago Pastorino and José Ignacio Costa 9f1900ec7a html_escape mail_to when encode javascript and not hex
Signed-off-by: Yehuda Katz <yehudakatz@YK.local>
2010-02-14 12:03:28 -08:00
Bruno Michel f86421fb28 content_tag should escape its input
Signed-off-by: Yehuda Katz <yehudakatz@YK.local>
2010-02-14 12:03:28 -08:00
Pratik Naik 6f3c5f6787 Merge remote branch 'mainstream/master'
Conflicts:
	railties/README
	railties/guides/source/active_support_core_extensions.textile
	railties/guides/source/getting_started.textile
	railties/lib/generators/rails/app/templates/README
2010-02-14 19:28:05 +00:00
David Heinemeier Hansson d68f8ba5c3 simple_format returns a safe buffer escaping unsafe input [Santiago Pastorino] 2010-02-12 17:24:04 -08:00
David Heinemeier Hansson 325fa58ef5 Safely concat the ending tag to simple_format or it will be escaped 2010-02-12 16:38:24 -08:00
Gabriel Mansour b235af702a Fix pluralization for numbers formatted like '1.00'
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-02-07 12:12:09 -08:00
José Valim de69c798db Fix nested attributes with specified collection. 2010-02-07 13:45:47 +01:00
Xavier Noria 8e72fd916e revises an example in the rdoc of TextHelper#concat 2010-02-06 16:17:03 +01:00
Santiago Pastorino and José Ignacio Costa e115eb097e More html_safe strings now use the safe_concat method
[#3856 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
2010-02-05 13:28:43 -08:00
Jeremy Kemper 3062bc70ef HTML-escape csrf meta contents 2010-02-04 17:45:43 -08:00
Jeremy Kemper 2191aa47ac Expose CSRF param name also 2010-02-04 15:26:24 -08:00
Jeremy Kemper 78de17cf70 Expose CSRF tag for UJS adapters 2010-02-04 14:58:32 -08:00
Pratik Naik 8260f0b40f Merge remote branch 'mainstream/master'
Conflicts:
	railties/guides/source/3_0_release_notes.textile
2010-02-04 13:14:44 +00:00
José Valim 95eadb39bd Configuration values should be on AV::Base. 2010-02-02 11:32:28 +01:00
Prem Sichanugrist c01014ac1c Modify the behavior of `radio_button_tag` to use `sanitize_to_id` for consistency [#1792 status:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-02-02 10:17:26 +01:00
Mikel Lindsaar 12681c2a71 Merge branch 'master' of git://github.com/rails/rails
Conflicts:
	activemodel/README
	activemodel/lib/active_model/errors.rb
	activemodel/lib/active_model/serialization.rb
	railties/guides/source/3_0_release_notes.textile
2010-02-02 14:04:23 +11:00
Sam Ruby 5998dd7bb8 Resolve view paths correctly on CygWin
Signed-off-by: Mikel Lindsaar <raasdnil@gmail.com>
2010-02-02 12:05:49 +11:00
Pratik Naik fdcf4d6c51 Merge remote branch 'mainstream/master' 2010-02-01 23:42:38 +00:00
Jeremy Kemper e5ab4b0d07 Convert to class_attribute 2010-02-01 02:02:42 -08:00
Yehuda Katz 2092351652 Add support for compile-time <%= raw %> 2010-01-31 23:42:35 -08:00
Santiago Pastorino 1adfb92135 Deleted all references to ActionView::SafeBuffer in favor of ActiveSupport::SafeBuffer
Signed-off-by: Yehuda Katz <wycats@Yehuda-Katz.local>
2010-01-31 22:14:18 -08:00
Santiago Pastorino f439f1d86f action_view is requiring the deleted action_view/erb/util.rb file
Signed-off-by: Yehuda Katz <wycats@Yehuda-Katz.local>
2010-01-31 20:26:28 -08:00
Yehuda Katz 4cbb9db0a5 For performance reasons, you can no longer call html_safe! on Strings. Instead, all Strings are always not html_safe?. Instead, you can get a SafeBuffer from a String by calling #html_safe, which will SafeBuffer.new(self).
* Additionally, instead of doing concat("</form>".html_safe), you can do
    safe_concat("</form>"), which will skip both the flag set, and the flag
    check.
  * For the first pass, I converted virtually all #html_safe!s to #html_safe,
    and the tests pass. A further optimization would be to try to use
    #safe_concat as much as possible, reducing the performance impact if
    we know up front that a String is safe.
2010-01-31 19:39:13 -08:00
Stefan Penner c493370f33 UJS documentation. 2010-01-31 16:37:33 -06:00
Erik St. Martin e1618b9ac3 data-remote needs to be on the form and not the submit when using button_to :remote=>true 2010-01-31 14:43:07 -06:00
Stephen St. Martin a9e89e82b6 add :remote option to form_tag 2010-01-31 13:46:33 -06:00