hot-glue 0.6.3.1 → 0.6.3.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a7f159816e4a57c69d46d17fc9de3a1d01cfc5119f9a3533ad4b0b41889dd721
4
- data.tar.gz: 6acd304e907a2b1518b9e243a04e5d937ab14a1bb4697b455480c2697eb5c031
3
+ metadata.gz: 76d714abff8aa0f8fd8f763d80d281bfad48b73f22264721a65aa8c4113895cd
4
+ data.tar.gz: c86b9c53e75cb794a9798ed3b112358c8ee6af2928c0d435486f2988a6fc5e38
5
5
  SHA512:
6
- metadata.gz: d44841aef402fa110552d2418a3a266bde9ff5e4ad161c8974cf16c192300aa335db9bd7471a8d2dafe166ead5254f7914c20f0a26d4e125122f2d10e12fd547
7
- data.tar.gz: b072b894e68efcd0dd88beeab4b09048fae8cd2f5591bf99e8ec4f94006b36ece8117344b20b371942c5dcf7c6aa17e26aea1991a4b3243f9fe0633b648cc195
6
+ metadata.gz: d794abf688a43ccd316547c35586938d6963c61e1194df2fd02efd434ab964f77f8eb5fba4f85a02f3d31ece2ad05a2282c1e31d07576048a3c4b88dbe1b62c3
7
+ data.tar.gz: f1ebd911e9da38b7631ee357a1863ed7706d4cd016ce665c70bca088ba6d537bc3e0264ecd64c0e957ca8973766d91d8fd24e76f4dc5739911859813604ea3b0
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- hot-glue (0.6.3)
4
+ hot-glue (0.6.3.2)
5
5
  ffaker (~> 2.16)
6
6
  kaminari (~> 1.2)
7
7
  rails (> 5.1)
@@ -201,8 +201,8 @@ module HotGlue
201
201
  end
202
202
 
203
203
  def boolean_query_constructor(field, search)
204
- unless search.blank?
205
- ["#{field} = ?", search]
204
+ unless search == "-1"
205
+ ["#{field} IS #{search ? 'TRUE' : 'FALSE'}"]
206
206
  else
207
207
  nil
208
208
  end
@@ -75,6 +75,14 @@ class BooleanField < Field
75
75
  end
76
76
  end
77
77
 
78
+ def truthy_value
79
+ modify_as[:binary][:truthy] || 'Yes'
80
+ end
81
+
82
+ def falsy_value
83
+ modify_as[:binary][:falsy] || 'No'
84
+ end
85
+
78
86
  def label_class
79
87
  super + " form-check-label"
80
88
  end
@@ -82,22 +90,21 @@ class BooleanField < Field
82
90
 
83
91
 
84
92
  def search_field_output
85
- " <%= f.radio_button('q[0][#{name}_match]', '-1', checked: @q[\'0\']['#{name}_match']==-1 ? '' : 'checked', class: '#{@layout_strategy.form_checkbox_input_class}') %>\n" +
93
+ " <%= f.radio_button('q[0][#{name}_match]', '-1', checked: @q[\'0\'][:#{name}_match]=='-1' ? 'checked' : '', class: '#{@layout_strategy.form_checkbox_input_class}') %>\n" +
86
94
  " <%= f.label('All', value: '-1', for: 'q[0][#{name}_match]_-1' ) %>\n" +
87
- " <%= f.radio_button('q[0][#{name}_match]', '0', checked: @q[\'0\']['#{name}_match']==0 ? '' : 'checked', class: '#{@layout_strategy.form_checkbox_input_class}') %>\n" +
88
- " <%= f.label('No', value: '0'}', for: 'q[0][#{name}_match]_0') %>\n" +
89
- " <br /> <%= f.radio_button('q[0][#{name}_match]', '1', checked: @q[\'0\']['#{name}_match']==1 ? 'checked' : '' , class: '#{@layout_strategy.form_checkbox_input_class}') %>\n" +
90
- " <%= f.label('Yes', value: '1'}', for: 'q[0][#{name}_match]_1') %>\n"
91
-
95
+ " <%= f.radio_button('q[0][#{name}_match]', '0', checked: @q[\'0\'][:#{name}_match]=='0' ? 'checked' : '', class: '#{@layout_strategy.form_checkbox_input_class}') %>\n" +
96
+ " <%= f.label('#{falsy_value}', value: '0', for: 'q[0][#{name}_match]_0') %>\n" +
97
+ " <br /> <%= f.radio_button('q[0][#{name}_match]', '1', checked: @q[\'0\'][:#{name}_match]=='1' ? 'checked' : '' , class: '#{@layout_strategy.form_checkbox_input_class}') %>\n" +
98
+ " <%= f.label('#{truthy_value}', value: '1', for: 'q[0][#{name}_match]_1') %>\n"
92
99
  end
93
100
 
94
101
 
95
102
  def where_query_statement
96
- ".where('#{name} ILIKE ?', #{name}_query)"
103
+ ".where(#{name}_query)"
97
104
  end
98
105
 
99
106
  def load_all_query_statement
100
- "#{name}_query = boolean_query_constructor(@q['0'][:#{name}_match], @q['0'][:#{name}_search])"
107
+ "#{name}_query = boolean_query_constructor(:#{name}, @q['0'][:#{name}_match])"
101
108
  end
102
109
 
103
110
  # def code_to_reset_match_if_search_is_blank
@@ -61,12 +61,12 @@ class DateTimeField < Field
61
61
  "\n <%= datetime_local_field 'q[0]', '#{name}_search_end', {value: @q[\'0\'][:#{name}_search_end], autocomplete: 'off', size: 40, class: 'form-control', placeholder: 'end' , 'data-date-range-picker-target': 'end' } %>" +
62
62
  "\n </div>"
63
63
  else
64
- " <%= f.radio_button('q[0][#{name}_match]', '-1', checked: @q[\'0\']['#{name}_match']=='-1' ? 'checked' : '', class: '#{@layout_strategy.form_checkbox_input_class}') %>\n" +
64
+ " <%= f.radio_button('q[0][#{name}_match]', '-1', checked: @q[\'0\'][:#{name}_match]=='-1' ? 'checked' : '', class: '#{@layout_strategy.form_checkbox_input_class}') %>\n" +
65
65
  " <%= f.label('All', value: '-1', for: 'q[0][#{name}_match]_-1' ) %>\n" +
66
- " <%= f.radio_button('q[0][#{name}_match]', '0', checked: @q[\'0\']['#{name}_match']=='0' ? 'checked' : '', class: '#{@layout_strategy.form_checkbox_input_class}') %>\n" +
67
- " <%= f.label('No', value: '0', for: 'q[0][#{name}_match]_0') %>\n" +
68
- " <%= f.radio_button('q[0][#{name}_match]', '1', checked: @q[\'0\']['#{name}_match']=='1' ? 'checked' : '' , class: '#{@layout_strategy.form_checkbox_input_class}') %>\n" +
69
- " <%= f.label('Yes', value: '1', for: 'q[0][#{name}_match]_1') %>\n" +
66
+ " <br /><%= f.radio_button('q[0][#{name}_match]', '0', checked: @q[\'0\'][:#{name}_match]=='0' ? 'checked' : '', class: '#{@layout_strategy.form_checkbox_input_class}') %>\n" +
67
+ " <%= f.label('#{modify_as[:binary][:falsy]}', value: '0', for: 'q[0][#{name}_match]_0') %>\n" +
68
+ " <br /><%= f.radio_button('q[0][#{name}_match]', '1', checked: @q[\'0\'][:#{name}_match]=='1' ? 'checked' : '', class: '#{@layout_strategy.form_checkbox_input_class}') %>\n" +
69
+ " <%= f.label('#{modify_as[:binary][:truthy]}', value: '1', for: 'q[0][#{name}_match]_1') %>\n" +
70
70
  "<br />"
71
71
  end
72
72
  end
@@ -96,25 +96,26 @@ module HotGlue
96
96
  res << "<div class=\"#{@layout_strategy.row_classes} search--#{@plural}\">"
97
97
 
98
98
  res << columns.map{ |column|
99
- if (column & @search_fields.collect(&:to_sym )).size > 0
100
- " <div class='#{column_classes} search-cell--#{singular}--#{column.join("-")}' >" +
101
- column.map { |col|
102
- if @search_fields.collect(&:to_sym).include?(col)
103
- label_class = columns_map[col].label_class
104
- label_for = columns_map[col].label_for
105
- the_label = "\n<label class='#{label_class}' for='search-#{label_for}'>#{col.to_s.humanize}</label>"
106
- search_field_result = columns_map[col].search_field_output
107
-
108
- add_spaces_each_line( "\n <span class='' >\n" +
109
- add_spaces_each_line( (form_labels_position == 'before' ? the_label || "" : "") +
110
- + " <br />\n" + search_field_result +
111
- (form_labels_position == 'after' ? the_label : "") , 4) +
112
- "\n </span>\n <br /></div>", 2)
113
- end
99
+ cols_result = column.map { |col|
100
+ if @search_fields.collect(&:to_sym).include?(col)
101
+ label_class = columns_map[col].label_class
102
+ label_for = columns_map[col].label_for
103
+ the_label = "\n<label class='#{label_class}' for='search-#{label_for}'>#{col.to_s.humanize}</label>"
104
+ search_field_result = columns_map[col].search_field_output
105
+
106
+ add_spaces_each_line( "\n <span class='' >\n" +
107
+ add_spaces_each_line( (form_labels_position == 'before' ? the_label || "" : "") +
108
+ + " <br />\n" + search_field_result +
109
+ (form_labels_position == 'after' ? the_label : "") , 4) +
110
+ "\n </span>\n <br />", 2)
111
+ end
112
+ }.compact.join("\n")
113
+
114
+ " <div class='#{column_classes} search-cell--#{singular}--#{column.join("-")}' >" +
115
+ cols_result + "</div>"
114
116
 
115
- }.join("\n")
116
- end
117
117
  }.join("\n")
118
+ res << "</div>"
118
119
  res << "<div class='#{column_classes}'>"
119
120
  if @search_clear_button
120
121
  res << "<\%= f.button \"Clear\", name: nil, 'data-search-form-target': 'clearButton', class: 'btn btn-sm btn-secondary' %>"
@@ -77,7 +77,8 @@ class <%= controller_class_name %> < <%= controller_descends_from %>
77
77
  end
78
78
 
79
79
  def index <% if @search == "set" %>
80
- @q = params[:q] || <%= {"0" => @search_fields.collect{|foo| {"#{foo}_match".to_sym => "", "#{foo}_search".to_sym => ""}}.reduce({}, :merge) } %> <% end %><% if @search_fields %>
80
+ @q = params[:q] || <%= {"0" => @search_fields.collect{|foo|
81
+ {"#{foo}_match".to_sym => ((@columns_map[foo.to_sym].modify_as && @columns_map[foo.to_sym].modify_as[:binary]) ? "-1" : ""), "#{foo}_search".to_sym => ""}}.reduce({}, :merge) } %> <% end %><% if @search_fields %>
81
82
  <%= @search_fields.collect{|field_name| @columns_map[field_name.to_sym].code_to_reset_match_if_search_is_blank}.compact.join(" \n") %><% end %>
82
83
  load_all_<%= plural %><% if @pundit %><% if @pundit %>
83
84
  authorize @<%= plural_name %><% end %>
@@ -42,7 +42,11 @@
42
42
  <% end %>
43
43
 
44
44
  <% if @search %>
45
+ <div class="card">
46
+ <div class="card-body">
45
47
  <%= @template_builder.search_input_area %>
48
+ </div>
49
+ </div>
46
50
  <% end %>
47
51
 
48
52
  <\% if <%= plural %>.empty? %>
@@ -1,5 +1,5 @@
1
1
  module HotGlue
2
2
  class Version
3
- CURRENT = '0.6.3.1'
3
+ CURRENT = '0.6.3.2'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hot-glue
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.3.1
4
+ version: 0.6.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Fleetwood-Boldt
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-01-16 00:00:00.000000000 Z
11
+ date: 2024-01-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails