Commit Graph

771 Commits

Author SHA1 Message Date
Vasiliy Ermolovich
c2ad51a2d0 Collection check boxes propagates input's id to the label's for attribute. 2015-10-20 16:39:05 -06:00
Rafael Mendonça França
a7bd1c7c88 Merge pull request #21894 from abhishekjain16/refactor_with_dry
Follow DRY principle and remove duplication
2015-10-08 14:16:46 -03:00
Abhishek Jain
9a57e7f9bb Follow DRY principle and remove duplication 2015-10-08 22:33:55 +05:30
Abhishek Jain
fc4fbac073 [ci skip] fix typo 2015-10-07 15:10:33 +05:30
Jeremy Daer
565094a8b5 Use Mime[:foo] instead of Mime::Type[:FOO] for back compat
Rails 4.x and earlier didn't support `Mime::Type[:FOO]`, so libraries
that support multiple Rails versions would've had to feature-detect
whether to use `Mime::Type[:FOO]` or `Mime::FOO`.

`Mime[:foo]` has been around for ages to look up registered MIME types
by symbol / extension, though, so libraries and plugins can safely
switch to that without breaking backward- or forward-compatibility.

Note: `Mime::ALL` isn't a real MIME type and isn't registered for lookup
by type or extension, so it's not available as `Mime[:all]`. We use it
internally as a wildcard for `respond_to` negotiation. If you use this
internal constant, continue to reference it with `Mime::ALL`.

Ref. efc6dd550ee49e7e443f9d72785caa0f240def53
2015-10-06 11:29:30 -07:00
Kasper Timm Hansen
5b69e30622 Merge pull request #21887 from abhishekjain16/doc_fix
Fix usage of word alternatively in docs [ci skip]
2015-10-06 20:21:00 +02:00
tanmay3011
148d1217a1 [ci skip] Change 'an URL' to 'a URL' as URL doesn't have a vowel sound 2015-10-06 23:34:05 +05:30
Abhishek Jain
fe33c15d4d Fix usage of word alternatively in docs [ci skip] 2015-10-06 23:20:27 +05:30
Prakash Laxkar
62b74d2b60 Improve readability of docs by using code tag [ci skip] 2015-09-29 14:44:17 +05:30
Rafael Mendonça França
0131c70175 Merge pull request #21661 from akshay-vishnoi/submit_tag_tests
Fix - Prevent adding of `data-disable-with` option twice in html.
2015-09-29 02:05:07 -03:00
Rafael Mendonça França
30c67000ca Merge pull request #21790 from yui-knk/fix_doc_date_field
[ci skip] Fix which method `FormHelper#date_field` try to call
2015-09-28 00:09:14 -03:00
yui-knk
a314879a96 [ci skip] Fix which method FormHelper#date_field try to call
When this method was implemented
(https://github.com/rails/rails/pull/5016/files), `to_date` is called.
But this behavior was chagned refactoring
(https://github.com/rails/rails/pull/6452/files).
In the first commit, there were not test which asserts `to_date` is called.

I think trying `to_date` is more useful than trying `strftime`, because
we can write `"2015-01-01".to_date`. But first fix comments to match
actual behavior.
2015-09-27 23:51:21 +09:00
Mehmet Emin İNAÇ
7c2104032b minor doc fix [ci skip] 2015-09-27 05:57:21 +03:00
Rafael Mendonça França
5b64835601 Merge pull request #21431 from ojab/master
Handle nested fields_for by adding indexes to record_name
2015-09-26 01:51:41 -03:00
Mauro George
491013e06d Add a hidden field on the collection_radio_buttons
This will avoid a error be raised when the only input on the form is the
`collection_radio_buttons`.
2015-09-24 19:58:15 -03:00
Yves Senn
8842ce2395 Merge pull request #21712 from amitsuroliya/html_fix
Correcting output of `file_field` with `multiple` attribute option [ci skip]
2015-09-22 10:35:47 +02:00
amitkumarsuroliya
851760c0e1 Correcting output of file_field with multiple attribute option [ci skip] 2015-09-22 14:02:24 +05:30
amitkumarsuroliya
f077cc6f41 Correcting output of number_to_percentage example in number_helper [ci skip]
Here is correct output of `number_to_percentage(100, format: "%n  %”)`
2015-09-22 07:38:02 +05:30
Sean Griffin
b223d729d8 Merge pull request #21612 from ronakjangir47/remove_unused_params
Removed unused parameter `options` for `register_detail` method
2015-09-21 08:30:43 -06:00
Akira Matsuda
c971bc0568 ✂️ empty line at the top of files 2015-09-21 01:27:33 +09:00
Jerry D'Antonio
56ac6e4768 Replaced ThreadSafe::Map with successor Concurrent::Map.
The thread_safe gem is being deprecated and all its code has been merged
into the concurrent-ruby gem. The new class, Concurrent::Map, is exactly
the same as its predecessor except for fixes to two bugs discovered
during the merge.
2015-09-19 09:56:26 -04:00
Kasper Timm Hansen
77370f27db Merge pull request #21632 from kirs/feature/translation-helper-include-interpolation
Include interpolation values to translation_missing helper
2015-09-18 21:37:28 +02:00
Kir Shatrov
0f138d1a8b Include interpolation values to translation_missing helper 2015-09-18 20:04:36 +03:00
Akshay Vishnoi
9331f00229 Fix - Prevent adding of data-disable-with option twice in html.
Earlier
when `data-disable-with` option is added direclty as in options then

```ruby
submit_tag("Save", { "data-disable-with" => "Processing..." })
# => <input type="submit" name="commit" value="Save" data-disable-with="Processing..." data-disable-with="Processing..." />
```

Now
when `data-disable-with` option is added direclty as in options then

```ruby
submit_tag("Save", { "data-disable-with" => "Processing..." })
# => <input type="submit" name="commit" value="Save" data-disable-with="Processing..." />
```
2015-09-18 12:44:09 +05:30
shingo.nakanishi
30eabcb921 No need the a 2015-09-17 23:18:22 +09:00
shingo.nakanishi
66d6cab987 Fixed helpers submit button Examples [ci skip] 2015-09-17 17:06:54 +09:00
Ronak Jangir
e46a117a4c Removed unused parameter options for register_detail method
This method is only called with name & block.
2015-09-13 21:54:10 +05:30
amitkumarsuroliya
ee8feecc57 fix typo intance -> instance in ActionView [ci skip]
`intance` should be `instance`
2015-09-13 20:18:10 +05:30
Rafael Mendonça França
f883867dd6 Merge pull request #21502 from bernerdschaefer/bs-polymorphic-url_for-dups-arguments
`url_for` does not modify polymorphic options
2015-09-08 13:49:22 -03:00
Kasper Timm Hansen
b5a489fc9c Merge pull request #21480 from amitsuroliya/add_return_value_description
adding description of return value [ci skip]
2015-09-07 07:48:12 +02:00
Aaron Patterson
f443ae670d Use ERB::Utils to percent encode hfvalue parts of mailto
`hfvalue` parts should always be percent encoded, so lets do that!

Revert "use path escaping for email addresses"

This reverts commit 21ffef38a5dc5a6a21f7e841aecab5b51f4fd185.
2015-09-05 10:59:46 -07:00
Aaron Patterson
21ffef38a5 use path escaping for email addresses
Due to e25fdad2f147e6f368958f9a06a5ac9d10288408, we are correctly using
path escaping for email addresses.  This commit fixes the tests to
expect path escaping.
2015-09-04 15:20:07 -07:00
Bernerd Schaefer
ee63532d40 url_for does not modify polymorphic options
The `url_for` methods in `actionpack` and `actionview`
now make a copy of the provided options
before generating polymorphic paths or URLs.

The bug in the previous behavior
is most noticeable in a case like:

    url_options = [:new, :post, param: 'value']

    if current_page?(url_options)
      css_class = "active"
    end

    link_to "New Post", url_options, class: css_class
2015-09-04 13:42:32 -07:00
amitkumarsuroliya
ddc05b61e0 adding description of return value [ci skip] 2015-09-03 17:22:36 +05:30
ojab
7089768b70 Handle nested fields_for by adding indexes to record_name
In case of the form with nested fields_for, i. e.

<%= form_for :foos, url: root_path do |f| %>
    <% @foos.each do |foo| %>
        <%= f.fields_for 'foo[]', foo do |f2| %>
            <%= f2.text_field :id %>
            <% foo.bars.each do |bar| %>
                <%= f2.fields_for 'bar[]', bar do |b| %>
                    <%= b.text_field :id %>
                <% end %>
            <% end %>
        <% end %>
     <% end %>
    <%= f.submit %>
<% end %>

rails doesn't add index for 'foo' in the inner fields_for block, so field names
in the outer fields_for looks like "foos[foo][#{foo_index}][id]" and in the
inner "foos[foo[]][bar][#{bar_index}][id]". Submitting of such form leads to an
error like:
>ActionController::BadRequest (Invalid request parameters: expected Array
>(got Rack::QueryParser::Params) for param `foo'):

This commit adds indexes for the foos in the inner blocks, so field names
become "foos[foo][#{foo_index}][bar][#{bar_index}][id]" and submitting of such
form works fine as expected.

Fixes #15332
2015-08-30 20:44:09 +00:00
Lachlan Sylvester
a9c6a583b6 Fix calling cache helper with a relation 2015-08-28 17:26:09 +10:00
Aaron Patterson
2ceb16e539 Pull plain content type handling up to render
`render` is the only possible source for the `plain` option.  Pulling
the conditional up to the `render` method removes far away conditionals
2015-08-26 14:04:04 -07:00
Aaron Patterson
fa09bf44db stop passing the options hash to _process_format
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"
2015-08-26 13:51:28 -07:00
Rafael Mendonça França
518ae9f055 Pass the correct formats 2015-08-24 15:36:14 -03:00
Rafael Mendonça França
face604266 Pass formats to lookup_context
Before we were changing the state of the lookup_context for the duration
of the with_layout_format block, but since we already know the formats
we can just pass it explicitly.

Related with 8d7ce0f22aee09d20091a4dc58cb379a09d13e26
2015-08-24 15:16:59 -03:00
Nick Sutterer
c0daa02c24 remove useless case in #resolve_layout. 2015-08-24 15:07:25 -03:00
Nick Sutterer
8d7ce0f22a remove LookupContext#with_layout_format by passing formats for layouts explicitely. 2015-08-24 15:07:25 -03:00
amitkumarsuroliya
bb289b9409 fix Docs [ci skip] 2015-08-18 00:41:17 +05:30
amitkumarsuroliya
f2c04d77ba typo fix [ci skip] 2015-08-18 00:02:16 +05:30
Sean Griffin
249a06d3be Merge pull request #21135 from DropsOfSerenity/master
make disable_with default in submit_tag
2015-08-17 06:49:00 -06:00
Vince Francesi
cfde3786e7 Add documentation for ActionView::Helpers::DateHelper :use_hidden option [ci skip] 2015-08-15 12:36:54 -07:00
Justin Schiff
3822a322a8 Make disable_with default in submit_tag
Prevents double submission by making disable_with the default.

Default disable_with option will only be applied if user has not
specified her/his own disable_with option, whether that is in the
`data-disable-with` string form or the
`:data => { :disable_with => "Saving..." }` hash form. disable_with
will default to the value attribute.

A configuration option was added to opt out of this functionality if
the user so desires.
`config.action_view.automatically_disable_submit_tag = false`
2015-08-11 16:35:10 -07:00
Mauricio Gomez Aguinaga
cf93c6ae48 Sometimes you need a specific break sequence while using word wrap and as today the only option we have is "\n" and is hardcoded.
With this change you will be able to specify any break sequence ("\r\n" for example) as an option.

adding proper documentation for break_sequence in ActionView::Helpers::TextHelper.word_wrap

adding some more documentation for word_wrap custom break sequence and making sure we use new hash syntax
2015-08-11 14:15:47 -07:00
Arthur Nogueira Neves
2117a535b5 Merge pull request #21187 from arthurnn/method_missing_routes_av
Dont try to call method missing in routes if thats not what we want
2015-08-11 16:10:41 +02:00
Arthur Neves
0ffaa56d51
Dont try to call method missing in routes if thats not what we want
If, doing a test like this:

```
class BugTest < ActionView::TestCase
  def test_foo
    omg
  end
```

Will raise with:
```
RuntimeError: In order to use #url_for, you must include routing helpers
explicitly. For instance, `include
Rails.application.routes.url_helpers`.
```

Thats a bit confusing, as we are not calling url_for at all.
2015-08-10 22:16:52 +02:00