admin_data 1.1.15 → 1.1.16
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/Gemfile.lock +1 -1
- data/README.md +14 -1
- data/app/assets/javascripts/admin_data.js +18 -0
- data/app/assets/stylesheets/{base.css → admin_data.css} +8 -0
- data/app/views/layouts/admin_data.html.erb +2 -30
- data/app/views/layouts/search.html.erb +2 -30
- data/lib/admin_data/version.rb +1 -1
- metadata +6 -12
- data/app/assets/javascripts/test/act_on_result.js +0 -120
- data/app/assets/javascripts/test/advance_search.js +0 -80
- data/app/assets/javascripts/test/ajaxify_advance_search.js +0 -29
- data/app/assets/javascripts/test/build_first_row.js +0 -10
- data/app/assets/javascripts/test/event_bindings.js +0 -100
- data/app/assets/javascripts/vendor/jack.js +0 -903
- data/app/assets/javascripts/vendor/qunit.js +0 -1043
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,12 +1,25 @@
|
|
1
1
|
# admin_data
|
2
2
|
|
3
|
+
## Rails 3.0.x
|
4
|
+
|
3
5
|
If you are using Rails 3.0.x then use
|
4
6
|
|
5
7
|
gem 'admin_data', '= 1.1.14'
|
6
8
|
|
9
|
+
## Rails 3.1.x
|
10
|
+
|
7
11
|
If you are using Rails 3.1.x then use
|
8
12
|
|
9
|
-
gem 'admin_data', '>= 1.1.
|
13
|
+
gem 'admin_data', '>= 1.1.16'
|
14
|
+
|
15
|
+
Also add following lines to config/application.rb just below the line that says <tt>config.assets.enabled = true</tt> .
|
16
|
+
|
17
|
+
config.assets.precompile += ['admin_data.css', 'admin_data.js']
|
18
|
+
|
19
|
+
Before deploying the code to production execute
|
20
|
+
|
21
|
+
bundle exec rake assets:precompile
|
22
|
+
|
10
23
|
|
11
24
|
Live demo is available at http://admin-data-demo.heroku.com/admin_data (read only version)
|
12
25
|
|
@@ -0,0 +1,18 @@
|
|
1
|
+
//= require ./vendor/jquery-1.4.2.js
|
2
|
+
//= require ./vendor/jquery-ui-1.7.2.custom.min.js
|
3
|
+
//= require ./vendor/jquery_form
|
4
|
+
//= require ./vendor/log
|
5
|
+
//= require ./vendor/rails
|
6
|
+
//= require ./misc/drop_down_change
|
7
|
+
//= require ./misc/quick_search_input_focus
|
8
|
+
//= require ./advance_search/global_ajax_setting
|
9
|
+
//= require ./misc/js_util
|
10
|
+
//= require ./analytics/report
|
11
|
+
//= require ./advance_search/advance_search
|
12
|
+
//= require ./advance_search/advance_search_structure
|
13
|
+
//= require ./advance_search/ajaxify_advance_search
|
14
|
+
//= require ./advance_search/act_on_result
|
15
|
+
//= require ./advance_search/build_first_row
|
16
|
+
//= require ./advance_search/event_bindings
|
17
|
+
//= require ./advance_search/trigger_submit_on_domready
|
18
|
+
//= require ./advance_search/sortby
|
@@ -1,3 +1,11 @@
|
|
1
|
+
/*
|
2
|
+
* This is a manifest file that'll automatically include all the stylesheets available in this directory
|
3
|
+
* and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
|
4
|
+
* the top of the compiled file, but it's generally better to create a new file per style scope.
|
5
|
+
*= require_self
|
6
|
+
*= require_tree ./vendor
|
7
|
+
*/
|
8
|
+
|
1
9
|
* {
|
2
10
|
margin: 0;
|
3
11
|
padding:0
|
@@ -6,36 +6,8 @@
|
|
6
6
|
<%= @page_title.blank? ? 'admin_data' : "#{@page_title} - admin_data" %>
|
7
7
|
</title>
|
8
8
|
|
9
|
-
<%= stylesheet_link_tag('
|
10
|
-
|
11
|
-
<%= stylesheet_link_tag('base') %>
|
12
|
-
|
13
|
-
<%= javascript_include_tag('vendor/jquery-1.4.2.js', 'vendor/jquery-ui-1.7.2.custom.min.js') %>
|
14
|
-
|
15
|
-
<%= javascript_include_tag('vendor/jquery_form') %>
|
16
|
-
|
17
|
-
<%= javascript_include_tag('vendor/log',
|
18
|
-
'vendor/rails',
|
19
|
-
'misc/drop_down_change',
|
20
|
-
'misc/quick_search_input_focus',
|
21
|
-
'advance_search/global_ajax_setting',
|
22
|
-
'misc/js_util') %>
|
23
|
-
|
24
|
-
<% if params[:action] == 'advance_search' %>
|
25
|
-
<%= javascript_include_tag(
|
26
|
-
'advance_search/advance_search',
|
27
|
-
'advance_search/advance_search_structure',
|
28
|
-
'advance_search/ajaxify_advance_search',
|
29
|
-
'advance_search/act_on_result',
|
30
|
-
'advance_search/build_first_row',
|
31
|
-
'advance_search/event_bindings',
|
32
|
-
'advance_search/trigger_submit_on_domready',
|
33
|
-
'advance_search/sortby'
|
34
|
-
) %>
|
35
|
-
<% elsif params[:controller] == 'admin_data/analytics' %>
|
36
|
-
<%= javascript_include_tag('analytics/report') %>
|
37
|
-
<% end %>
|
38
|
-
|
9
|
+
<%= stylesheet_link_tag('admin_data') %>
|
10
|
+
<%= javascript_include_tag('admin_data') %>
|
39
11
|
<%= csrf_meta_tag %>
|
40
12
|
|
41
13
|
</head>
|
@@ -6,36 +6,8 @@
|
|
6
6
|
<%= @page_title.blank? ? 'admin_data' : "#{@page_title} - admin_data" %>
|
7
7
|
</title>
|
8
8
|
|
9
|
-
<%= stylesheet_link_tag('
|
10
|
-
|
11
|
-
<%= stylesheet_link_tag('base') %>
|
12
|
-
|
13
|
-
<%= javascript_include_tag('vendor/jquery-1.4.2.js', 'vendor/jquery-ui-1.7.2.custom.min.js') %>
|
14
|
-
|
15
|
-
<%= javascript_include_tag('vendor/jquery_form') %>
|
16
|
-
|
17
|
-
<%= javascript_include_tag('vendor/log',
|
18
|
-
'vendor/rails',
|
19
|
-
'misc/drop_down_change',
|
20
|
-
'misc/quick_search_input_focus',
|
21
|
-
'advance_search/global_ajax_setting',
|
22
|
-
'misc/js_util') %>
|
23
|
-
|
24
|
-
<% if params[:action] == 'advance_search' %>
|
25
|
-
<%= javascript_include_tag(
|
26
|
-
'advance_search/advance_search',
|
27
|
-
'advance_search/advance_search_structure',
|
28
|
-
'advance_search/ajaxify_advance_search',
|
29
|
-
'advance_search/act_on_result',
|
30
|
-
'advance_search/build_first_row',
|
31
|
-
'advance_search/event_bindings',
|
32
|
-
'advance_search/trigger_submit_on_domready',
|
33
|
-
'advance_search/sortby'
|
34
|
-
) %>
|
35
|
-
<% elsif params[:controller] == 'admin_data/analytics' %>
|
36
|
-
<%= javascript_include_tag('analytics/report') %>
|
37
|
-
<% end %>
|
38
|
-
|
9
|
+
<%= stylesheet_link_tag('admin_data') %>
|
10
|
+
<%= javascript_include_tag('admin_data') %>
|
39
11
|
<%= csrf_meta_tag %>
|
40
12
|
|
41
13
|
</head>
|
data/lib/admin_data/version.rb
CHANGED
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: admin_data
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 1.1.
|
5
|
+
version: 1.1.16
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Neeraj Singh
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-
|
13
|
+
date: 2011-11-03 00:00:00 -04:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -47,6 +47,7 @@ files:
|
|
47
47
|
- app/assets/images/sort_by_asc.jpg
|
48
48
|
- app/assets/images/sort_by_desc.jpg
|
49
49
|
- app/assets/images/sort_by_nothing.jpg
|
50
|
+
- app/assets/javascripts/admin_data.js
|
50
51
|
- app/assets/javascripts/advance_search/act_on_result.js
|
51
52
|
- app/assets/javascripts/advance_search/advance_search.js
|
52
53
|
- app/assets/javascripts/advance_search/advance_search_structure.js
|
@@ -60,20 +61,13 @@ files:
|
|
60
61
|
- app/assets/javascripts/misc/drop_down_change.js
|
61
62
|
- app/assets/javascripts/misc/js_util.js
|
62
63
|
- app/assets/javascripts/misc/quick_search_input_focus.js
|
63
|
-
- app/assets/javascripts/test/act_on_result.js
|
64
|
-
- app/assets/javascripts/test/advance_search.js
|
65
|
-
- app/assets/javascripts/test/ajaxify_advance_search.js
|
66
|
-
- app/assets/javascripts/test/build_first_row.js
|
67
|
-
- app/assets/javascripts/test/event_bindings.js
|
68
|
-
- app/assets/javascripts/vendor/jack.js
|
69
64
|
- app/assets/javascripts/vendor/jquery-1.4.2.js
|
70
65
|
- app/assets/javascripts/vendor/jquery-ui-1.7.2.custom.min.js
|
71
66
|
- app/assets/javascripts/vendor/jquery.ba-isjquery.js
|
72
67
|
- app/assets/javascripts/vendor/jquery_form.js
|
73
68
|
- app/assets/javascripts/vendor/log.js
|
74
|
-
- app/assets/javascripts/vendor/qunit.js
|
75
69
|
- app/assets/javascripts/vendor/rails.js
|
76
|
-
- app/assets/stylesheets/
|
70
|
+
- app/assets/stylesheets/admin_data.css
|
77
71
|
- app/assets/stylesheets/vendor/jquery-ui-1.7.2.custom.css
|
78
72
|
- app/controllers/admin_data/analytics_controller.rb
|
79
73
|
- app/controllers/admin_data/application_controller.rb
|
@@ -222,7 +216,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
222
216
|
requirements:
|
223
217
|
- - ">="
|
224
218
|
- !ruby/object:Gem::Version
|
225
|
-
hash:
|
219
|
+
hash: -199132812590787471
|
226
220
|
segments:
|
227
221
|
- 0
|
228
222
|
version: "0"
|
@@ -231,7 +225,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
231
225
|
requirements:
|
232
226
|
- - ">="
|
233
227
|
- !ruby/object:Gem::Version
|
234
|
-
hash:
|
228
|
+
hash: -199132812590787471
|
235
229
|
segments:
|
236
230
|
- 0
|
237
231
|
version: "0"
|
@@ -1,120 +0,0 @@
|
|
1
|
-
module('act_on_result', {
|
2
|
-
teardown: function() {
|
3
|
-
$('#advance_search_delete_all').remove();
|
4
|
-
$('#advance_search_destroy_all').remove();
|
5
|
-
$('#results').remove();
|
6
|
-
$('#advance_search_form').remove();
|
7
|
-
},
|
8
|
-
setup: function() {
|
9
|
-
$(document.body).append($('<a />', {
|
10
|
-
href: '#',
|
11
|
-
id: 'advance_search_delete_all'
|
12
|
-
}));
|
13
|
-
|
14
|
-
$(document.body).append($('<a />', {
|
15
|
-
href: '#',
|
16
|
-
id: 'advance_search_destroy_all'
|
17
|
-
}));
|
18
|
-
|
19
|
-
$(document.body).append($('<div />', {
|
20
|
-
id: 'results'
|
21
|
-
}));
|
22
|
-
|
23
|
-
$(document.body).append($('<div />', {
|
24
|
-
id: 'advance_search_form'
|
25
|
-
}));
|
26
|
-
}
|
27
|
-
});
|
28
|
-
|
29
|
-
test('invoking success callback', function() {
|
30
|
-
expect(1);
|
31
|
-
AdminData.actOnResult.successCallback({
|
32
|
-
success: 'hello world'
|
33
|
-
});
|
34
|
-
equals('hello world', $('#results').text(), '#results should have text hello world');
|
35
|
-
});
|
36
|
-
|
37
|
-
test('live clicking #advance_search_delete_all with cancel action', function() {
|
38
|
-
expect(0);
|
39
|
-
jack(function() {
|
40
|
-
jack.expect('AdminData.jsUtil.confirm').once().mock(function() {
|
41
|
-
return false;
|
42
|
-
});
|
43
|
-
//TODO ensure that the value passed to action is delete
|
44
|
-
jack.expect('AdminData.actOnResult.action').exactly('0 time');
|
45
|
-
$('#advance_search_delete_all').trigger('click');
|
46
|
-
});
|
47
|
-
});
|
48
|
-
|
49
|
-
test('live clicking #advance_search_delete_all', function() {
|
50
|
-
expect(0);
|
51
|
-
var args;
|
52
|
-
|
53
|
-
jack(function() {
|
54
|
-
jack.expect('AdminData.jsUtil.confirm').once().mock(function() {
|
55
|
-
return true;
|
56
|
-
});
|
57
|
-
jack.expect('AdminData.actOnResult.action').once().mock(function(action_type) {
|
58
|
-
args = action_type;
|
59
|
-
return {};
|
60
|
-
});
|
61
|
-
$('#advance_search_delete_all').trigger('click');
|
62
|
-
});
|
63
|
-
equals('delete', args, 'action_type should be delete');
|
64
|
-
|
65
|
-
});
|
66
|
-
|
67
|
-
test('live clicking #advance_search_destroy_all with cancel action', function() {
|
68
|
-
expect(0);
|
69
|
-
jack(function() {
|
70
|
-
jack.expect('AdminData.jsUtil.confirm').once().mock(function() {
|
71
|
-
return false;
|
72
|
-
});
|
73
|
-
jack.expect('AdminData.actOnResult.action').exactly('0 time');
|
74
|
-
$('#advance_search_destroy_all').trigger('click');
|
75
|
-
});
|
76
|
-
});
|
77
|
-
|
78
|
-
test('live clicking #advance_search_destroy_all', function() {
|
79
|
-
expect(0);
|
80
|
-
var args;
|
81
|
-
|
82
|
-
jack(function() {
|
83
|
-
jack.expect('AdminData.jsUtil.confirm').once().mock(function() {
|
84
|
-
return true;
|
85
|
-
});
|
86
|
-
jack.expect('AdminData.actOnResult.action').once().mock(function(action_type) {
|
87
|
-
args = action_type;
|
88
|
-
return {};
|
89
|
-
});
|
90
|
-
$('#advance_search_destroy_all').trigger('click');
|
91
|
-
});
|
92
|
-
equals('destroy', args, 'action_type should be destroy');
|
93
|
-
});
|
94
|
-
|
95
|
-
test('actOnResultAJAX', function() {
|
96
|
-
expect(5);
|
97
|
-
$('#advance_search_form').attr('action', 'http://localhost:3000');
|
98
|
-
$('#advance_search_form').data('admin_data_form_array', [{
|
99
|
-
name: 'foo',
|
100
|
-
value: 'i_am_foo'
|
101
|
-
}]);
|
102
|
-
|
103
|
-
var ajaxArgs;
|
104
|
-
|
105
|
-
jack(function() {
|
106
|
-
jack.expect('$.ajax').once().mock(function(args) {
|
107
|
-
ajaxArgs = args;
|
108
|
-
});
|
109
|
-
AdminData.actOnResult.action('delete');
|
110
|
-
});
|
111
|
-
|
112
|
-
equals('post', ajaxArgs.type, 'ajax arguments should have type as post');
|
113
|
-
equals('json', ajaxArgs.dataType, 'ajax arguments should have json as dataType');
|
114
|
-
equals('http://localhost:3000', ajaxArgs.url, 'ajax arguments should have valid url');
|
115
|
-
var data = ajaxArgs.data;
|
116
|
-
ok(data, 'ajax arguments should have value for key data');
|
117
|
-
equals('foo=i_am_foo&admin_data_advance_search_action_type=delete', data, 'data should have parameterized value');
|
118
|
-
|
119
|
-
});
|
120
|
-
|
@@ -1,80 +0,0 @@
|
|
1
|
-
module('advance_search');
|
2
|
-
|
3
|
-
test('buildFirstRow', function() {
|
4
|
-
expect(2);
|
5
|
-
$('#advance_search_table').html('');
|
6
|
-
AdminData.advanceSearch.buildFirstRow();
|
7
|
-
var $a = $('#advance_search_table').find('a');
|
8
|
-
ok($a.hasClass('add_row_link'), 'first row should have anchor element with class remove_row');
|
9
|
-
ok('+', $a.text(), 'first row should have anchor element with text +');
|
10
|
-
});
|
11
|
-
|
12
|
-
|
13
|
-
test("buildCol1", function() {
|
14
|
-
expect(3);
|
15
|
-
|
16
|
-
var $td = AdminData.advanceSearch.buildCol1();
|
17
|
-
ok($.isjQuery($td), "buildCol1 should return an instance of jQuery");
|
18
|
-
|
19
|
-
var className = $td.find('select').attr('className');
|
20
|
-
equals('col1', className, 'buildCol1 should have select with class col1');
|
21
|
-
|
22
|
-
var countOfOptions = $td.find('select option').length;
|
23
|
-
equals(12, countOfOptions, 'buildCol1 should have select with 12 options');
|
24
|
-
});
|
25
|
-
|
26
|
-
test("buildCol2", function() {
|
27
|
-
expect(3);
|
28
|
-
|
29
|
-
var $td = AdminData.advanceSearch.buildCol2();
|
30
|
-
ok($.isjQuery($td), "buildCol2 should return an instance of jQuery");
|
31
|
-
|
32
|
-
ok($td.find('select').hasClass('col2'), 'buildCol2 should have class col2');
|
33
|
-
ok($td.find('select').hasClass('disabled'), 'buildCol2 should have class disabled');
|
34
|
-
});
|
35
|
-
|
36
|
-
test("buildCol3", function() {
|
37
|
-
expect(3);
|
38
|
-
|
39
|
-
var $td = AdminData.advanceSearch.buildCol3();
|
40
|
-
ok($.isjQuery($td), "buildCol3 should return an instance of jQuery");
|
41
|
-
|
42
|
-
ok($td.find('input').hasClass('col3'), 'buildCol3 should have input element with class col3');
|
43
|
-
ok($td.find('input').attr('disabled'), 'buildCol3 should have input element with attribute disabled');
|
44
|
-
});
|
45
|
-
|
46
|
-
test("buildCol4", function() {
|
47
|
-
expect(3);
|
48
|
-
|
49
|
-
var $td = AdminData.advanceSearch.buildCol4();
|
50
|
-
ok($.isjQuery($td), "buildCol4 should return an instance of jQuery");
|
51
|
-
|
52
|
-
var a = $td.find('a');
|
53
|
-
ok(a.hasClass('remove_row'), 'buildCol4 should have anchor element with class remove_row');
|
54
|
-
equals('x', a.text(), 'buildCol4 should have anchor element with text x');
|
55
|
-
});
|
56
|
-
|
57
|
-
test("buildRow", function() {
|
58
|
-
expect(8);
|
59
|
-
jack(function() {
|
60
|
-
jack.expect("AdminData.jsUtil.randomNumber").exactly("1 time").mock(function() {
|
61
|
-
return 100;
|
62
|
-
});
|
63
|
-
|
64
|
-
var $tr = AdminData.advanceSearch.buildRow();
|
65
|
-
ok($.isjQuery($tr), "buildCol4 should return an instance of jQuery");
|
66
|
-
|
67
|
-
equals(4, $tr.find('td').length, 'buildRow should have 4 td elements');
|
68
|
-
|
69
|
-
ok($tr.find('select.col1').attr('name'), 'buildRow should have select.col1 with attribute name');
|
70
|
-
ok($tr.find('select.col2').attr('name'), 'buildRow should have select.col1 with attribute name');
|
71
|
-
ok($tr.find('input.col3').attr('name'), 'buildRow should have input.col1 with attribute name');
|
72
|
-
|
73
|
-
equals('adv_search[100_row][col1]', $tr.find('select.col1').attr('name'), 'select.col1 should have right name');
|
74
|
-
equals('adv_search[100_row][col2]', $tr.find('select.col2').attr('name'), 'select.col2 should have right name');
|
75
|
-
equals('adv_search[100_row][col3]', $tr.find('input.col3').attr('name'), 'input.col3 should have right name');
|
76
|
-
|
77
|
-
});
|
78
|
-
|
79
|
-
});
|
80
|
-
|
@@ -1,29 +0,0 @@
|
|
1
|
-
module('ajaxify advance search', {
|
2
|
-
teardown: function() {
|
3
|
-
$('#results').remove();
|
4
|
-
$('#advance_search_form').remove();
|
5
|
-
},
|
6
|
-
setup: function() {
|
7
|
-
$(document.body).append($('<div />', {
|
8
|
-
id: 'results'
|
9
|
-
}));
|
10
|
-
$(document.body).append($('<div />', {
|
11
|
-
id: 'advance_search_form'
|
12
|
-
}));
|
13
|
-
}
|
14
|
-
});
|
15
|
-
|
16
|
-
test('successCallback', function() {
|
17
|
-
expect(1);
|
18
|
-
AdminData.ajaxifyAdvanceSearch.successCallback('hello world');
|
19
|
-
equals('hello world', $('#results').text(), '#results should have text hello world');
|
20
|
-
});
|
21
|
-
|
22
|
-
test('beforeSubmitCallback', function() {
|
23
|
-
expect(1);
|
24
|
-
AdminData.ajaxifyAdvanceSearch.beforeSubmitCallback(['1', '2'], null);
|
25
|
-
|
26
|
-
var $results = $('#results');
|
27
|
-
equals('searching...', $('#results').text(), '#results should have text searching');
|
28
|
-
});
|
29
|
-
|