admin_data 1.0.17 → 1.0.18
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.
- data/History.txt +5 -0
- data/README.md +9 -13
- data/app/controllers/admin_data/search_controller.rb +4 -5
- data/app/views/admin_data/search/search/_advance_search_form.html.erb +1 -1
- data/lib/admin_data/version.rb +1 -1
- data/lib/js/advance_search/act_on_result.js +0 -1
- data/lib/js/advance_search/advance_search.js +16 -22
- data/lib/js/advance_search/build_first_row.js +2 -6
- data/lib/js/advance_search/event_bindings.js +8 -14
- metadata +4 -4
data/History.txt
CHANGED
data/README.md
CHANGED
@@ -1,25 +1,21 @@
|
|
1
|
-
# admin_data works with rails3. [More information is available here](http://github.com/neerajdotname/admin_data/wiki/Installing-admin_data-in-a-Rails-3-project)#
|
2
1
|
|
3
|
-
#
|
2
|
+
# This plugin works with both Rails 2.3.x and Rails 3.
|
3
|
+
* master branch hosts code where admin_data is a plugin and it works with Rails 2.3.x .
|
4
|
+
* rails3_gem branch hosts code where admin_data is a gem and it works with Rails 3.x .
|
4
5
|
|
5
|
-
[
|
6
|
+
[More info about Rails3](http://github.com/neerajdotname/admin_data/wiki/Installing-admin_data-in-a-Rails-3-project)
|
6
7
|
|
7
|
-
|
8
|
+
## [Live Demo](http://admin-data-test.heroku.com/admin_data)
|
8
9
|
|
9
|
-
[
|
10
|
+
## [Documentation](http://github.com/neerajdotname/admin_data/wiki)
|
10
11
|
|
11
|
-
|
12
|
-
|
13
|
-
[http://demo.neeraj.name/admin_data/jstest](http://demo.neeraj.name/admin_data/jstest)
|
14
|
-
|
15
|
-
#Source code#
|
16
|
-
|
17
|
-
[http://github.com/neerajdotname/admin_data](http://github.com/neerajdotname/admin_data)
|
12
|
+
## [Source Code](http://github.com/neerajdotname/admin_data)
|
18
13
|
|
19
14
|
#Test#
|
20
15
|
|
21
16
|
Test code currently resides in a different project [admin_data_test](http://github.com/neerajdotname/admin_data_test) . Test code should be merged into this project very soon.
|
22
17
|
|
23
|
-
|
18
|
+
|
19
|
+
### License
|
24
20
|
|
25
21
|
Dual licensed under the [MIT](http://github.com/jquery/jquery/blob/master/MIT-LICENSE.txt) and [GPL version 2](http://github.com/jquery/jquery/blob/master/GPL-LICENSE.txt) licenses.
|
@@ -110,13 +110,12 @@ class AdminData::SearchController < AdminData::BaseController
|
|
110
110
|
end
|
111
111
|
|
112
112
|
def set_collection_of_columns
|
113
|
-
|
113
|
+
collection_of_columns = @klass.columns.collect { |column|
|
114
114
|
#JSLint complains if a hash has key named boolean. So I am changing the key to booleant
|
115
115
|
column_type = (column.type.to_s == 'boolean') ? 'booleant' : column.type.to_s
|
116
|
-
"#{column.name}:
|
117
|
-
}
|
118
|
-
|
119
|
-
@collection_of_colums = "[{#{collection_of_colums}}]"
|
116
|
+
%Q{ "#{column.name}":"#{column_type}" }
|
117
|
+
}.join(',')
|
118
|
+
@collection_of_columns = "{#{collection_of_columns}}"
|
120
119
|
end
|
121
120
|
|
122
121
|
end
|
data/lib/admin_data/version.rb
CHANGED
@@ -8,13 +8,17 @@ AdminData.advanceSearch = {
|
|
8
8
|
src: 'https://github.com/neerajdotname/admin_data/raw/rails3_gem/public/images/add.png'
|
9
9
|
});
|
10
10
|
|
11
|
-
$('#advance_search_table').append(this.buildRow())
|
11
|
+
$('#advance_search_table').append(this.buildRow())
|
12
|
+
.find('tr td:last a')
|
13
|
+
.attr('id','add_row_link_1')
|
14
|
+
.removeClass('remove_row')
|
15
|
+
.addClass('add_row_link')
|
16
|
+
.html('')
|
17
|
+
.append(img);
|
12
18
|
},
|
13
19
|
|
14
20
|
buildCol1: function() {
|
15
|
-
var i, col = $('<select />', {
|
16
|
-
className: 'col1'
|
17
|
-
}).append($('<option />')),
|
21
|
+
var i, col = $('<select />', { className: 'col1' }).append($('<option />')),
|
18
22
|
tableStructure = $('#advance_search_table').data('table_structure');
|
19
23
|
|
20
24
|
for (i in tableStructure) {
|
@@ -27,16 +31,13 @@ AdminData.advanceSearch = {
|
|
27
31
|
},
|
28
32
|
|
29
33
|
buildCol2: function() {
|
30
|
-
var select = $('<select />', {
|
31
|
-
className: 'col2'
|
32
|
-
});
|
34
|
+
var select = $('<select />', { className: 'col2', disabled: 'disabled' });
|
33
35
|
return $('<td />').append(select);
|
34
36
|
},
|
35
37
|
|
36
38
|
buildCol3: function() {
|
37
|
-
|
38
|
-
|
39
|
-
}));
|
39
|
+
var select = $('<input />', { className: 'col3' });
|
40
|
+
return $('<td />').append($('<input />', { className: 'col3', disabled: 'disabled' }));
|
40
41
|
},
|
41
42
|
|
42
43
|
buildCol4: function() {
|
@@ -60,25 +61,19 @@ AdminData.advanceSearch = {
|
|
60
61
|
|
61
62
|
if (currentRowNumber === undefined) {
|
62
63
|
currentRowNumber = 1;
|
63
|
-
$(document).data('currentRowNumber', currentRowNumber)
|
64
|
+
$(document).data('currentRowNumber', currentRowNumber);
|
64
65
|
} else {
|
65
66
|
currentRowNumber = parseInt(currentRowNumber) + 1;
|
66
|
-
$(document).data('currentRowNumber', currentRowNumber)
|
67
|
+
$(document).data('currentRowNumber', currentRowNumber);
|
67
68
|
}
|
68
69
|
|
69
70
|
$.each(build_array, function(index, value) {
|
70
71
|
$tr.append(that[value]());
|
71
72
|
});
|
72
73
|
|
73
|
-
$tr.find('select.col1').attr({
|
74
|
-
|
75
|
-
});
|
76
|
-
$tr.find('select.col2').attr({
|
77
|
-
name: 'adv_search[' + currentRowNumber + '_row][col2]'
|
78
|
-
});
|
79
|
-
$tr.find('input.col3').attr({
|
80
|
-
name: 'adv_search[' + currentRowNumber + '_row][col3]'
|
81
|
-
});
|
74
|
+
$tr.find('select.col1').attr({ name: 'adv_search[' + currentRowNumber + '_row][col1]' });
|
75
|
+
$tr.find('select.col2').attr({ name: 'adv_search[' + currentRowNumber + '_row][col2]' });
|
76
|
+
$tr.find('input.col3').attr({ name: 'adv_search[' + currentRowNumber + '_row][col3]' });
|
82
77
|
|
83
78
|
$tr.find('.remove_row').attr('id', 'remove_row_'+currentRowNumber);
|
84
79
|
|
@@ -86,4 +81,3 @@ AdminData.advanceSearch = {
|
|
86
81
|
}
|
87
82
|
|
88
83
|
};
|
89
|
-
|
@@ -1,11 +1,7 @@
|
|
1
1
|
$(function() {
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
table_structure_data_json = eval(table_structure_data_non_json);
|
6
|
-
|
7
|
-
$('#advance_search_table').data('table_structure', table_structure_data_json[0]);
|
8
|
-
|
3
|
+
var json = $.parseJSON( $('#admin_data_table_structure_data').html());
|
4
|
+
$('#advance_search_table').data('table_structure', json);
|
9
5
|
AdminData.advanceSearch.buildFirstRow();
|
10
6
|
|
11
7
|
});
|
@@ -1,31 +1,26 @@
|
|
1
1
|
var AdminData = AdminData || {};
|
2
2
|
|
3
3
|
AdminData.bindings = {
|
4
|
+
|
4
5
|
col2_change: function(e) {
|
5
6
|
var arrayList = ['is_false', 'is_true', 'is_null', 'is_not_null'],
|
6
7
|
$col2 = $(e.target).closest('select'),
|
7
8
|
value = $col2.val(),
|
8
9
|
tableStructure = $('#advance_search_table').data('table_structure'),
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
$col3 = $col2.parents('tr').find('td input.col3');
|
13
|
-
$col1 = $col2.parents('tr').find('td select.col1');
|
10
|
+
$col3 = $col2.parents('tr').find('td input.col3'),
|
11
|
+
$col1 = $col2.parents('tr').find('td select.col1'),
|
14
12
|
col1ColumnType = tableStructure[$col1.val()];
|
15
13
|
|
14
|
+
|
16
15
|
if (value.length === 0 || ($.inArray(value, arrayList) > - 1)) {
|
17
|
-
$col3.val('');
|
16
|
+
$col3.val('').attr('disabled','disabled');
|
18
17
|
|
19
18
|
} else {
|
20
|
-
|
19
|
+
$col3.removeAttr('disabled');
|
21
20
|
if (col1ColumnType === 'datetime' || col1ColumnType === 'date') {
|
22
21
|
$col3.val(AdminData.jsUtil.dateToString(new Date())).addClass('datepicker');
|
23
22
|
|
24
|
-
$('.datepicker').datepicker({
|
25
|
-
dateFormat: 'dd-MM-yy',
|
26
|
-
changeYear: true,
|
27
|
-
changeMonth: true
|
28
|
-
});
|
23
|
+
$('.datepicker').datepicker({ dateFormat: 'dd-MM-yy', changeYear: true, changeMonth: true });
|
29
24
|
|
30
25
|
} else {
|
31
26
|
$('.datepicker').datepicker('destroy');
|
@@ -53,7 +48,7 @@ AdminData.bindings = {
|
|
53
48
|
|
54
49
|
col2.html('');
|
55
50
|
AdminData.jsUtil.buildOptionsFromArray(options, col2);
|
56
|
-
col2.trigger('change');
|
51
|
+
col2.trigger('change').removeAttr('disabled');
|
57
52
|
}
|
58
53
|
};
|
59
54
|
|
@@ -79,4 +74,3 @@ $('#advance_search_table select.col1').live('change', function(e) {
|
|
79
74
|
$('#advance_search_table select.col2').live('change', function(e) {
|
80
75
|
AdminData.bindings.col2_change(e);
|
81
76
|
});
|
82
|
-
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: admin_data
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 51
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 1.0.
|
9
|
+
- 18
|
10
|
+
version: 1.0.18
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Neeraj Singh
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-11-
|
18
|
+
date: 2010-11-08 00:00:00 -05:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|