Skip to content

Commit fe5b694

Browse files
committed
fixed gritter and form plugins
1 parent abf5ee2 commit fe5b694

30 files changed

Lines changed: 2452 additions & 22 deletions

.gitmodules

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,6 @@
4040
[submodule "src/assets/submodule/validVal"]
4141
path = src/assets/submodule/validVal
4242
url = https://github.com/FrDH/jquery.validVal.git
43-
[submodule "src/assets/submodule/gritter"]
44-
path = src/assets/submodule/gritter
45-
url = https://github.com/FrDH/jquery.validVal.git
4643
[submodule "src/assets/submodule/wysihtml5"]
4744
path = src/assets/submodule/wysihtml5
4845
url = https://github.com/jhollingworth/bootstrap-wysihtml5.git
@@ -67,3 +64,9 @@
6764
[submodule "src/assets/submodule/switch"]
6865
path = src/assets/submodule/switch
6966
url = https://github.com/nostalgiaz/bootstrap-switch.git
67+
[submodule "src/assets/submodule/gritter"]
68+
path = src/assets/submodule/gritter
69+
url = https://github.com/jboesch/Gritter.git
70+
[submodule "src/assets/submodule/form"]
71+
path = src/assets/submodule/form
72+
url = https://github.com/malsup/form.git

dist/assets/lib/form/README.md

Lines changed: 205 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,205 @@
1+
#[jQuery Form Plugin](http://jquery.malsup.com/form/)
2+
3+
##Overview
4+
The jQuery Form Plugin allows you to easily and unobtrusively upgrade HTML forms to use AJAX. The main methods, ajaxForm and ajaxSubmit, gather information from the form element to determine how to manage the submit process. Both of these methods support numerous options which allows you to have full control over how the data is submitted.
5+
6+
No special markup is needed, just a normal form. Submitting a form with AJAX doesn't get any easier than this!
7+
8+
---
9+
10+
##API
11+
12+
###jqXHR
13+
The jqXHR object is stored in element <em>data</em>-cache with the <code>jqxhr</code> key after each <code>ajaxSubmit</code>
14+
call. It can be accessed like this:
15+
````javascript
16+
var form = $('#myForm').ajaxSubmit({ /* options */ });
17+
var xhr = form.data('jqxhr');
18+
19+
xhr.done(function() {
20+
...
21+
});
22+
````
23+
24+
###ajaxForm( options )
25+
Prepares a form to be submitted via AJAX by adding all of the necessary event listeners. It does **not** submit the form. Use `ajaxForm` in your document's `ready` function to prepare existing forms for AJAX submission, or with the `delegation` option to handle forms not yet added to the DOM.
26+
Use ajaxForm when you want the plugin to manage all the event binding for you.
27+
28+
````javascript
29+
// prepare all forms for ajax submission
30+
$('form').ajaxForm({
31+
target: '#myResultsDiv'
32+
});
33+
````
34+
35+
###ajaxSubmit( options )
36+
Immediately submits the form via AJAX. In the most common use case this is invoked in response to the user clicking a submit button on the form.
37+
Use ajaxSubmit if you want to bind your own submit handler to the form.
38+
39+
````javascript
40+
// bind submit handler to form
41+
$('form').on('submit', function(e) {
42+
e.preventDefault(); // prevent native submit
43+
$(this).ajaxSubmit({
44+
target: 'myResultsDiv'
45+
})
46+
});
47+
````
48+
49+
---
50+
51+
##Options
52+
Note: all standard [$.ajax](http://api.jquery.com/jQuery.ajax) options can be used.
53+
54+
###beforeSerialize
55+
Callback function invoked prior to form serialization. Provides an opportunity to manipulate the form before its values are retrieved. Returning `false` from the callback will prevent the form from being submitted. The callback is invoked with two arguments: the jQuery wrapped form object and the options object.
56+
57+
````javascript
58+
beforeSerialize: function($form, options) {
59+
// return false to cancel submit
60+
}
61+
````
62+
63+
###beforeSubmit
64+
Callback function invoked prior to form submission. This provides an opportunity to manipulate the form before it's values are retrieved. Returning `false` from the callback will prevent the form from being submitted. The callback is invoked with three arguments: the form data in array format, the jQuery wrapped form object, and the options Oobject.
65+
66+
````javascript
67+
beforeSubmit: function(arr, $form, options) {
68+
// form data array is an array of objects with name and value properties
69+
// [ { name: 'username', value: 'jresig' }, { name: 'password', value: 'secret' } ]
70+
// return false to cancel submit
71+
}
72+
````
73+
74+
###clearForm
75+
Boolean flag indicating whether the form should be cleared if the submit is successful
76+
77+
###data
78+
An object containing extra data that should be submitted along with the form.
79+
80+
````javascript
81+
data: { key1: 'value1', key2: 'value2' }
82+
````
83+
84+
###dataType
85+
Expected data type of the response. One of: null, 'xml', 'script', or 'json'. The dataType option provides a means for specifying how the server response should be handled. This maps directly to jQuery's dataType method. The following values are supported:
86+
87+
* 'xml': server response is treated as XML and the 'success' callback method, if specified, will be passed the responseXML value
88+
* 'json': server response will be evaluted and passed to the 'success' callback, if specified
89+
* 'script': server response is evaluated in the global context
90+
91+
###delegation
92+
true to enable support for event delegation
93+
*requires jQuery v1.7+*
94+
95+
````javascript
96+
// prepare all existing and future forms for ajax submission
97+
$('form').ajaxForm({
98+
delegation: true
99+
});
100+
````
101+
102+
###error
103+
Callback function to be invoked upon error.
104+
105+
###forceSync
106+
Only applicable when explicity using the iframe option or when uploading files on browses that don't support XHR2.
107+
Set to `true` to remove the short delay before posting form when uploading files. The delay is used to allow the browser to render DOM updates prior to performing a native form submit. This improves usability when displaying notifications to the user, such as "Please Wait..."
108+
109+
###iframe
110+
Boolean flag indicating whether the form should *always* target the server response to an iframe instead of leveraging XHR when possible.
111+
112+
###iframeSrc
113+
String value that should be used for the iframe's src attribute when/if an iframe is used.
114+
115+
###iframeTarget
116+
Identifies the iframe element to be used as the response target for file uploads. By default, the plugin will create a temporary iframe element to capture the response when uploading files. This options allows you to use an existing iframe if you wish. When using this option the plugin will make no attempt at handling the response from the server.
117+
118+
###replaceTarget
119+
Optionally used along with the the target option. Set to true if the target should be replaced or false if only the target contents should be replaced.
120+
121+
###resetForm
122+
Boolean flag indicating whether the form should be reset if the submit is successful
123+
124+
###semantic
125+
Boolean flag indicating whether data must be submitted in strict semantic order (slower). Note that the normal form serialization is done in semantic order with the exception of input elements of `type="image"`. You should only set the semantic option to true if your server has strict semantic requirements and your form contains an input element of `type="image"`.
126+
127+
###success
128+
Callback function to be invoked after the form has been submitted. If a `success` callback function is provided it is invoked after the response has been returned from the server. It is passed the following arguments:
129+
130+
1. responseText or responseXML value (depending on the value of the dataType option).
131+
2. statusText
132+
3. xhr (or the jQuery-wrapped form element if using jQuery < 1.4)
133+
4. jQuery-wrapped form element (or undefined if using jQuery < 1.4)
134+
135+
###target
136+
Identifies the element(s) in the page to be updated with the server response. This value may be specified as a jQuery selection string, a jQuery object, or a DOM element.
137+
138+
###type
139+
The method in which the form data should be submitted, 'GET' or 'POST'.
140+
141+
###uploadProgress
142+
Callback function to be invoked with upload progress information (if supported by the browser). The callback is passed the following arguments:
143+
144+
1. event; the browser event
145+
2. position (integer)
146+
3. total (integer)
147+
4. percentComplete (integer)
148+
149+
###url
150+
URL to which the form data will be submitted.
151+
152+
---
153+
154+
##Utility Methods
155+
###formSerialize
156+
Serializes the form into a query string. This method will return a string in the format: `name1=value1&name2=value2`
157+
158+
````javascript
159+
var queryString = $('#myFormId').formSerialize();
160+
````
161+
162+
###fieldSerialize
163+
Serializes field elements into a query string. This is handy when you need to serialize only part of a form. This method will return a string in the format: `name1=value1&name2=value2`
164+
165+
````javascript
166+
var queryString = $('#myFormId .specialFields').fieldSerialize();
167+
````
168+
169+
###fieldValue
170+
Returns the value(s) of the element(s) in the matched set in an array. This method always returns an array. If no valid value can be determined the array will be empty, otherwise it will contain one or more values.
171+
172+
###resetForm
173+
Resets the form to its original state by invoking the form element's native DOM method.
174+
175+
###clearForm
176+
Clears the form elements. This method emptys all of the text inputs, password inputs and textarea elements, clears the selection in any select elements, and unchecks all radio and checkbox inputs. It does *not* clear hidden field values.
177+
178+
###clearFields
179+
Clears selected field elements. This is handy when you need to clear only a part of the form.
180+
181+
---
182+
183+
##File Uploads
184+
The Form Plugin supports use of [XMLHttpRequest Level 2]("http://www.w3.org/TR/XMLHttpRequest/") and [FormData](https://developer.mozilla.org/en/XMLHttpRequest/FormData) objects on browsers that support these features. As of today (March 2012) that includes Chrome, Safari, and Firefox. On these browsers (and future Opera and IE10) files uploads will occur seamlessly through the XHR object and progress updates are available as the upload proceeds. For older browsers, a fallback technology is used which involves iframes. [More Info](http://malsup.com/jquery/form/#file-upload)
185+
186+
---
187+
188+
##Copyright and License
189+
Copyright 2006-2013 (c) M. Alsup
190+
191+
All versions, present and past, of the jQuery Form plugin are dual licensed under the MIT and GPL licenses:
192+
193+
* [MIT](http://malsup.github.com/mit-license.txt)
194+
* [GPL](http://malsup.github.com/gpl-license-v2.txt)
195+
196+
You may use either license. The MIT License is recommended for most projects because it is simple and easy to understand and it places almost no restrictions on what you can do with the plugin.
197+
198+
If the GPL suits your project better you are also free to use the plugin under that license.
199+
200+
You don't have to do anything special to choose one license or the other and you don't have to notify anyone which license you are using. You are free to use the jQuery Form Plugin in commercial projects as long as the copyright header is left intact.
201+
202+
203+
---
204+
205+
Additional documentation and examples at: http://malsup.com/jquery/form/

dist/assets/lib/form/bower.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"name": "jquery-form",
3+
"version": "3.37.0",
4+
"main": "jquery.form.js",
5+
"author": "M. Alsup",
6+
"dependencies": {
7+
"jquery": ">=1.5"
8+
},
9+
"ignore": [
10+
"README.md",
11+
"composer.json",
12+
"form.jquery.json",
13+
"package.json"
14+
]
15+
}

dist/assets/lib/form/composer.json

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{
2+
"name": "malsup/form",
3+
"description": "A simple way to AJAX-ify any form on your page; with file upload and progress support.",
4+
"type": "component",
5+
"homepage": "http://jquery.malsup.com/form/",
6+
"keywords": [
7+
"form",
8+
"upload",
9+
"ajax"
10+
],
11+
"support": {
12+
"issues": "https://github.com/malsup/form/issues",
13+
"wiki": "http://jquery.malsup.com/form/"
14+
},
15+
"authors": [
16+
{
17+
"name": "M. Alsup",
18+
"homepage": "http://jquery.malsup.com"
19+
}
20+
],
21+
"license": [
22+
"MIT",
23+
"GPL-2.0"
24+
],
25+
"require": {
26+
"components/jquery": ">=1.5"
27+
},
28+
"extra": {
29+
"component": {
30+
"scripts": [
31+
"jquery.form.js"
32+
],
33+
"shim": {
34+
"deps": [
35+
"jquery"
36+
]
37+
}
38+
}
39+
}
40+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"name": "form",
3+
"title": "Form",
4+
"description": "A simple way to AJAX-ify any form on your page; with file upload and progress support.",
5+
"keywords": [
6+
"form",
7+
"upload",
8+
"ajax"
9+
],
10+
"version": "3.26.0-2013.01.28",
11+
"author": {
12+
"name": "M. Alsup",
13+
"url": "http://jquery.malsup.com"
14+
},
15+
"licenses": [
16+
{
17+
"type": "MIT",
18+
"url": "http://malsup.github.com/mit-license.txt"
19+
},
20+
{
21+
"type": "GPL",
22+
"url": "http://malsup.github.com/gpl-license-v2.txt"
23+
}
24+
],
25+
"bugs": "https://github.com/malsup/form/issues",
26+
"homepage": "http://jquery.malsup.com/form/",
27+
"docs": "http://jquery.malsup.com/form/",
28+
"download": "http://malsup.github.com/jquery.form.js",
29+
"dependencies": {
30+
"jquery": ">=1.5"
31+
}
32+
}
33+

0 commit comments

Comments
 (0)