-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathc006-crud.js
51 lines (48 loc) · 1.97 KB
/
c006-crud.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/**
* Created by user on 7/18/14.
*/
jQuery(function () {
jQuery('.c006-activeform-toggle-container')
.bind("click",
function () {
/* This is not ideal, but it works for now */
setTimeout(function () {
var $elm = jQuery('#crud-exclude_models').parent().parent();
$elm.hide();
var $ow = jQuery('#crud-overwrite_models');
if ($ow.val() == "1") {
$elm.show("fast");
}
$elm = jQuery('#crud-exclude_controllers').parent().parent();
$elm.hide();
$ow = jQuery('#crud-overwrite_controllers');
if ($ow.val() == "1") {
$elm.show("fast");
}
}, 100);
})
.trigger('click');
jQuery('label[for=crud-database_tables]')
.append('<span class="c006-add-all">add all</span>')
.click(function () {
var _html = '';
jQuery('#crud-database_tables')
.find('option')
.each(function (item) {
_html += ',' + jQuery(this).html();
});
jQuery('#crud-tables').val(_html.replace(/\s+/gi, '').replace(/,+/gi, ',').replace(/^,/, ''));
});
jQuery('#crud-database_tables')
.bind('change',
function () {
var val = jQuery(this).find('option:selected').text();
if (val) {
var $elm = jQuery('#crud-tables');
var val2 = $elm.val().replace(val + ',', '');
val = val2 + ',' + val;
val = val.replace(/\s+/gi, '').replace(/,+/gi, ',').replace(/^,/, '');
$elm.val(val);
}
});
});