admin_data 1.1.3 → 1.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -1
- data/app/controllers/admin_data/public_controller.rb +14 -5
- data/lib/admin_data/version.rb +1 -1
- data/lib/admin_data.rb +1 -1
- metadata +3 -32
- data/lib/public/images/add.png +0 -0
- data/lib/public/images/no.png +0 -0
- data/lib/public/images/site.png +0 -0
- data/lib/public/javascripts/advance_search/act_on_result.js +0 -45
- data/lib/public/javascripts/advance_search/advance_search.js +0 -83
- data/lib/public/javascripts/advance_search/advance_search_structure.js +0 -79
- data/lib/public/javascripts/advance_search/ajaxify_advance_search.js +0 -28
- data/lib/public/javascripts/advance_search/build_first_row.js +0 -8
- data/lib/public/javascripts/advance_search/event_bindings.js +0 -76
- data/lib/public/javascripts/advance_search/global_ajax_setting.js +0 -10
- data/lib/public/javascripts/advance_search/trigger_submit_on_domready.js +0 -6
- data/lib/public/javascripts/misc/drop_down_change.js +0 -8
- data/lib/public/javascripts/misc/js_util.js +0 -58
- data/lib/public/javascripts/misc/quick_search_input_focus.js +0 -6
- data/lib/public/javascripts/test/act_on_result.js +0 -120
- data/lib/public/javascripts/test/advance_search.js +0 -80
- data/lib/public/javascripts/test/ajaxify_advance_search.js +0 -29
- data/lib/public/javascripts/test/build_first_row.js +0 -10
- data/lib/public/javascripts/test/event_bindings.js +0 -100
- data/lib/public/javascripts/vendor/jack.js +0 -903
- data/lib/public/javascripts/vendor/jquery-1.4.2.js +0 -6240
- data/lib/public/javascripts/vendor/jquery-ui-1.7.2.custom.min.js +0 -298
- data/lib/public/javascripts/vendor/jquery.ba-isjquery.js +0 -21
- data/lib/public/javascripts/vendor/jquery_form.js +0 -814
- data/lib/public/javascripts/vendor/log.js +0 -9
- data/lib/public/javascripts/vendor/qunit.js +0 -1043
- data/lib/public/javascripts/vendor/rails.js +0 -132
- data/lib/public/stylesheets/base.css +0 -1109
- data/lib/public/stylesheets/vendor/jquery-ui-1.7.2.custom.css +0 -406
@@ -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
|
-
|
@@ -1,100 +0,0 @@
|
|
1
|
-
module('event_bindings');
|
2
|
-
|
3
|
-
test('live click on a.add_row_link', function() {
|
4
|
-
expect(3);
|
5
|
-
|
6
|
-
$('#advance_search_table').html('');
|
7
|
-
equals(0, $('#advance_search_table tr').length, 'there should be no row in the table');
|
8
|
-
|
9
|
-
AdminData.advanceSearch.buildFirstRow();
|
10
|
-
equals(1, $('#advance_search_table tr').length, 'there should be only first row in the table');
|
11
|
-
|
12
|
-
$('#advance_search_table a.add_row_link').trigger('click');
|
13
|
-
equals(2, $('#advance_search_table tr').length, 'additional row should be added to the table');
|
14
|
-
});
|
15
|
-
|
16
|
-
test('live click on a.remove_row link', function() {
|
17
|
-
expect(5);
|
18
|
-
|
19
|
-
$('#advance_search_table').html('');
|
20
|
-
equals(0, $('#advance_search_table tr').length, 'there should be no row in the table');
|
21
|
-
|
22
|
-
AdminData.advanceSearch.buildFirstRow();
|
23
|
-
equals(1, $('#advance_search_table tr').length, 'there should be only first row in the table');
|
24
|
-
|
25
|
-
$('#advance_search_table').append(AdminData.advanceSearch.buildRow());
|
26
|
-
equals(2, $('#advance_search_table tr').length, 'there should be two rows in the table');
|
27
|
-
|
28
|
-
var $a = $('#advance_search_table a.remove_row');
|
29
|
-
equals(1, $a.length, 'there should be one anchor element with class remove_row');
|
30
|
-
|
31
|
-
$('#advance_search_table a.remove_row').trigger('click');
|
32
|
-
equals(1, $('#advance_search_table tr').length, 'there should be only one row in the table');
|
33
|
-
});
|
34
|
-
|
35
|
-
test('live select.col1 change', function() {
|
36
|
-
expect(10);
|
37
|
-
|
38
|
-
$('#advance_search_table').html('');
|
39
|
-
equals(0, $('#advance_search_table tr').length, 'there should be no row in the table');
|
40
|
-
|
41
|
-
AdminData.advanceSearch.buildFirstRow();
|
42
|
-
equals(1, $('#advance_search_table tr').length, 'there should be only first row in the table');
|
43
|
-
|
44
|
-
ok($('#advance_search_table select.col2').is(':disabled'), 'second column should be disabled');
|
45
|
-
|
46
|
-
$('#advance_search_table select.col1').val('first_name');
|
47
|
-
$('#advance_search_table select.col1').trigger('change');
|
48
|
-
|
49
|
-
ok(!$('#advance_search_table select.col2').is(':disabled'), 'second column should be enabled');
|
50
|
-
|
51
|
-
var s = $('#advance_search_table select.col2 option').eq(0).text();
|
52
|
-
equals('', s, 'empty value should be the first option');
|
53
|
-
|
54
|
-
s = $('#advance_search_table select.col2 option').eq(1).text();
|
55
|
-
equals('is null', s, 'is null should be the second option');
|
56
|
-
|
57
|
-
s = $('#advance_search_table select.col2 option').eq(2).text();
|
58
|
-
equals('is not null', s, 'is null should be the third option');
|
59
|
-
|
60
|
-
s = $('#advance_search_table select.col2 option').eq(3).text();
|
61
|
-
equals('contains', s, 'contains should be the fourth option');
|
62
|
-
|
63
|
-
s = $('#advance_search_table select.col2 option').eq(4).text();
|
64
|
-
equals('is exactly', s, 'contains should be the fifth option');
|
65
|
-
|
66
|
-
s = $('#advance_search_table select.col2 option').eq(5).text();
|
67
|
-
equals("doesn't contain", s, 'does not contain should be the sixth option');
|
68
|
-
});
|
69
|
-
|
70
|
-
test('live select.col2 change', function() {
|
71
|
-
expect(2);
|
72
|
-
|
73
|
-
$('#advance_search_table').html('');
|
74
|
-
AdminData.advanceSearch.buildFirstRow();
|
75
|
-
ok($('#advance_search_table input.col3').is(':disabled'), 'third column should be disabled');
|
76
|
-
|
77
|
-
$('#advance_search_table select.col1').val('first_name');
|
78
|
-
$('#advance_search_table select.col1').trigger('change');
|
79
|
-
$('#advance_search_table select.col2').val('contains');
|
80
|
-
$('#advance_search_table select.col2').trigger('change');
|
81
|
-
|
82
|
-
ok($('#advance_search_table input.col3').is(':enabled'), 'third column should be enabled');
|
83
|
-
});
|
84
|
-
|
85
|
-
|
86
|
-
test('live select.col2 change for is_null input', function() {
|
87
|
-
expect(2);
|
88
|
-
|
89
|
-
$('#advance_search_table').html('');
|
90
|
-
AdminData.advanceSearch.buildFirstRow();
|
91
|
-
ok($('#advance_search_table input.col3').is(':disabled'), 'third column should be disabled');
|
92
|
-
|
93
|
-
$('#advance_search_table select.col1').val('first_name');
|
94
|
-
$('#advance_search_table select.col1').trigger('change');
|
95
|
-
$('#advance_search_table select.col2').val('is_null');
|
96
|
-
$('#advance_search_table select.col2').trigger('change');
|
97
|
-
|
98
|
-
ok($('#advance_search_table input.col3').is(':disabled'), 'third column should be disabled');
|
99
|
-
});
|
100
|
-
|