goat 0.3.10 → 0.3.11
Sign up to get free protection for your applications and to get access to all the features.
- data/goat.gemspec +1 -1
- data/lib/goat/goat.js +38 -13
- metadata +3 -3
data/goat.gemspec
CHANGED
data/lib/goat/goat.js
CHANGED
@@ -170,14 +170,6 @@ var GoatRT = {
|
|
170
170
|
}
|
171
171
|
}
|
172
172
|
|
173
|
-
function showSpinner() {
|
174
|
-
$("#menu").prepend(GoatRT.spinner);
|
175
|
-
}
|
176
|
-
|
177
|
-
function hideSpinner() {
|
178
|
-
$("#spinner").remove();
|
179
|
-
}
|
180
|
-
|
181
173
|
function newTxn() {
|
182
174
|
var op = new RTTxn();
|
183
175
|
rt.ops[op.code] = op;
|
@@ -199,9 +191,10 @@ var GoatRT = {
|
|
199
191
|
delete rt.pendingTxns[txn];
|
200
192
|
|
201
193
|
if(pendingCount() == 0) {
|
202
|
-
|
203
|
-
if(txn.complete) txn.complete();
|
194
|
+
LoadingIndicator.hide();
|
204
195
|
}
|
196
|
+
|
197
|
+
if(txn.complete) txn.complete();
|
205
198
|
} else {
|
206
199
|
console.error("Can't complete txn " + txn + ": no such txn was started");
|
207
200
|
}
|
@@ -218,12 +211,44 @@ var GoatRT = {
|
|
218
211
|
rt.newTxn = newTxn;
|
219
212
|
rt.beginTxn = beginTxn;
|
220
213
|
rt.txnCompleteMsg = txnCompleteMsg;
|
221
|
-
rt.spinner = $("<img id=\"spinner\" src=\"/static/img/spinner.gif\">");
|
222
|
-
rt.showSpinner = showSpinner;
|
223
214
|
|
224
215
|
return rt;
|
225
216
|
})(GoatRT);
|
226
217
|
|
218
|
+
var LoadingIndicator = {
|
219
|
+
url: null,
|
220
|
+
indicator: null,
|
221
|
+
where: null,
|
222
|
+
indicatorActive: false
|
223
|
+
};
|
224
|
+
|
225
|
+
(function(ld) {
|
226
|
+
function initIndicator() {
|
227
|
+
if(!ld.url || !ld.where) console.error("Loading indicator not configured");
|
228
|
+
ld.indicator = $("<img id=\"loading_indicator\" src=\"" + ld.url + "\">");
|
229
|
+
}
|
230
|
+
|
231
|
+
function show() {
|
232
|
+
ld.indicatorActive = true;
|
233
|
+
$(ld.where).prepend(ld.indicator);
|
234
|
+
}
|
235
|
+
|
236
|
+
function hide() {
|
237
|
+
if(ld.indicatorActive)
|
238
|
+
ld.indicator.remove();
|
239
|
+
}
|
240
|
+
|
241
|
+
$(document).ready(function() {
|
242
|
+
initIndicator();
|
243
|
+
new Image(ld.url);
|
244
|
+
});
|
245
|
+
|
246
|
+
ld.show = show;
|
247
|
+
ld.hide = hide;
|
248
|
+
|
249
|
+
return ld;
|
250
|
+
})(LoadingIndicator);
|
251
|
+
|
227
252
|
var RTTxn = Class.extend({
|
228
253
|
init: function() {
|
229
254
|
this.code = String.random(8, 'txn');
|
@@ -306,7 +331,7 @@ var GoatRPC = Class.extend({
|
|
306
331
|
}
|
307
332
|
|
308
333
|
if(this.start) this.start()
|
309
|
-
else if(this.rt)
|
334
|
+
else if(this.rt) LoadingIndicator.show();
|
310
335
|
|
311
336
|
$.ajax({
|
312
337
|
type: 'POST',
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: goat
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 5
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
version: 0.3.
|
9
|
+
- 11
|
10
|
+
version: 0.3.11
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Patrick Collison
|