Commit Graph

1592 Commits

Author SHA1 Message Date
Carlos Galdino
fb8a830a32 Remove :confirm in favor of :data => { :confirm => 'Text' } option
This applies to the following helpers:
`button_to`
`button_tag`
`image_submit_tag`
`link_to`
`submit_tag`
2012-07-18 10:32:17 -03:00
Dmitry Vorotilin
eb19ca3457 Common behavior with adding formats to lookup_context for TemplateRenderer and PartialRenderer 2012-07-18 10:48:24 +04:00
Rusty Geldmacher
1a935ad7c6 Fixed bug creating invalid HTML in select options
When a select tag is created for a field with errors, then the inserted
options will errantly have a <div class="field_with_errors"> wrapping
them.
2012-07-10 15:03:37 -04:00
Carlos Antonio da Silva
d1c4acc669 Remove AS declarative extension from erb tag test
The extension was removed in 22bc12ec374b8bdeb3818ca0a3eb787dd3ce39d8,
making "test" an alias for minitest's "it".
2012-07-08 20:10:49 -03:00
kennyj
238a4253bf Added support add_flash_types 2012-07-07 17:07:57 +09:00
Carlos Antonio da Silva
dc766c9e7b Move number helper i18n related tests to AS
They also make more sense here since all the related logic with I18n is
handled by AS::NumberHelper, and not by AV anymore.
2012-06-24 19:30:06 -03:00
Carlos Antonio da Silva
feec54b781 Refactor AV number helper tests with invalid numbers
Just make use of the returning exception from assert_raise, instead of
calling the method again with a rescue clause to test the saved
exception number.
2012-06-24 19:30:05 -03:00
Yehuda Katz
a010fc1800 Merge pull request #6428 from pinetops/resolver_concurrency_fix
Make the Resolver template cache threadsafe
2012-06-21 13:47:18 -07:00
Aaron Patterson
188cc90af9 stop subclassing string 2012-06-21 12:13:13 -07:00
Steve Klabnik
afb053b4d3 Respect absolute paths in compute_source_path.
When using compute_source_path to determine the full path of an
asset, if our source begins with '/', we don't want to include
the directory. Examples are illustrative:

> compute_source_path("foo", "stylesheets", "css")
=> "/Users/steve/src/my_app/public/stylesheets/foo.css"
> compute_source_path("/foo", "stylesheets", "css")
=> "/Users/steve/src/my_app/public/foo.css"

Before this patch, the second example would return the same as the
first.

Fixes #5680.
2012-06-16 18:06:15 +02:00
Akira Matsuda
24889666c7 fix meaningless test case
Module#instance_methods returns an Array of Symbols in Ruby >= 1.9
So this was not actually testing anything
2012-06-06 18:56:49 +09:00
Yuki Nishijima
0ec88cd1c8 accept a block in button helper. 2012-06-05 04:30:40 +09:00
Piotr Sarnacki
60b4290f1b Allow to use mounted helpers in ActionView::TestCase
Similarly to 6525002, this allows to use routes helpers for mounted
helpers, but this time in ActionView::TestCase
2012-06-01 17:45:06 +02:00
Carlos Antonio da Silva
e2f5f01675 Simplify link_to using content_tag
Add some tests for link_to with blocks and escaping content.
2012-05-31 09:44:10 -03:00
Sergey Nartimov
ab7a80ea22 accept a block in button_to helper
Make possible to use a block in button_to helper if button text is hard
to fit into the name parameter, e.g.:

    <%= button_to [:make_happy, @user] do %>
      Make happy <strong><%= @user.name %></strong>
    <% end %>
    # => "<form method="post" action="/users/1/make_happy" class="button_to">
    #      <div>
    #        <button type="submit">
    #          Make happy <strong>Name</strong>
    #        </button>
    #      </div>
    #    </form>"
2012-05-30 23:29:13 +03:00
Andrew Mutz
155cd5e6b5 Moving NumberHelpers from ActionView to ActiveSupport 2012-05-27 18:14:21 -07:00
Rafael Mendonça França
2c2b0beaf4 Add :escape option for truncate
This options can be used to not escape the result by default.
2012-05-26 14:27:07 -03:00
Rafael Mendonça França
4ce3b5d6fe Test that the block used in truncate is escaped if it is not HTML safe
Refactoring the truncate method to not do a sort-circuit return
2012-05-26 13:57:15 -03:00
Li Ellis Gallardo
38813da6dc Truncate now has the ability to receive a html option that allows it to call rails helpers.
This way if my text is long I don't have to do something like this:

.text
= truncate(@text, :length => 27)

 if @text.size >= 27
    = link_to "continue", notes_path, ....."")
2012-05-26 10:24:17 -05:00
Carlos Galdino
30847b499b Add tests for time_field and date_field helpers
These tests check the values of 'min' and 'max' input attrs
2012-05-22 23:33:07 -03:00
Jeremy Kemper
65d2a60a8c Merge pull request #6359 from carlosgaldino/add-html5-inputs
Add HTML5 color and date/time inputs
2012-05-22 16:17:40 -07:00
Philip Arndt
40c0b3a25d Fixed typo new_defautls -> new_defaults.
* Added tests for 'else' case in ActionView::Helpers::TranslationHelper#wrap_translate_defaults
* Also updated the testing syntax of translation.html_safe? asserts to provide better output upon failure.
2012-05-23 11:04:15 +12:00
Carlos Galdino
b02d14aad5 Add several HTML5 input helpers
The input types added are:

- input[type="month"]

- input[type="week"]

- input[type="datetime"]

- input[type="datetime-local"]
2012-05-21 17:23:56 -03:00
Carlos Galdino
1ce4b5b33d Add HTML5 input[type="color"] helper 2012-05-21 17:23:48 -03:00
Tom Clarke
2a121870a6 Make the Resolver template cache threadsafe - closes #6404
The Template cache in the Resolver can be accessed by multiple threads
similtaneously in multi-threaded environments. The cache is implemented
using a Hash, which isn't threadsafe in all VMs (notably JRuby).

This commit extracts the cache to a new Cache class and adds mutexes to
prevent concurrent access.
2012-05-21 15:24:07 -04:00
José Valim
776ea1090f Revert "Merge pull request #6425 from pinetops/resolver_concurrency_fix"
This reverts commit 254c04286c5916ae7f91eb6e173b312e7a74e364, reversing
changes made to 513a0525c24c2944630acfa465b22cd2f4601adf.
2012-05-21 21:01:02 +02:00
Aaron Patterson
254c04286c Merge pull request #6425 from pinetops/resolver_concurrency_fix
Resolver concurrency fix
2012-05-21 11:29:25 -07:00
Tom Clarke
685192bbcb Make the Resolver template cache threadsafe - closes #6404
The Template cache in the Resolver can be accessed by multiple threads
similtaneously in multi-threaded environments. The cache is implemented
using a Hash, which isn't threadsafe in all VMs (notably JRuby).

This commit extracts the cache to a new Cache class and adds mutexes to
prevent concurrent access.
2012-05-21 14:24:30 -04:00
Carlos Antonio da Silva
0e207a499f Clarify grouped_options_for_select method API, add changelog entry
Make the method API more clear by explicitly showing the expected
arguments. This means that the options cannot be passed as second
argument because we are not relying on extract_options! anymore,
you are expected to give a selected key or `nil` if you want to pass
options, as it is the last argument.

Notice that this does not change the current method arguments contract
available in 3.2, it just brings back the same functionality with the
divider addition.
2012-05-19 09:58:14 -03:00
Jeremy Kemper
49b72fa864 Merge pull request #6384 from ihid/tidy_text_helpers
Tidied and standardised text_helper implementations.
2012-05-18 17:15:32 -07:00
Jeremy Walker
7e82ebd25e Tidied and standardised text_helper implementations. 2012-05-19 00:39:31 +01:00
kennyj
130b0d215d Fix build: can't convert Regexp to String 2012-05-19 05:13:28 +09:00
Andrew Mutz
2c423b3f3f reverting decoupling of NumberHelper from safe_join and adding tests for escaping of delimiters and separators 2012-05-18 11:56:18 -07:00
José Valim
6bb86e1f3f Merge pull request #5020 from KL-7/fix-blank-image_tag-source
Render img tag with empty src if empty string is passed to image_tag.
2012-05-17 23:42:37 -07:00
Alex Soulim
446940c366 Add HTML5 input[type="time"] helper 2012-05-18 08:38:19 +04:00
Kirill Lashuk
3e9ec2411a Render img tag with empty src if empty string is passed to image_tag. 2012-05-18 01:39:39 +03:00
Jeremy Walker
90ec863b1d Removed old text_helper apis for highlight, excerpt and word_wrap 2012-05-17 21:52:49 +01:00
Rafael Mendonça França
319903bde5 Merge pull request #2036 from Bodacious/tag_helper_data_fix
TagHelper creates invalid data attributes when value is a BigDecimal
2012-05-17 11:01:21 -07:00
José Valim
f5ebc9a232 Merge pull request #6309 from steveklabnik/fix-2394
Created a Raw handler for templates.
2012-05-17 10:19:27 -07:00
Bodacious
56aabfd559 Fixed tag_helper data-attribute bug with BigDecimals 2012-05-17 18:15:43 +01:00
Steve Klabnik
8bea607265 Created a Raw handler for templates.
Fixes #2394
2012-05-17 12:14:20 -05:00
Rafael Mendonça França
982ed06b3a Make :prompt work as documented 2012-05-16 20:53:28 -03:00
Rafael Mendonça França
6f04975272 Test deprecation and fix the documentation of grouped_options_for_select 2012-05-16 20:53:28 -03:00
Aaron Patterson
66cbde016c Merge pull request #5369 from Greenie0506/add_separator_to_grouped_options_for_select
Add separator option to grouped_options_for_select
2012-05-16 16:15:50 -07:00
Rafael Mendonça França
7994496ab4 Merge pull request #6273 from KensoDev/feature/simple_format_refactoring
Feature/simple format refactoring
2012-05-15 15:58:11 -07:00
Greenie0506
a1ae17e327 Add separator argument to grouped_options_for_select
Change prompt to options hash in grouped_options_for_select
2012-05-15 13:45:12 -04:00
José Valim
dd42e89058 Revert "Revert "Remove :disable_with in favor of 'data-disable-with' option from submit_tag, button_tag and button_to helpers.""
Finally remove `:disable_with` but use `:data => { :disable_with => ... }`
in examples to show off a better API (which looks nicer in Ruby 1.9)

This reverts commit a5c38a9c087e33d36397afc496be7c8e01b37ef0.
2012-05-15 10:08:51 +02:00
José Valim
a5c38a9c08 Revert "Remove :disable_with in favor of 'data-disable-with' option from submit_tag, button_tag and button_to helpers."
`disable_with:` is much easier to type than `"data-disable-with" =>`,
and the fact it uses "data-disable-with" => is an implementation concern,
it should not affect the public API.

This reverts commit 683fc4db00f496e5225928afb4d4e932e0fcdc48.
2012-05-15 09:55:30 +02:00
Carlos Galdino + Rafael Mendonça França
683fc4db00 Remove :disable_with in favor of 'data-disable-with' option from submit_tag, button_tag and button_to helpers. 2012-05-14 16:42:19 -03:00
Avi Tzurel
4bb14b0daa Added the wrapper tag option to simple_format 2012-05-14 16:55:41 +03:00