will_filter 3.0.0

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 (110) hide show
  1. data/.loadpath +12 -0
  2. data/.project +18 -0
  3. data/CHANGELOG.rdoc +1 -0
  4. data/Gemfile +32 -0
  5. data/Gemfile.lock +73 -0
  6. data/LICENSE +18 -0
  7. data/README.rdoc +74 -0
  8. data/Rakefile +54 -0
  9. data/VERSION +1 -0
  10. data/app/controllers/application_controller.rb +27 -0
  11. data/app/controllers/will_filter/calendar_controller.rb +31 -0
  12. data/app/controllers/will_filter/exporter_controller.rb +122 -0
  13. data/app/controllers/will_filter/filter_controller.rb +107 -0
  14. data/app/helpers/application_helper.rb +26 -0
  15. data/app/models/will_filter/filter.rb +694 -0
  16. data/app/views/layouts/application.html.erb +11 -0
  17. data/app/views/will_filter/calendar/_annual.html.erb +14 -0
  18. data/app/views/will_filter/calendar/_month.html.erb +39 -0
  19. data/app/views/will_filter/calendar/_quarter.html.erb +15 -0
  20. data/app/views/will_filter/calendar/index.html.erb +52 -0
  21. data/app/views/will_filter/common/_actions_bar.html.erb +5 -0
  22. data/app/views/will_filter/common/_results_table.html.erb +129 -0
  23. data/app/views/will_filter/common/_scripts.html.erb +10 -0
  24. data/app/views/will_filter/exporter/export.html.erb +11 -0
  25. data/app/views/will_filter/exporter/index.html.erb +47 -0
  26. data/app/views/will_filter/filter/_condition.html.erb +30 -0
  27. data/app/views/will_filter/filter/_conditions.html.erb +56 -0
  28. data/app/views/will_filter/filter/_container.html.erb +31 -0
  29. data/app/views/will_filter/filter/containers/_blank.html.erb +1 -0
  30. data/app/views/will_filter/filter/containers/_boolean.html.erb +5 -0
  31. data/app/views/will_filter/filter/containers/_date.html.erb +12 -0
  32. data/app/views/will_filter/filter/containers/_date_range.html.erb +20 -0
  33. data/app/views/will_filter/filter/containers/_date_time.html.erb +12 -0
  34. data/app/views/will_filter/filter/containers/_date_time_range.html.erb +20 -0
  35. data/app/views/will_filter/filter/containers/_list.html.erb +7 -0
  36. data/app/views/will_filter/filter/containers/_numeric_range.html.erb +13 -0
  37. data/app/views/will_filter/filter/containers/_text.html.erb +7 -0
  38. data/app/views/will_filter/filter/index.html.erb +4 -0
  39. data/config/application.rb +45 -0
  40. data/config/boot.rb +6 -0
  41. data/config/database.yml +22 -0
  42. data/config/environment.rb +13 -0
  43. data/config/environments/development.rb +26 -0
  44. data/config/environments/production.rb +49 -0
  45. data/config/environments/test.rb +38 -0
  46. data/config/routes.rb +64 -0
  47. data/config/will_filter/config.yml +97 -0
  48. data/config.ru +4 -0
  49. data/db/development.sqlite3 +0 -0
  50. data/db/migrate/20090730070119_create_will_filter_tables.rb +19 -0
  51. data/db/seeds.rb +7 -0
  52. data/db/test.sqlite3 +0 -0
  53. data/doc/README_FOR_APP +2 -0
  54. data/examples/README +1 -0
  55. data/lib/application_helper.rb +45 -0
  56. data/lib/core_ext/active_record/base.rb +44 -0
  57. data/lib/core_ext/array.rb +34 -0
  58. data/lib/core_ext/object.rb +34 -0
  59. data/lib/generators/will_filter/templates/config.yml +97 -0
  60. data/lib/generators/will_filter/templates/create_will_filter_tables.rb +19 -0
  61. data/lib/generators/will_filter/will_filter_generator.rb +24 -0
  62. data/lib/tasks/.gitkeep +0 -0
  63. data/lib/tasks/will_filter_tasks.rake +32 -0
  64. data/lib/will_filter/calendar.rb +168 -0
  65. data/lib/will_filter/common_methods.rb +49 -0
  66. data/lib/will_filter/config.rb +104 -0
  67. data/lib/will_filter/containers/boolean.rb +43 -0
  68. data/lib/will_filter/containers/date.rb +51 -0
  69. data/lib/will_filter/containers/date_range.rb +56 -0
  70. data/lib/will_filter/containers/date_time.rb +50 -0
  71. data/lib/will_filter/containers/date_time_range.rb +64 -0
  72. data/lib/will_filter/containers/filter_list.rb +59 -0
  73. data/lib/will_filter/containers/list.rb +56 -0
  74. data/lib/will_filter/containers/nil.rb +45 -0
  75. data/lib/will_filter/containers/numeric.rb +52 -0
  76. data/lib/will_filter/containers/numeric_delimited.rb +50 -0
  77. data/lib/will_filter/containers/numeric_range.rb +60 -0
  78. data/lib/will_filter/containers/single_date.rb +57 -0
  79. data/lib/will_filter/containers/text.rb +45 -0
  80. data/lib/will_filter/containers/text_delimited.rb +51 -0
  81. data/lib/will_filter/engine.rb +11 -0
  82. data/lib/will_filter/filter_condition.rb +59 -0
  83. data/lib/will_filter/filter_container.rb +73 -0
  84. data/lib/will_filter/filter_exception.rb +27 -0
  85. data/lib/will_filter.rb +15 -0
  86. data/pkg/will_filter-0.1.0.gem +0 -0
  87. data/pkg/will_filter-0.1.1.gem +0 -0
  88. data/public/404.html +26 -0
  89. data/public/422.html +26 -0
  90. data/public/500.html +26 -0
  91. data/public/favicon.ico +0 -0
  92. data/public/robots.txt +5 -0
  93. data/public/will_filter/images/buttons.png +0 -0
  94. data/public/will_filter/images/calendar.png +0 -0
  95. data/public/will_filter/images/clock.png +0 -0
  96. data/public/will_filter/images/close.gif +0 -0
  97. data/public/will_filter/images/results_table_th_active.gif +0 -0
  98. data/public/will_filter/images/sort_arrow_all.gif +0 -0
  99. data/public/will_filter/images/sort_bg.gif +0 -0
  100. data/public/will_filter/images/spinner.gif +0 -0
  101. data/public/will_filter/javascripts/will_filter.js +568 -0
  102. data/public/will_filter/javascripts/will_filter_prototype_effects.js +15 -0
  103. data/public/will_filter/stylesheets/will_filter.css +168 -0
  104. data/script/rails +6 -0
  105. data/test/functional/models/will_filter/filter_test.rb +297 -0
  106. data/test/performance/browsing_test.rb +9 -0
  107. data/test/test_helper.rb +71 -0
  108. data/uninstall.rb +24 -0
  109. data/will_filter.gemspec +7 -0
  110. metadata +208 -0
@@ -0,0 +1,39 @@
1
+ <table class="wf_calendar_cells" cellpadding="0" cellspacing="0" style="border:1px black #ccc;">
2
+ <tr>
3
+ <% WillFilter::Calendar.days.each_with_index do |day, index| %>
4
+ <td style="text-align:center;color:grey;font-size:10px;font-weight:bold;">
5
+ <%= day %>
6
+ </td>
7
+ <% end %>
8
+ </tr>
9
+ <tr>
10
+ <% index = 0 %>
11
+ <% current_date = calendar.start_date %>
12
+
13
+ <% while current_date <= calendar.end_date do %>
14
+ <% if current_date.wday == 0 %>
15
+ </tr><tr>
16
+ <% end %>
17
+
18
+ <% 0.upto(6) do |i| %>
19
+ <td style="text-align:center; vertical-align: middle;">
20
+ <% if current_date.wday == i and current_date <= calendar.end_date
21
+ today = (current_date==Date.today) ? "today" : ""
22
+ selected = (current_date == calendar.selected_date.to_date and current_date!=Date.today) ? "selected" : ""
23
+ selected = "" # for now
24
+
25
+ set_date = calendar.show_time? ? "" : "wfCalendar.setDate();"
26
+ %>
27
+ <center>
28
+ <div id="wf_calendar_cell_<%=current_date.year%>_<%=current_date.month%>_<%=current_date.day%>" class="wf_calendar_date_cell <%=today%> <%=selected%>" onClick="wfCalendar.selectDateValue(this, '<%=current_date%>'); <%=set_date%>">
29
+ <%=current_date.day %>
30
+ </div>
31
+ </center>
32
+ <% current_date += 1.day %>
33
+ <% index += 1 %>
34
+ <% end %>
35
+ </td>
36
+ <% end %>
37
+ <% end %>
38
+ </tr>
39
+ </table>
@@ -0,0 +1,15 @@
1
+ <table class="wf_calendar_table" cellpadding="0" cellspacing="0">
2
+ <tr>
3
+ <% 0.upto(3) do |m| %>
4
+ <% if m % 2 == 0 %>
5
+ </tr><tr>
6
+ <% end %>
7
+
8
+ <td valign="top">
9
+ <% next_cal = calendar.move(m.months) %>
10
+ <div class="wf_calendar_title"><%=next_cal.title %></div>
11
+ <%= render :partial => "month", :locals => {:calendar => next_cal} %>
12
+ </td>
13
+ <% end %>
14
+ </tr>
15
+ </table>
@@ -0,0 +1,52 @@
1
+ <div style="font-size:12px;font-weight:bold;">
2
+ <div style="float:right; padding-right:2px;">
3
+ <% if @calendar.mode == 'month' %>
4
+ <%=link_to_function("&laquo; expand".html_safe, "wfCalendar.changeMode('quarter', #{@calendar.show_time?})", :style => "font-size:10px; padding-bottom: 3px")%> &nbsp;
5
+ <% elsif @calendar.mode == 'quarter' %>
6
+ <%=link_to_function("&laquo; expand".html_safe, "wfCalendar.changeMode('annual', #{@calendar.show_time?})", :style => "font-size:10px; padding-bottom: 3px")%> &nbsp;
7
+ <% end %>
8
+
9
+ <%=link_to_function(image_tag("/wf/images/close.gif", :title=>"Close"), "wfCalendar.hide()")%>
10
+ </div>
11
+
12
+ Calendar
13
+ </div>
14
+ <div class="wf_calendar_container">
15
+ <% form_tag({:controller => "/will_filter/calendar"}, {:method => :get, :id => "wf_calendar_form"}) do %>
16
+ <%= hidden_field_tag :wf_calendar_start_date, @calendar.start_date.strftime("%Y/%m/%d") %>
17
+ <%= hidden_field_tag :wf_calendar_selected_date, @calendar.selected_date.strftime("%Y/%m/%d") %>
18
+ <%= hidden_field_tag :wf_calendar_mode, @calendar.mode %>
19
+ <%= hidden_field_tag :wf_calendar_show_time, @calendar.show_time? %>
20
+
21
+ <div style="padding:5px;text-align:center; margin-bottom:5px; border-bottom: 1px solid #ccc;">
22
+ &nbsp;
23
+ <%=link_to_function("&laquo;".html_safe, "wfCalendar.goToStartDate('#{@calendar.previous_start_date}')", :style=>"font-size:16px;")%>
24
+ &nbsp;&nbsp;&nbsp;
25
+ <% if @calendar.mode != 'annual' %>
26
+ <%= select_tag("month", options_for_select(WillFilter::Calendar.month_options, @calendar.month), {:id => "wf_calendar_month", :onChange=>"wfCalendar.goToStartDate('')"}) %>
27
+ <% end %>
28
+ <%= select_tag("year", options_for_select(WillFilter::Calendar.year_options, @calendar.year), {:id => "wf_calendar_year",:onChange=>"wfCalendar.goToStartDate('')"}) %>
29
+ &nbsp;&nbsp;&nbsp;
30
+ <%=link_to_function("&raquo".html_safe, "wfCalendar.goToStartDate('#{@calendar.next_start_date}')", :style=>"font-size:16px;")%>
31
+ &nbsp;
32
+ </div>
33
+
34
+ <%= render :partial => @calendar.mode, :locals => {:calendar => @calendar} %>
35
+
36
+ <% if @calendar.show_time? %>
37
+ <div style="text-align:center; margin-top:10px; padding:5px; border-top:1px solid #ccc;">
38
+ <div style="margin:5px;">
39
+ Time: &nbsp;
40
+ <%= select_tag("wf_calendar_hour", options_for_select(WillFilter::Calendar.hour_options, @calendar.hour)) %>
41
+ :
42
+ <%= select_tag("wf_calendar_minute", options_for_select(WillFilter::Calendar.minute_options, @calendar.minute)) %>
43
+ :
44
+ <%= select_tag("wf_calendar_second", options_for_select(WillFilter::Calendar.second_options, @calendar.second)) %>
45
+ </div>
46
+ <%=link_to_function("<span>Set Date and Time</span>".html_safe, "wfCalendar.setDateTime()", :class => "wf_grey_button wf_pcb") %>
47
+ <%=link_to_function("<span>Cancel</span>".html_safe, "wfCalendar.hide()", :class => "wf_grey_button wf_pcb") %>
48
+ </div>
49
+ <% end %>
50
+
51
+ <% end %>
52
+ </div>
@@ -0,0 +1,5 @@
1
+ <div class="<%=opts[:class]%>" style="<%=opts[:style]%>">
2
+ <% actions.each do |action| %>
3
+ <%=link_to_function("<span>#{action.first}</span>".html_safe, "#{action.last}", :class => "wf_grey_button wf_pcb") %>
4
+ <% end %>
5
+ </div>
@@ -0,0 +1,129 @@
1
+ <table class='wf_paginator' style="margin-top:10px; margin-bottom:10px;">
2
+ <tr>
3
+ <td style='text-align:left'>
4
+ <%= will_paginate(results) %>
5
+ </td>
6
+ <td style='text-align:right'>
7
+ <%= page_entries_info(results) %>
8
+ </td>
9
+ </tr>
10
+ </table>
11
+
12
+ <table class='wf_results_table'>
13
+ <thead>
14
+ <tr>
15
+ <%
16
+ opts[:columns].each_with_index do |column, index|
17
+ if column.is_a?(Array)
18
+ key = column.first
19
+ elsif column.is_a?(Hash)
20
+ key = column[:key] || "key_#{index}"
21
+ else
22
+ key = column
23
+ end
24
+
25
+ style = ""
26
+ sort_direction = filter.column_sorted?(key) ? filter.order_type : "asc"
27
+ sort_direction_click = filter.column_sorted?(key) ? (sort_direction == "asc" ? "desc" : "asc") : "asc"
28
+ column_title = filter.condition_title_for(key)
29
+ the_class_name = key.to_s
30
+ the_class_name << " sortable" if filter.contains_column?(key)
31
+ the_class_name << " current_sort" if filter.column_sorted?(key)
32
+ the_class_name << " #{sort_direction}"
33
+
34
+ style << "width:15px" if key == :checkbox
35
+ %>
36
+ <th class="<%= the_class_name %>" style="<%=style%>">
37
+ <div class="table_head_container">
38
+ <% if filter.contains_column?(key) %>
39
+ <div class="sort_control">
40
+ <%= link_to "", filter.serialize_to_params(:wf_order => key, :wf_order_type => 'asc'), :title => "sort by #{key} ascending", :class => 'up' %>
41
+ <%= link_to "", filter.serialize_to_params(:wf_order => key, :wf_order_type => 'desc'), :title => "sort by #{key} descending", :class => 'down' %>
42
+ </div>
43
+
44
+ <%= link_to column_title, filter.serialize_to_params(:wf_order => key, :wf_order_type => sort_direction_click), :class => "sort_link" %>
45
+ <% elsif key == :checkbox %>
46
+ <%= check_box_tag("wf_check_all", "", false, :onClick => "wfCheckAll(this)") %>
47
+ <% else %>
48
+ <%= column_title %>
49
+ <% end %>
50
+ </div>
51
+ </th>
52
+ <% end %>
53
+ </tr>
54
+ </thead>
55
+
56
+ <tbody>
57
+ <% results.each_with_index do |obj, index| %>
58
+ <tr class='data_row <%=(index % 2 == 0) ? "wf_row_even" : "wf_row_odd"%>'>
59
+ <% opts[:columns].each_with_index do |column, column_index| %>
60
+ <%
61
+ style = 'padding:3px;'
62
+ if column.is_a?(Array)
63
+ key = column.first
64
+ if column.second.is_a?(Proc)
65
+ value = column.second.call(obj)
66
+ else
67
+ value = column.second.to_s
68
+ end
69
+ style << column.last if column.size > 2
70
+
71
+ elsif column.is_a?(Hash)
72
+ key = column[:key] || "key_#{column_index}"
73
+ if column[:value]
74
+ value = column[:value]
75
+ value = value.call(obj) if value.is_a?(Proc)
76
+ else
77
+ value = obj.send(key)
78
+ end
79
+ style << column[:style] if column[:style]
80
+
81
+ else
82
+ key = column
83
+ value = obj.send(key)
84
+ end
85
+
86
+ style << "padding-left:10px;" if key == :checkbox
87
+ %>
88
+ <td style='<%=style%>' <%= " class='current_sort'" if filter.column_sorted?(key) %>>
89
+ <% if key == :checkbox %>
90
+ <%= check_box_tag("#{value}[]", obj.id, false, :id => "wf_check_#{index}", :onClick => "wfVerifyTrigger(this)") %>
91
+
92
+ <% elsif value.is_a?(Hash) %>
93
+ <% value.each do |key, value| %>
94
+ <strong><%=key%>:</strong> <%= value %>;
95
+ <% end %>
96
+
97
+ <% elsif value.is_a?(Time) %>
98
+ <%= value.strftime("%m/%d/%Y %l:%M:%S") %>
99
+
100
+ <% elsif value.is_a?(Date) %>
101
+ <%= value.strftime("%m/%d/%Y") %>
102
+
103
+ <% else %>
104
+ <%= value.to_s %>
105
+ <% end %>
106
+ </td>
107
+ <% end %>
108
+ </tr>
109
+ <% end %>
110
+ </tbody>
111
+ </table>
112
+
113
+ <script>
114
+ function wfVerifyTrigger(check) {
115
+ if (!check.checked) {
116
+ var check_all = document.getElementById("wf_check_all");
117
+ check_all.checked = false;
118
+ }
119
+ }
120
+
121
+ function wfCheckAll(trigger) {
122
+ var index = 0;
123
+ var check = document.getElementById("wf_check_" + index);
124
+ while (check) {
125
+ check.checked = trigger.checked;
126
+ check = document.getElementById("wf_check_" + (++index));
127
+ }
128
+ }
129
+ </script>
@@ -0,0 +1,10 @@
1
+ <%= stylesheet_link_tag("/will_filter/stylesheets/will_filter.css") -%>
2
+ <%= javascript_include_tag("/will_filter/javascripts/will_filter.js") -%>
3
+
4
+ <% if WillFilter::Config.effects_options[:enabled] %>
5
+ <%= javascript_include_tag(WillFilter::Config.effects_options[:script_path]) -%>
6
+ <% end %>
7
+
8
+ <script>
9
+ initializeWillFilter();
10
+ </script>
@@ -0,0 +1,11 @@
1
+ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2
+ <html>
3
+ <head>
4
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
5
+ <title>Filter Export Data Table</title>
6
+ <%=will_filter_scripts_tag %>
7
+ </head>
8
+ <body>
9
+ <%= will_filter_table_tag(@wf_filter.results, :columns => @wf_filter.fields) %>
10
+ </body>
11
+ </html>
@@ -0,0 +1,47 @@
1
+ <div style="font-size:12px;font-weight:bold;">
2
+ <div style="float:right; padding-right:2px;">
3
+ <%=link_to_function(image_tag("/will_filter/images/close.gif", :title=>"Close"), "wfExporter.hide()")%>
4
+ </div>
5
+
6
+ Exporter
7
+ </div>
8
+ <div class="wf_exporter_container">
9
+ <table style="width:100%" cellpadding="0px" cellspacing="0px;">
10
+ <tr>
11
+ <td>
12
+ <input type="checkbox" id="wf_fld_all" onClick="wfExporter.selectAllFields(this);" style="width:20px;">
13
+ </td>
14
+ <td>
15
+ <b>Name</b>
16
+ </td>
17
+ <td>
18
+ <b>Type</b>
19
+ </td>
20
+ </tr>
21
+ <tr>
22
+ <td colspan="3">
23
+ <hr style="width:100%">
24
+ </td>
25
+ </tr><% @wf_filter.model_class.columns.each_with_index do |col, index| %>
26
+ <tr>
27
+ <td>
28
+ <input type="checkbox" id="wf_fld_chk_<%=index%>" onClick="wfExporter.selectField(this);" style="width:20px;"><input type="hidden" id="wf_fld_name_<%=index%>" value="<%=col.name%>">
29
+ </td>
30
+ <td>
31
+ <%=col.name %>
32
+ </td>
33
+ <td>
34
+ <%=col.type %>
35
+ </td>
36
+ </tr>
37
+ <% end %>
38
+ </table>
39
+ <hr>
40
+ <div style="text-align:center; width:100%; padding:3px;">
41
+ Format: <%= select_tag("wf_export_format_selector", options_for_select(@wf_filter.export_formats, @wf_filter.format)) %>
42
+ </div>
43
+ <div style="text-align:center; width:100%; padding:3px;">
44
+ <%=link_to_function("<span>Export</span>".html_safe, "wfExporter.exportFilter()", :class => "wf_grey_button wf_pcb") %>
45
+ <%=link_to_function("<span>Cancel</span>".html_safe, "wfExporter.hide()", :class => "wf_grey_button wf_pcb") %>
46
+ </div>
47
+ </div>
@@ -0,0 +1,30 @@
1
+ <% if wf_filter.errors[index] %>
2
+ <tr>
3
+ <td colspan="2">
4
+ </td>
5
+ <td>
6
+ <div class="wf_condition_error">
7
+ <%= wf_filter.errors[index] %>
8
+ </div>
9
+ </td>
10
+ <td>
11
+ </td>
12
+ </tr>
13
+ <% end %>
14
+
15
+ <tr>
16
+ <td class="wf_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}')"} %>
18
+ </td>
19
+ <td class="wf_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}')"} %>
21
+ </td>
22
+ <td class="wf_values" style="padding:2px;">
23
+ <%= render :partial => "/will_filter/filter/containers/#{condition.container.template_name}", :locals => {:container => condition.container, :index => index} %>
24
+ </td>
25
+ <td class="wf_condition_actions" style="padding:0px;">
26
+ <%=link_to_function("<span>-</span>".html_safe, "wfFilter.removeConditionAt('#{index}')", :class => "wf_grey_button wf_pcb") %>
27
+ <%=link_to_function("<span>+</span>".html_safe, "wfFilter.addConditionAfter('#{index}')", :class => "wf_grey_button wf_pcb") %>
28
+ </td>
29
+ </tr>
30
+
@@ -0,0 +1,56 @@
1
+ <%= hidden_field_tag(:wf_id, wf_filter.id) %>
2
+ <%= hidden_field_tag(:wf_type, wf_filter.class.name) %>
3
+ <%= hidden_field_tag(:wf_dirty, "false") %>
4
+ <%= hidden_field_tag(:wf_submitted, "false") %>
5
+ <%= hidden_field_tag(:wf_name, wf_filter.name) %>
6
+ <%= hidden_field_tag(:wf_model, wf_filter.model_class_name) %>
7
+ <%= hidden_field_tag(:wf_export_format, "") %>
8
+ <%= hidden_field_tag(:wf_export_fields, "") %>
9
+
10
+ <div class="wf_header">
11
+ <% if wf_filter.show_save_options? %>
12
+ <div style="float:right;">
13
+ <%=link_to_function("<span>Save As New...</span>".html_safe, "wfFilter.saveFilter()", :class => "wf_grey_button wf_pcb") %>
14
+ <%=link_to_function("<span>Update</span>".html_safe, "wfFilter.updateFilter()", :class => "wf_grey_button wf_pcb") %>
15
+ <%=link_to_function("<span>Delete</span>".html_safe, "wfFilter.deleteFilter()", :class => "wf_grey_button wf_pcb") %>
16
+ <% if wf_filter.show_export_options? %>
17
+ <%=link_to_function("<span>Export Data...</span>".html_safe, "wfExporter.show(this)", :class => "wf_grey_button wf_pcb") %>
18
+ <% end %>
19
+ </div>
20
+ <% end %>
21
+ <div style="font-weight:bold; font-size:18px;">
22
+ <% unless wf_filter.saved_filters.empty? %>
23
+ <%= select_tag(:wf_key, options_for_select(wf_filter.saved_filters, wf_filter.key), {:onChange=>"wfFilter.loadSavedFilter()"}) %>
24
+ <% end %>
25
+ </div>
26
+ </div>
27
+
28
+ <div class="wf_container_panel">
29
+ <% if wf_filter.errors[:filter] %>
30
+ <div class="wf_filter_error">
31
+ <%= wf_filter.errors[:filter] %>
32
+ </div>
33
+ <% end %>
34
+
35
+ <div style="padding:5px">
36
+ Match <%= select_tag(:wf_match, options_for_select(wf_filter.match_options, wf_filter.match), {:onChange=>"wfFilter.markDirty()"}) %>
37
+ of the following conditions:
38
+ </div>
39
+
40
+ <% if wf_filter.size == 0 %>
41
+ <div style="font-style:italic; padding:5px; color: black">
42
+ You haven't added any filter conditions, so all of the results were returned.
43
+ Use the "Add" button in the bottom left corner to add a new condition or select
44
+ a predefined filter from a drop-down list above.
45
+ </div>
46
+ <% else %>
47
+ <table class="wf_conditions_table" cellpadding="0" cellspacing="0">
48
+ <%
49
+ 0.upto(wf_filter.size-1) do |index|
50
+ condition = wf_filter.condition_at(index)
51
+ %>
52
+ <%= render :partial => "/will_filter/filter/condition", :locals => {:wf_filter => wf_filter, :condition => condition, :index => index}%>
53
+ <% end %>
54
+ </table>
55
+ <% end %>
56
+ </div>
@@ -0,0 +1,31 @@
1
+ <%=will_filter_scripts_tag %>
2
+
3
+ <%= form_tag({}, {:method => :get, :name=>'wf_form', :id => 'wf_form', :class => 'wf_form' }) do %>
4
+ <div class="wf_container">
5
+ <div id="wf_filter_conditions" class="conditions">
6
+ <%= render :partial=> "/will_filter/filter/conditions", :locals => {:wf_filter => wf_filter} %>
7
+ </div>
8
+
9
+ <div class="wf_footer">
10
+ <div style="float:right">
11
+ <%=link_to_function("Toggle Conditions", "wfFilter.toggleDebugger()", :style=>"font-size:9px") %>
12
+ &nbsp;&nbsp;
13
+ Order:
14
+ <%= select_tag(:wf_order, options_for_select(wf_filter.condition_options, wf_filter.order), {:onChange=>"markDirty()"}) %>
15
+ <%= select_tag(:wf_order_type, options_for_select(wf_filter.order_type_options, wf_filter.order_type), {:onChange=>"markDirty()"}) %>
16
+ Per Page:
17
+ <%= select_tag(:wf_per_page, options_for_select(wf_filter.per_page_options, wf_filter.per_page.to_s), {:onChange=>"markDirty()"}) %>
18
+ &nbsp;&nbsp;<%=link_to_function("<span>Submit Filter</span>".html_safe, "wfFilter.submit()", :class => "wf_grey_button wf_pcb") %>
19
+ </div>
20
+ <div>
21
+ <%=link_to_function("<span>+ Add</span>".html_safe, "wfFilter.addCondition()", :class => "wf_grey_button wf_pcb") %>
22
+ <%=link_to_function("<span>- Clear</span>".html_safe, "wfFilter.removeAllConditions()", :class => "wf_grey_button wf_pcb") %>
23
+ &nbsp;&nbsp;<span id="wf_loader" class="spinner" style="display:none;"><%=image_tag "/will_filter/images/spinner.gif", {:style=>"vertical-align:middle"} %> Loading...</span>
24
+ </div>
25
+ </div>
26
+
27
+ <div id="wf_debugger" class="wf_debugger" style="display:none;">
28
+ <%= wf_filter.debug_sql_conditions %>
29
+ </div>
30
+ </div>
31
+ <% end %>
@@ -0,0 +1,5 @@
1
+ <div style='vertical-align:middle; text-align:left; padding-top:4px;'>
2
+ <input type='radio' style='width:20px' name='wf_v<%=index%>_0' id='wf_v<%=index%>_0' onChange='wfFilter.fieldChanged(this)' value='1' <%='checked' if container.value == '1' %>> True
3
+ &nbsp;&nbsp;
4
+ <input type='radio' style='width:20px' name='wf_v<%=index%>_0' id='wf_v<%=index%>_0' onChange='wfFilter.fieldChanged(this)' value='0' <%='checked' if container.value == '0' %>> False
5
+ </div>
@@ -0,0 +1,12 @@
1
+ <table class='wf_values_table' cellspacing='0px' cellpadding='0px'>
2
+ <tr>
3
+ <td width='99%'>
4
+ <input type='text' style='width:99%;' class='wf_input' name='wf_v<%=index%>_0' id='wf_v<%=index%>_0' onChange='wfFilter.fieldChanged(this)' value='<%=container.sanitized_value%>'>
5
+ </td>
6
+ <td width='1%'>
7
+ <a href="#" onclick="wfCalendar.selectDate('wf_v<%=index%>_0', this); return false;">
8
+ <img align="top" title="select date" border="0" class="wf_calendar_trigger" src="/will_filter/images/calendar.png" />
9
+ </a>
10
+ </td>
11
+ </tr>
12
+ </table>
@@ -0,0 +1,20 @@
1
+ <table class='wf_values_table' cellspacing='0px' cellpadding='0px'>
2
+ <tr>
3
+ <td width='49%'>
4
+ <input type='text' style='width:99%;' class='wf_input' name='wf_v<%=index%>_0' id='wf_v<%=index%>_0' onChange='wfFilter.fieldChanged(this)' value='<%=container.sanitized_value(0)%>'>
5
+ </td>
6
+ <td width='1%'>
7
+ <a href="#" onclick="wfCalendar.selectDate('wf_v<%=index%>_0', this); return false;">
8
+ <img align="top" title="select date" border="0" class="wf_calendar_trigger" src="/will_filter/images/calendar.png" />
9
+ </a>
10
+ </td>
11
+ <td width='49%'>
12
+ <input type='text' style='width:99%;' class='wf_input' name='wf_v<%=index%>_1' id='wf_v<%=index%>_1' onChange='wfFilter.fieldChanged(this)' value='<%=container.sanitized_value(1)%>'>
13
+ </td>
14
+ <td width='1%'>
15
+ <a href="#" onclick="wfCalendar.selectDate('wf_v<%=index%>_1', this); return false;">
16
+ <img align="top" title="select date" border="0" class="wf_calendar_trigger" src="/will_filter/images/calendar.png" />
17
+ </a>
18
+ </td>
19
+ </tr>
20
+ </table>
@@ -0,0 +1,12 @@
1
+ <table class='wf_values_table' cellspacing='0px' cellpadding='0px'>
2
+ <tr>
3
+ <td width='99%'>
4
+ <input type='text' style='width:99%;' class='wf_input' name='wf_v<%=index%>_0' id='wf_v<%=index%>_0' onChange='wfFilter.fieldChanged(this)' value='<%=container.sanitized_value%>'>
5
+ </td>
6
+ <td width='1%'>
7
+ <a href="#" onclick="wfCalendar.selectDateTime('wf_v<%=index%>_0', this); return false;">
8
+ <img align="top" title="select date & time" border="0" class="wf_calendar_trigger" src="/will_filter/images/clock.png" />
9
+ </a>
10
+ </td>
11
+ </tr>
12
+ </table>
@@ -0,0 +1,20 @@
1
+ <table class='wf_values_table' cellspacing='0px' cellpadding='0px'>
2
+ <tr>
3
+ <td width='49%'>
4
+ <input type='text' style='width:99%;' class='wf_input' name='wf_v<%=index%>_0' id='wf_v<%=index%>_0' onChange='wfFilter.fieldChanged(this)' value='<%=container.sanitized_value(0)%>'>
5
+ </td>
6
+ <td width='1%'>
7
+ <a href="#" onclick="wfCalendar.selectDateTime('wf_v<%=index%>_0', this); return false;">
8
+ <img align="top" title="select start date & time" border="0" class="wf_calendar_trigger" src="/will_filter/images/clock.png" />
9
+ </a>
10
+ </td>
11
+ <td width='49%'>
12
+ <input type='text' style='width:99%;' class='wf_input' name='wf_v<%=index%>_1' id='wf_v<%=index%>_1' onChange='wfFilter.fieldChanged(this)' value='<%=container.sanitized_value(1)%>'>
13
+ </td>
14
+ <td width='1%'>
15
+ <a href="#" onclick="wfCalendar.selectDateTime('wf_v<%=index%>_1', this); return false;">
16
+ <img align="top" title="select end date & time" border="0" class="wf_calendar_trigger" src="/will_filter/images/clock.png" />
17
+ </a>
18
+ </td>
19
+ </tr>
20
+ </table>
@@ -0,0 +1,7 @@
1
+ <select style='width:100%' class='wf_input' name='wf_v<%=index%>_0' id='wf_v<%=index%>_0' onChange='wfFilter.fieldChanged(this)'>
2
+ <% container.options.each do |option| %>
3
+ <option <%= "selected" if option.last == container.value %> value="<%=option.last%>">
4
+ <%=option.first%>
5
+ </option>
6
+ <% end %>
7
+ </select>
@@ -0,0 +1,13 @@
1
+ <table class='wf_values_table' cellspacing='0px' cellpadding='0px'>
2
+ <tr>
3
+ <td width='49%'>
4
+ <input type='text' style='width:99%;' class='wf_input' name='wf_v<%=index%>_0' id='wf_v<%=index%>_0' onChange='wfFilter.fieldChanged(this)' value='<%=container.sanitized_value(0)%>'>
5
+ </td>
6
+ <td width='2%'>
7
+ &nbsp;
8
+ </td>
9
+ <td width='49%'>
10
+ <input type='text' style='width:99%;' class='wf_input' name='wf_v<%=index%>_1' id='wf_v<%=index%>_1' onChange='wfFilter.fieldChanged(this)' value='<%=container.sanitized_value(1)%>'>
11
+ </td>
12
+ </tr>
13
+ </table>
@@ -0,0 +1,7 @@
1
+ <table class='wf_values_table' cellspacing='0px' cellpadding='0px'>
2
+ <tr>
3
+ <td width='99%'>
4
+ <input type='text' style='width:99%;' class='wf_input' name='wf_v<%=index%>_0' id='wf_v<%=index%>_0' onChange='wfFilter.fieldChanged(this)' value='<%=container.sanitized_value%>'>
5
+ </td>
6
+ </tr>
7
+ </table>
@@ -0,0 +1,4 @@
1
+ <div style="margin:5px;">
2
+ <%= will_filter(@filters) %>
3
+ <%= will_filter_table_tag(@filters) %>
4
+ </div>
@@ -0,0 +1,45 @@
1
+ require File.expand_path('../boot', __FILE__)
2
+
3
+ require 'rails/all'
4
+ require 'pp'
5
+
6
+ # If you have a Gemfile, require the gems listed there, including any gems
7
+ # you've limited to :test, :development, or :production.
8
+ Bundler.require(:default, Rails.env) if defined?(Bundler)
9
+
10
+ module WillFilter
11
+ class Application < Rails::Application
12
+ # Settings in config/environments/* take precedence over those specified here.
13
+ # Application configuration should go into files in config/initializers
14
+ # -- all .rb files in that directory are automatically loaded.
15
+
16
+ # Custom directories with classes and modules you want to be autoloadable.
17
+ # config.autoload_paths += %W(#{config.root}/extras)
18
+
19
+ # Only load the plugins named here, in the order given (default is alphabetical).
20
+ # :all can be used as a placeholder for all plugins not explicitly named.
21
+ # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
22
+
23
+ # Activate observers that should always be running.
24
+ # config.active_record.observers = :cacher, :garbage_collector, :forum_observer
25
+
26
+ # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
27
+ # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
28
+ # config.time_zone = 'Central Time (US & Canada)'
29
+
30
+ # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
31
+ # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
32
+ # config.i18n.default_locale = :de
33
+
34
+ # JavaScript files you want as :defaults (application.js is always included).
35
+ # config.action_view.javascript_expansions[:defaults] = %w(jquery rails)
36
+
37
+ # Configure the default encoding used in templates for Ruby 1.9.
38
+ config.encoding = "utf-8"
39
+
40
+ # Configure sensitive parameters which will be filtered from the log file.
41
+ config.filter_parameters += [:password]
42
+ config.session_store :active_record_store
43
+ config.secret_token = 'ba8e7d52f10084c758887c56815e894f32aef79496ecb2ed9ab9458a0bd37b33d6d2bace4a2c1cd828e4aaf347a5b23fe1c9c14ef11c7c9ad950207022902003'
44
+ end
45
+ end
data/config/boot.rb ADDED
@@ -0,0 +1,6 @@
1
+ require 'rubygems'
2
+
3
+ # Set up gems listed in the Gemfile.
4
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
5
+
6
+ require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
@@ -0,0 +1,22 @@
1
+ # SQLite version 3.x
2
+ # gem install sqlite3
3
+ development:
4
+ adapter: sqlite3
5
+ database: db/development.sqlite3
6
+ pool: 5
7
+ timeout: 5000
8
+
9
+ # Warning: The database defined as "test" will be erased and
10
+ # re-generated from your development database when you run "rake".
11
+ # Do not set this db to the same as development or production.
12
+ test:
13
+ adapter: sqlite3
14
+ database: db/test.sqlite3
15
+ pool: 5
16
+ timeout: 5000
17
+
18
+ production:
19
+ adapter: sqlite3
20
+ database: db/production.sqlite3
21
+ pool: 5
22
+ timeout: 5000