will_filter 3.1.2 → 3.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. data/.gitignore +12 -1
  2. data/.rspec +2 -1
  3. data/Gemfile.lock +1 -1
  4. data/app/assets/stylesheets/will_filter/buttons.css.scss +1 -1
  5. data/app/assets/stylesheets/will_filter/calendar.css.scss +54 -7
  6. data/app/assets/stylesheets/will_filter/exporter.css.scss +40 -17
  7. data/app/assets/stylesheets/will_filter/filter.css.scss +169 -144
  8. data/app/controllers/will_filter/exporter_controller.rb +3 -10
  9. data/app/views/will_filter/filter/_condition.html.erb +8 -10
  10. data/app/views/will_filter/filter/_conditions.html.erb +41 -37
  11. data/app/views/will_filter/filter/_container.html.erb +28 -22
  12. data/app/views/will_filter/filter/containers/_boolean.html.erb +1 -1
  13. data/config/will_filter/config.yml +1 -1
  14. data/lib/generators/will_filter/templates/config.yml +1 -1
  15. data/lib/will_filter/version.rb +1 -1
  16. data/spec/config/config_spec.rb +14 -0
  17. data/spec/extensions/active_record_extension_spec.rb +40 -0
  18. data/spec/fake_app.rb +57 -0
  19. data/spec/spec_helper.rb +24 -23
  20. data/test/.DS_Store +0 -0
  21. data/test/dummy/.DS_Store +0 -0
  22. data/test/dummy/config/will_filter/config.yml +1 -1
  23. data/test/dummy/db/migrate/20110924023807_create_will_filter_filters.rb +19 -0
  24. metadata +38 -60
  25. data/test/dummy/.sass-cache/f9cb1ef521115be73f1c61d3d5d64f66c947af63/buttons.css.scssc +0 -0
  26. data/test/dummy/.sass-cache/f9cb1ef521115be73f1c61d3d5d64f66c947af63/calendar.css.scssc +0 -0
  27. data/test/dummy/.sass-cache/f9cb1ef521115be73f1c61d3d5d64f66c947af63/exporter.css.scssc +0 -0
  28. data/test/dummy/.sass-cache/f9cb1ef521115be73f1c61d3d5d64f66c947af63/filter.css.scssc +0 -0
  29. data/test/dummy/test/functional/welcome_controller_test.rb +0 -9
  30. data/test/dummy/test/unit/helpers/welcome_helper_test.rb +0 -4
  31. data/test/fixtures/will_filter/filters.yml +0 -11
  32. data/test/functional/will_filter/calendar_controller_test.rb +0 -9
  33. data/test/functional/will_filter/exporter_controller_test.rb +0 -9
  34. data/test/functional/will_filter/filter_controller_test.rb +0 -9
  35. data/test/integration/navigation_test.rb +0 -10
  36. data/test/unit/helpers/will_filter/calendar_helper_test.rb +0 -6
  37. data/test/unit/helpers/will_filter/exporter_helper_test.rb +0 -6
  38. data/test/unit/helpers/will_filter/filter_helper_test.rb +0 -6
  39. data/test/unit/will_filter/filter_test.rb +0 -9
data/.gitignore CHANGED
@@ -3,4 +3,15 @@ log/*.log
3
3
  pkg/
4
4
  test/dummy/db/*.sqlite3
5
5
  test/dummy/log/*.log
6
- test/dummy/tmp/
6
+ test/dummy/tmp/
7
+ db/schema.rb*
8
+ tmp/*
9
+ log/*
10
+ .DS_Store
11
+ *.swp
12
+ .project
13
+ .loadpath
14
+ *~
15
+ .dotest*
16
+ Thumbs.db
17
+ .tmp*
data/.rspec CHANGED
@@ -1 +1,2 @@
1
- --colour
1
+ --color
2
+ --format=d
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- will_filter (3.1.2)
4
+ will_filter (3.1.3)
5
5
  coffee-script
6
6
  kaminari
7
7
  rails (>= 3.1.0)
@@ -11,7 +11,7 @@
11
11
  * html div#frame .wf_pcb {color: #333; padding-top: 0px; padding-bottom: 0px; text-decoration: none; }
12
12
 
13
13
  /* ie 7 hack */
14
- *:first-child+html .wf_pcb {color: #333; padding-top: 0px; padding-bottom: 0px; text-decoration: none; }
14
+ *:first-child + html .wf_pcb {color: #333; padding-top: 0px; padding-bottom: 0px; text-decoration: none; }
15
15
 
16
16
  .wf_pcb span {background-position: right -326px; padding-right: 14px; }
17
17
  a.wf_grey_button {background-position: left -219px; padding-top: 3px; }
@@ -4,6 +4,12 @@
4
4
  -webkit-border-radius: $radius;
5
5
  }
6
6
 
7
+ @mixin shadow($info) {
8
+ box-shadow:$info;
9
+ -moz-box-shadow:$info;
10
+ -webkit-box-shadow:$info;
11
+ }
12
+
7
13
  .wf_calendar_trigger {border:0px; padding-left:2px; padding-right:2px;}
8
14
 
9
15
  .wf_calendar {
@@ -14,6 +20,7 @@
14
20
  border-color:#e8e8e8 #bababa #bababa #e8e8e8;
15
21
  padding: 5px;
16
22
  @include rounded-corners(10px);
23
+ @include shadow(2px 3px 3px 2px rgba(0,0,0,0.6));
17
24
 
18
25
  input {
19
26
  border: 1px solid #ccc;
@@ -42,14 +49,54 @@
42
49
  @include rounded-corners(10px);
43
50
  }
44
51
 
45
- .wf_calendar_table {width:100%;}
46
- .wf_calendar_table td {padding:2px; margin:2px; text-align:center; vertical-align:top;}
47
- .wf_calendar img {border: 0px;}
52
+ .wf_calendar_table {
53
+ width:100%;
54
+ td {
55
+ padding:2px;
56
+ margin:2px;
57
+ text-align:center;
58
+ vertical-align:top;
59
+ }
60
+ img {
61
+ border: 0px;
62
+ }
63
+ }
64
+
65
+ .wf_calendar_cells {
66
+ border:1px dotted #ccc;
67
+ width:100%;
68
+ padding:2px;
69
+ margin:0px;
70
+ td {
71
+ padding:2px;
72
+ border: 0px;
73
+ text-align:center;
74
+ vertical-align:middle;
75
+ font-size:8px;
76
+ color:black;
77
+ background-color:white;
78
+ cursor:pointer;
79
+ }
80
+ }
81
+
82
+ .wf_calendar_title {
83
+ text-align:center;
84
+ border-top:1px solid #ccc;
85
+ border-bottom:1px solid #ccc;
86
+ background: #eee;
87
+ }
88
+
89
+ .wf_calendar_date_cell {
90
+ width:11px;
91
+ border: 1px solid #ccc;
92
+ padding:2px;
93
+ margin:1px;
94
+ cursor:pointer;
95
+ vertical-align:middle;
96
+ text-align:center;
97
+ background-color:white;
98
+ }
48
99
 
49
- .wf_calendar_cells {border:1px dotted #ccc; width:100%; padding:2px; margin:0px; }
50
- .wf_calendar_cells td {padding:2px; border: 0px; text-align:center; vertical-align:middle; font-size:8px; color:black; background-color:white;cursor:pointer;}
51
- .wf_calendar_title {text-align:center; border-top:1px solid #ccc; border-bottom:1px solid #ccc; background: #eee;}
52
- .wf_calendar_date_cell {width:11px; border: 1px solid #ccc; padding:2px; margin:1px; cursor:pointer; vertical-align:middle; text-align:center; background-color:white;}
53
100
  .wf_calendar_date_cell.today {background-color:light-blue; }
54
101
  .wf_calendar_date_cell.selected {background-color:#ccc; }
55
102
  .wf_calendar_date_cell:hover {background-color:#ccc; }
@@ -4,6 +4,12 @@
4
4
  -webkit-border-radius: $radius;
5
5
  }
6
6
 
7
+ @mixin shadow($info) {
8
+ box-shadow:$info;
9
+ -moz-box-shadow:$info;
10
+ -webkit-box-shadow:$info;
11
+ }
12
+
7
13
  .wf_exporter {
8
14
  background-color:#eee;
9
15
  position:absolute;
@@ -13,6 +19,40 @@
13
19
  border:solid 1px #e8e8e8;
14
20
  border-color:#e8e8e8 #bababa #bababa #e8e8e8;
15
21
  @include rounded-corners(10px);
22
+ @include shadow(2px 3px 3px 2px rgba(0,0,0,0.6));
23
+
24
+ img {
25
+ border: 0px;
26
+ }
27
+
28
+ input {
29
+ border: 1px solid #ccc;
30
+ font-size: 12px;
31
+ font-family: Arial;
32
+ @include rounded-corners(10px);
33
+ }
34
+
35
+ select {
36
+ border: 1px solid #ccc;
37
+ font-size: 12px;
38
+ font-family: Arial;
39
+ background-color:#EDEDED;
40
+ @include rounded-corners(10px);
41
+ }
42
+
43
+ table {
44
+ width:100%;
45
+ border-collapse: collapse;
46
+ font-size:12px;
47
+ padding:0px;
48
+ margin:0px;
49
+ }
50
+
51
+ td {
52
+ vertical-align:top;
53
+ padding: 0px;
54
+ margin: 0px;
55
+ }
16
56
  }
17
57
 
18
58
  .wf_exporter_container {
@@ -24,20 +64,3 @@
24
64
  border-color:#bababa #e8e8e8 #e8e8e8 #bababa;
25
65
  @include rounded-corners(10px);
26
66
  }
27
-
28
- .wf_exporter img {border: 0px;}
29
- .wf_exporter input {
30
- border: 1px solid #ccc;
31
- font-size: 12px;
32
- font-family: Arial;
33
- @include rounded-corners(10px);
34
- }
35
- .wf_exporter select {
36
- border: 1px solid #ccc;
37
- font-size: 12px;
38
- font-family: Arial;
39
- background-color:#EDEDED;
40
- @include rounded-corners(10px);
41
- }
42
- .wf_exporter table {width:100%;border-collapse: collapse; font-size:12px; padding:0px; margin:0px;}
43
- .wf_exporter td {vertical-align:top; padding: 0px; margin: 0px; }
@@ -5,148 +5,173 @@
5
5
  }
6
6
 
7
7
  .wf_container {
8
- padding:0px;
9
- background:#f1f4f9;
10
- margin:0px;
11
- margin-bottom:10px;
12
- font-size: 12px;
13
- font-family: Arial;
14
- width: 100%;
15
- border:solid 1px #e8e8e8;
16
- border-color:#e8e8e8 #bababa #bababa #e8e8e8;
17
- @include rounded-corners(10px);
18
-
19
- .spinner {
20
- font-size: 10px;
21
- }
22
-
23
- .debugger {
24
- padding:5px;
25
- margin:2px;
26
- background:white;
27
- border:solid 1px #bababa;
28
- border-color:#bababa #e8e8e8 #e8e8e8 #bababa;
29
- font-size:10px;
30
- color: #777;
31
- @include rounded-corners(10px);
32
- }
33
-
34
- .footer {
35
- padding:5px;
36
- margin-top:3px;
37
- .actions {
38
- float:right;
39
- }
40
- }
41
-
42
- .conditions {
43
- padding:0px;
44
- margin:5px;
45
- .header {
46
- margin:0px;
47
- height:25px;
48
- padding:5px;
49
- }
50
- .body {
51
- padding:5px;
52
- background:white;
53
- border:solid 1px #bababa;
54
- border-color:#bababa #e8e8e8 #e8e8e8 #bababa;
55
- @include rounded-corners(10px);
56
- }
57
- .condition {
58
- padding-left:5px;
59
- padding-right:2px;
60
- padding-bottom:0px;
61
- width:20%;
62
- white-space:nowrap;
63
- vertical-align: top;
64
- }
65
- .operator {
66
- padding-right:2px;
67
- padding-bottom:0px;
68
- width:15%;
69
- white-space:nowrap;
70
- vertical-align: top;
71
- }
72
- .values {
73
- padding-right:2px;
74
- width:70%;
75
- margin:0px;
76
- vertical-align:top;
77
- }
78
- .actions {
79
- padding-right:5px;
80
- padding-bottom:2px;
81
- white-space:nowrap;
82
- text-align:right;
83
- width:100px;
84
- vertical-align: top;
85
- }
86
- .table {
87
- border:0px;
88
- width:100%;
89
- margin:0px;
90
- padding:0px;
91
- td {
92
- padding: 1px;
93
- vertical-align:top;
94
- white-space:nowrap;
95
- }
96
- .error {
97
- padding: 2px;
98
- padding-left:10px;
99
- padding-right:10px;
100
- margin:2px;
101
- font-size: 10px;
102
- background-color: #ffeded;
103
- font-family: Arial;
104
- border: 1px #f58a8a solid;
105
- color:#b60e0e;
106
- @include rounded-corners(10px);
107
- }
108
- }
109
-
110
- .values {
111
- border:0px;
112
- width:100%;
113
- margin:0px;
114
- padding:0px;
115
- td {
116
- vertical-align:top;
117
- padding: 0px;
118
- margin: 0px;
119
- }
120
- }
121
- }
122
-
123
- input {
124
- border: 1px solid #ccc;
125
- font-size: 12px;
126
- font-family: Arial;
127
- margin:0px;
128
- padding: 2px !important;
129
- @include rounded-corners(10px);
130
- }
131
-
132
- select {
133
- border: 1px solid #ccc;
134
- font-size: 12px;
135
- font-family: Arial;
136
- margin:0px;
137
- padding: 1px !important;
138
- background-color:#EDEDED;
139
- @include rounded-corners(10px);
140
- }
141
-
142
- a {
143
- text-decoration:none;
144
- color:#16b;
145
- outline:none;
146
- border:0px;
147
- }
148
-
149
- img {
150
- border:0px;
151
- }
8
+ padding:0px;
9
+ background:#f1f4f9;
10
+ margin:0px;
11
+ margin-bottom:10px;
12
+ font-size: 12px;
13
+ font-family: Arial;
14
+ width: 100%;
15
+ border:solid 1px #e8e8e8;
16
+ border-color:#e8e8e8 #bababa #bababa #e8e8e8;
17
+ @include rounded-corners(10px);
18
+
19
+ .spinner {
20
+ font-size: 10px;
21
+
22
+ img {vertical-align:middle;}
23
+ }
24
+
25
+ .debugger {
26
+ padding:5px;
27
+ margin:2px;
28
+ background:white;
29
+ border:solid 1px #bababa;
30
+ border-color:#bababa #e8e8e8 #e8e8e8 #bababa;
31
+ font-size:10px;
32
+ color: #777;
33
+ @include rounded-corners(10px);
34
+ }
35
+
36
+ .footer {
37
+ padding:5px;
38
+ margin-top:3px;
39
+ .actions {
40
+ float:right;
41
+ }
42
+ small {font-size:9px;}
43
+ }
44
+
45
+ .conditions {
46
+ padding:0px;
47
+ margin:5px;
48
+ .header {
49
+ margin:0px;
50
+ height:25px;
51
+ padding:5px;
52
+ }
53
+ .body {
54
+ padding:5px;
55
+ background:white;
56
+ border:solid 1px #bababa;
57
+ border-color:#bababa #e8e8e8 #e8e8e8 #bababa;
58
+ @include rounded-corners(10px);
59
+
60
+ .no_filter_hint {
61
+ font-style:italic;
62
+ padding:5px;
63
+ color: black;
64
+ }
65
+
66
+ .filter_match_type {
67
+ padding:5px;
68
+ }
69
+ }
70
+ .condition {
71
+ padding-left:5px;
72
+ padding-right:2px;
73
+ padding-bottom:0px;
74
+ width:20%;
75
+ white-space:nowrap;
76
+ vertical-align: top;
77
+ }
78
+ .operator {
79
+ padding-right:2px;
80
+ padding-bottom:0px;
81
+ width:15%;
82
+ white-space:nowrap;
83
+ vertical-align: top;
84
+ }
85
+ .values {
86
+ padding-right:2px;
87
+ width:70%;
88
+ margin:0px;
89
+ vertical-align:top;
90
+ }
91
+ .actions {
92
+ padding-right:5px;
93
+ padding-bottom:2px;
94
+ white-space:nowrap;
95
+ text-align:right;
96
+ width:100px;
97
+ vertical-align: top;
98
+ }
99
+ .table {
100
+ border:0px;
101
+ width:100%;
102
+ margin:0px;
103
+ padding:0px;
104
+ td {
105
+ padding: 2px;
106
+ vertical-align:top;
107
+ white-space:nowrap;
108
+ }
109
+
110
+ td.actions {padding:0;}
111
+ .error {
112
+ padding: 2px 10px;
113
+ margin:2px;
114
+ font-size: 10px;
115
+ background-color: #ffeded;
116
+ font-family: Arial;
117
+ border: 1px #f58a8a solid;
118
+ color:#b60e0e;
119
+ @include rounded-corners(10px);
120
+ }
121
+ }
122
+
123
+ .values {
124
+ border:0px;
125
+ width:100%;
126
+ margin:0px;
127
+ padding:0px;
128
+ td {
129
+ vertical-align:top;
130
+ padding: 0px;
131
+ margin: 0px;
132
+ }
133
+ }
134
+ }
135
+
136
+ input {
137
+ border: 1px solid #ccc;
138
+ font-size: 12px;
139
+ font-family: Arial;
140
+ margin:0px;
141
+ padding: 2px !important;
142
+ @include rounded-corners(10px);
143
+ }
144
+
145
+ select {
146
+ border: 1px solid #ccc;
147
+ font-size: 12px;
148
+ font-family: Arial;
149
+ margin:0px;
150
+ padding: 1px !important;
151
+ background-color:#EDEDED;
152
+ @include rounded-corners(10px);
153
+ }
154
+
155
+ a {
156
+ text-decoration:none;
157
+ color:#16b;
158
+ outline:none;
159
+ border:0px;
160
+ }
161
+
162
+ img {
163
+ border:0px;
164
+ }
152
165
  }
166
+
167
+ .end {float:right;}
168
+ .begin {float:left;}
169
+ .full_width {width:100%;}
170
+
171
+ .boolean_container {
172
+ vertical-align:middle;
173
+ text-align:left;
174
+ padding-top:2px;
175
+ }
176
+
177
+
@@ -97,15 +97,7 @@ module WillFilter
97
97
  end
98
98
 
99
99
  def send_csv_data(wf_filter)
100
- result = StringIO.new
101
-
102
- # CSV.open(result) do |csv|
103
- # csv << ["row", "of", "CSV", "data"]
104
- # csv << ["another", "row"]
105
- # # ...
106
- # end
107
-
108
- CSV::Writer.generate(result) do |csv|
100
+ csv_string = CSV.generate do |csv|
109
101
  csv << wf_filter.fields
110
102
  wf_filter.results.each do |obj|
111
103
  row = []
@@ -116,7 +108,8 @@ module WillFilter
116
108
  end
117
109
  end
118
110
 
119
- send_data(result.string, :type => 'text/csv', :charset => 'utf-8')
111
+ send_data csv_string, :type => 'text/csv; charset=utf-8; header=present', :charset => 'utf-8',
112
+ :disposition => "attachment; filename=results.csv"
120
113
  end
121
114
  end
122
115
  end
@@ -1,28 +1,26 @@
1
1
  <% if wf_filter.errors[index] %>
2
2
  <tr>
3
- <td colspan="2">
4
- </td>
3
+ <td colspan="2"></td>
5
4
  <td>
6
5
  <div class="error">
7
6
  <%= wf_filter.errors[index] %>
8
7
  </div>
9
8
  </td>
10
- <td>
11
- </td>
9
+ <td></td>
12
10
  </tr>
13
11
  <% end %>
14
12
 
15
13
  <tr>
16
- <td class="condition" style="padding:2px;">
17
- <%= select_tag "wf_c#{index}", options_for_select(wf_filter.condition_options, condition.key.to_s), {:class=>"wf_input", :style=>"width:100%;", :onChange=>"wfFilter.updateConditionAt('#{index}')"} %>
14
+ <td class="condition">
15
+ <%= select_tag "wf_c#{index}", options_for_select(wf_filter.condition_options, condition.key.to_s), {:class=>"wf_input full_width", :onChange=>"wfFilter.updateConditionAt('#{index}')"} %>
18
16
  </td>
19
- <td class="operator" style="padding:2px;">
20
- <%= select_tag "wf_o#{index}", options_for_select(wf_filter.operator_options_for(condition.key), condition.operator.to_s), {:class=>"wf_input", :style=>"width:100%;", :onChange=>"wfFilter.updateConditionAt('#{index}')"} %>
17
+ <td class="operator">
18
+ <%= select_tag "wf_o#{index}", options_for_select(wf_filter.operator_options_for(condition.key), condition.operator.to_s), {:class=>"wf_input full_width", :onChange=>"wfFilter.updateConditionAt('#{index}')"} %>
21
19
  </td>
22
- <td class="values" style="padding:2px;">
20
+ <td class="values">
23
21
  <%= render :partial => "/will_filter/filter/containers/#{condition.container.template_name}", :locals => {:container => condition.container, :index => index} %>
24
22
  </td>
25
- <td class="actions" style="padding:0px;">
23
+ <td class="actions">
26
24
  <%=link_to_function("<span>-</span>".html_safe, "wfFilter.removeConditionAt('#{index}')", :class => "wf_grey_button wf_pcb") %>
27
25
  <%=link_to_function("<span>+</span>".html_safe, "wfFilter.addConditionAfter('#{index}')", :class => "wf_grey_button wf_pcb") %>
28
26
  </td>