umlaut 3.0.0alpha10 → 3.0.0alpha11
Sign up to get free protection for your applications and to get access to all the features.
- data/app/models/collection.rb +7 -1
- data/app/models/referent.rb +11 -77
- data/app/models/request.rb +2 -2
- data/app/models/service_store.rb +4 -0
- data/app/models/service_wave.rb +1 -1
- data/lib/section_renderer.rb +9 -5
- data/lib/service.rb +0 -62
- data/lib/service_adaptors/isi.rb +1 -1
- data/lib/service_adaptors/jcr.rb +1 -1
- data/lib/umlaut/version.rb +1 -1
- data/lib/umlaut_configurable.rb +1 -0
- data/test/dummy/config/environments/profile.rb +24 -0
- data/test/dummy/config/primo.yml +271 -0
- data/test/dummy/config/umlaut_services-TEST.yml +37 -0
- data/test/dummy/profile/sfx_collection_prof.rb +22 -0
- data/test/dummy/tmp/cache/assets/C2A/410/sprockets%2Fd654b74912b4773a2534616863fb6565 +0 -0
- data/test/dummy/tmp/cache/assets/C45/A30/sprockets%2F39494895e462697b478d3d0c79298a26 +0 -0
- data/test/dummy/tmp/cache/assets/C5F/340/sprockets%2F99692920160b7a279b86a80415b79db7 +0 -0
- data/test/dummy/tmp/cache/assets/C70/4D0/sprockets%2F034ad2036e623081bd352800786dfe80 +0 -0
- data/test/dummy/tmp/cache/assets/C80/980/sprockets%2Fc94807409c1523d43e18d25f35d93c41 +0 -0
- data/test/dummy/tmp/cache/assets/{D0E/570/sprockets%2Fd4a16e3bdd7c7b9543c446b1b0174688 → CBD/730/sprockets%2F034c1086748b981c36672d5a56e7fed6} +0 -0
- data/test/dummy/tmp/cache/assets/CBF/B60/sprockets%2F08ca89671549936265dcb673bf02e36f +0 -0
- data/test/dummy/tmp/cache/assets/CC9/9F0/sprockets%2F306166316e2cafd13c15e62b51a2339d +0 -0
- data/test/dummy/tmp/cache/assets/CD6/300/sprockets%2F397ec39d3d883789effe506c38760368 +0 -0
- data/test/dummy/tmp/cache/assets/CD7/DD0/sprockets%2F4f1fe68aa2042a0970bde9b185530646 +0 -0
- data/test/dummy/tmp/cache/assets/CD8/370/sprockets%2F357970feca3ac29060c1e3861e2c0953 +0 -0
- data/test/dummy/tmp/cache/assets/CF7/2B0/sprockets%2F25a7c73655bd3598173b39d9f98bcd46 +0 -0
- data/test/dummy/tmp/cache/assets/CFE/080/sprockets%2F37fe9f4255baddbd549a659914929398 +0 -0
- data/test/dummy/tmp/cache/assets/{CE1/F50/sprockets%2F6e6b593b107866863500ba0fee5a9e24 → D16/F90/sprockets%2F5fe3c021048c6f9a6086bed7736d87b1} +0 -0
- data/test/dummy/tmp/cache/assets/{CDD/7D0/sprockets%2F60687bff4553a7f8c701bb9627a6200a → D24/360/sprockets%2F6987b047a96dc685ba3cf39b31477f6d} +0 -0
- data/test/dummy/tmp/cache/assets/D32/A10/sprockets%2F13fe41fee1fe35b49d145bcc06610705 +0 -0
- data/test/dummy/tmp/cache/assets/D37/2B0/sprockets%2F40834fb07d7318c1fddd5003bd9e04f6 +0 -0
- data/test/dummy/tmp/cache/assets/D43/0D0/sprockets%2F682843a8d0795a5fbcfeb2f0c81727d0 +0 -0
- data/test/dummy/tmp/cache/assets/D4E/1B0/sprockets%2Ff7cbd26ba1d28d48de824f0e94586655 +0 -0
- data/test/dummy/tmp/cache/assets/D50/A30/sprockets%2F7d8b294ac433db5d056538f8cf7c66b9 +0 -0
- data/test/dummy/tmp/cache/assets/D5A/EA0/sprockets%2Fd771ace226fc8215a3572e0aa35bb0d6 +0 -0
- data/test/dummy/tmp/cache/assets/D6C/7D0/sprockets%2F8a05d6981ec0d38c51739bef0b3a9c2b +0 -0
- data/test/dummy/tmp/cache/assets/D94/FF0/sprockets%2F3b56a1aa77de0d570c38a4a9d5f4b1d6 +0 -0
- data/test/dummy/tmp/cache/assets/D97/6B0/sprockets%2Fb070e8c799d1a4ad5e62e0a1ae3b83e6 +0 -0
- data/test/dummy/tmp/cache/assets/DA6/A80/sprockets%2F92e26d8e58d5bcc8b8f6c25d1b05b9c1 +0 -0
- data/test/dummy/tmp/cache/assets/{DB7/BD0/sprockets%2Ff2c59778ab79dcfd3792f46f2ce82f2a → DC0/D20/sprockets%2F1ccf7405cd252dcec4bf23af82e2563a} +0 -0
- data/test/dummy/tmp/cache/assets/{D5C/B00/sprockets%2F2b7ac06cc680d7480c06b917bac5a6b0 → DD2/D80/sprockets%2Fc66d103807d0f971fbbcf9aa8b8b27ee} +0 -0
- data/test/dummy/tmp/cache/assets/DDC/400/sprockets%2Fcffd775d018f68ce5dba1ee0d951a994 +0 -0
- data/test/dummy/tmp/cache/assets/DE8/790/sprockets%2Fd1333bde2b9aafcc712d11dd09ab35d8 +0 -0
- data/test/dummy/tmp/cache/assets/DF5/5E0/sprockets%2F8e64a37c73cdc0b37a4ccfcb42ab45d8 +0 -0
- data/test/dummy/tmp/cache/assets/DF7/960/sprockets%2F99ac6db10b44a64fbba4ee847b35ba8b +0 -0
- data/test/dummy/tmp/cache/assets/{C84/A00/sprockets%2F3ba04c88513936081d59d8771f6804aa → DFC/040/sprockets%2F15ea81cf915c0cb1dfc9cc04c9fef364} +0 -0
- data/test/dummy/tmp/cache/assets/DFD/300/sprockets%2Fabac9489cf7f1db8ef00d72a1571ee1e +0 -0
- data/test/dummy/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af +0 -0
- data/test/dummy/tmp/cache/assets/E38/FE0/sprockets%2Fe1fc875efa817cbb94a5d8de25ea4e6b +0 -0
- data/test/dummy/tmp/cache/assets/E5F/960/sprockets%2Fdc007b6cad5c7ef08e33ec28cfff0ef6 +0 -0
- data/test/dummy/tmp/performance/BenchmarkerTest#test_puts_foo_gc_runs.csv +2 -0
- data/test/dummy/tmp/performance/BenchmarkerTest#test_puts_foo_gc_time.csv +2 -0
- data/test/dummy/tmp/performance/BenchmarkerTest#test_puts_foo_memory.csv +2 -0
- data/test/dummy/tmp/performance/BenchmarkerTest#test_puts_foo_objects.csv +2 -0
- data/test/dummy/tmp/performance/BenchmarkerTest#test_puts_foo_wall_time.csv +2 -0
- data/test/dummy/tmp/performance/ProfilerTest#test_puts_foo_process_time_flat.txt +11 -0
- data/test/dummy/tmp/performance/ProfilerTest#test_puts_foo_process_time_graph.html +303 -0
- data/test/dummy/tmp/performance/ProfilerTest#test_puts_foo_process_time_stack.html +546 -0
- data/test/dummy/tmp/performance/ProfilerTest#test_puts_foo_process_time_tree.txt +38 -0
- data/test/dummy/tmp/performance/empty.png +0 -0
- data/test/dummy/tmp/performance/minus.png +0 -0
- data/test/dummy/tmp/performance/plus.png +0 -0
- data/test/test_helper.rb +36 -0
- data/test/unit/aleph_patron_test.rb +40 -35
- data/test/unit/aleph_record_benchmarks.rb +28 -24
- data/test/unit/aleph_record_test.rb +31 -26
- data/test/unit/collection_test.rb +17 -18
- data/test/unit/google_book_search_test.rb +18 -44
- data/test/unit/primo_searcher_test.rb +325 -321
- data/test/unit/primo_service_test.rb +924 -919
- data/test/unit/primo_ws_test.rb +141 -138
- data/test/unit/service_test.rb +2 -16
- metadata +93 -100
- data/test/dummy/tmp/cache/assets/C73/920/sprockets%2Fd371318f22900492fd180f17c5e2a504 +0 -0
- data/test/dummy/tmp/cache/assets/C8F/780/sprockets%2Fe47e28558116fb5f8038754e60d1961d +0 -0
- data/test/dummy/tmp/cache/assets/CAA/EB0/sprockets%2F1d179210e8b76f1ea63c802688a015e4 +0 -9271
- data/test/dummy/tmp/cache/assets/CB2/DA0/sprockets%2Fa1808990b72376256db2ae3818c0e9b5 +0 -0
- data/test/dummy/tmp/cache/assets/CBB/9C0/sprockets%2F706f28923fb754cad04b9107c89986a1 +0 -0
- data/test/dummy/tmp/cache/assets/CDC/680/sprockets%2F2b68ef632d12610f3c9563168bfa7c05 +0 -0
- data/test/dummy/tmp/cache/assets/CEA/2A0/sprockets%2F9c8607157b998108ce08f4aca39f810a +0 -0
- data/test/dummy/tmp/cache/assets/CF5/9B0/sprockets%2F7933bfe880731b396791f1682ce3f7fa +0 -0
- data/test/dummy/tmp/cache/assets/CFB/2F0/sprockets%2F62d51f0aa5cac4b1cf7091823772a604 +0 -0
- data/test/dummy/tmp/cache/assets/D22/060/sprockets%2F9aec77b768e91a802d284271c58e2f7e +0 -0
- data/test/dummy/tmp/cache/assets/D33/6D0/sprockets%2F500129c57f1146e556ec3aacd6cd38c1 +0 -0
- data/test/dummy/tmp/cache/assets/D33/FD0/sprockets%2F2ba0b4e6334a77b923e5f770381bb2bf +0 -0
- data/test/dummy/tmp/cache/assets/D4C/0A0/sprockets%2F7810d837eec3ac57ad78756af83a6a55 +0 -0
- data/test/dummy/tmp/cache/assets/D4C/E30/sprockets%2F631abf89746799b7a5b2b3b4f6294bcd +0 -0
- data/test/dummy/tmp/cache/assets/D54/ED0/sprockets%2F71c9fa01091d432b131da3bb73faf3d4 +0 -873
- data/test/dummy/tmp/cache/assets/D5D/AD0/sprockets%2Fbdb053d9a6a967788f09fbc555d69f58 +0 -0
- data/test/dummy/tmp/cache/assets/D66/890/sprockets%2F06287a78ed20d8214197eab03bfca5dd +0 -0
- data/test/dummy/tmp/cache/assets/D6B/2A0/sprockets%2F81f17ab0ed20f4a8d9355f7a1d872eb2 +0 -0
- data/test/dummy/tmp/cache/assets/D70/080/sprockets%2F24d3ce40ae5cc827a9183b1fb837e84e +0 -0
- data/test/dummy/tmp/cache/assets/D71/6B0/sprockets%2Fde558b71b494cf09b1bf055c8dff0353 +0 -0
- data/test/dummy/tmp/cache/assets/D72/610/sprockets%2Fa8c708eeb30ef93de34d755d4f45d023 +0 -0
- data/test/dummy/tmp/cache/assets/D74/4C0/sprockets%2F64fdf30f75592d6e45fcfc45a48d20a2 +0 -0
- data/test/dummy/tmp/cache/assets/D76/AD0/sprockets%2Fe2158cde93188cf5ab6457bc6d6602ec +0 -0
- data/test/dummy/tmp/cache/assets/D7A/E40/sprockets%2F9622ffcc499a57627cd1bb18fe31b8e4 +0 -11772
- data/test/dummy/tmp/cache/assets/D84/210/sprockets%2Fabd0103ccec2b428ac62c94e4c40b384 +0 -0
- data/test/dummy/tmp/cache/assets/D9B/770/sprockets%2F8aacf02eb7dbb0949704b28f27b87e0b +0 -0
- data/test/dummy/tmp/cache/assets/DF7/F30/sprockets%2F7bc16c4109b17fabe29f8ddbbf732d1c +0 -0
- data/test/dummy/tmp/cache/assets/E03/570/sprockets%2F493bdc0ac14cd4f57fdfe4253f992bde +0 -0
- data/test/dummy/tmp/cache/assets/E09/850/sprockets%2F4bf497a38ecfef660b2f0ebb852d5e9c +0 -0
- data/test/dummy/tmp/cache/assets/E0B/4B0/sprockets%2F7988df51a61c81ce6ede4a2d4c8cce4f +0 -377
- data/test/dummy/tmp/cache/assets/E6F/A00/sprockets%2Fd32bcea45ea04a6aaee95b3aa840cbab +0 -0
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -1,377 +0,0 @@
|
|
1
|
-
o: ActiveSupport::Cache::Entry :@compressedF:@value{"asset_paths["v/home/rochkind/.rvm/gems/ruby-1.8.7-p352@umlaut3/gems/jquery-rails-1.0.19/vendor/assets/javascripts/jquery_ujs.js" body"�;(function($, undefined) {
|
2
|
-
|
3
|
-
/**
|
4
|
-
* Unobtrusive scripting adapter for jQuery
|
5
|
-
*
|
6
|
-
* Requires jQuery 1.6.0 or later.
|
7
|
-
* https://github.com/rails/jquery-ujs
|
8
|
-
|
9
|
-
* Uploading file using rails.js
|
10
|
-
* =============================
|
11
|
-
*
|
12
|
-
* By default, browsers do not allow files to be uploaded via AJAX. As a result, if there are any non-blank file fields
|
13
|
-
* in the remote form, this adapter aborts the AJAX submission and allows the form to submit through standard means.
|
14
|
-
*
|
15
|
-
* The `ajax:aborted:file` event allows you to bind your own handler to process the form submission however you wish.
|
16
|
-
*
|
17
|
-
* Ex:
|
18
|
-
* $('form').live('ajax:aborted:file', function(event, elements){
|
19
|
-
* // Implement own remote file-transfer handler here for non-blank file inputs passed in `elements`.
|
20
|
-
* // Returning false in this handler tells rails.js to disallow standard form submission
|
21
|
-
* return false;
|
22
|
-
* });
|
23
|
-
*
|
24
|
-
* The `ajax:aborted:file` event is fired when a file-type input is detected with a non-blank value.
|
25
|
-
*
|
26
|
-
* Third-party tools can use this hook to detect when an AJAX file upload is attempted, and then use
|
27
|
-
* techniques like the iframe method to upload the file instead.
|
28
|
-
*
|
29
|
-
* Required fields in rails.js
|
30
|
-
* ===========================
|
31
|
-
*
|
32
|
-
* If any blank required inputs (required="required") are detected in the remote form, the whole form submission
|
33
|
-
* is canceled. Note that this is unlike file inputs, which still allow standard (non-AJAX) form submission.
|
34
|
-
*
|
35
|
-
* The `ajax:aborted:required` event allows you to bind your own handler to inform the user of blank required inputs.
|
36
|
-
*
|
37
|
-
* !! Note that Opera does not fire the form's submit event if there are blank required inputs, so this event may never
|
38
|
-
* get fired in Opera. This event is what causes other browsers to exhibit the same submit-aborting behavior.
|
39
|
-
*
|
40
|
-
* Ex:
|
41
|
-
* $('form').live('ajax:aborted:required', function(event, elements){
|
42
|
-
* // Returning false in this handler tells rails.js to submit the form anyway.
|
43
|
-
* // The blank required inputs are passed to this function in `elements`.
|
44
|
-
* return ! confirm("Would you like to submit the form with missing info?");
|
45
|
-
* });
|
46
|
-
*/
|
47
|
-
|
48
|
-
// Shorthand to make it a little easier to call public rails functions from within rails.js
|
49
|
-
var rails;
|
50
|
-
|
51
|
-
$.rails = rails = {
|
52
|
-
// Link elements bound by jquery-ujs
|
53
|
-
linkClickSelector: 'a[data-confirm], a[data-method], a[data-remote], a[data-disable-with]',
|
54
|
-
|
55
|
-
// Select elements bound by jquery-ujs
|
56
|
-
inputChangeSelector: 'select[data-remote], input[data-remote], textarea[data-remote]',
|
57
|
-
|
58
|
-
// Form elements bound by jquery-ujs
|
59
|
-
formSubmitSelector: 'form',
|
60
|
-
|
61
|
-
// Form input elements bound by jquery-ujs
|
62
|
-
formInputClickSelector: 'form input[type=submit], form input[type=image], form button[type=submit], form button:not(button[type])',
|
63
|
-
|
64
|
-
// Form input elements disabled during form submission
|
65
|
-
disableSelector: 'input[data-disable-with], button[data-disable-with], textarea[data-disable-with]',
|
66
|
-
|
67
|
-
// Form input elements re-enabled after form submission
|
68
|
-
enableSelector: 'input[data-disable-with]:disabled, button[data-disable-with]:disabled, textarea[data-disable-with]:disabled',
|
69
|
-
|
70
|
-
// Form required input elements
|
71
|
-
requiredInputSelector: 'input[name][required]:not([disabled]),textarea[name][required]:not([disabled])',
|
72
|
-
|
73
|
-
// Form file input elements
|
74
|
-
fileInputSelector: 'input:file',
|
75
|
-
|
76
|
-
// Link onClick disable selector with possible reenable after remote submission
|
77
|
-
linkDisableSelector: 'a[data-disable-with]',
|
78
|
-
|
79
|
-
// Make sure that every Ajax request sends the CSRF token
|
80
|
-
CSRFProtection: function(xhr) {
|
81
|
-
var token = $('meta[name="csrf-token"]').attr('content');
|
82
|
-
if (token) xhr.setRequestHeader('X-CSRF-Token', token);
|
83
|
-
},
|
84
|
-
|
85
|
-
// Triggers an event on an element and returns false if the event result is false
|
86
|
-
fire: function(obj, name, data) {
|
87
|
-
var event = $.Event(name);
|
88
|
-
obj.trigger(event, data);
|
89
|
-
return event.result !== false;
|
90
|
-
},
|
91
|
-
|
92
|
-
// Default confirm dialog, may be overridden with custom confirm dialog in $.rails.confirm
|
93
|
-
confirm: function(message) {
|
94
|
-
return confirm(message);
|
95
|
-
},
|
96
|
-
|
97
|
-
// Default ajax function, may be overridden with custom function in $.rails.ajax
|
98
|
-
ajax: function(options) {
|
99
|
-
return $.ajax(options);
|
100
|
-
},
|
101
|
-
|
102
|
-
// Submits "remote" forms and links with ajax
|
103
|
-
handleRemote: function(element) {
|
104
|
-
var method, url, data,
|
105
|
-
crossDomain = element.data('cross-domain') || null,
|
106
|
-
dataType = element.data('type') || ($.ajaxSettings && $.ajaxSettings.dataType),
|
107
|
-
options;
|
108
|
-
|
109
|
-
if (rails.fire(element, 'ajax:before')) {
|
110
|
-
|
111
|
-
if (element.is('form')) {
|
112
|
-
method = element.attr('method');
|
113
|
-
url = element.attr('action');
|
114
|
-
data = element.serializeArray();
|
115
|
-
// memoized value from clicked submit button
|
116
|
-
var button = element.data('ujs:submit-button');
|
117
|
-
if (button) {
|
118
|
-
data.push(button);
|
119
|
-
element.data('ujs:submit-button', null);
|
120
|
-
}
|
121
|
-
} else if (element.is(rails.inputChangeSelector)) {
|
122
|
-
method = element.data('method');
|
123
|
-
url = element.data('url');
|
124
|
-
data = element.serialize();
|
125
|
-
if (element.data('params')) data = data + "&" + element.data('params');
|
126
|
-
} else {
|
127
|
-
method = element.data('method');
|
128
|
-
url = element.attr('href');
|
129
|
-
data = element.data('params') || null;
|
130
|
-
}
|
131
|
-
|
132
|
-
options = {
|
133
|
-
type: method || 'GET', data: data, dataType: dataType, crossDomain: crossDomain,
|
134
|
-
// stopping the "ajax:beforeSend" event will cancel the ajax request
|
135
|
-
beforeSend: function(xhr, settings) {
|
136
|
-
if (settings.dataType === undefined) {
|
137
|
-
xhr.setRequestHeader('accept', '*/*;q=0.5, ' + settings.accepts.script);
|
138
|
-
}
|
139
|
-
return rails.fire(element, 'ajax:beforeSend', [xhr, settings]);
|
140
|
-
},
|
141
|
-
success: function(data, status, xhr) {
|
142
|
-
element.trigger('ajax:success', [data, status, xhr]);
|
143
|
-
},
|
144
|
-
complete: function(xhr, status) {
|
145
|
-
element.trigger('ajax:complete', [xhr, status]);
|
146
|
-
},
|
147
|
-
error: function(xhr, status, error) {
|
148
|
-
element.trigger('ajax:error', [xhr, status, error]);
|
149
|
-
}
|
150
|
-
};
|
151
|
-
// Only pass url to `ajax` options if not blank
|
152
|
-
if (url) { options.url = url; }
|
153
|
-
|
154
|
-
return rails.ajax(options);
|
155
|
-
} else {
|
156
|
-
return false;
|
157
|
-
}
|
158
|
-
},
|
159
|
-
|
160
|
-
// Handles "data-method" on links such as:
|
161
|
-
// <a href="/users/5" data-method="delete" rel="nofollow" data-confirm="Are you sure?">Delete</a>
|
162
|
-
handleMethod: function(link) {
|
163
|
-
var href = link.attr('href'),
|
164
|
-
method = link.data('method'),
|
165
|
-
target = link.attr('target'),
|
166
|
-
csrf_token = $('meta[name=csrf-token]').attr('content'),
|
167
|
-
csrf_param = $('meta[name=csrf-param]').attr('content'),
|
168
|
-
form = $('<form method="post" action="' + href + '"></form>'),
|
169
|
-
metadata_input = '<input name="_method" value="' + method + '" type="hidden" />';
|
170
|
-
|
171
|
-
if (csrf_param !== undefined && csrf_token !== undefined) {
|
172
|
-
metadata_input += '<input name="' + csrf_param + '" value="' + csrf_token + '" type="hidden" />';
|
173
|
-
}
|
174
|
-
|
175
|
-
if (target) { form.attr('target', target); }
|
176
|
-
|
177
|
-
form.hide().append(metadata_input).appendTo('body');
|
178
|
-
form.submit();
|
179
|
-
},
|
180
|
-
|
181
|
-
/* Disables form elements:
|
182
|
-
- Caches element value in 'ujs:enable-with' data store
|
183
|
-
- Replaces element text with value of 'data-disable-with' attribute
|
184
|
-
- Sets disabled property to true
|
185
|
-
*/
|
186
|
-
disableFormElements: function(form) {
|
187
|
-
form.find(rails.disableSelector).each(function() {
|
188
|
-
var element = $(this), method = element.is('button') ? 'html' : 'val';
|
189
|
-
element.data('ujs:enable-with', element[method]());
|
190
|
-
element[method](element.data('disable-with'));
|
191
|
-
element.prop('disabled', true);
|
192
|
-
});
|
193
|
-
},
|
194
|
-
|
195
|
-
/* Re-enables disabled form elements:
|
196
|
-
- Replaces element text with cached value from 'ujs:enable-with' data store (created in `disableFormElements`)
|
197
|
-
- Sets disabled property to false
|
198
|
-
*/
|
199
|
-
enableFormElements: function(form) {
|
200
|
-
form.find(rails.enableSelector).each(function() {
|
201
|
-
var element = $(this), method = element.is('button') ? 'html' : 'val';
|
202
|
-
if (element.data('ujs:enable-with')) element[method](element.data('ujs:enable-with'));
|
203
|
-
element.prop('disabled', false);
|
204
|
-
});
|
205
|
-
},
|
206
|
-
|
207
|
-
/* For 'data-confirm' attribute:
|
208
|
-
- Fires `confirm` event
|
209
|
-
- Shows the confirmation dialog
|
210
|
-
- Fires the `confirm:complete` event
|
211
|
-
|
212
|
-
Returns `true` if no function stops the chain and user chose yes; `false` otherwise.
|
213
|
-
Attaching a handler to the element's `confirm` event that returns a `falsy` value cancels the confirmation dialog.
|
214
|
-
Attaching a handler to the element's `confirm:complete` event that returns a `falsy` value makes this function
|
215
|
-
return false. The `confirm:complete` event is fired whether or not the user answered true or false to the dialog.
|
216
|
-
*/
|
217
|
-
allowAction: function(element) {
|
218
|
-
var message = element.data('confirm'),
|
219
|
-
answer = false, callback;
|
220
|
-
if (!message) { return true; }
|
221
|
-
|
222
|
-
if (rails.fire(element, 'confirm')) {
|
223
|
-
answer = rails.confirm(message);
|
224
|
-
callback = rails.fire(element, 'confirm:complete', [answer]);
|
225
|
-
}
|
226
|
-
return answer && callback;
|
227
|
-
},
|
228
|
-
|
229
|
-
// Helper function which checks for blank inputs in a form that match the specified CSS selector
|
230
|
-
blankInputs: function(form, specifiedSelector, nonBlank) {
|
231
|
-
var inputs = $(), input,
|
232
|
-
selector = specifiedSelector || 'input,textarea';
|
233
|
-
form.find(selector).each(function() {
|
234
|
-
input = $(this);
|
235
|
-
// Collect non-blank inputs if nonBlank option is true, otherwise, collect blank inputs
|
236
|
-
if (nonBlank ? input.val() : !input.val()) {
|
237
|
-
inputs = inputs.add(input);
|
238
|
-
}
|
239
|
-
});
|
240
|
-
return inputs.length ? inputs : false;
|
241
|
-
},
|
242
|
-
|
243
|
-
// Helper function which checks for non-blank inputs in a form that match the specified CSS selector
|
244
|
-
nonBlankInputs: function(form, specifiedSelector) {
|
245
|
-
return rails.blankInputs(form, specifiedSelector, true); // true specifies nonBlank
|
246
|
-
},
|
247
|
-
|
248
|
-
// Helper function, needed to provide consistent behavior in IE
|
249
|
-
stopEverything: function(e) {
|
250
|
-
$(e.target).trigger('ujs:everythingStopped');
|
251
|
-
e.stopImmediatePropagation();
|
252
|
-
return false;
|
253
|
-
},
|
254
|
-
|
255
|
-
// find all the submit events directly bound to the form and
|
256
|
-
// manually invoke them. If anyone returns false then stop the loop
|
257
|
-
callFormSubmitBindings: function(form, event) {
|
258
|
-
var events = form.data('events'), continuePropagation = true;
|
259
|
-
if (events !== undefined && events['submit'] !== undefined) {
|
260
|
-
$.each(events['submit'], function(i, obj){
|
261
|
-
if (typeof obj.handler === 'function') return continuePropagation = obj.handler(event);
|
262
|
-
});
|
263
|
-
}
|
264
|
-
return continuePropagation;
|
265
|
-
},
|
266
|
-
|
267
|
-
// replace element's html with the 'data-disable-with' after storing original html
|
268
|
-
// and prevent clicking on it
|
269
|
-
disableElement: function(element) {
|
270
|
-
element.data('ujs:enable-with', element.html()); // store enabled state
|
271
|
-
element.html(element.data('disable-with')); // set to disabled state
|
272
|
-
element.bind('click.railsDisable', function(e) { // prevent further clicking
|
273
|
-
return rails.stopEverything(e)
|
274
|
-
});
|
275
|
-
},
|
276
|
-
|
277
|
-
// restore element to its original state which was disabled by 'disableElement' above
|
278
|
-
enableElement: function(element) {
|
279
|
-
if (element.data('ujs:enable-with') !== undefined) {
|
280
|
-
element.html(element.data('ujs:enable-with')); // set to old enabled state
|
281
|
-
// this should be element.removeData('ujs:enable-with')
|
282
|
-
// but, there is currently a bug in jquery which makes hyphenated data attributes not get removed
|
283
|
-
element.data('ujs:enable-with', false); // clean up cache
|
284
|
-
}
|
285
|
-
element.unbind('click.railsDisable'); // enable element
|
286
|
-
}
|
287
|
-
|
288
|
-
};
|
289
|
-
|
290
|
-
$.ajaxPrefilter(function(options, originalOptions, xhr){ if ( !options.crossDomain ) { rails.CSRFProtection(xhr); }});
|
291
|
-
|
292
|
-
$(document).delegate(rails.linkDisableSelector, 'ajax:complete', function() {
|
293
|
-
rails.enableElement($(this));
|
294
|
-
});
|
295
|
-
|
296
|
-
$(document).delegate(rails.linkClickSelector, 'click.rails', function(e) {
|
297
|
-
var link = $(this), method = link.data('method'), data = link.data('params');
|
298
|
-
if (!rails.allowAction(link)) return rails.stopEverything(e);
|
299
|
-
|
300
|
-
if (link.is(rails.linkDisableSelector)) rails.disableElement(link);
|
301
|
-
|
302
|
-
if (link.data('remote') !== undefined) {
|
303
|
-
if ( (e.metaKey || e.ctrlKey) && (!method || method === 'GET') && !data ) { return true; }
|
304
|
-
|
305
|
-
if (rails.handleRemote(link) === false) { rails.enableElement(link); }
|
306
|
-
return false;
|
307
|
-
|
308
|
-
} else if (link.data('method')) {
|
309
|
-
rails.handleMethod(link);
|
310
|
-
return false;
|
311
|
-
}
|
312
|
-
});
|
313
|
-
|
314
|
-
$(document).delegate(rails.inputChangeSelector, 'change.rails', function(e) {
|
315
|
-
var link = $(this);
|
316
|
-
if (!rails.allowAction(link)) return rails.stopEverything(e);
|
317
|
-
|
318
|
-
rails.handleRemote(link);
|
319
|
-
return false;
|
320
|
-
});
|
321
|
-
|
322
|
-
$(document).delegate(rails.formSubmitSelector, 'submit.rails', function(e) {
|
323
|
-
var form = $(this),
|
324
|
-
remote = form.data('remote') !== undefined,
|
325
|
-
blankRequiredInputs = rails.blankInputs(form, rails.requiredInputSelector),
|
326
|
-
nonBlankFileInputs = rails.nonBlankInputs(form, rails.fileInputSelector);
|
327
|
-
|
328
|
-
if (!rails.allowAction(form)) return rails.stopEverything(e);
|
329
|
-
|
330
|
-
// skip other logic when required values are missing or file upload is present
|
331
|
-
if (blankRequiredInputs && form.attr("novalidate") == undefined && rails.fire(form, 'ajax:aborted:required', [blankRequiredInputs])) {
|
332
|
-
return rails.stopEverything(e);
|
333
|
-
}
|
334
|
-
|
335
|
-
if (remote) {
|
336
|
-
if (nonBlankFileInputs) {
|
337
|
-
return rails.fire(form, 'ajax:aborted:file', [nonBlankFileInputs]);
|
338
|
-
}
|
339
|
-
|
340
|
-
// If browser does not support submit bubbling, then this live-binding will be called before direct
|
341
|
-
// bindings. Therefore, we should directly call any direct bindings before remotely submitting form.
|
342
|
-
if (!$.support.submitBubbles && $().jquery < '1.7' && rails.callFormSubmitBindings(form, e) === false) return rails.stopEverything(e);
|
343
|
-
|
344
|
-
rails.handleRemote(form);
|
345
|
-
return false;
|
346
|
-
|
347
|
-
} else {
|
348
|
-
// slight timeout so that the submit button gets properly serialized
|
349
|
-
setTimeout(function(){ rails.disableFormElements(form); }, 13);
|
350
|
-
}
|
351
|
-
});
|
352
|
-
|
353
|
-
$(document).delegate(rails.formInputClickSelector, 'click.rails', function(event) {
|
354
|
-
var button = $(this);
|
355
|
-
|
356
|
-
if (!rails.allowAction(button)) return rails.stopEverything(event);
|
357
|
-
|
358
|
-
// register the pressed submit button
|
359
|
-
var name = button.attr('name'),
|
360
|
-
data = name ? {name:name, value:button.val()} : null;
|
361
|
-
|
362
|
-
button.closest('form').data('ujs:submit-button', data);
|
363
|
-
});
|
364
|
-
|
365
|
-
$(document).delegate(rails.formSubmitSelector, 'ajax:beforeSend.rails', function(event) {
|
366
|
-
if (this == event.target) rails.disableFormElements($(this));
|
367
|
-
});
|
368
|
-
|
369
|
-
$(document).delegate(rails.formSubmitSelector, 'ajax:complete.rails', function(event) {
|
370
|
-
if (this == event.target) rails.enableFormElements($(this));
|
371
|
-
});
|
372
|
-
|
373
|
-
})( jQuery );
|
374
|
-
"content_type"application/javascript"
|
375
|
-
class"BundledAsset"
|
376
|
-
mtime"2011-12-06T17:02:51-05:00"
|
377
|
-
mtimeu: Time
|