muck-engine 0.4.17 → 0.4.21

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.17
1
+ 0.4.21
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{muck-engine}
8
- s.version = "0.4.17"
8
+ s.version = "0.4.21"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Justin Ball", "Joel Duffin"]
12
- s.date = %q{2010-03-29}
12
+ s.date = %q{2010-04-08}
13
13
  s.description = %q{The base engine for the muck system. Contains common tables, custom for, css and javascript.}
14
14
  s.email = %q{justin@tatemae.com}
15
15
  s.extra_rdoc_files = [
@@ -556,6 +556,7 @@ Gem::Specification.new do |s|
556
556
  "public/javascripts/jquery/jquery.tips.js",
557
557
  "public/javascripts/jquery/jrails.js",
558
558
  "public/javascripts/muck-countries.js",
559
+ "public/javascripts/muck-src.js",
559
560
  "public/javascripts/muck.js",
560
561
  "public/javascripts/muck_time/en.js",
561
562
  "public/javascripts/tree.js",
@@ -1,7 +1,7 @@
1
- /*
1
+ /*!
2
2
  * jQuery Form Plugin
3
- * version: 2.36 (07-NOV-2009)
4
- * @requires jQuery v1.2.6 or later
3
+ * version: 2.43 (12-MAR-2010)
4
+ * @requires jQuery v1.3.2 or later
5
5
  *
6
6
  * Examples and documentation at: http://malsup.com/jquery/form/
7
7
  * Dual licensed under the MIT and GPL licenses:
@@ -124,15 +124,16 @@ $.fn.ajaxSubmit = function(options) {
124
124
  if (!options.dataType && options.target) {
125
125
  var oldSuccess = options.success || function(){};
126
126
  callbacks.push(function(data) {
127
- $(options.target).html(data).each(oldSuccess, arguments);
127
+ var fn = options.replaceTarget ? 'replaceWith' : 'html';
128
+ $(options.target)[fn](data).each(oldSuccess, arguments);
128
129
  });
129
130
  }
130
131
  else if (options.success)
131
132
  callbacks.push(options.success);
132
133
 
133
- options.success = function(data, status) {
134
+ options.success = function(data, status, xhr) { // jQuery 1.4+ passes xhr as 3rd arg
134
135
  for (var i=0, max=callbacks.length; i < max; i++)
135
- callbacks[i].apply(options, [data, status, $form]);
136
+ callbacks[i].apply(options, [data, status, xhr || $form, $form]);
136
137
  };
137
138
 
138
139
  // are there files to upload?
@@ -177,7 +178,7 @@ $.fn.ajaxSubmit = function(options) {
177
178
  var s = $.extend(true, {}, $.extend(true, {}, $.ajaxSettings), opts);
178
179
 
179
180
  var id = 'jqFormIO' + (new Date().getTime());
180
- var $io = $('<iframe id="' + id + '" name="' + id + '" src="'+ opts.iframeSrc +'" />');
181
+ var $io = $('<iframe id="' + id + '" name="' + id + '" src="'+ opts.iframeSrc +'" onload="(jQuery(this).data(\'form-plugin-onload\'))()" />');
181
182
  var io = $io[0];
182
183
 
183
184
  $io.css({ position: 'absolute', top: '-1000px', left: '-1000px' });
@@ -209,7 +210,7 @@ $.fn.ajaxSubmit = function(options) {
209
210
  if (xhr.aborted)
210
211
  return;
211
212
 
212
- var cbInvoked = 0;
213
+ var cbInvoked = false;
213
214
  var timedOut = 0;
214
215
 
215
216
  // add submitting element to data if we know it
@@ -217,17 +218,17 @@ $.fn.ajaxSubmit = function(options) {
217
218
  if (sub) {
218
219
  var n = sub.name;
219
220
  if (n && !sub.disabled) {
220
- options.extraData = options.extraData || {};
221
- options.extraData[n] = sub.value;
221
+ opts.extraData = opts.extraData || {};
222
+ opts.extraData[n] = sub.value;
222
223
  if (sub.type == "image") {
223
- options.extraData[name+'.x'] = form.clk_x;
224
- options.extraData[name+'.y'] = form.clk_y;
224
+ opts.extraData[n+'.x'] = form.clk_x;
225
+ opts.extraData[n+'.y'] = form.clk_y;
225
226
  }
226
227
  }
227
228
  }
228
229
 
229
230
  // take a breath so that pending repaints get some cpu time before the upload starts
230
- setTimeout(function() {
231
+ function doSubmit() {
231
232
  // make sure form attrs are set
232
233
  var t = $form.attr('target'), a = $form.attr('action');
233
234
 
@@ -239,7 +240,7 @@ $.fn.ajaxSubmit = function(options) {
239
240
  form.setAttribute('action', opts.url);
240
241
 
241
242
  // ie borks in some cases when setting encoding
242
- if (! options.skipEncodingOverride) {
243
+ if (! opts.skipEncodingOverride) {
243
244
  $form.attr({
244
245
  encoding: 'multipart/form-data',
245
246
  enctype: 'multipart/form-data'
@@ -253,15 +254,15 @@ $.fn.ajaxSubmit = function(options) {
253
254
  // add "extra" data to form if provided in options
254
255
  var extraInputs = [];
255
256
  try {
256
- if (options.extraData)
257
- for (var n in options.extraData)
257
+ if (opts.extraData)
258
+ for (var n in opts.extraData)
258
259
  extraInputs.push(
259
- $('<input type="hidden" name="'+n+'" value="'+options.extraData[n]+'" />')
260
+ $('<input type="hidden" name="'+n+'" value="'+opts.extraData[n]+'" />')
260
261
  .appendTo(form)[0]);
261
262
 
262
263
  // add iframe to doc and submit the form
263
264
  $io.appendTo('body');
264
- io.attachEvent ? io.attachEvent('onload', cb) : io.addEventListener('load', cb, false);
265
+ $io.data('form-plugin-onload', cb);
265
266
  form.submit();
266
267
  }
267
268
  finally {
@@ -270,14 +271,18 @@ $.fn.ajaxSubmit = function(options) {
270
271
  t ? form.setAttribute('target', t) : $form.removeAttr('target');
271
272
  $(extraInputs).remove();
272
273
  }
273
- }, 10);
274
+ };
274
275
 
275
- var domCheckCount = 50;
276
+ if (opts.forceSync)
277
+ doSubmit();
278
+ else
279
+ setTimeout(doSubmit, 10); // this lets dom updates render
280
+
281
+ var domCheckCount = 100;
276
282
 
277
283
  function cb() {
278
- if (cbInvoked++) return;
279
-
280
- io.detachEvent ? io.detachEvent('onload', cb) : io.removeEventListener('load', cb, false);
284
+ if (cbInvoked)
285
+ return;
281
286
 
282
287
  var ok = true;
283
288
  try {
@@ -293,14 +298,16 @@ $.fn.ajaxSubmit = function(options) {
293
298
  if (--domCheckCount) {
294
299
  // in some browsers (Opera) the iframe DOM is not always traversable when
295
300
  // the onload callback fires, so we loop a bit to accommodate
296
- cbInvoked = 0;
297
- setTimeout(cb, 100);
301
+ log('requeing onLoad callback, DOM not available');
302
+ setTimeout(cb, 250);
298
303
  return;
299
304
  }
300
- log('Could not access iframe DOM after 50 tries.');
305
+ log('Could not access iframe DOM after 100 tries.');
301
306
  return;
302
307
  }
303
308
 
309
+ log('response detected');
310
+ cbInvoked = true;
304
311
  xhr.responseText = doc.body ? doc.body.innerHTML : null;
305
312
  xhr.responseXML = doc.XMLDocument ? doc.XMLDocument : doc;
306
313
  xhr.getResponseHeader = function(header){
@@ -326,7 +333,9 @@ $.fn.ajaxSubmit = function(options) {
326
333
  data = $.httpData(xhr, opts.dataType);
327
334
  }
328
335
  catch(e){
336
+ log('error caught:',e);
329
337
  ok = false;
338
+ xhr.error = e;
330
339
  $.handleError(opts, xhr, 'error', e);
331
340
  }
332
341
 
@@ -341,6 +350,7 @@ $.fn.ajaxSubmit = function(options) {
341
350
 
342
351
  // clean up
343
352
  setTimeout(function() {
353
+ $io.removeData('form-plugin-onload');
344
354
  $io.remove();
345
355
  xhr.responseXML = null;
346
356
  }, 100);
@@ -375,9 +385,9 @@ $.fn.ajaxSubmit = function(options) {
375
385
  * the form itself.
376
386
  */
377
387
  $.fn.ajaxForm = function(options) {
378
- return this.ajaxFormUnbind().bind('submit.form-plugin', function() {
388
+ return this.ajaxFormUnbind().bind('submit.form-plugin', function(e) {
389
+ e.preventDefault();
379
390
  $(this).ajaxSubmit(options);
380
- return false;
381
391
  }).bind('click.form-plugin', function(e) {
382
392
  var target = e.target;
383
393
  var $el = $(target);
@@ -653,8 +663,13 @@ $.fn.selected = function(select) {
653
663
  // helper fn for console logging
654
664
  // set $.fn.ajaxSubmit.debug to true to enable debug logging
655
665
  function log() {
656
- if ($.fn.ajaxSubmit.debug && window.console && window.console.log)
657
- window.console.log('[jquery.form] ' + Array.prototype.join.call(arguments,''));
666
+ if ($.fn.ajaxSubmit.debug) {
667
+ var msg = '[jquery.form] ' + Array.prototype.join.call(arguments,'');
668
+ if (window.console && window.console.log)
669
+ window.console.log(msg);
670
+ else if (window.opera && window.opera.postError)
671
+ window.opera.postError(msg);
672
+ }
658
673
  };
659
674
 
660
675
  })(jQuery);
@@ -0,0 +1,134 @@
1
+ // compress with http://closure-compiler.appspot.com/home
2
+ //jQuery.noConflict();
3
+ jQuery(document).ajaxSend(function(event, request, settings) {
4
+ add_headers(request);
5
+ if (settings.type.toUpperCase() == 'GET' || typeof(AUTH_TOKEN) == "undefined") return; // for details see: http://www.justinball.com/2009/07/08/jquery-ajax-get-in-firefox-post-in-internet-explorer/
6
+ // settings.data is a serialized string like "foo=bar&baz=boink" (or null)
7
+ settings.data = settings.data || "";
8
+ if (typeof(AUTH_TOKEN) != "undefined")
9
+ settings.data += (settings.data ? "&" : "") + "authenticity_token=" + encodeURIComponent(AUTH_TOKEN);
10
+ });
11
+
12
+ function apply_ajax_forms() {
13
+ jQuery('form.ajax').ajaxForm({
14
+ dataType: 'script',
15
+ beforeSend: add_headers
16
+ });
17
+ jQuery('form.ajax').append('<input type="hidden" name="format" value="js" />');
18
+ }
19
+
20
+ function add_headers(xhr){
21
+ xhr.setRequestHeader("Accept", "text/javascript");
22
+ xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest");
23
+ }
24
+
25
+ jQuery(document).ready(function() {
26
+
27
+ jQuery('a.ajax-delete').live('click', function() {
28
+ var title = jQuery(this).attr('title');
29
+ var do_delete = true;
30
+ if(title.length > 0){
31
+ do_delete = confirm(title);
32
+ }
33
+ if (do_delete){
34
+ jQuery.post(this.href, { _method: 'delete', format: 'js' }, null, "script");
35
+ }
36
+ return false;
37
+ });
38
+
39
+ jQuery('a.ajax-update').live('click', function() {
40
+ jQuery.post(this.href, { _method: 'put', format: 'js' }, null, "script");
41
+ return false;
42
+ });
43
+
44
+ jQuery(".submit-form").click(function() {
45
+ jQuery(this).parent('form').submit();
46
+ });
47
+
48
+ apply_ajax_forms();
49
+
50
+ jQuery('a.dialog-pop').live('click', function() {
51
+ var d = jQuery('<div class="dialog"></div>').appendTo("body");
52
+ d.dialog({ modal: true, autoOpen: false, width: 'auto', title: jQuery(this).attr('title') });
53
+ d.load(jQuery(this).attr('href'), '', function(){
54
+ d.dialog("open");
55
+ apply_ajax_forms();
56
+ });
57
+ return false;
58
+ });
59
+
60
+ jQuery(".submit-delete").live('click', function() {
61
+ jQuery(this).parents('.delete-container').fadeOut();
62
+ var form = jQuery(this).parents('form');
63
+ jQuery.post(form.attr('action') + '.json', form.serialize(),
64
+ function(data){
65
+ var json = eval('(' + data + ')');
66
+ if(!json.success){
67
+ jQuery.jGrowl.info(json.message);
68
+ }
69
+ });
70
+ return false;
71
+ });
72
+
73
+ jQuery(".submit-delete-js").live('click', function() {
74
+ jQuery(this).parents('.delete-container').fadeOut();
75
+ var form = jQuery(this).parents('form');
76
+ jQuery.post(form.attr('action') + '.js', form.serialize(),
77
+ function(data){
78
+ });
79
+ return false;
80
+ });
81
+
82
+ jQuery(document).ready(function() {
83
+ jQuery('.waiting').hide();
84
+ jQuery(".wait-button").live('click', function() {
85
+ jQuery(this).siblings('.waiting').show();
86
+ jQuery(this).hide();
87
+ });
88
+ });
89
+
90
+ });
91
+
92
+ // String list methods. These are handy for dealing with comma delimited lists
93
+ // in text boxes such as a list of emails or tags.
94
+ // Given a comma delimited string add a new item if it isn't in the string
95
+ function add_to_list(items_string, new_item){
96
+ var items = split_list(items_string);
97
+ var add = true;
98
+ for(i=0;i<items.length;i++){
99
+ if(items[i] == new_item){ add = false; }
100
+ }
101
+ if(add){
102
+ items.push(new_item);
103
+ }
104
+ return items.join(', ');
105
+ }
106
+
107
+ // Given a comma delimited list remove an item from the string
108
+ function remove_from_list(items_string, remove_item){
109
+ var items = split_list(items_string);
110
+ var cleaned = [];
111
+ for(i=0;i<items.length;i++){
112
+ if(items[i] != remove_item){
113
+ cleaned.push(items[i]);
114
+ }
115
+ }
116
+ return cleaned.join(', ');
117
+ }
118
+
119
+ // Split a string on commas
120
+ function split_list(items_string){
121
+ if(undefined != items_string && items_string.length > 0){
122
+ var items = items_string.split(',');
123
+ } else {
124
+ var items = [];
125
+ }
126
+ var cleaned = [];
127
+ for(i=0;i<items.length;i++){
128
+ var cleaned_item = items[i].split(" ").join("");
129
+ if(cleaned_item.length > 0){
130
+ cleaned.push(cleaned_item);
131
+ }
132
+ }
133
+ return cleaned;
134
+ }
@@ -1,89 +1,6 @@
1
- //jQuery.noConflict();
2
- jQuery(document).ajaxSend(function(event, request, settings) {
3
- add_headers(request);
4
- if (settings.type.toUpperCase() == 'GET' || typeof(AUTH_TOKEN) == "undefined") return; // for details see: http://www.justinball.com/2009/07/08/jquery-ajax-get-in-firefox-post-in-internet-explorer/
5
- // settings.data is a serialized string like "foo=bar&baz=boink" (or null)
6
- settings.data = settings.data || "";
7
- if (typeof(AUTH_TOKEN) != "undefined")
8
- settings.data += (settings.data ? "&" : "") + "authenticity_token=" + encodeURIComponent(AUTH_TOKEN);
9
- });
10
-
11
- function apply_ajax_forms() {
12
- jQuery('form.ajax').ajaxForm({
13
- dataType: 'script',
14
- beforeSend: add_headers
15
- });
16
- jQuery('form.ajax').append('<input type="hidden" name="format" value="js" />');
17
- }
18
-
19
- function add_headers(xhr){
20
- xhr.setRequestHeader("Accept", "text/javascript");
21
- xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest");
22
- }
23
-
24
- jQuery(document).ready(function() {
25
-
26
- jQuery('a.ajax-delete').live('click', function() {
27
- var title = jQuery(this).attr('title');
28
- var do_delete = true;
29
- if(title.length > 0){
30
- do_delete = confirm(title);
31
- }
32
- if (do_delete){
33
- jQuery.post(this.href, { _method: 'delete', format: 'js' }, null, "script");
34
- }
35
- return false;
36
- });
37
-
38
- jQuery('a.ajax-update').live('click', function() {
39
- jQuery.post(this.href, { _method: 'put', format: 'js' }, null, "script");
40
- return false;
41
- });
42
-
43
- jQuery(".submit-form").click(function() {
44
- jQuery(this).parent('form').submit();
45
- });
46
-
47
- apply_ajax_forms();
48
-
49
- jQuery('a.dialog-pop').live('click', function() {
50
- var d = jQuery('<div class="dialog"></div>').appendTo("body");
51
- d.dialog({ modal: true, autoOpen: false, width: 'auto', title: jQuery(this).attr('title') });
52
- d.load(jQuery(this).attr('href'), '', function(){
53
- d.dialog("open");
54
- apply_ajax_forms();
55
- });
56
- return false;
57
- });
58
-
59
- jQuery(".submit-delete").live('click', function() {
60
- jQuery(this).parents('.delete-container').fadeOut();
61
- var form = jQuery(this).parents('form');
62
- jQuery.post(form.attr('action') + '.json', form.serialize(),
63
- function(data){
64
- var json = eval('(' + data + ')');
65
- if(!json.success){
66
- jQuery.jGrowl.info(json.message);
67
- }
68
- });
69
- return false;
70
- });
71
-
72
- jQuery(".submit-delete-js").live('click', function() {
73
- jQuery(this).parents('.delete-container').fadeOut();
74
- var form = jQuery(this).parents('form');
75
- jQuery.post(form.attr('action') + '.js', form.serialize(),
76
- function(data){
77
- });
78
- return false;
79
- });
80
-
81
- jQuery(document).ready(function() {
82
- jQuery('.waiting').hide();
83
- jQuery(".wait-button").click(function() {
84
- jQuery('.waiting').show();
85
- jQuery(this).hide();
86
- });
87
- });
88
-
89
- });
1
+ jQuery(document).ajaxSend(function(a,b,c){add_headers(b);if(!(c.type.toUpperCase()=="GET"||typeof AUTH_TOKEN=="undefined")){c.data=c.data||"";if(typeof AUTH_TOKEN!="undefined")c.data+=(c.data?"&":"")+"authenticity_token="+encodeURIComponent(AUTH_TOKEN)}});function apply_ajax_forms(){jQuery("form.ajax").ajaxForm({dataType:"script",beforeSend:add_headers});jQuery("form.ajax").append('<input type="hidden" name="format" value="js" />')}
2
+ function add_headers(a){a.setRequestHeader("Accept","text/javascript");a.setRequestHeader("X-Requested-With","XMLHttpRequest")}
3
+ jQuery(document).ready(function(){jQuery("a.ajax-delete").live("click",function(){var a=jQuery(this).attr("title"),b=true;if(a.length>0)b=confirm(a);b&&jQuery.post(this.href,{_method:"delete",format:"js"},null,"script");return false});jQuery("a.ajax-update").live("click",function(){jQuery.post(this.href,{_method:"put",format:"js"},null,"script");return false});jQuery(".submit-form").click(function(){jQuery(this).parent("form").submit()});apply_ajax_forms();jQuery("a.dialog-pop").live("click",function(){var a=
4
+ jQuery('<div class="dialog"></div>').appendTo("body");a.dialog({modal:true,autoOpen:false,width:"auto",title:jQuery(this).attr("title")});a.load(jQuery(this).attr("href"),"",function(){a.dialog("open");apply_ajax_forms()});return false});jQuery(".submit-delete").live("click",function(){jQuery(this).parents(".delete-container").fadeOut();var a=jQuery(this).parents("form");jQuery.post(a.attr("action")+".json",a.serialize(),function(b){b=eval("("+b+")");b.success||jQuery.jGrowl.info(b.message)});return false});
5
+ jQuery(".submit-delete-js").live("click",function(){jQuery(this).parents(".delete-container").fadeOut();var a=jQuery(this).parents("form");jQuery.post(a.attr("action")+".js",a.serialize(),function(){});return false});jQuery(document).ready(function(){jQuery(".waiting").hide();jQuery(".wait-button").live("click",function(){jQuery(this).siblings(".waiting").show();jQuery(this).hide()})})});
6
+ function add_to_list(a,b){a=split_list(a);var c=true;for(i=0;i<a.length;i++)if(a[i]==b)c=false;c&&a.push(b);return a.join(", ")}function remove_from_list(a,b){a=split_list(a);var c=[];for(i=0;i<a.length;i++)a[i]!=b&&c.push(a[i]);return c.join(", ")}function split_list(a){a=undefined!=a&&a.length>0?a.split(","):[];var b=[];for(i=0;i<a.length;i++){var c=a[i].split(" ").join("");c.length>0&&b.push(c)}return b};
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 4
8
- - 17
9
- version: 0.4.17
8
+ - 21
9
+ version: 0.4.21
10
10
  platform: ruby
11
11
  authors:
12
12
  - Justin Ball
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-03-29 00:00:00 -06:00
18
+ date: 2010-04-08 00:00:00 -06:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -615,6 +615,7 @@ files:
615
615
  - public/javascripts/jquery/jquery.tips.js
616
616
  - public/javascripts/jquery/jrails.js
617
617
  - public/javascripts/muck-countries.js
618
+ - public/javascripts/muck-src.js
618
619
  - public/javascripts/muck.js
619
620
  - public/javascripts/muck_time/en.js
620
621
  - public/javascripts/tree.js