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 +4 -4
- data/Gemfile.lock +1 -1
- data/app/helpers/hot_glue/controller_helper.rb +2 -2
- data/lib/generators/hot_glue/fields/boolean_field.rb +15 -8
- data/lib/generators/hot_glue/fields/date_time_field.rb +5 -5
- data/lib/generators/hot_glue/markup_templates/erb.rb +18 -17
- data/lib/generators/hot_glue/templates/controller.rb.erb +2 -1
- data/lib/generators/hot_glue/templates/erb/_list.erb +4 -0
- data/lib/hotglue/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 76d714abff8aa0f8fd8f763d80d281bfad48b73f22264721a65aa8c4113895cd
|
4
|
+
data.tar.gz: c86b9c53e75cb794a9798ed3b112358c8ee6af2928c0d435486f2988a6fc5e38
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d794abf688a43ccd316547c35586938d6963c61e1194df2fd02efd434ab964f77f8eb5fba4f85a02f3d31ece2ad05a2282c1e31d07576048a3c4b88dbe1b62c3
|
7
|
+
data.tar.gz: f1ebd911e9da38b7631ee357a1863ed7706d4cd016ce665c70bca088ba6d537bc3e0264ecd64c0e957ca8973766d91d8fd24e76f4dc5739911859813604ea3b0
|
data/Gemfile.lock
CHANGED
@@ -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\'][
|
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\'][
|
88
|
-
" <%= f.label('
|
89
|
-
" <br /> <%= f.radio_button('q[0][#{name}_match]', '1', checked: @q[\'0\'][
|
90
|
-
" <%= f.label('
|
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(
|
103
|
+
".where(#{name}_query)"
|
97
104
|
end
|
98
105
|
|
99
106
|
def load_all_query_statement
|
100
|
-
"#{name}_query = boolean_query_constructor(
|
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\'][
|
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
|
-
"
|
67
|
-
" <%= f.label('
|
68
|
-
"
|
69
|
-
" <%= f.label('
|
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
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
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|
|
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 %>
|
data/lib/hotglue/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2024-01-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|