thin_man 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/assets/javascripts/ajax_bindings.js +1 -86
- data/lib/thin_man/ajax_helper.rb +9 -0
- data/lib/thin_man/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3df271cf5579e78ca64f45ad02137ff51dfd0d52
|
|
4
|
+
data.tar.gz: 03837270de0433fb89ad6d1c2f843a78b6a5429a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3e25535df17c5a19fc50e139dc06b377367d498103fa16b23227eb7ae085a59d118647fd5676144c6b60ae01ccb73e28921984be641670bfac4e84a51691fa5e
|
|
7
|
+
data.tar.gz: 651af586b67e8a8bbcbc20cdc8be1e3d1bcf31c5df1b878fd3bdd9f5d64daa287e9652d98d2b00d2ef3b16071c183ea600b65ec3040c7fa7a20c403928c43635
|
|
@@ -76,8 +76,7 @@ var AjaxSubmission = Class.extend({
|
|
|
76
76
|
ajaxSuccess: function(data,textStatus,jqXHR){
|
|
77
77
|
if(typeof data === 'string'){
|
|
78
78
|
this.insertHtml(data);
|
|
79
|
-
}
|
|
80
|
-
else if(typeof data === 'object'){
|
|
79
|
+
} else if(typeof data === 'object') {
|
|
81
80
|
if(typeof data.html != 'undefined'){
|
|
82
81
|
this.insertHtml(data.html)
|
|
83
82
|
}
|
|
@@ -431,58 +430,6 @@ var AjaxPushState = Class.extend({
|
|
|
431
430
|
}
|
|
432
431
|
});
|
|
433
432
|
|
|
434
|
-
var RadioFormGroup = Class.extend({
|
|
435
|
-
init: function($form_group){
|
|
436
|
-
this.$form_group = $form_group;
|
|
437
|
-
$form_group.data('form-group', this);
|
|
438
|
-
},
|
|
439
|
-
closeForm: function(){
|
|
440
|
-
this.cancel_button.cancel();
|
|
441
|
-
},
|
|
442
|
-
removeOpenForm: function(){
|
|
443
|
-
delete this.cancel_button;
|
|
444
|
-
}
|
|
445
|
-
});
|
|
446
|
-
|
|
447
|
-
var RadioEdit = Class.extend({
|
|
448
|
-
init: function($radio_edit){
|
|
449
|
-
$radio_edit.data('radio-edit-loaded',true);
|
|
450
|
-
this.$radio_edit = $radio_edit;
|
|
451
|
-
this.$go_link = $($radio_edit.data('radio-edit'));
|
|
452
|
-
var radio_edit = this;
|
|
453
|
-
$radio_edit.bind('click',function(e){
|
|
454
|
-
e.preventDefault();
|
|
455
|
-
radio_edit.tryEdit();
|
|
456
|
-
return false;
|
|
457
|
-
})
|
|
458
|
-
},
|
|
459
|
-
tryEdit: function(){
|
|
460
|
-
if(confirm("Any incomplete changes on other forms will be lost, are you sure you want to open this form?")){
|
|
461
|
-
this.form_group.closeForm();
|
|
462
|
-
step = this.$go_link.data('step-link') - 1;
|
|
463
|
-
this.$go_link.click();
|
|
464
|
-
}
|
|
465
|
-
},
|
|
466
|
-
findGroup: function(){
|
|
467
|
-
$form_group = this.$radio_edit.parents('[data-radio-form-group]')
|
|
468
|
-
this.form_group = $form_group.data('form-group');
|
|
469
|
-
}
|
|
470
|
-
});
|
|
471
|
-
|
|
472
|
-
var RadioCancel = Class.extend({
|
|
473
|
-
init: function($radio_cancel){
|
|
474
|
-
this.$radio_cancel = $radio_cancel;
|
|
475
|
-
},
|
|
476
|
-
findGroup: function(){
|
|
477
|
-
$form_group = this.$radio_cancel.parents('[data-radio-form-group]')
|
|
478
|
-
this.form_group = $form_group.data('form-group');
|
|
479
|
-
this.form_group.cancel_button = this;
|
|
480
|
-
},
|
|
481
|
-
cancel: function(){
|
|
482
|
-
this.$radio_cancel.click();
|
|
483
|
-
}
|
|
484
|
-
});
|
|
485
|
-
|
|
486
433
|
$(document).ready(function(){
|
|
487
434
|
$(document).on('click','[data-ajax-link]',function(e){
|
|
488
435
|
e.preventDefault();
|
|
@@ -504,40 +451,8 @@ $(document).ready(function(){
|
|
|
504
451
|
var deletion = new this_class($(this));
|
|
505
452
|
});
|
|
506
453
|
|
|
507
|
-
$(document).on('click','form input[type=submit]',function(e){
|
|
508
|
-
$("input[type=submit]", $(this).parents("form")).removeAttr("clicked");
|
|
509
|
-
$(this).attr("clicked", "true");
|
|
510
|
-
});
|
|
511
|
-
|
|
512
454
|
$('[data-sortable]').each(function(){
|
|
513
455
|
new AjaxSorter($(this));
|
|
514
456
|
});
|
|
515
457
|
|
|
516
|
-
$('[data-radio-form-group]').each(function(){
|
|
517
|
-
new RadioFormGroup($(this));
|
|
518
|
-
})
|
|
519
458
|
});
|
|
520
|
-
$(document).ready(function(){
|
|
521
|
-
$('[data-radio-edit]').each(function(){
|
|
522
|
-
if(!($(this).data('radio-edit-loaded'))){
|
|
523
|
-
var radio_edit = new RadioEdit($(this))
|
|
524
|
-
radio_edit.findGroup();
|
|
525
|
-
}
|
|
526
|
-
});
|
|
527
|
-
$('[data-radio-cancel]').each(function(){
|
|
528
|
-
var radio_cancel = new RadioCancel($(this))
|
|
529
|
-
radio_cancel.findGroup();
|
|
530
|
-
});
|
|
531
|
-
});
|
|
532
|
-
$(document).ajaxComplete(function(){
|
|
533
|
-
$('[data-radio-edit]').each(function(){
|
|
534
|
-
if(!($(this).data('radio-edit-loaded'))){
|
|
535
|
-
var radio_edit = new RadioEdit($(this))
|
|
536
|
-
radio_edit.findGroup();
|
|
537
|
-
}
|
|
538
|
-
});
|
|
539
|
-
$('[data-radio-cancel]').each(function(){
|
|
540
|
-
var radio_cancel = new RadioCancel($(this))
|
|
541
|
-
radio_cancel.findGroup();
|
|
542
|
-
});
|
|
543
|
-
});
|
data/lib/thin_man/ajax_helper.rb
CHANGED
|
@@ -36,6 +36,15 @@ module ThinMan
|
|
|
36
36
|
ajax_options
|
|
37
37
|
end
|
|
38
38
|
|
|
39
|
+
def ajax_form_attrs(target, sub_class: nil, insert_method: nil, error_target: nil, empty_on_success: nil)
|
|
40
|
+
data_attrs = "data-ajax-form=true data-ajax-target=#{target}"
|
|
41
|
+
data_attrs += " data-insert-method=#{insert_method}" if insert_method
|
|
42
|
+
data_attrs += " data-sub-type=#{sub_class}" if sub_class
|
|
43
|
+
data_attrs += " data-empty-on-success=#{empty_on_success}" if empty_on_success
|
|
44
|
+
data_attrs += " data-error-target=#{error_target}" if error_target
|
|
45
|
+
data_attrs
|
|
46
|
+
end
|
|
47
|
+
|
|
39
48
|
def ajax_link_attrs(target, insert_method: nil, sub_type: nil, empty_on_success: nil)
|
|
40
49
|
data_attrs = "data-ajax-link=true data-ajax-target=#{target}"
|
|
41
50
|
data_attrs += " data-insert-method=#{insert_method}" if insert_method
|
data/lib/thin_man/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: thin_man
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.5.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Eric Draut, Adam Bialek
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2015-
|
|
11
|
+
date: 2015-03-24 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rails
|