193 specs | 5 failing The 5 failing specs appear (according to Firebug) to be due to missing fixtures and/or missing routes in the Jasmine environment. Fixing these last 5 failures is a task probably best left to a more experienced Javascript/Jasmine developer. This commit also moves validation.js and clear-form.js into app/assets/javascripts and precompiles validation.js
18 lines
635 B
JavaScript
18 lines
635 B
JavaScript
/* Clear form plugin - called using $("elem").clearForm(); */
|
|
$.fn.clearForm = function() {
|
|
return this.each(function() {
|
|
if ($(this).is('form')) {
|
|
return $(':input', this).clearForm();
|
|
}
|
|
if ($(this).hasClass('clear_on_submit') || $(this).is(':text') || $(this).is(':password') || $(this).is('textarea')) {
|
|
$(this).val('');
|
|
} else if ($(this).is(':checkbox') || $(this).is(':radio')) {
|
|
$(this).attr('checked', false);
|
|
} else if ($(this).is('select')) {
|
|
this.selectedIndex = -1;
|
|
} else if ($(this).attr('name') == 'photos[]') {
|
|
$(this).val('');
|
|
}
|
|
$(this).blur();
|
|
});
|
|
};
|