From 1005c42a65e8a9027a6abf6a0ff3d3427283a883 Mon Sep 17 00:00:00 2001 From: Jon Moss Date: Thu, 27 Apr 2017 18:22:21 -0400 Subject: Small grammar fixes Will backport to 5-1-stable, since the original PR landed there. [ci skip] --- guides/source/working_with_javascript_in_rails.md | 26 +++++++++++------------ 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'guides/source/working_with_javascript_in_rails.md') diff --git a/guides/source/working_with_javascript_in_rails.md b/guides/source/working_with_javascript_in_rails.md index 9af1c5438c..047aeae37d 100644 --- a/guides/source/working_with_javascript_in_rails.md +++ b/guides/source/working_with_javascript_in_rails.md @@ -161,9 +161,9 @@ remote elements inside your application. #### form_with [`form_with`](http://api.rubyonrails.org/classes/ActionView/Helpers/FormHelper.html#method-i-form_with) -is a helper that assists with writing forms. By default, `form_with` considers -that your form will be using Ajax ; you can opt-out by specifying the `:local` -option. +is a helper that assists with writing forms. By default, `form_with` assumes that +your form will be using Ajax. You can opt out of this behavior by +passing the `:local` option `form_with`. ```erb <%= form_with(model: @article) do |f| %> @@ -257,13 +257,13 @@ attributes to accomplish this. Activating hyperlinks always results in an HTTP GET request. However, if your application is [RESTful](http://en.wikipedia.org/wiki/Representational_State_Transfer), -some links are in fact actions that change data on the server and must be +some links are in fact actions that change data on the server, and must be performed with non-GET requests. This attribute allows marking up such links with an explicit method such as "post", "put" or "delete". The way it works is that, when the link is activated, it constructs a hidden form in the document with the "action" attribute corresponding to "href" value of the -link and the method corresponding to `data-method` value, and submits that form. +link, and the method corresponding to `data-method` value, and submits that form. NOTE: Because submitting forms with HTTP methods other than GET and POST isn't widely supported across browsers, all other HTTP methods are actually sent over @@ -272,8 +272,8 @@ automatically detects and compensates for this. #### `data-url` and `data-params` -Certain elements of your page aren't actually referring to any URL but you would -like them to trigger Ajax calls. Specifying the `data-url` attribute along with +Certain elements of your page aren't actually referring to any URL, but you may want +them to trigger Ajax calls. Specifying the `data-url` attribute along with the `data-remote` one will trigger an Ajax call to the given URL. You can also specify extra parameters through the `data-params` attribute. @@ -286,8 +286,8 @@ This can be useful to trigger an action on check-boxes for instance: #### `data-type` -It is also possible to defines the Ajax `dataType` explicitly when performing -requests for `data-remote` elements through the `data-type` attribute. +It is also possible to define the Ajax `dataType` explicitly while performing +requests for `data-remote` elements, by way of the `data-type` attribute. ### Confirmations @@ -296,7 +296,7 @@ attribute on links and forms. The user will be presented a JavaScript `confirm() dialog containing the attribute's text. If the user chooses to cancel, the action doesn't take place. -Adding this attribute on links will trigger the dialog on click and adding it +Adding this attribute on links will trigger the dialog on click, and adding it on forms will trigger it on submit. For example: ```erb @@ -315,8 +315,8 @@ the warning message depending on the button which was activated. In this case, you should **not** have `data-confirm` on the form itself. The default confirmation uses a JavaScript confirm dialog, but you can customize -it by listening to the `confirm` event, that is fired just before the confirmation -window appears to the user. To cancel this default confirmation, make the confirm +this by listening to the `confirm` event, which is fired just before the confirmation +window appears to the user. To cancel this default confirmation, have the confirm handler to return `false`. ### Automatic disabling @@ -324,7 +324,7 @@ handler to return `false`. It is also possible to automatically disable an input while the form is submitting by using the `data-disable-with` attribute. This is to prevent accidental double-clicks from the user, which could result in duplicate HTTP requests that -the backend may not detect as such. The value of the attribute is text that will +the backend may not detect as such. The value of the attribute is the text that will become the new value of the button in its disabled state. This also works for links with `data-method` attribute. -- cgit v1.2.3