will_filter 3.1.11 → 5.1.0

Sign up to get free protection for your applications and to get access to all the features.
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,4 +1,3 @@
1
-
2
1
  <%= render :partial => '/will_filter/filter/conditions_header', :locals => {:wf_filter => wf_filter} %>
3
2
 
4
3
  <div class="body">
@@ -12,30 +11,34 @@
12
11
  <div class="filter_match_type">
13
12
  <div class="end">
14
13
  <small>
15
- <%=link_to_function("Toggle Conditions", "wfFilter.toggleDebugger()") %>
14
+ <%= link_to("Toggle Conditions", "#", :onclick => "wfFilter.toggleDebugger();") %>
16
15
  </small>
17
16
  </div>
18
- Match <%= select_tag(:wf_match, options_for_select(wf_filter.match_options, wf_filter.match), {:onChange=>"wfFilter.markDirty()"}) %>
17
+ Match <%= select_tag(:wf_match, options_for_select(wf_filter.match_options, wf_filter.match), {:onChange => "wfFilter.markDirty()"}) %>
19
18
  of the following conditions:
20
19
  </div>
21
20
 
22
21
  <% if wf_filter.size == 0 %>
23
22
  <div class="no_filter_hint">
24
- You haven't added any filter conditions, so all of the results were returned.
25
- Use the "Add" button in the bottom left corner to add a new condition or select
23
+ No filter conditions have been specified and all results have been returned.
24
+ Use the "+ Add Condition" button in the bottom left corner to add a new condition or select
26
25
  a predefined filter from a drop-down list above.
27
26
  </div>
28
27
  <% else %>
29
- <table class="table" cellpadding="0" cellspacing="0">
28
+ <table>
30
29
  <% 0.upto(wf_filter.size-1) do |index| %>
31
30
  <% condition = wf_filter.condition_at(index) %>
32
- <%= render :partial => "/will_filter/filter/condition", :locals => {:wf_filter => wf_filter, :condition => condition, :index => index}%>
31
+ <%= render :partial => '/will_filter/filter/condition', :locals => {
32
+ :wf_filter => wf_filter,
33
+ :condition => condition,
34
+ :index => index
35
+ } %>
33
36
  <% end %>
34
37
  </table>
35
38
  <% end %>
36
39
 
37
40
  <div id="wf_debugger" class="debugger" style="display:none;">
38
- <%= raw(wf_filter.debug_sql_conditions) %>
41
+ <%= raw(wf_filter.debug_sql_conditions) %>
39
42
  </div>
40
43
 
41
- </div>
44
+ </div>
@@ -1,17 +1,32 @@
1
1
  <div class="actions">
2
- Order:
3
- <%= select_tag(:wf_order, options_for_select(wf_filter.condition_options, wf_filter.order), {:onChange=>"markDirty()"}) %>
4
- <%= select_tag(:wf_order_type, options_for_select(wf_filter.order_type_options, wf_filter.order_type), {:onChange=>"markDirty()"}) %>
5
- Per Page:
6
- <%= select_tag(:wf_per_page, options_for_select(wf_filter.per_page_options, wf_filter.per_page.to_s), {:onChange=>"markDirty()"}) %>
2
+
3
+ <% if wf_filter.order_configurable? %>
4
+ Order:
5
+ <%= select_tag(:wf_order, options_for_select(wf_filter.condition_options, wf_filter.order), {:onChange => "markDirty()"}) %>
6
+ <%= select_tag(:wf_order_type, options_for_select(wf_filter.order_type_options, wf_filter.order_type), {:onChange => "markDirty()"}) %>
7
+ <% end %>
8
+
9
+ <% if wf_filter.per_page_configurable? %>
10
+ Per Page:
11
+ <%= select_tag(:wf_per_page, options_for_select(wf_filter.per_page_options, wf_filter.per_page.to_s), {:onChange => "markDirty()"}) %>
12
+ <% end %>
13
+
7
14
  &nbsp;&nbsp;
8
- <%=link_to_function("<span>Submit Filter</span>".html_safe, "wfFilter.submit()", :class => "wf_grey_button wf_pcb") %>
15
+ <button type="button" class="btn btn-primary btn-xs" onclick="wfFilter.submit()">
16
+ Submit
17
+ </button>
9
18
  </div>
19
+
10
20
  <div>
11
- <%=link_to_function("<span><b>&plus;</b> Add</span>".html_safe, "wfFilter.addCondition()", :class => "wf_grey_button wf_pcb") %>
12
- <%=link_to_function("<span>Clear</span>".html_safe, "wfFilter.removeAllConditions()", :class => "wf_grey_button wf_pcb") %>
21
+ <button type="button" class="btn btn-default btn-xs" onclick="wfFilter.addCondition()">
22
+ + Add Condition
23
+ </button>
24
+ <button type="button" class="btn btn-default btn-xs" onclick="wfFilter.removeAllConditions()">
25
+ Clear All
26
+ </button>
27
+
13
28
  &nbsp;&nbsp;
14
29
  <span id="wf_loader" class="spinner" style="display:none;">
15
- <%=image_tag "will_filter/spinner.gif" %> Loading...
30
+ <%= image_tag 'will_filter/loading.gif', style: 'height: 15px;' %>
16
31
  </span>
17
- </div>
32
+ </div>
@@ -1,38 +1,52 @@
1
- <div style="margin:0;padding:0;display:inline">
2
- <%= hidden_field_tag(:wf_id, wf_filter.id) %>
3
- <%= hidden_field_tag(:wf_type, wf_filter.class.name) %>
4
- <%= hidden_field_tag(:wf_dirty, "false") %>
5
- <%= hidden_field_tag(:wf_submitted, "false") %>
6
- <%= hidden_field_tag(:wf_name, wf_filter.name) %>
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) %>
7
6
 
8
- <% unless WillFilter::Config.require_filter_extensions? %>
9
- <%= hidden_field_tag(:wf_model, wf_filter.model_class_name) %>
10
- <% end %>
11
-
12
- <%= hidden_field_tag(:wf_export_format, "") %>
13
- <%= hidden_field_tag(:wf_export_fields, "") %>
14
- </div>
7
+ <% unless WillFilter::Config.require_filter_extensions? %>
8
+ <%= hidden_field_tag(:wf_model, wf_filter.model_class_name) %>
9
+ <% end %>
15
10
 
16
- <div class="header">
11
+ <%= hidden_field_tag(:wf_export_format, "") %>
12
+ <%= hidden_field_tag(:wf_export_fields, "") %>
13
+
14
+ <div class="wf_header">
17
15
  <% if wf_filter.show_export_options? %>
18
16
  <div class="end" style="padding-left:3px;">
19
- <%=link_to_function("<span>Export Data...</span>".html_safe, "wfExporter.show(this)", :class => "wf_grey_button wf_pcb") %>
20
- </div>
17
+ <button type="button" class="btn btn-default btn-xs" onclick="wfExporter.show(this)">
18
+ Export Data...
19
+ </button>
20
+ </div>
21
21
  <% end %>
22
-
22
+
23
23
  <% if wf_filter.show_save_options? %>
24
24
  <div class="end">
25
- <%=link_to_function("<span>Save As New...</span>".html_safe, "wfFilter.saveFilter()", :class => "wf_grey_button wf_pcb") %>
25
+ <button type="button" class="btn btn-default btn-xs" onclick="wfFilter.saveFilter()">
26
+ Save As New...
27
+ </button>
28
+
26
29
  <% if wf_filter.id %>
27
- <%=link_to_function("<span>Update</span>".html_safe, "wfFilter.updateFilter()", :class => "wf_grey_button wf_pcb") %>
28
- <%=link_to_function("<span>Delete</span>".html_safe, "wfFilter.deleteFilter()", :class => "wf_grey_button wf_pcb") %>
30
+ <button type="button" class="btn btn-default btn-xs" onclick="wfFilter.updateFilter()">
31
+ Update
32
+ </button>
33
+ <button type="button" class="btn btn-default btn-xs" onclick="wfFilter.deleteFilter()">
34
+ Delete
35
+ </button>
29
36
  <% end %>
30
37
  </div>
31
38
  <% end %>
32
39
 
33
40
  <div>
34
- <% unless wf_filter.saved_filters.empty? %>
35
- <%= select_tag(:wf_key, options_for_select(wf_filter.saved_filters, wf_filter.key), {:onChange=>"wfFilter.loadSavedFilter()"}) %>
36
- <% end %>
41
+ <% unless wf_filter.filter_options.empty? %>
42
+ <%= select_tag(:wf_key, grouped_options_for_select(wf_filter.filter_options, wf_filter.key), {:onChange => "wfFilter.loadSavedFilter()", style: 'width:250px'}) %>
43
+ <script>
44
+ $("#wf_key").select2({
45
+ placeholder: "Select pre-defined or saved filter"
46
+ }).on("change", function (e) {
47
+ wfFilter.loadSavedFilter();
48
+ });
49
+ </script>
50
+ <% end %>
37
51
  </div>
38
- </div>
52
+ </div>
@@ -1,15 +1,16 @@
1
1
  <%= will_filter_scripts_tag %>
2
2
 
3
- <%= form_tag({}, {:method => :get, :name=>'wf_form', :id => 'wf_form', :class => 'wf_form' }) do %>
4
- <div class="wf_container">
3
+ <%= form_tag({}, {:method => :get, :name => 'wf_form', :id => 'wf_form', :class => 'wf_form'}) do %>
5
4
 
6
- <div id="wf_filter_conditions" class="conditions">
7
- <%= render :partial=> '/will_filter/filter/conditions', :locals => { :wf_filter => wf_filter } %>
8
- </div>
5
+ <div class="wf_container">
9
6
 
10
- <div class="footer">
11
- <%= render :partial => '/will_filter/filter/conditions_footer', :locals => { :wf_filter => wf_filter } %>
12
- </div>
7
+ <div id="wf_filter_conditions" class="wf_conditions">
8
+ <%= render :partial => '/will_filter/filter/conditions', :locals => {:wf_filter => wf_filter} %>
9
+ </div>
13
10
 
14
- </div>
11
+ <div class="wf_footer">
12
+ <%= render :partial => '/will_filter/filter/conditions_footer', :locals => {:wf_filter => wf_filter} %>
13
+ </div>
14
+
15
+ </div>
15
16
  <% end %>
@@ -1,10 +1,8 @@
1
- <table class='values' cellspacing='0px' cellpadding='0px'>
2
- <tr>
3
- <td width='99%'>
4
- <%=text_field_tag("wf_v#{index}_0", container.sanitized_value, :style => 'width:99%', :onChange => 'wfFilter.fieldChanged(this)')%>
5
- </td>
6
- <td width='1%'>
7
- <%=link_to_function(image_tag("will_filter/calendar.png", :title => "Select date", :class => "wf_calendar_trigger"), "wfCalendar.selectDate('wf_v#{index}_0', this)")%>
8
- </td>
9
- </tr>
10
- </table>
1
+ <div class="input-group" style="width: 99%;">
2
+ <%= text_field_tag("wf_v#{index}_0", container.sanitized_value, :class => 'form-control input-xs', 'aria-describedby' => "wf_v#{index}_0_addon", :onChange => 'wfFilter.fieldChanged(this)') %>
3
+ <span class="input-group-addon input-xs" id="<%="wf_v#{index}_0_addon"%>">
4
+ <%= link_to("#", :onclick => "wfCalendar.selectDate('wf_v#{index}_0', this);", :style=>'color: #666;') do %>
5
+ <i class="fa fa-calendar" aria-hidden="true"></i>
6
+ <% end %>
7
+ </span>
8
+ </div>
@@ -1,16 +1,24 @@
1
- <table class='values' cellspacing='0px' cellpadding='0px'>
2
- <tr>
3
- <td width='49%'>
4
- <%=text_field_tag("wf_v#{index}_0", container.sanitized_value(0), :style => 'width:98%', :onChange => 'wfFilter.fieldChanged(this)')%>
1
+ <table class='values' cellspacing='0px' cellpadding='0px' style="width: 99%">
2
+ <tr>
3
+ <td style="width: 50%;">
4
+ <div class="input-group" style="width: 100%; padding-right: 5px;">
5
+ <%= text_field_tag("wf_v#{index}_0", container.sanitized_value(0), :class => 'form-control input-xs', 'aria-describedby' => "wf_v#{index}_0_addon", :onChange => 'wfFilter.fieldChanged(this)') %>
6
+ <span class="input-group-addon input-xs" id="<%= "wf_v#{index}_0_addon" %>">
7
+ <%= link_to("#", :onclick => "wfCalendar.selectDate('wf_v#{index}_0', this);", :style => 'color: #666;') do %>
8
+ <i class="fa fa-calendar" aria-hidden="true" title="Select start date and time"></i>
9
+ <% end %>
10
+ </span>
11
+ </div>
5
12
  </td>
6
- <td width='1%'>
7
- <%=link_to_function(image_tag("will_filter/calendar.png", :title => "Select start date", :class => "wf_calendar_trigger"), "wfCalendar.selectDate('wf_v#{index}_0', this)")%>
13
+ <td style="width: 50%;">
14
+ <div class="input-group" style="width: 100%;">
15
+ <%= text_field_tag("wf_v#{index}_1", container.sanitized_value(1), :class => 'form-control input-xs', 'aria-describedby' => "wf_v#{index}_1_addon", :onChange => 'wfFilter.fieldChanged(this)') %>
16
+ <span class="input-group-addon input-xs" id="<%= "wf_v#{index}_1_addon" %>">
17
+ <%= link_to("#", :onclick => "wfCalendar.selectDate('wf_v#{index}_1', this);", :style => 'color: #666;') do %>
18
+ <i class="fa fa-calendar" aria-hidden="true" title="Select start date and time"></i>
19
+ <% end %>
20
+ </span>
21
+ </div>
8
22
  </td>
9
- <td width='49%'>
10
- <%=text_field_tag("wf_v#{index}_1", container.sanitized_value(1), :style => 'width:98%', :onChange => 'wfFilter.fieldChanged(this)')%>
11
- </td>
12
- <td width='1%'>
13
- <%=link_to_function(image_tag("will_filter/calendar.png", :title => "Select end date", :class => "wf_calendar_trigger"), "wfCalendar.selectDate('wf_v#{index}_1', this)")%>
14
- </td>
15
- </tr>
23
+ </tr>
16
24
  </table>
@@ -1,10 +1,8 @@
1
- <table class='values' cellspacing='0px' cellpadding='0px'>
2
- <tr>
3
- <td width='99%'>
4
- <%=text_field_tag("wf_v#{index}_0", container.sanitized_value, :style => 'width:99%', :onChange => 'wfFilter.fieldChanged(this)')%>
5
- </td>
6
- <td width='1%'>
7
- <%=link_to_function(image_tag("will_filter/clock.png", :title => "Select date and time", :class => "wf_calendar_trigger"), "wfCalendar.selectDateTime('wf_v#{index}_0', this)")%>
8
- </td>
9
- </tr>
10
- </table>
1
+ <div class="input-group" style="width: 99%;">
2
+ <%= text_field_tag("wf_v#{index}_0", container.sanitized_value, :class => 'form-control input-xs', 'aria-describedby' => "wf_v#{index}_0_addon", :onChange => 'wfFilter.fieldChanged(this)') %>
3
+ <span class="input-group-addon input-xs" id="<%="wf_v#{index}_0_addon"%>">
4
+ <%= link_to("#", :onclick => "wfCalendar.selectDateTime('wf_v#{index}_0', this);", :style=>'color: #666;') do %>
5
+ <i class="fa fa-clock-o" aria-hidden="true"></i>
6
+ <% end %>
7
+ </span>
8
+ </div>
@@ -1,16 +1,24 @@
1
- <table class='values' cellspacing='0px' cellpadding='0px'>
2
- <tr>
3
- <td width='49%'>
4
- <%=text_field_tag("wf_v#{index}_0", container.sanitized_value(0), :style => 'width:98%', :onChange => 'wfFilter.fieldChanged(this)')%>
1
+ <table class='values' cellspacing='0px' cellpadding='0px' style="width: 99%">
2
+ <tr>
3
+ <td style="width: 50%;">
4
+ <div class="input-group" style="width: 100%; padding-right: 5px;">
5
+ <%= text_field_tag("wf_v#{index}_0", container.sanitized_value(0), :class => 'form-control input-xs', 'aria-describedby' => "wf_v#{index}_0_addon", :onChange => 'wfFilter.fieldChanged(this)') %>
6
+ <span class="input-group-addon input-xs" id="<%= "wf_v#{index}_0_addon" %>">
7
+ <%= link_to("#", :onclick => "wfCalendar.selectDateTime('wf_v#{index}_0', this);", :style => 'color: #666;') do %>
8
+ <i class="fa fa-clock-o" aria-hidden="true" title="Select start date and time"></i>
9
+ <% end %>
10
+ </span>
11
+ </div>
5
12
  </td>
6
- <td width='1%'>
7
- <%=link_to_function(image_tag("will_filter/clock.png", :title => "Select start date and time", :class => "wf_calendar_trigger"), "wfCalendar.selectDateTime('wf_v#{index}_0', this)")%>
13
+ <td style="width: 50%;">
14
+ <div class="input-group" style="width: 100%;">
15
+ <%= text_field_tag("wf_v#{index}_1", container.sanitized_value(1), :class => 'form-control input-xs', 'aria-describedby' => "wf_v#{index}_1_addon", :onChange => 'wfFilter.fieldChanged(this)') %>
16
+ <span class="input-group-addon input-xs" id="<%= "wf_v#{index}_1_addon" %>">
17
+ <%= link_to("#", :onclick => "wfCalendar.selectDateTime('wf_v#{index}_1', this);", :style => 'color: #666;') do %>
18
+ <i class="fa fa-clock-o" aria-hidden="true" title="Select start date and time"></i>
19
+ <% end %>
20
+ </span>
21
+ </div>
8
22
  </td>
9
- <td width='49%'>
10
- <%=text_field_tag("wf_v#{index}_1", container.sanitized_value(1), :style => 'width:98%', :onChange => 'wfFilter.fieldChanged(this)')%>
11
- </td>
12
- <td width='1%'>
13
- <%=link_to_function(image_tag("will_filter/clock.png", :title => "Select end date and time", :class => "wf_calendar_trigger"), "wfCalendar.selectDateTime('wf_v#{index}_1', this)")%>
14
- </td>
15
- </tr>
23
+ </tr>
16
24
  </table>
@@ -1,7 +1,17 @@
1
- <select style='width:100%' 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%>
1
+ <div id="wf_v<%=index%>_0_border">
2
+ <select style='width:100%' name='wf_v<%= index %>_0' id='wf_v<%= index %>_0' onChange='wfFilter.fieldChanged(this)'>
3
+ <% container.options.each do |option| %>
4
+ <option <%= "selected" if option.last == container.value %> value="<%= option.last %>">
5
+ <%= option.first %>
5
6
  </option>
6
- <% end %>
7
- </select>
7
+ <% end %>
8
+ </select>
9
+ </div>
10
+
11
+ <script>
12
+ $("#wf_v<%=index%>_0").select2().on("change", function (e) {
13
+ // $('#wf_v<%=index%>_0_border').css({'border-width': '1px', 'border-color': 'red', 'border-style': 'solid', 'border-radius': '3px'});
14
+ // $('#wf_v<%=index%>_0_border').css({'background-color': 'red'});
15
+ // wfFilter.fieldChanged("#wf_v<%=index%>_0");
16
+ });
17
+ </script>
data/config/routes.rb CHANGED
@@ -1,5 +1,14 @@
1
1
  #--
2
- # Copyright (c) 2010-2011 Michael Berkovich
2
+ # Copyright (c) 2017 Michael Berkovich, theiceberk@gmail.com
3
+ #
4
+ # __ __ ____ _ _ _____ ____ _ ______ ___ ____
5
+ # | |__| || || | | | | || || | | | / _]| \
6
+ # | | | | | | | | | | | __| | | | | | | / [_ | D )
7
+ # | | | | | | | |___ | |___ | |_ | | | |___|_| |_|| _]| /
8
+ # | ` ' | | | | || | | _] | | | | | | | [_ | \
9
+ # \ / | | | || | | | | | | | | | | || . \
10
+ # \_/\_/ |____||_____||_____| |__| |____||_____| |__| |_____||__|\_|
11
+ #
3
12
  #
4
13
  # Permission is hereby granted, free of charge, to any person obtaining
5
14
  # a copy of this software and associated documentation files (the
@@ -22,22 +31,23 @@
22
31
  #++
23
32
 
24
33
  WillFilter::Engine.routes.draw do
25
- match 'filter/index', :to => 'filter#index'
26
- match 'filter/add_condition', :to => 'filter#add_condition'
27
- match 'filter/update_condition', :to => 'filter#update_condition'
28
- match 'filter/remove_condition', :to => 'filter#remove_condition'
29
- match 'filter/remove_all_conditions', :to => 'filter#remove_all_conditions'
30
- match 'filter/load_filter', :to => 'filter#load_filter'
31
- match 'filter/save_filter', :to => 'filter#save_filter'
32
- match 'filter/update_filter', :to => 'filter#update_filter'
33
- match 'filter/delete_filter', :to => 'filter#delete_filter'
34
34
 
35
- match 'calendar', :to => 'calendar#index'
36
- match 'calendar/index', :to => 'calendar#index'
35
+ match 'filter/index', :to => 'filter#index', via: [:get, :post]
36
+ match 'filter/add_condition', :to => 'filter#add_condition', via: [:get, :post]
37
+ match 'filter/update_condition', :to => 'filter#update_condition', via: [:get, :post]
38
+ match 'filter/remove_condition', :to => 'filter#remove_condition', via: [:get, :post]
39
+ match 'filter/remove_all_conditions', :to => 'filter#remove_all_conditions', via: [:get, :post]
40
+ match 'filter/load_filter', :to => 'filter#load_filter', via: [:get, :post]
41
+ match 'filter/save_filter', :to => 'filter#save_filter', via: [:get, :post]
42
+ match 'filter/update_filter', :to => 'filter#update_filter', via: [:get, :post]
43
+ match 'filter/delete_filter', :to => 'filter#delete_filter', via: [:get, :post]
44
+
45
+ match 'calendar', :to => 'calendar#index', via: [:get, :post]
46
+ match 'calendar/index', :to => 'calendar#index', via: [:get, :post]
37
47
 
38
- match 'exporter', :to => 'exporter#index'
39
- match 'exporter/index', :to => 'exporter#index'
40
- match 'exporter/export', :to => 'exporter#export'
48
+ match 'exporter', :to => 'exporter#index', via: [:get, :post]
49
+ match 'exporter/index', :to => 'exporter#index', via: [:get, :post]
50
+ match 'exporter/export', :to => 'exporter#export', via: [:get, :post]
41
51
 
42
- root :to => "filter#index"
52
+ root :to => 'filter#index'
43
53
  end
data/deploy ADDED
@@ -0,0 +1,63 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ def execute(cmd)
4
+ puts "\n***************************************************************************\n"
5
+ puts "$ #{cmd}"
6
+ system(cmd)
7
+ end
8
+
9
+ def version_file_path
10
+ './lib/will_filter/version.rb'
11
+ end
12
+
13
+ def version_file
14
+ @version_file ||= File.read(version_file_path)
15
+ end
16
+
17
+ def version
18
+ @version ||= version_file.match(/VERSION\s*=\s*'([^']*)'/)[1]
19
+ end
20
+
21
+ def increment_version
22
+ parts = version.split('.')
23
+ parts[2] = (parts[2].to_i + 1).to_s
24
+ new_version = parts.join('.')
25
+
26
+ version_file.gsub!(version, new_version)
27
+
28
+ File.open(version_file_path, 'w') do |file|
29
+ file.write(version_file)
30
+ end
31
+
32
+ @version_file = nil
33
+ @version = nil
34
+ end
35
+
36
+ puts "\nBuilding will_filter-#{version}.gem..."
37
+
38
+ if ARGV.include?('release')
39
+ execute('git checkout master')
40
+ execute('git merge develop')
41
+ execute('git push')
42
+ end
43
+
44
+ execute('bundle exec rspec')
45
+ execute('gem build will_filter.gemspec')
46
+ execute("gem install will_filter-#{version}.gem --no-ri --no-rdoc")
47
+
48
+ if ARGV.include?('release')
49
+ execute("git tag #{version}")
50
+ execute('git push --tags')
51
+
52
+ execute("gem push will_filter-#{version}.gem")
53
+
54
+ execute('git checkout develop')
55
+
56
+ increment_version
57
+ execute("git add #{version_file_path}")
58
+ execute("git commit -m 'Updated version to #{version}'")
59
+ execute('git push')
60
+ end
61
+
62
+
63
+