will_filter 3.1.11 → 5.1.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 (99) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +1 -0
  3. data/Gemfile +8 -3
  4. data/Gemfile.lock +182 -127
  5. data/README.rdoc +1 -10
  6. data/app/assets/images/will_filter/loading.gif +0 -0
  7. data/app/assets/javascripts/will_filter/filter.js +526 -517
  8. data/app/assets/stylesheets/will_filter/filter.css.scss +405 -108
  9. data/app/controllers/will_filter/calendar_controller.rb +10 -1
  10. data/app/controllers/will_filter/exporter_controller.rb +12 -3
  11. data/app/controllers/will_filter/filter_controller.rb +19 -10
  12. data/app/models/will_filter/filter.rb +254 -203
  13. data/app/views/will_filter/calendar/index.html.erb +55 -43
  14. data/app/views/will_filter/common/_actions_bar.html.erb +3 -3
  15. data/app/views/will_filter/common/_results_table.html.erb +55 -39
  16. data/app/views/will_filter/common/_scripts.html.erb +2 -12
  17. data/app/views/will_filter/exporter/index.html.erb +26 -22
  18. data/app/views/will_filter/filter/_condition.html.erb +25 -9
  19. data/app/views/will_filter/filter/_conditions.html.erb +12 -9
  20. data/app/views/will_filter/filter/_conditions_footer.html.erb +25 -10
  21. data/app/views/will_filter/filter/_conditions_header.html.erb +38 -24
  22. data/app/views/will_filter/filter/_container.html.erb +10 -9
  23. data/app/views/will_filter/filter/containers/_date.html.erb +8 -10
  24. data/app/views/will_filter/filter/containers/_date_range.html.erb +21 -13
  25. data/app/views/will_filter/filter/containers/_date_time.html.erb +8 -10
  26. data/app/views/will_filter/filter/containers/_date_time_range.html.erb +21 -13
  27. data/app/views/will_filter/filter/containers/_list.html.erb +16 -6
  28. data/config/routes.rb +26 -16
  29. data/deploy +63 -0
  30. data/lib/generators/will_filter/templates/config.yml +18 -5
  31. data/lib/generators/will_filter/templates/create_will_filter_filters.rb +12 -1
  32. data/lib/generators/will_filter/will_filter_generator.rb +10 -1
  33. data/lib/tasks/will_filter_tasks.rake +10 -2
  34. data/lib/will_filter.rb +10 -1
  35. data/lib/will_filter/calendar.rb +10 -1
  36. data/lib/will_filter/config.rb +31 -4
  37. data/lib/will_filter/containers/boolean.rb +10 -1
  38. data/lib/will_filter/containers/date.rb +10 -1
  39. data/lib/will_filter/containers/date_range.rb +10 -1
  40. data/lib/will_filter/containers/date_time.rb +10 -1
  41. data/lib/will_filter/containers/date_time_range.rb +10 -1
  42. data/lib/will_filter/containers/double.rb +10 -1
  43. data/lib/will_filter/containers/double_delimited.rb +10 -1
  44. data/lib/will_filter/containers/double_range.rb +10 -1
  45. data/lib/will_filter/containers/filter_list.rb +21 -7
  46. data/lib/will_filter/containers/list.rb +10 -1
  47. data/lib/will_filter/containers/nil.rb +10 -1
  48. data/lib/will_filter/containers/numeric.rb +10 -1
  49. data/lib/will_filter/containers/numeric_delimited.rb +10 -1
  50. data/lib/will_filter/containers/numeric_range.rb +10 -1
  51. data/lib/will_filter/containers/single_date.rb +12 -1
  52. data/lib/will_filter/containers/text.rb +10 -1
  53. data/lib/will_filter/containers/text_delimited.rb +11 -2
  54. data/lib/will_filter/engine.rb +10 -1
  55. data/lib/will_filter/extensions/action_controller_extension.rb +34 -10
  56. data/lib/will_filter/extensions/action_view_extension.rb +12 -3
  57. data/lib/will_filter/extensions/active_record_extension.rb +11 -1
  58. data/lib/will_filter/extensions/active_record_relation_extension.rb +51 -0
  59. data/lib/will_filter/extensions/array_extension.rb +10 -1
  60. data/lib/will_filter/filter_condition.rb +11 -7
  61. data/lib/will_filter/filter_container.rb +10 -1
  62. data/lib/will_filter/filter_exception.rb +10 -1
  63. data/lib/will_filter/railtie.rb +14 -4
  64. data/lib/will_filter/version.rb +11 -2
  65. data/spec/config/config_spec.rb +5 -5
  66. data/spec/models/will_filter/filter_spec.rb +130 -131
  67. data/test/dummy/app/assets/javascripts/application.js +3 -0
  68. data/test/dummy/app/assets/javascripts/bootstrap.js +1951 -0
  69. data/test/dummy/app/assets/javascripts/jquery-2.1.3.min.js +4 -0
  70. data/test/dummy/app/assets/javascripts/select2.min.js +3 -0
  71. data/test/dummy/app/assets/stylesheets/{application.css → application.css.sass} +5 -2
  72. data/test/dummy/app/assets/stylesheets/bootstrap.min.css +7 -0
  73. data/test/dummy/app/assets/stylesheets/select2.min.css +1 -0
  74. data/test/dummy/app/controllers/advanced_controller.rb +4 -4
  75. data/test/dummy/app/controllers/orders_controller.rb +2 -2
  76. data/test/dummy/app/controllers/simple_controller.rb +3 -3
  77. data/test/dummy/app/models/event.rb +1 -1
  78. data/test/dummy/app/models/user.rb +1 -1
  79. data/test/dummy/app/views/common/_events.html.erb +7 -13
  80. data/test/dummy/app/views/common/_menu.html.erb +25 -27
  81. data/test/dummy/app/views/layouts/application.html.erb +3 -5
  82. data/test/dummy/config/environments/development.rb +2 -0
  83. data/test/dummy/config/environments/production.rb +2 -0
  84. data/test/dummy/config/environments/test.rb +2 -0
  85. data/test/dummy/config/initializers/assets.rb +12 -0
  86. data/test/dummy/config/routes.rb +10 -10
  87. data/test/dummy/db/schema.rb +46 -50
  88. data/will_filter.gemspec +3 -3
  89. metadata +39 -44
  90. data/.rvmrc +0 -1
  91. data/app/assets/javascripts/will_filter/filter_prototype_effects.js +0 -38
  92. data/app/assets/stylesheets/will_filter/actions.css.scss +0 -27
  93. data/app/assets/stylesheets/will_filter/buttons.css.scss +0 -24
  94. data/app/assets/stylesheets/will_filter/calendar.css.scss +0 -102
  95. data/app/assets/stylesheets/will_filter/exporter.css.scss +0 -89
  96. data/app/assets/stylesheets/will_filter/results.css.scss +0 -63
  97. data/app/views/layouts/will_filter/application.html.erb +0 -14
  98. data/test/dummy/app/assets/javascripts/orders.js +0 -2
  99. data/test/dummy/app/assets/stylesheets/orders.css +0 -4
@@ -1,52 +1,64 @@
1
- <div style="font-size:12px;font-weight:bold;">
1
+ <div class="wf_calendar_header">
2
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("will_filter/close.gif", :title=>"Close"), "wfCalendar.hide()")%>
3
+ <% if @calendar.mode == 'month' %>
4
+ <%= link_to("&laquo; expand".html_safe, "#", :onclick => "wfCalendar.changeMode('quarter', #{@calendar.show_time?});", :style => "font-size:10px; padding-bottom: 3px") %> &nbsp;
5
+ <% elsif @calendar.mode == 'quarter' %>
6
+ <%= link_to("&laquo; expand".html_safe, "#", :onclick => "wfCalendar.changeMode('annual', #{@calendar.show_time?});", :style => "font-size:10px; padding-bottom: 3px") %> &nbsp;
7
+ <% end %>
8
+
9
+ <%= link_to('&times;'.html_safe, '#', :title=>"Close", :onclick => "wfCalendar.hide(); return false;") %>
10
10
  </div>
11
-
12
- Calendar
13
- </div>
11
+
12
+ <% if @calendar.show_time? %>
13
+ Select Date/Time
14
+ <% else %>
15
+ Select Date
16
+ <% end %>
17
+ </div>
18
+
14
19
  <div class="wf_calendar_container">
15
- <%= form_tag({:controller => "/will_filter/calendar"}, {:method => :get, :id => "wf_calendar_form"}) do %>
20
+ <%= form_tag({:controller => "/will_filter/calendar"}, {:method => :get, :id => "wf_calendar_form"}) do %>
16
21
  <%= 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") %>
22
+ <%= hidden_field_tag :wf_calendar_selected_date, @calendar.selected_date.strftime("%Y/%m/%d") %>
18
23
  <%= hidden_field_tag :wf_calendar_mode, @calendar.mode %>
19
24
  <%= hidden_field_tag :wf_calendar_show_time, @calendar.show_time? %>
20
25
 
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('')", :style => "width:auto;"}) %>
27
- <% end %>
28
- <%= select_tag("year", options_for_select(WillFilter::Calendar.year_options, @calendar.year), {:id => "wf_calendar_year",:onChange=>"wfCalendar.goToStartDate('')", :style => "width:auto;"}) %>
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
-
26
+ <div style="padding:5px;text-align:center; margin-bottom:5px; border-bottom: 1px solid #ccc;">
27
+ &nbsp;
28
+ <%= link_to("&laquo;".html_safe, "#", :onclick => "wfCalendar.goToStartDate('#{@calendar.previous_start_date}');", :style => "font-size:16px;") %>
29
+ &nbsp;&nbsp;&nbsp;
30
+ <% if @calendar.mode != 'annual' %>
31
+ <%= select_tag("month", options_for_select(WillFilter::Calendar.month_options, @calendar.month), {:id => "wf_calendar_month", :onChange => "wfCalendar.goToStartDate('')", :style => "width:auto;"}) %>
32
+ <% end %>
33
+ <%= select_tag("year", options_for_select(WillFilter::Calendar.year_options, @calendar.year), {:id => "wf_calendar_year", :onChange => "wfCalendar.goToStartDate('')", :style => "width:auto;"}) %>
34
+ &nbsp;&nbsp;&nbsp;
35
+ <%= link_to("&raquo".html_safe, "#", :onclick => "wfCalendar.goToStartDate('#{@calendar.next_start_date}');", :style => "font-size:16px;") %>
36
+ &nbsp;
37
+ </div>
38
+
34
39
  <%= 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), :style => "width:auto;") %>
41
- :
42
- <%= select_tag("wf_calendar_minute", options_for_select(WillFilter::Calendar.minute_options, @calendar.minute), :style => "width:auto;") %>
43
- :
44
- <%= select_tag("wf_calendar_second", options_for_select(WillFilter::Calendar.second_options, @calendar.second), :style => "width:auto;") %>
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 %>
40
+
41
+ <% if @calendar.show_time? %>
42
+ <div style="text-align:center; margin-top:10px; padding:5px; border-top:1px solid #ccc;">
43
+ <div style="margin:10px;">
44
+ Time: &nbsp;
45
+ <%= select_tag("wf_calendar_hour", options_for_select(WillFilter::Calendar.hour_options, @calendar.hour), :style => "width:auto;") %>
46
+ :
47
+ <%= select_tag("wf_calendar_minute", options_for_select(WillFilter::Calendar.minute_options, @calendar.minute), :style => "width:auto;") %>
48
+ :
49
+ <%= select_tag("wf_calendar_second", options_for_select(WillFilter::Calendar.second_options, @calendar.second), :style => "width:auto;") %>
50
+ </div>
51
+
52
+
53
+ <button type="button" class="btn btn-primary btn-xs" onclick="wfCalendar.setDateTime()">
54
+ Select Date and Time
55
+ </button>
56
+
57
+ <button type="button" class="btn btn-default btn-xs" onclick="wfCalendar.hide()">
58
+ Cancel
59
+ </button>
60
+ </div>
61
+ <% end %>
62
+
63
+ <% end %>
52
64
  </div>
@@ -1,7 +1,7 @@
1
1
  <% if results.size > 0 %>
2
2
  <div class="<%=opts[:class]%>" style="<%=opts[:style]%>">
3
3
  <% actions.each do |action| %>
4
- <%=link_to_function("<span>#{action.first}</span>".html_safe, "#{action.last}", :class => "wf_grey_button wf_pcb") %>
5
- <% end %>
6
- </div>
4
+ <%=link_to("<span>#{action.first}</span>".html_safe, "#", :onclick => "#{action.last};", :class => "wf_grey_button wf_pcb") %>
5
+ <% end %>
6
+ </div>
7
7
  <% end %>
@@ -15,7 +15,7 @@
15
15
  <table class='wf_results_table'>
16
16
  <thead>
17
17
  <tr>
18
- <%
18
+ <%
19
19
  carray = [] # stores the order of the columns
20
20
 
21
21
  opts[:columns].each_with_index do |column, index|
@@ -23,34 +23,32 @@
23
23
 
24
24
  # supported notations for columns => [
25
25
  # :id,
26
- # [:id, lambda{|obj| obj.id}],
27
- # [:id, lambda{|obj| obj.id}, "color: white"],
28
- # [:id, lambda{|obj| obj.id}, {:style => "color: white"}],
26
+ # [:id, lambda{|obj| obj.id}],
27
+ # [:id, lambda{|obj| obj.id}, "color: white"],
28
+ # [:id, lambda{|obj| obj.id}, {:style => "color: white"}],
29
29
  # [:id, {:filterable => true, :value => lambda{|obj| obj.id}}],
30
30
  # [:id, {:filterable => true, :value => lambda{|obj| obj.id}}],
31
- # {:key => :id, :filterable => true}
31
+ # {:key => :id, :filterable => true}
32
32
  # ]
33
33
 
34
34
  if column.is_a?(Array)
35
35
  if column.size < 2
36
- raise WillFilter::FilterException.new("Array table column definition must have at least two elements")
36
+ raise WillFilter::FilterException.new("Array table column definition must have at least two elements")
37
37
  end
38
38
 
39
39
  cmeta[:key] = column[0] # first param must always be the column key
40
40
 
41
41
  if column[1].is_a?(Hash) # second param is a hash
42
- cmeta.merge!(column[1])
43
- else
42
+ cmeta.merge!(column[1])
43
+ else
44
44
  cmeta[:value] = column[1]
45
45
  unless column[2].nil?
46
46
  if column[2].is_a?(Hash) # third param can be a set of attributes
47
47
  cmeta.merge!(column[2])
48
- elsif column[2].is_a?(String) # third param can be a string, which represents a style
48
+ else # third param can be a string, which represents a style
49
49
  cmeta[:style] = column[2]
50
- else
51
- raise WillFilter::FilterException.new("Unsupported table column format #{column[2]}")
52
50
  end
53
- end
51
+ end
54
52
  end
55
53
  elsif column.is_a?(Hash)
56
54
  cmeta = column
@@ -66,7 +64,7 @@
66
64
 
67
65
  if cmeta[:sort_key]
68
66
  sort_key = cmeta[:sort_key].call(filter)
69
- else
67
+ else
70
68
  sort_key = cmeta[:key]
71
69
  end
72
70
 
@@ -80,7 +78,7 @@
80
78
  column_title = cmeta[:title].call(filter)
81
79
  else
82
80
  # column_title = cmeta[:title] || filter ? filter.condition_title_for(cmeta[:key]) : "Undefined"
83
- if filter
81
+ if filter
84
82
  column_title = cmeta[:title] || filter.condition_title_for(cmeta[:key])
85
83
  else
86
84
  column_title = cmeta[:title] || cmeta[:key].to_s.titleize
@@ -88,18 +86,18 @@
88
86
 
89
87
  if sortable
90
88
  column_title = link_to(column_title, filter.to_params(:wf_order => cmeta[:key], :wf_order_type => sort_direction_click), :title => "sort by #{cmeta[:key]} ascending", :class => "sort_link")
91
- end
92
- end
89
+ end
90
+ end
93
91
 
94
- # column class name
92
+ # column class name
95
93
  title_class_name = "wf_#{cmeta[:title_class] || cmeta[:key].to_s}"
96
- title_class_name << " sortable" if sortable
94
+ title_class_name << " sortable" if sortable
97
95
  title_class_name << " current_sort" if filter && filter.column_sorted?(sort_key)
98
96
  title_class_name << " #{sort_direction}"
99
97
 
100
98
  # extra styling that can be applied on a column
101
- title_style = cmeta[:title_style] || ""
102
- title_style << ";width:15px" if cmeta[:key] == :checkbox
99
+ title_style = cmeta[:title_style] || ""
100
+ title_style << ";width:15px" if cmeta[:key] == :checkbox
103
101
  %>
104
102
 
105
103
  <th class="<%= title_class_name %>" style="<%=title_style%>">
@@ -109,7 +107,7 @@
109
107
  <%= link_to "", filter.to_params(:wf_order => sort_key, :wf_order_type => 'asc'), :title => "sort by #{sort_key} ascending", :class => 'up' %>
110
108
  <%= link_to "", filter.to_params(:wf_order => sort_key, :wf_order_type => 'desc'), :title => "sort by #{sort_key} descending", :class => 'down' %>
111
109
  </div>
112
-
110
+
113
111
  <div style='white-space: nowrap;'>
114
112
  <%= column_title %>
115
113
  </div>
@@ -118,14 +116,14 @@
118
116
  <%= check_box_tag("wf_check_all", "", false, :onClick => "wfCheckAll(this)") %>
119
117
 
120
118
  <% else %>
121
- <%= column_title %>
119
+ <%= column_title %>
122
120
 
123
- <% end %>
121
+ <% end %>
124
122
  </div>
125
123
  </th>
126
124
  <% end %>
127
125
  </tr>
128
- </thead>
126
+ </thead>
129
127
 
130
128
  <tbody>
131
129
 
@@ -137,11 +135,18 @@
137
135
  <tr class='data_row <%=(index % 2 == 0) ? "wf_row_even" : "wf_row_odd"%>'>
138
136
  <% carray.each_with_index do |cmeta, column_index| %>
139
137
  <%
140
- value_style = cmeta[:style] || 'padding-top:2px;padding-bottom:2px;vertical-align:middle;' # should be moved to css
138
+ if cmeta[:style].nil?
139
+ value_style = 'padding-top:2px;padding-bottom:2px;vertical-align:middle;'
140
+ elsif cmeta[:style].is_a?(Proc)
141
+ value_style = cmeta[:style].call(obj)
142
+ else
143
+ value_style = cmeta[:style]
144
+ end
145
+
141
146
  value_class = cmeta[:class] || ''
142
147
 
143
148
  if cmeta[:value].nil?
144
- value = obj.send(cmeta[:key])
149
+ value = obj.send(cmeta[:key])
145
150
  elsif cmeta[:value].is_a?(Proc)
146
151
  value = cmeta[:value].call(obj)
147
152
  else
@@ -158,26 +163,26 @@
158
163
  <td style='<%=value_style%>' class='<%=value_class%>'>
159
164
  <% if cmeta[:filterable] %>
160
165
  <div style='float:right;'><%=link_to(image_tag("will_filter/filter.png", :style=>"width:12px;"), results.add_filter_condition(cmeta[:key], :is, filter_value.to_s).to_params, {:title => "Show only #{filter_value}"}) %></div>
161
- <% end -%>
166
+ <% end -%>
162
167
 
163
168
  <% if cmeta[:key] == :checkbox %>
164
169
  <%= check_box_tag("#{value}[]", obj.id, false, :id => "wf_check_#{index}", :onClick => "wfVerifyTrigger(this)") %>
165
-
170
+
166
171
  <% elsif value.is_a?(Hash) %>
167
172
  <% value.each do |key, value| %>
168
173
  <strong><%=key%>:</strong> <%= value %>;
169
174
  <% end -%>
170
-
171
- <% elsif value.is_a?(Time) %>
172
- <%= value.strftime("%m/%d/%Y %l:%M:%S") %>
173
175
 
174
- <% elsif value.is_a?(Date) %>
176
+ <% elsif value.is_a?(Time) %>
177
+ <%= value.strftime("%m/%d/%Y %l:%M:%S %p %Z") %>
178
+
179
+ <% elsif value.is_a?(Date) %>
175
180
  <%= value.strftime("%m/%d/%Y") %>
176
-
181
+
177
182
  <% else %>
178
183
 
179
- <%= value.to_s %>
180
- <% end -%>
184
+ <%= value.to_s %>
185
+ <% end -%>
181
186
  </td>
182
187
  <% end -%>
183
188
  </tr>
@@ -188,8 +193,19 @@
188
193
  <% end -%>
189
194
 
190
195
  </tbody>
191
- </table>
192
-
196
+ </table>
197
+
198
+ <table class='wf_paginator'>
199
+ <tr>
200
+ <td style='text-align:left;vertical-align:middle;'>
201
+ <%= paginate(results) %>
202
+ </td>
203
+ <td style='text-align:right;vertical-align:middle;'>
204
+ Showing <%= results.offset_value + 1 %> - <%= results.offset_value + results.length %> of <%= results.total_count %>
205
+ </td>
206
+ </tr>
207
+ </table>
208
+
193
209
  <script>
194
210
  function wfVerifyTrigger(check) {
195
211
  if (!check.checked) {
@@ -197,7 +213,7 @@
197
213
  check_all.checked = false;
198
214
  }
199
215
  }
200
-
216
+
201
217
  function wfCheckAll(trigger) {
202
218
  var index = 0;
203
219
  var check = document.getElementById("wf_check_" + index);
@@ -220,4 +236,4 @@
220
236
  </tr>
221
237
  </table>
222
238
 
223
- <% end %>
239
+ <% end %>
@@ -1,15 +1,5 @@
1
- <%= stylesheet_link_tag("will_filter/filter") -%>
2
- <%= stylesheet_link_tag("will_filter/calendar") -%>
3
- <%= stylesheet_link_tag("will_filter/exporter") -%>
4
- <%= stylesheet_link_tag("will_filter/actions") -%>
5
- <%= stylesheet_link_tag("will_filter/results") -%>
6
- <%= stylesheet_link_tag("will_filter/buttons") -%>
7
-
8
- <%= javascript_include_tag("will_filter/filter") -%>
9
-
10
- <% if WillFilter::Config.effects_options[:enabled] %>
11
- <%= javascript_include_tag(WillFilter::Config.effects_options[:script_path]) -%>
12
- <% end %>
1
+ <%= stylesheet_link_tag('will_filter/filter') -%>
2
+ <%= javascript_include_tag('will_filter/filter') -%>
13
3
 
14
4
  <script>
15
5
  initializeWillFilter();
@@ -1,39 +1,43 @@
1
1
  <div class="wf_exporter_header">
2
- <div class="end">
3
- <%=link_to_function("&times;".html_safe, "wfExporter.hide()", :title=>"Close", :class => "close")%>
2
+ <div class="end" style="margin-top: -3px;">
3
+ <%= link_to("&times;".html_safe, "#", :onclick => "wfExporter.hide(); return false;", :title => "Close", :class => "close") %>
4
4
  </div>
5
- Exporter
5
+ Export Data
6
6
  </div>
7
7
 
8
8
  <div class="wf_exporter_container">
9
9
 
10
10
  <table style="width:100%" cellpadding="0px" cellspacing="0px;">
11
11
  <thead>
12
- <tr>
13
- <td><input type="checkbox" id="wf_fld_all" onClick="wfExporter.selectAllFields(this);" style="width:20px;"></td>
14
- <td>Name</td>
15
- <td>Type</td>
16
- </tr>
12
+ <tr>
13
+ <td><input type="checkbox" id="wf_fld_all" onClick="wfExporter.selectAllFields(this);" style="width:20px;"></td>
14
+ <td>Name</td>
15
+ <td>Type</td>
16
+ </tr>
17
17
  </thead>
18
18
  <tbody>
19
- <% @wf_filter.model_class.columns.each_with_index do |col, index| %>
19
+ <% @wf_filter.model_class.columns.each_with_index do |col, index| %>
20
20
  <tr>
21
- <td>
22
- <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%>">
23
- </td>
24
- <td><%=col.name %></td>
25
- <td><%=col.type %></td>
21
+ <td>
22
+ <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 %>">
23
+ </td>
24
+ <td><%= col.name %></td>
25
+ <td><%= col.type %></td>
26
26
  </tr>
27
- <% end %>
27
+ <% end %>
28
28
  </tbody>
29
29
  </table>
30
-
31
- <hr>
32
- <div class="center">
33
- Format: <%= select_tag("wf_export_format_selector", options_for_select(@wf_filter.export_formats, @wf_filter.format)) %>
30
+
31
+
32
+ <div class="center" style="border-top: 1px solid #ccc; padding-top: 5px; margin-top: 5px;">
33
+ Format: <%= select_tag("wf_export_format_selector", options_for_select(@wf_filter.export_formats, @wf_filter.format)) %>
34
34
  </div>
35
35
  <div class="center">
36
- <%=link_to_function("<span>Export</span>".html_safe, "wfExporter.exportFilter()", :class => "wf_grey_button wf_pcb") %>
37
- <%=link_to_function("<span>Cancel</span>".html_safe, "wfExporter.hide()", :class => "wf_grey_button wf_pcb") %>
36
+ <button type="button" class="btn btn-primary btn-xs" onclick="wfExporter.exportFilter()">
37
+ Export
38
+ </button>
39
+ <button type="button" class="btn btn-default btn-xs" onclick="wfExporter.hide()">
40
+ Cancel
41
+ </button>
38
42
  </div>
39
- </div>
43
+ </div>
@@ -1,28 +1,44 @@
1
1
  <% if wf_filter.errors[index] %>
2
2
  <tr>
3
- <td colspan="2"></td>
3
+ <td colspan="2"></td>
4
4
  <td>
5
5
  <div class="error">
6
- <%= wf_filter.errors[index] %>
6
+ <%= wf_filter.errors[index] %>
7
7
  </div>
8
8
  </td>
9
9
  <td></td>
10
- </tr>
10
+ </tr>
11
11
  <% end %>
12
12
 
13
13
  <tr>
14
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}')"} %>
15
+ <%= select_tag "wf_c#{index}", options_for_select(wf_filter.condition_options, condition.key.to_s), {:class => "wf_input full_width", style: 'width:100%', :onChange => "wfFilter.updateConditionAt('#{index}')"} %>
16
+ <script>
17
+ $("#wf_c<%=index%>").select2().on("change", function (e) {
18
+ wfFilter.updateConditionAt('<%=index%>');
19
+ });
20
+ </script>
16
21
  </td>
17
22
  <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}')"} %>
23
+ <%= select_tag "wf_o#{index}", options_for_select(wf_filter.operator_options_for(condition.key), condition.operator.to_s), {:class => "wf_input full_width", style: 'width:100%', :onChange => "wfFilter.updateConditionAt('#{index}')"} %>
24
+ <script>
25
+ $("#wf_o<%=index%>").select2().on("change", function (e) {
26
+ wfFilter.updateConditionAt('<%=index%>');
27
+ });
28
+ </script>
19
29
  </td>
20
30
  <td class="values">
21
- <%= render :partial => "/will_filter/filter/containers/#{condition.container.template_name}", :locals => {:container => condition.container, :index => index} %>
31
+ <%= render :partial => "/will_filter/filter/containers/#{condition.container.template_name}", :locals => {:container => condition.container, :index => index} %>
22
32
  </td>
23
33
  <td class="actions">
24
- <%=link_to_function("<span>-</span>".html_safe, "wfFilter.removeConditionAt('#{index}')", :class => "wf_grey_button wf_pcb") %>
25
- <%=link_to_function("<span>+</span>".html_safe, "wfFilter.addConditionAfter('#{index}')", :class => "wf_grey_button wf_pcb") %>
34
+ <button type="button" class="btn btn-default btn-xs" onclick="wfFilter.removeConditionAt('<%= index %>')" style="width: 20px;">
35
+ -
36
+ </button>
37
+ <button type="button" class="btn btn-default btn-xs" onclick="wfFilter.addConditionAfter('<%= index %>')" style="width: 20px;">
38
+ +
39
+ </button>
26
40
  </td>
27
41
  </tr>
28
-
42
+
43
+ </td>
44
+ </tr>