will_filter 3.0.5 → 3.1.1

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.
Files changed (233) hide show
  1. data/.gitignore +6 -0
  2. data/.rspec +1 -0
  3. data/.rvmrc +1 -0
  4. data/CHANGELOG.rdoc +2 -0
  5. data/Gemfile +4 -0
  6. data/Gemfile.lock +156 -0
  7. data/MIT-LICENSE +20 -0
  8. data/README.rdoc +78 -0
  9. data/Rakefile +68 -0
  10. data/app/.DS_Store +0 -0
  11. data/app/assets/images/.DS_Store +0 -0
  12. data/{public/favicon.ico → app/assets/images/will_filter/.gitkeep} +0 -0
  13. data/{public/will_filter/images → app/assets/images/will_filter}/buttons.png +0 -0
  14. data/{public/will_filter/images → app/assets/images/will_filter}/calendar.png +0 -0
  15. data/{public/will_filter/images → app/assets/images/will_filter}/clock.png +0 -0
  16. data/{public/will_filter/images → app/assets/images/will_filter}/close.gif +0 -0
  17. data/{public/will_filter/images → app/assets/images/will_filter}/sort_arrow_all.gif +0 -0
  18. data/{public/will_filter/images → app/assets/images/will_filter}/sort_bg.gif +0 -0
  19. data/{public/will_filter/images → app/assets/images/will_filter}/spinner.gif +0 -0
  20. data/{public/will_filter/javascripts/will_filter.js → app/assets/javascripts/will_filter/filter.js} +7 -7
  21. data/app/assets/javascripts/will_filter/filter_prototype_effects.js +38 -0
  22. data/app/assets/stylesheets/will_filter/actions.css.scss +27 -0
  23. data/app/assets/stylesheets/will_filter/buttons.css.scss +24 -0
  24. data/app/assets/stylesheets/will_filter/calendar.css.scss +55 -0
  25. data/app/assets/stylesheets/will_filter/exporter.css.scss +43 -0
  26. data/app/assets/stylesheets/will_filter/filter.css.scss +152 -0
  27. data/app/assets/stylesheets/will_filter/results.css.scss +63 -0
  28. data/app/controllers/{application_controller.rb → will_filter/application_controller.rb} +4 -4
  29. data/app/controllers/will_filter/calendar_controller.rb +1 -1
  30. data/app/controllers/will_filter/exporter_controller.rb +1 -1
  31. data/app/controllers/will_filter/filter_controller.rb +1 -7
  32. data/app/models/will_filter/filter.rb +12 -40
  33. data/app/views/.DS_Store +0 -0
  34. data/app/views/layouts/will_filter/application.html.erb +14 -0
  35. data/app/views/will_filter/.DS_Store +0 -0
  36. data/app/views/will_filter/calendar/.tmp__annual.html.erb.10120~ +32 -0
  37. data/app/views/will_filter/calendar/.tmp__annual.html.erb.2839~ +14 -0
  38. data/app/views/will_filter/calendar/.tmp__annual.html.erb.58862~ +14 -0
  39. data/app/views/will_filter/calendar/.tmp__annual.html.erb.64846~ +14 -0
  40. data/app/views/will_filter/calendar/.tmp__annual.html.erb.68789~ +32 -0
  41. data/app/views/will_filter/calendar/.tmp__annual.html.erb.93003~ +14 -0
  42. data/app/views/will_filter/calendar/.tmp__annual.html.erb.93827~ +32 -0
  43. data/app/views/will_filter/calendar/.tmp__month.html.erb.756~ +39 -0
  44. data/app/views/will_filter/calendar/.tmp__quarter.html.erb.69400~ +24 -0
  45. data/app/views/will_filter/calendar/.tmp_index.html.erb.11043~ +52 -0
  46. data/app/views/will_filter/calendar/.tmp_index.html.erb.33725~ +52 -0
  47. data/app/views/will_filter/calendar/.tmp_index.html.erb.56447~ +66 -0
  48. data/app/views/will_filter/calendar/.tmp_index.html.erb.85379~ +70 -0
  49. data/app/views/will_filter/calendar/.tmp_index.html.erb.86425~ +70 -0
  50. data/app/views/will_filter/calendar/.tmp_index.html.erb.95884~ +52 -0
  51. data/app/views/will_filter/calendar/index.html.erb +3 -3
  52. data/app/views/will_filter/common/.tmp__results_table.html.erb.47785~ +87 -0
  53. data/app/views/will_filter/common/.tmp__results_table.html.erb.88043~ +87 -0
  54. data/app/views/will_filter/common/.tmp__scripts.html.erb.51111~ +0 -0
  55. data/app/views/will_filter/common/.tmp__scripts.html.erb.6990~ +2 -0
  56. data/app/views/will_filter/common/.tmp__scripts.html.erb.88469~ +6 -0
  57. data/app/views/will_filter/common/_results_table.html.erb +6 -2
  58. data/app/views/will_filter/common/_scripts.html.erb +8 -2
  59. data/app/views/will_filter/exporter/.tmp_export.html.erb.10837~ +9 -0
  60. data/app/views/will_filter/exporter/.tmp_export.html.erb.1415~ +29 -0
  61. data/app/views/will_filter/exporter/.tmp_export.html.erb.60681~ +29 -0
  62. data/app/views/will_filter/exporter/.tmp_export.html.erb.61343~ +29 -0
  63. data/app/views/will_filter/exporter/.tmp_export_dialog.html.erb.22940~ +38 -0
  64. data/app/views/will_filter/exporter/.tmp_index.html.erb.13538~ +47 -0
  65. data/app/views/will_filter/exporter/.tmp_index.html.erb.23276~ +47 -0
  66. data/app/views/will_filter/exporter/.tmp_index.html.erb.28308~ +44 -0
  67. data/app/views/will_filter/exporter/.tmp_index.html.erb.29049~ +44 -0
  68. data/app/views/will_filter/exporter/index.html.erb +1 -1
  69. data/app/views/will_filter/filter/.tmp__condition.html.erb.24762~ +28 -0
  70. data/app/views/will_filter/filter/.tmp__condition.html.erb.27587~ +28 -0
  71. data/app/views/will_filter/filter/.tmp__condition.html.erb.45362~ +28 -0
  72. data/app/views/will_filter/filter/.tmp__condition.html.erb.49252~ +28 -0
  73. data/app/views/will_filter/filter/.tmp__condition.html.erb.58234~ +30 -0
  74. data/app/views/will_filter/filter/.tmp__condition.html.erb.60688~ +28 -0
  75. data/app/views/will_filter/filter/.tmp__condition.html.erb.66557~ +28 -0
  76. data/app/views/will_filter/filter/.tmp__condition.html.erb.68032~ +30 -0
  77. data/app/views/will_filter/filter/.tmp__condition.html.erb.73740~ +28 -0
  78. data/app/views/will_filter/filter/.tmp__condition.html.erb.81041~ +30 -0
  79. data/app/views/will_filter/filter/.tmp__condition.html.erb.98638~ +28 -0
  80. data/app/views/will_filter/filter/.tmp__conditions.html.erb.23216~ +50 -0
  81. data/app/views/will_filter/filter/.tmp__conditions.html.erb.53568~ +50 -0
  82. data/app/views/will_filter/filter/.tmp__conditions.html.erb.5788~ +56 -0
  83. data/app/views/will_filter/filter/.tmp__conditions.html.erb.79521~ +50 -0
  84. data/app/views/will_filter/filter/.tmp__conditions.html.erb.92102~ +56 -0
  85. data/app/views/will_filter/filter/.tmp__conditions.html.erb.97034~ +52 -0
  86. data/app/views/will_filter/filter/.tmp__container.html.erb.23178~ +30 -0
  87. data/app/views/will_filter/filter/.tmp__container.html.erb.25113~ +31 -0
  88. data/app/views/will_filter/filter/.tmp__container.html.erb.29332~ +36 -0
  89. data/app/views/will_filter/filter/.tmp__container.html.erb.31412~ +32 -0
  90. data/app/views/will_filter/filter/.tmp__container.html.erb.57958~ +32 -0
  91. data/app/views/will_filter/filter/.tmp__container.html.erb.80588~ +30 -0
  92. data/app/views/will_filter/filter/.tmp__container.html.erb.89054~ +30 -0
  93. data/app/views/will_filter/filter/.tmp__container.html.erb.92260~ +32 -0
  94. data/app/views/will_filter/filter/.tmp__container.html.erb.92798~ +36 -0
  95. data/app/views/will_filter/filter/.tmp__filter_conditions.html.erb.70617~ +78 -0
  96. data/app/views/will_filter/filter/.tmp_calendar.html.erb.30839~ +66 -0
  97. data/app/views/will_filter/filter/.tmp_calendar.html.erb.52766~ +66 -0
  98. data/app/views/will_filter/filter/.tmp_calendar.html.erb.83182~ +66 -0
  99. data/app/views/will_filter/filter/.tmp_export_data.html.erb.50322~ +44 -0
  100. data/app/views/will_filter/filter/.tmp_index.html.erb.40957~ +4 -0
  101. data/app/views/will_filter/filter/_condition.html.erb +5 -5
  102. data/app/views/will_filter/filter/_conditions.html.erb +4 -7
  103. data/app/views/will_filter/filter/_container.html.erb +5 -5
  104. data/app/views/will_filter/filter/containers/_boolean.html.erb +2 -2
  105. data/app/views/will_filter/filter/containers/_date.html.erb +3 -5
  106. data/app/views/will_filter/filter/containers/_date_range.html.erb +5 -9
  107. data/app/views/will_filter/filter/containers/_date_time.html.erb +3 -5
  108. data/app/views/will_filter/filter/containers/_date_time_range.html.erb +5 -9
  109. data/app/views/will_filter/filter/containers/_list.html.erb +1 -1
  110. data/app/views/will_filter/filter/containers/_numeric_range.html.erb +3 -3
  111. data/app/views/will_filter/filter/containers/_text.html.erb +2 -2
  112. data/app/views/will_filter/filter/index.html.erb +1 -1
  113. data/config/routes.rb +39 -17
  114. data/db/migrate/20110924023807_create_will_filter_filters.rb +15 -0
  115. data/lib/generators/.DS_Store +0 -0
  116. data/lib/generators/will_filter/templates/config.yml +0 -28
  117. data/lib/generators/will_filter/templates/create_will_filter_filters.rb +15 -0
  118. data/lib/generators/will_filter/will_filter_generator.rb +27 -4
  119. data/lib/tasks/will_filter_tasks.rake +1 -2
  120. data/lib/will_filter.rb +26 -1
  121. data/lib/will_filter/calendar.rb +1 -1
  122. data/lib/will_filter/config.rb +1 -6
  123. data/lib/will_filter/containers/filter_list.rb +2 -2
  124. data/lib/will_filter/engine.rb +23 -17
  125. data/lib/will_filter/{common_methods.rb → extensions/action_controller_extension.rb} +18 -20
  126. data/lib/will_filter/extensions/action_view_extension.rb +50 -0
  127. data/lib/{core_ext/active_record/base.rb → will_filter/extensions/active_record_extension.rb} +22 -17
  128. data/lib/{core_ext/array.rb → will_filter/extensions/array_extension.rb} +1 -1
  129. data/lib/{application_helper.rb → will_filter/railtie.rb} +30 -20
  130. data/{app/helpers/application_helper.rb → lib/will_filter/version.rb} +3 -3
  131. data/script/rails +6 -0
  132. data/spec/spec_helper.rb +27 -0
  133. data/test/.DS_Store +0 -0
  134. data/test/dummy/.DS_Store +0 -0
  135. data/test/dummy/.sass-cache/f9cb1ef521115be73f1c61d3d5d64f66c947af63/actions.css.scssc +0 -0
  136. data/test/dummy/.sass-cache/f9cb1ef521115be73f1c61d3d5d64f66c947af63/buttons.css.scssc +0 -0
  137. data/test/dummy/.sass-cache/f9cb1ef521115be73f1c61d3d5d64f66c947af63/calendar.css.scssc +0 -0
  138. data/test/dummy/.sass-cache/f9cb1ef521115be73f1c61d3d5d64f66c947af63/exporter.css.scssc +0 -0
  139. data/test/dummy/.sass-cache/f9cb1ef521115be73f1c61d3d5d64f66c947af63/filter.css.scssc +0 -0
  140. data/test/dummy/.sass-cache/f9cb1ef521115be73f1c61d3d5d64f66c947af63/results.css.scssc +0 -0
  141. data/test/dummy/Rakefile +7 -0
  142. data/test/dummy/app/.DS_Store +0 -0
  143. data/test/dummy/app/assets/javascripts/application.js +7 -0
  144. data/test/dummy/app/assets/stylesheets/application.css +7 -0
  145. data/test/dummy/app/assets/stylesheets/kaminari.css +10 -0
  146. data/test/dummy/app/controllers/advanced_controller.rb +19 -0
  147. data/test/dummy/app/controllers/application_controller.rb +8 -0
  148. data/test/dummy/app/controllers/simple_controller.rb +15 -0
  149. data/test/dummy/app/helpers/application_helper.rb +3 -0
  150. data/test/dummy/app/mailers/.gitkeep +0 -0
  151. data/test/dummy/app/models/.gitkeep +0 -0
  152. data/test/dummy/app/models/event.rb +15 -0
  153. data/test/dummy/app/models/event_filter.rb +41 -0
  154. data/test/dummy/app/models/event_user.rb +10 -0
  155. data/test/dummy/app/models/event_user_filter.rb +40 -0
  156. data/test/dummy/app/models/user.rb +42 -0
  157. data/test/dummy/app/models/user_filter.rb +57 -0
  158. data/test/dummy/app/views/advanced/event_members.html.erb +2 -0
  159. data/test/dummy/app/views/advanced/events.html.erb +2 -0
  160. data/test/dummy/app/views/advanced/users.html.erb +2 -0
  161. data/test/dummy/app/views/advanced/users_with_actions.html.erb +12 -0
  162. data/test/dummy/app/views/common/_event_members.html.erb +2 -0
  163. data/test/dummy/app/views/common/_events.html.erb +2 -0
  164. data/test/dummy/app/views/common/_menu.html.erb +23 -0
  165. data/test/dummy/app/views/common/_users.html.erb +2 -0
  166. data/test/dummy/app/views/kaminari/_first_page.html.erb +11 -0
  167. data/test/dummy/app/views/kaminari/_gap.html.erb +8 -0
  168. data/test/dummy/app/views/kaminari/_last_page.html.erb +11 -0
  169. data/test/dummy/app/views/kaminari/_next_page.html.erb +11 -0
  170. data/test/dummy/app/views/kaminari/_page.html.erb +12 -0
  171. data/test/dummy/app/views/kaminari/_paginator.html.erb +23 -0
  172. data/test/dummy/app/views/kaminari/_prev_page.html.erb +11 -0
  173. data/test/dummy/app/views/layouts/application.html.erb +17 -0
  174. data/test/dummy/app/views/simple/event_members.html.erb +2 -0
  175. data/test/dummy/app/views/simple/events.html.erb +3 -0
  176. data/test/dummy/app/views/simple/users.html.erb +2 -0
  177. data/test/dummy/config.ru +4 -0
  178. data/{config → test/dummy/config}/application.rb +11 -10
  179. data/test/dummy/config/boot.rb +10 -0
  180. data/test/dummy/config/data/female_names.txt +26 -0
  181. data/test/dummy/config/data/last_names.txt +50 -0
  182. data/test/dummy/config/data/male_names.txt +25 -0
  183. data/{config → test/dummy/config}/database.yml +3 -0
  184. data/test/dummy/config/environment.rb +5 -0
  185. data/{config → test/dummy/config}/environments/development.rb +8 -4
  186. data/{config → test/dummy/config}/environments/production.rb +24 -13
  187. data/{config → test/dummy/config}/environments/test.rb +9 -5
  188. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  189. data/test/dummy/config/initializers/inflections.rb +10 -0
  190. data/test/dummy/config/initializers/mime_types.rb +5 -0
  191. data/test/dummy/config/initializers/secret_token.rb +7 -0
  192. data/test/dummy/config/initializers/session_store.rb +8 -0
  193. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  194. data/test/dummy/config/locales/en.yml +5 -0
  195. data/test/dummy/config/routes.rb +13 -0
  196. data/test/dummy/config/will_filter/config.yml +97 -0
  197. data/test/dummy/db/migrate/.DS_Store +0 -0
  198. data/test/dummy/db/migrate/20090416182137_create_users.rb +15 -0
  199. data/test/dummy/db/migrate/20090418042757_create_events.rb +20 -0
  200. data/test/dummy/db/migrate/20090418062225_create_event_users.rb +17 -0
  201. data/test/dummy/db/schema.rb +61 -0
  202. data/test/dummy/lib/assets/.gitkeep +0 -0
  203. data/test/dummy/lib/tasks/dummy.rake +14 -0
  204. data/test/dummy/log/.gitkeep +0 -0
  205. data/{public → test/dummy/public}/404.html +0 -0
  206. data/{public → test/dummy/public}/422.html +0 -0
  207. data/{public → test/dummy/public}/500.html +0 -0
  208. data/test/dummy/public/favicon.ico +0 -0
  209. data/test/dummy/script/rails +6 -0
  210. data/test/dummy/test/functional/welcome_controller_test.rb +9 -0
  211. data/test/dummy/test/unit/helpers/welcome_helper_test.rb +4 -0
  212. data/test/fixtures/will_filter/filters.yml +11 -0
  213. data/test/functional/will_filter/calendar_controller_test.rb +9 -0
  214. data/test/functional/will_filter/exporter_controller_test.rb +9 -0
  215. data/test/functional/will_filter/filter_controller_test.rb +9 -0
  216. data/test/integration/navigation_test.rb +10 -0
  217. data/test/test_helper.rb +10 -0
  218. data/test/unit/helpers/will_filter/calendar_helper_test.rb +6 -0
  219. data/test/unit/helpers/will_filter/exporter_helper_test.rb +6 -0
  220. data/test/unit/helpers/will_filter/filter_helper_test.rb +6 -0
  221. data/test/unit/will_filter/filter_test.rb +9 -0
  222. data/test/will_filter_test.rb +7 -0
  223. data/will_filter.gemspec +38 -0
  224. metadata +446 -45
  225. data/app/views/layouts/application.html.erb +0 -11
  226. data/config/boot.rb +0 -6
  227. data/config/environment.rb +0 -15
  228. data/lib/core_ext/object.rb +0 -34
  229. data/lib/generators/will_filter/templates/create_will_filter_tables.rb +0 -19
  230. data/public/robots.txt +0 -5
  231. data/public/will_filter/images/results_table_th_active.gif +0 -0
  232. data/public/will_filter/javascripts/will_filter_prototype_effects.js +0 -15
  233. data/public/will_filter/stylesheets/will_filter.css +0 -168
@@ -0,0 +1,27 @@
1
+ @mixin rounded-corners($radius) {
2
+ border-radius: $radius;
3
+ -moz-border-radius: $radius;
4
+ -webkit-border-radius: $radius;
5
+ }
6
+
7
+ .wf_actions_bar_yellow {
8
+ margin-top:10px;
9
+ margin-bottom:10px;
10
+ padding:10px;
11
+ background-color: #f9f8f7;
12
+ border-color: #E8E8E8 #BABABA #BABABA #E8E8E8;
13
+ border-style: solid;
14
+ border-width: 1px;
15
+ @include rounded-corners(10px);
16
+ }
17
+
18
+ .wf_actions_bar_blue {
19
+ margin-top:10px;
20
+ margin-bottom:10px;
21
+ padding:10px;
22
+ background-color: #f1f4fa;
23
+ border-color: #E8E8E8 #BABABA #BABABA #E8E8E8;
24
+ border-style: solid;
25
+ border-width: 1px;
26
+ @include rounded-corners(10px);
27
+ }
@@ -0,0 +1,24 @@
1
+ /*
2
+ Pure CSS Buttons.
3
+ Learn more ~ http://www.halmatferello.com/lab/pure-css-buttons/
4
+
5
+ Licensed under GPL and MIT.
6
+ */
7
+ .wf_pcb, .wf_pcb span {background: url('/assets/will_filter/buttons.png') no-repeat; height: 23px; line-height: 23px; padding: 3px 0 7px 0; }
8
+ .wf_pcb, a.wf_pcb:link, a.wf_pcb:visited {color: #333; font-size: 12px; font-style:bold; font-family:arial; padding-left: 14px; text-decoration: none !important; }
9
+
10
+ /* ie 6 hack */
11
+ * html div#frame .wf_pcb {color: #333; padding-top: 0px; padding-bottom: 0px; text-decoration: none; }
12
+
13
+ /* ie 7 hack */
14
+ *:first-child+html .wf_pcb {color: #333; padding-top: 0px; padding-bottom: 0px; text-decoration: none; }
15
+
16
+ .wf_pcb span {background-position: right -326px; padding-right: 14px; }
17
+ a.wf_grey_button {background-position: left -219px; padding-top: 3px; }
18
+ a.wf_grey_button span {background-position: right -545px; padding-top: 3px; }
19
+ a.wf_grey_button:hover {background-position: left -246px; }
20
+ a.wf_grey_button:hover span {background-position: right -572px; }
21
+ a.wf_grey_button:active, .grey_active_button {background-position: left -273px; }
22
+ a.wf_grey_button:active span, .grey_active_button span {background-position: right -599px; }
23
+ body.wf_grey_disabled_button {background-position: left -300px; color: #bbb !important; }
24
+ body.wf_grey_disabled_button span {background-position: right -626px; }
@@ -0,0 +1,55 @@
1
+ @mixin rounded-corners($radius) {
2
+ border-radius: $radius;
3
+ -moz-border-radius: $radius;
4
+ -webkit-border-radius: $radius;
5
+ }
6
+
7
+ .wf_calendar_trigger {border:0px; padding-left:2px; padding-right:2px;}
8
+
9
+ .wf_calendar {
10
+ background-color:#eee;
11
+ position:absolute;
12
+ font-size:10px;
13
+ border:solid 1px #e8e8e8;
14
+ border-color:#e8e8e8 #bababa #bababa #e8e8e8;
15
+ padding: 5px;
16
+ @include rounded-corners(10px);
17
+
18
+ input {
19
+ border: 1px solid #ccc;
20
+ font-size: 12px;
21
+ font-family: Arial;
22
+ @include rounded-corners(10px);
23
+ }
24
+
25
+ select {
26
+ border: 1px solid #ccc;
27
+ font-size: 12px;
28
+ font-family: Arial;
29
+ padding:2px;
30
+ background-color:#EDEDED;
31
+ @include rounded-corners(10px);
32
+ }
33
+ }
34
+
35
+ .wf_calendar_container {
36
+ background-color:white;
37
+ padding: 5px;
38
+ margin: 5px;
39
+ font-size:10px;
40
+ border:solid 1px #bababa;
41
+ border-color:#bababa #e8e8e8 #e8e8e8 #bababa;
42
+ @include rounded-corners(10px);
43
+ }
44
+
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;}
48
+
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
+ .wf_calendar_date_cell.today {background-color:light-blue; }
54
+ .wf_calendar_date_cell.selected {background-color:#ccc; }
55
+ .wf_calendar_date_cell:hover {background-color:#ccc; }
@@ -0,0 +1,43 @@
1
+ @mixin rounded-corners($radius) {
2
+ border-radius: $radius;
3
+ -moz-border-radius: $radius;
4
+ -webkit-border-radius: $radius;
5
+ }
6
+
7
+ .wf_exporter {
8
+ background-color:#eee;
9
+ position:absolute;
10
+ width:230px;
11
+ padding: 5px;
12
+ font-size:10px;
13
+ border:solid 1px #e8e8e8;
14
+ border-color:#e8e8e8 #bababa #bababa #e8e8e8;
15
+ @include rounded-corners(10px);
16
+ }
17
+
18
+ .wf_exporter_container {
19
+ background-color:white;
20
+ padding: 5px;
21
+ margin: 5px;
22
+ font-size:10px;
23
+ border:solid 1px #bababa;
24
+ border-color:#bababa #e8e8e8 #e8e8e8 #bababa;
25
+ @include rounded-corners(10px);
26
+ }
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; }
@@ -0,0 +1,152 @@
1
+ @mixin rounded-corners($radius) {
2
+ border-radius: $radius;
3
+ -moz-border-radius: $radius;
4
+ -webkit-border-radius: $radius;
5
+ }
6
+
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
+ }
152
+ }
@@ -0,0 +1,63 @@
1
+ .wf_paginator { width:100%; margin-bottom: 10px; font-size: 12px; font-family: Arial;}
2
+
3
+ .wf_results_table {
4
+ width: 100%;
5
+ font-size: 12px;
6
+ border: 1px #e5e5e5 solid;
7
+ border-collapse: collapse;
8
+ background-color: white;
9
+ margin-bottom: 10px;
10
+ }
11
+
12
+ .wf_results_table thead th {
13
+ background-color:#F5F5F5;
14
+ border-bottom:1px solid #CCCCCC;
15
+ border-top:1px solid #CCCCCC;
16
+ font-size:12px;
17
+ padding:5px 5px 5px 10px;
18
+ text-align:left;
19
+ white-space:nowrap;
20
+ }
21
+ .wf_results_table th,
22
+ .wf_results_table td {padding-right:10px;padding-left:10px; border-left:1px solid #eee;}
23
+ .wf_results_table td {padding:10px;border-bottom:solid 1px #ddd;vertical-align:top;}
24
+ .wf_results_table th {border-left:1px solid #ccc;padding-right:0px;font-weight:normal}
25
+ .wf_results_table th.first {border-left:none;}
26
+ .wf_results_table th {background: transparent url(/assets/will_filter/sort_bg.gif) repeat-x scroll 0 0;}
27
+
28
+ .wf_results_table th.sortable:hover {background-color:#ddd;}
29
+ .wf_results_table th.sortable:hover .sort_control {display:block;}
30
+ .wf_results_table th.sortable .sort_link {text-decoration:none;;width:100%;display:block;}
31
+
32
+ .wf_results_table th.current_sort {background: transparent url(/assets/will_filter/sort_bg.gif) repeat-x scroll 0 -100px;}
33
+ .wf_results_table th.current_sort .sort_control {display:block;}
34
+ .wf_results_table th.current_sort .sort_link {color:#000}
35
+
36
+ .wf_results_table th.desc .sort_control {display:block;}
37
+ .wf_results_table th.asc .sort_control .up {background: url(/assets/will_filter/sort_arrow_all.gif) -17px 0 no-repeat;}
38
+ .wf_results_table th.desc .sort_control .down {background: url(/assets/will_filter/sort_arrow_all.gif) -17px -13px no-repeat;}
39
+ .wf_results_table td.current_sort {font-weight:bold;border-left:1px solid #ccc;border-right:1px solid #ccc;}
40
+ .wf_results_table tr.data_row:hover {background-color: #eee;}
41
+
42
+ .wf_results_table .sort_title {float:left;}
43
+ .wf_results_table .table_head_container {position:relative;padding-right:20px;}
44
+
45
+ .wf_results_table .edit_location th,
46
+ .wf_results_table .edit_location td {background:none;padding:1px 2px;border:none;font-size:11px;}
47
+ .wf_results_table .edit_location_link {font-size:11px;}
48
+
49
+ .wf_results_table .sort_control {position:absolute;right:21px;margin:-5px -20px -5px 5px;display:none;height:24px;}
50
+ .wf_results_table .sort_control .up {width:17px;height:11px;display:block;background: url(/assets/will_filter/sort_arrow_all.gif) 0 0 no-repeat;}
51
+ .wf_results_table .sort_control .up:hover {width:17px;height:11px;display:block;background: url(/assets/will_filter/sort_arrow_all.gif) -17px 0 no-repeat;}
52
+ .wf_results_table .sort_control .down {width:17px;height:11px;display:block;background: url(/assets/will_filter/sort_arrow_all.gif) 0 -13px no-repeat;}
53
+ .wf_results_table .sort_control .down:hover {width:17px;height:11px;display:block;background: url(/assets/will_filter/sort_arrow_all.gif) -17px -13px no-repeat;}
54
+
55
+ .wf_results_table th .sort_control .up,
56
+ .wf_results_table th .sort_control .down {_height:12px !important;overflow:hidden;}
57
+
58
+ .wf_results_table {width:100%;margin:0}
59
+ .wf_results_table.short {margin-bottom:200px;}
60
+
61
+ .wf_results_table thead th {padding:5px 5px 5px 10px;text-align:left;font-size:12px;border-bottom:solid 1px #ccc;border-top:solid 1px #eee;background-color:#f5f5f5;white-space:nowrap;}
62
+ .wf_results_table th.active {background:url(/assets/will_filter/results_table_th_active.gif) repeat-x;color:#fff;border-left:solid 1px #ccc;border-right:solid 1px #ccc}
63
+ .wf_results_table th.active a {color:#fff;}
@@ -1,5 +1,5 @@
1
1
  #--
2
- # Copyright (c) 2011 Michael Berkovich
2
+ # Copyright (c) 2010-2011 Michael Berkovich
3
3
  #
4
4
  # Permission is hereby granted, free of charge, to any person obtaining
5
5
  # a copy of this software and associated documentation files (the
@@ -21,7 +21,7 @@
21
21
  # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
22
  #++
23
23
 
24
- class ApplicationController < ActionController::Base
25
- # protect_from_forgery
26
-
24
+ module WillFilter
25
+ class ApplicationController < ActionController::Base
26
+ end
27
27
  end
@@ -1,5 +1,5 @@
1
1
  #--
2
- # Copyright (c) 2011 Michael Berkovich
2
+ # Copyright (c) 2010-2011 Michael Berkovich
3
3
  #
4
4
  # Permission is hereby granted, free of charge, to any person obtaining
5
5
  # a copy of this software and associated documentation files (the
@@ -1,5 +1,5 @@
1
1
  #--
2
- # Copyright (c) 2011 Michael Berkovich
2
+ # Copyright (c) 2010-2011 Michael Berkovich
3
3
  #
4
4
  # Permission is hereby granted, free of charge, to any person obtaining
5
5
  # a copy of this software and associated documentation files (the
@@ -1,5 +1,5 @@
1
1
  #--
2
- # Copyright (c) 2011 Michael Berkovich
2
+ # Copyright (c) 2010-2011 Michael Berkovich
3
3
  #
4
4
  # Permission is hereby granted, free of charge, to any person obtaining
5
5
  # a copy of this software and associated documentation files (the
@@ -64,8 +64,6 @@ module WillFilter
64
64
  end
65
65
 
66
66
  def save_filter
67
- raise WillFilter::FilterException.new("Saving functions are disabled") unless WillFilter::Config.saving_enabled?
68
-
69
67
  params.delete(:wf_id)
70
68
 
71
69
  wf_filter = WillFilter::Filter.deserialize_from_params(params)
@@ -81,8 +79,6 @@ module WillFilter
81
79
  end
82
80
 
83
81
  def update_filter
84
- raise WillFilter::FilterException.new("Saving functions are disabled") unless WillFilter::Config.saving_enabled?
85
-
86
82
  wf_filter = WillFilter::Filter.find_by_id(params.delete(:wf_id))
87
83
  wf_filter.deserialize_from_params(params)
88
84
  wf_filter.validate!
@@ -97,8 +93,6 @@ module WillFilter
97
93
  end
98
94
 
99
95
  def delete_filter
100
- raise WillFilter::FilterException.new("Saving functions are disabled") unless WillFilter::Config.saving_enabled?
101
-
102
96
  wf_filter = WillFilter::Filter.find_by_id(params[:wf_id])
103
97
  wf_filter.destroy if wf_filter
104
98
 
@@ -1,5 +1,5 @@
1
1
  #--
2
- # Copyright (c) 2011 Michael Berkovich
2
+ # Copyright (c) 2010-2011 Michael Berkovich
3
3
  #
4
4
  # Permission is hereby granted, free of charge, to any person obtaining
5
5
  # a copy of this software and associated documentation files (the
@@ -23,7 +23,7 @@
23
23
 
24
24
  module WillFilter
25
25
  class Filter < ActiveRecord::Base
26
- set_table_name :wf_filters
26
+ set_table_name :will_filter_filters
27
27
  serialize :data
28
28
  before_save :prepare_save
29
29
  after_find :process_find
@@ -31,13 +31,8 @@ module WillFilter
31
31
  #############################################################################
32
32
  # Basics
33
33
  #############################################################################
34
- def initialize(model_class = nil)
34
+ def initialize(model_class)
35
35
  super()
36
-
37
- if WillFilter::Config.require_filter_extensions? and self.class.name == "WillFilter::Filter"
38
- raise WillFilter::FilterException.new("Your configuration requires you to subclass the filter. Default filter cannot be created.")
39
- end
40
-
41
36
  self.model_class_name = model_class.to_s
42
37
  end
43
38
 
@@ -94,16 +89,8 @@ module WillFilter
94
89
  []
95
90
  end
96
91
 
97
- # For extra security, this method must be overloaded by the extending class.
98
92
  def model_class
99
- if WillFilter::Config.require_filter_extensions?
100
- raise WillFilter::FilterException.new("model_class method must be overloaded in the extending class.")
101
- end
102
-
103
- if model_class_name.blank?
104
- raise WillFilter::FilterException.new("model_class_name was not specified.")
105
- end
106
-
93
+ return nil unless model_class_name
107
94
  @model_class ||= model_class_name.constantize
108
95
  end
109
96
 
@@ -201,8 +188,6 @@ module WillFilter
201
188
 
202
189
  def order
203
190
  @order ||= default_order
204
- @order = default_order unless contains_column?(@order.to_sym)
205
- @order
206
191
  end
207
192
 
208
193
  def default_order_type
@@ -211,8 +196,6 @@ module WillFilter
211
196
 
212
197
  def order_type
213
198
  @order_type ||= default_order_type
214
- @order_type = default_order_type unless ['asc', 'desc'].include?(@order_type.to_s)
215
- @order_type
216
199
  end
217
200
 
218
201
  def order_clause
@@ -397,30 +380,15 @@ module WillFilter
397
380
  def self.deserialize_from_params(params)
398
381
  params = HashWithIndifferentAccess.new(params) unless params.is_a?(HashWithIndifferentAccess)
399
382
  params[:wf_type] = self.name unless params[:wf_type]
400
- filter_class = params[:wf_type].constantize
401
- filter_instance = filter_class.new
402
-
403
- unless filter_instance.kind_of?(WillFilter::Filter)
404
- raise WillFilter::FilterException.new("Invalid filter class. Filter classes must extand WillFilter::Filter.")
405
- end
406
-
407
- if WillFilter::Config.require_filter_extensions?
408
- filter_instance.deserialize_from_params(params)
409
- else
410
- filter_class.new(params[:wf_model]).deserialize_from_params(params)
411
- end
383
+ params[:wf_type].constantize.new(params[:wf_model]).deserialize_from_params(params)
412
384
  end
413
385
 
414
386
  def deserialize_from_params(params)
415
387
  params = HashWithIndifferentAccess.new(params) unless params.is_a?(HashWithIndifferentAccess)
416
-
417
- # Validate sanity of user provided parameters
418
- params.delete(:wf_order_type) unless [ 'asc', 'desc' ].include? params[:wf_order_type]
419
- params.delete(:wf_order) unless self.class.columns.map(&:name).include? params[:wf_order]
420
-
421
388
  @conditions = []
422
389
  @match = params[:wf_match] || :all
423
390
  @key = params[:wf_key] || self.id.to_s
391
+ self.model_class_name = params[:wf_model] if params[:wf_model]
424
392
 
425
393
  @per_page = params[:wf_per_page] || default_per_page
426
394
  @page = params[:page] || 1
@@ -699,6 +667,7 @@ module WillFilter
699
667
  ""
700
668
  end
701
669
 
670
+ # deprecated for Rails 3.0 and up
702
671
  def joins
703
672
  return nil if inner_joins.empty?
704
673
  inner_joins.collect do |inner_join|
@@ -711,8 +680,11 @@ module WillFilter
711
680
  def results
712
681
  @results ||= begin
713
682
  handle_empty_filter!
714
-
715
- recs = model_class.paginate(:order => order_clause, :page => page, :per_page => per_page, :conditions => sql_conditions, :joins => joins)
683
+ recs = model_class.where(sql_conditions).order(order_clause)
684
+ inner_joins.each do |j|
685
+ recs = recs.joins(j.first)
686
+ end
687
+ recs = recs.page(page).per(per_page)
716
688
  recs.wf_filter = self
717
689
  recs
718
690
  end