hot-glue 0.4.1 → 0.4.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/FUNDING.yml +2 -1
- data/Gemfile +4 -4
- data/Gemfile.lock +18 -18
- data/{LICENCE → LICENSE} +10 -6
- data/README.md +811 -0
- data/config/database.yml +83 -8
- data/config/hot_glue.yml +3 -0
- data/db/schema.rb +3 -3
- data/lib/generators/hot_glue/helpers.rb +13 -0
- data/lib/generators/hot_glue/install_generator.rb +47 -16
- data/lib/generators/hot_glue/layout/builder.rb +117 -0
- data/lib/generators/hot_glue/markup_templates/erb.rb +160 -181
- data/lib/generators/hot_glue/markup_templates/haml.rb +7 -2
- data/lib/generators/hot_glue/scaffold_generator.rb +119 -88
- data/lib/generators/hot_glue/templates/controller.rb.erb +1 -1
- data/lib/generators/hot_glue/templates/erb/_form.erb +1 -1
- data/lib/generators/hot_glue/templates/erb/_list.erb +9 -12
- data/lib/generators/hot_glue/templates/erb/_show.erb +10 -10
- data/lib/generators/hot_glue/templates/system_spec.rb.erb +37 -26
- data/lib/hotglue/version.rb +1 -1
- metadata +9 -36
- data/db/migrate/20210306212711_create_abcs.rb +0 -11
- data/db/migrate/20210306223300_create_defs.rb +0 -9
- data/db/migrate/20210306223305_create_ghis.rb +0 -9
- data/db/migrate/20210306223309_create_jkls.rb +0 -9
- data/db/migrate/20210306223701_devise_create_users.rb +0 -44
- data/db/migrate/20210306225506_create_xyzs.rb +0 -9
@@ -5,10 +5,8 @@ module HotGlue
|
|
5
5
|
attr_accessor :singular
|
6
6
|
|
7
7
|
def field_output(col, type = nil, width, col_identifier )
|
8
|
-
"<div class='#{col_identifier} form-group <%='alert-danger' if @#{singular}.errors.details.keys.include?(:#{col.to_s})%>' > \n" +
|
9
8
|
" <%= f.text_field :#{col.to_s}, value: @#{@singular}.#{col.to_s}, autocomplete: 'off', size: #{width}, class: 'form-control', type: '#{type}' %>\n "+
|
10
|
-
" <label class='form-text' >#{col.to_s.humanize}</label>\n"
|
11
|
-
"</div>"
|
9
|
+
" <label class='form-text' >#{col.to_s.humanize}</label>\n"
|
12
10
|
end
|
13
11
|
|
14
12
|
|
@@ -17,11 +15,12 @@ module HotGlue
|
|
17
15
|
path_helper_args = args[0][:path_helper_args]
|
18
16
|
singular = args[0][:singular]
|
19
17
|
magic_buttons = args[0][:magic_buttons]
|
18
|
+
small_buttons = args[0][:small_buttons]
|
20
19
|
|
21
20
|
magic_buttons.collect{ |button_name|
|
22
|
-
"<%= form_with model: #{singular}, url: #{path_helper_singular}(#{path_helper_args}) do |f| %>
|
21
|
+
"<%= form_with model: #{singular}, url: #{path_helper_singular}(#{path_helper_args}), html: {style: 'display: inline', , data: {turbo-confirm: 'Are you sure you want to #{button_name} this #{singular}?'}} do |f| %>
|
23
22
|
<%= f.hidden_field :#{button_name}, value: \"#{button_name}\" %>
|
24
|
-
<%= f.submit '#{button_name.titleize}'.html_safe, disabled: (#{singular}.respond_to?(:#{button_name}able?) && ! #{singular}.#{button_name}able? ),
|
23
|
+
<%= f.submit '#{button_name.titleize}'.html_safe, disabled: (#{singular}.respond_to?(:#{button_name}able?) && ! #{singular}.#{button_name}able? ), class: '#{singular}-button btn btn-primary #{"btn-sm" if small_buttons}' %>
|
25
24
|
<% end %>"
|
26
25
|
}.join("\n")
|
27
26
|
end
|
@@ -32,28 +31,31 @@ module HotGlue
|
|
32
31
|
lines = 5
|
33
32
|
end
|
34
33
|
|
35
|
-
"<div class=\"#{col_identifier} form-group \#{'alert-danger' if #{singular}.errors.details.keys.include?(:#{col.to_s})}\">" +
|
36
34
|
"<%= f.text_area :#{col.to_s}, class: 'form-control', autocomplete: 'off', cols: 40, rows: '#{lines}' %>" +
|
37
|
-
"<label class='form-text'>#{col.to_s.humanize}</label>"
|
38
|
-
"</div>"
|
39
|
-
|
35
|
+
"<label class='form-text'>#{col.to_s.humanize}</label>"
|
40
36
|
end
|
41
37
|
|
42
38
|
def list_column_headings(*args)
|
43
|
-
|
39
|
+
layout_columns = args[0][:columns]
|
44
40
|
column_width = args[0][:column_width]
|
45
41
|
col_identifier = args[0][:col_identifier]
|
46
|
-
|
42
|
+
layout = args[0][:layout]
|
43
|
+
|
44
|
+
if layout == "hotglue"
|
47
45
|
col_style = " style='flex-basis: #{column_width}%'"
|
48
46
|
else
|
49
47
|
col_style = ""
|
50
48
|
end
|
51
|
-
|
49
|
+
|
50
|
+
result = layout_columns.map{ |column|
|
51
|
+
"<div class='#{col_identifier}'" + col_style + ">" + column.map(&:to_s).map{|col_name| "#{col_name.humanize}"}.join("<br />") + "</div>"
|
52
|
+
}.join("\n")
|
53
|
+
return result
|
52
54
|
end
|
53
55
|
|
54
56
|
|
55
57
|
def all_form_fields(*args)
|
56
|
-
|
58
|
+
layout_columns = args[0][:columns]
|
57
59
|
show_only = args[0][:show_only]
|
58
60
|
singular_class = args[0][:singular_class]
|
59
61
|
col_identifier = args[0][:col_identifier]
|
@@ -63,99 +65,86 @@ module HotGlue
|
|
63
65
|
@singular = args[0][:singular]
|
64
66
|
singular = @singular
|
65
67
|
|
66
|
-
|
67
|
-
|
68
68
|
col_spaces_prepend = " "
|
69
69
|
|
70
|
-
res = columns.map { |col|
|
71
|
-
|
72
|
-
if show_only.include?(col)
|
73
70
|
|
74
|
-
|
75
|
-
|
76
|
-
"<label class='form-text'>#{col.to_s.humanize}</label>" +
|
77
|
-
"</div>"
|
71
|
+
result = layout_columns.map{ |column|
|
72
|
+
"<div class='#{col_identifier}' >" +
|
78
73
|
|
79
|
-
|
74
|
+
column.map { |col|
|
80
75
|
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
76
|
+
field_result = if show_only.include?(col)
|
77
|
+
"<%= @#{singular}.#{col.to_s} %>" +
|
78
|
+
"<label class='form-text'>#{col.to_s.humanize}</label>"
|
79
|
+
else
|
80
|
+
type = eval("#{singular_class}.columns_hash['#{col}']").type
|
81
|
+
limit = eval("#{singular_class}.columns_hash['#{col}']").limit
|
82
|
+
sql_type = eval("#{singular_class}.columns_hash['#{col}']").sql_type
|
83
|
+
|
84
|
+
case type
|
85
|
+
when :integer
|
86
|
+
# look for a belongs_to on this object
|
87
|
+
if col.to_s.ends_with?("_id")
|
88
|
+
assoc_name = col.to_s.gsub("_id","")
|
89
|
+
assoc = eval("#{singular_class}.reflect_on_association(:#{assoc_name})")
|
90
|
+
if assoc.nil?
|
91
|
+
exit_message= "*** Oops. on the #{singular_class} object, there doesn't seem to be an association called '#{assoc_name}'"
|
92
|
+
exit
|
93
|
+
end
|
94
|
+
display_column = HotGlue.derrive_reference_name(assoc.class_name)
|
95
|
+
"<%= f.collection_select(:#{col.to_s}, #{assoc.class_name}.all, :id, :#{display_column}, {prompt: true, selected: @#{singular}.#{col.to_s} }, class: 'form-control') %>
|
96
|
+
<label class='small form-text text-muted'>#{col.to_s.humanize}</label>"
|
97
|
+
|
98
|
+
else
|
99
|
+
"<%= f.text_field :#{col.to_s}, value: #{singular}.#{col.to_s}, class: 'form-control', size: 4, type: 'number' %>
|
100
|
+
<label class='small form-text text-muted'>#{col.to_s.humanize}</label>"
|
101
|
+
|
102
|
+
end
|
103
|
+
when :string
|
104
|
+
if sql_type == "varchar" || sql_type == "character varying"
|
105
|
+
field_output(col, nil, limit || 40, col_identifier)
|
106
|
+
else
|
107
|
+
text_area_output(col, 65536, col_identifier)
|
108
|
+
end
|
109
|
+
|
110
|
+
when :text
|
111
|
+
if sql_type == "varchar"
|
112
|
+
field_output(col, nil, limit, col_identifier)
|
113
|
+
else
|
114
|
+
text_area_output(col, 65536, col_identifier)
|
115
|
+
end
|
116
|
+
when :float
|
117
|
+
field_output(col, nil, 5, col_identifier)
|
118
|
+
when :datetime
|
119
|
+
"<%= datetime_field_localized(f, :#{col.to_s}, #{singular}.#{col.to_s}, '#{ col.to_s.humanize }', #{@auth ? @auth+'.timezone' : 'nil'}) %>"
|
120
|
+
when :date
|
121
|
+
"<%= date_field_localized(f, :#{col.to_s}, #{singular}.#{col.to_s}, '#{ col.to_s.humanize }', #{@auth ? @auth+'.timezone' : 'nil'}) %>"
|
122
|
+
when :time
|
123
|
+
"<%= time_field_localized(f, :#{col.to_s}, #{singular}.#{col.to_s}, '#{ col.to_s.humanize }', #{@auth ? @auth+'.timezone' : 'nil'}) %>"
|
124
|
+
when :boolean
|
125
|
+
" " +
|
126
|
+
" <span>#{col.to_s.humanize}</span>" +
|
127
|
+
" <%= f.radio_button(:#{col.to_s}, '0', checked: #{singular}.#{col.to_s} ? '' : 'checked') %>\n" +
|
128
|
+
" <%= f.label(:#{col.to_s}, value: 'No', for: '#{singular}_#{col.to_s}_0') %>\n" +
|
129
|
+
" <%= f.radio_button(:#{col.to_s}, '1', checked: #{singular}.#{col.to_s} ? 'checked' : '') %>\n" +
|
130
|
+
" <%= f.label(:#{col.to_s}, value: 'Yes', for: '#{singular}_#{col.to_s}_1') %>\n" +
|
131
|
+
""
|
132
|
+
when :enum
|
133
|
+
enum_type = eval("#{singular_class}.columns.select{|x| x.name == '#{col.to_s}'}[0].sql_type")
|
134
|
+
"<%= f.collection_select(:#{col.to_s}, enum_to_collection_select( #{singular_class}.defined_enums['#{enum_type}']), :key, :value, {selected: @#{singular}.#{col.to_s} }, class: 'form-control') %>
|
135
|
+
<label class='small form-text text-muted'>#{col.to_s.humanize}</label>"
|
95
136
|
end
|
96
|
-
|
97
|
-
|
98
|
-
"<div class='#{col_identifier} form-group <%= 'alert-danger' if #{singular}.errors.details.keys.include?(:#{assoc_name.to_s}) %>' >
|
99
|
-
<%= f.collection_select(:#{col.to_s}, #{assoc.class_name}.all, :id, :#{display_column}, {prompt: true, selected: @#{singular}.#{col.to_s} }, class: 'form-control') %>
|
100
|
-
<label class='small form-text text-muted'>#{col.to_s.humanize}</label></div>"
|
101
|
-
|
102
|
-
else
|
103
|
-
"<div class=\"#{col_identifier} form-group <%= 'alert-danger' if #{singular}.errors.details.keys.include?(:#{col}) %> \" >
|
104
|
-
<%= f.text_field :#{col.to_s}, value: #{singular}.#{col.to_s}, class: 'form-control', size: 4, type: 'number' %>
|
105
|
-
<label class='small form-text text-muted'>#{col.to_s.humanize}</label></div>"
|
106
|
-
|
107
|
-
end
|
108
|
-
when :string
|
109
|
-
if sql_type == "varchar" || sql_type == "character varying"
|
110
|
-
field_output(col, nil, limit || 40, col_identifier)
|
111
|
-
else
|
112
|
-
text_area_output(col, 65536, col_identifier)
|
113
|
-
end
|
114
|
-
|
115
|
-
when :text
|
116
|
-
if sql_type == "varchar"
|
117
|
-
field_output(col, nil, limit, col_identifier)
|
118
|
-
else
|
119
|
-
text_area_output(col, 65536, col_identifier)
|
120
|
-
end
|
121
|
-
when :float
|
122
|
-
field_output(col, nil, 5, col_identifier)
|
123
|
-
when :datetime
|
124
|
-
|
125
|
-
|
126
|
-
"<div class='col form-group <%='alert-danger' if @#{singular}.errors.details.keys.include?(:#{col.to_s})%>' > \n" +
|
127
|
-
"<%= datetime_field_localized(f, :#{col.to_s}, #{singular}.#{col.to_s}, '#{ col.to_s.humanize }', #{@auth ? @auth+'.timezone' : 'nil'}) %>" +
|
128
|
-
"</div>"
|
129
|
-
when :date
|
130
|
-
"<div class='col form-group <%='alert-danger' if @#{singular}.errors.details.keys.include?(:#{col.to_s})%>' > \n" +
|
131
|
-
"<%= date_field_localized(f, :#{col.to_s}, #{singular}.#{col.to_s}, '#{ col.to_s.humanize }', #{@auth ? @auth+'.timezone' : 'nil'}) %>" +
|
132
|
-
"</div>"
|
133
|
-
when :time
|
134
|
-
"<div class='col form-group <%='alert-danger' if @#{singular}.errors.details.keys.include?(:#{col.to_s})%>' > \n" +
|
135
|
-
"<%= time_field_localized(f, :#{col.to_s}, #{singular}.#{col.to_s}, '#{ col.to_s.humanize }', #{@auth ? @auth+'.timezone' : 'nil'}) %>" +
|
136
|
-
"</div>"
|
137
|
-
|
138
|
-
when :boolean
|
139
|
-
"<div class='col form-group <%='alert-danger' if @#{singular}.errors.details.keys.include?(:#{col.to_s})%>' > \n" +
|
140
|
-
" <span>#{col.to_s.humanize}</span>" +
|
141
|
-
" <%= f.radio_button(:#{col.to_s}, '0', checked: #{singular}.#{col.to_s} ? '' : 'checked') %>\n" +
|
142
|
-
" <%= f.label(:#{col.to_s}, value: 'No', for: '#{singular}_#{col.to_s}_0') %>\n" +
|
143
|
-
" <%= f.radio_button(:#{col.to_s}, '1', checked: #{singular}.#{col.to_s} ? 'checked' : '') %>\n" +
|
144
|
-
" <%= f.label(:#{col.to_s}, value: 'Yes', for: '#{singular}_#{col.to_s}_1') %>\n" +
|
145
|
-
"</div>"
|
146
|
-
when :enum
|
147
|
-
enum_name = "enum_name"
|
148
|
-
# byebug
|
149
|
-
enum_type = eval("#{singular_class}.columns.select{|x| x.name == '#{col.to_s}'}[0].sql_type")
|
150
|
-
"<div class='#{col_identifier} form-group <%= 'alert-danger' if #{singular}.errors.details.keys.include?(:#{col.to_s}) %>' >
|
151
|
-
<%= f.collection_select(:#{col.to_s}, enum_to_collection_select( #{singular_class}.defined_enums['#{enum_type}']), :key, :value, {prompt: true, selected: @#{singular}.#{col.to_s} }, class: 'form-control') %>
|
152
|
-
<label class='small form-text text-muted'>#{col.to_s.humanize}</label></div>"
|
137
|
+
end
|
153
138
|
|
139
|
+
if (type == :integer) && col.to_s.ends_with?("_id")
|
140
|
+
field_error_name = col.to_s.gsub("_id","")
|
141
|
+
else
|
142
|
+
field_error_name = col.to_s
|
154
143
|
end
|
155
|
-
|
156
|
-
|
144
|
+
"<span class='<%= \"alert-danger\" if #{singular}.errors.details.keys.include?(:#{field_error_name}) %>' #{ 'style="display: inherit;"'} >" + field_result + "</span>"
|
145
|
+
}.join("<br />\n") + "</div>"
|
157
146
|
}.join("\n")
|
158
|
-
return
|
147
|
+
return result
|
159
148
|
end
|
160
149
|
|
161
150
|
|
@@ -167,116 +156,106 @@ module HotGlue
|
|
167
156
|
end
|
168
157
|
|
169
158
|
def all_line_fields(*args)
|
170
|
-
|
159
|
+
layout_columns = args[0][:columns]
|
171
160
|
show_only = args[0][:show_only]
|
172
161
|
singular_class = args[0][:singular_class]
|
173
162
|
singular = args[0][:singular]
|
174
163
|
perc_width = args[0][:perc_width]
|
175
164
|
layout = args[0][:layout]
|
176
165
|
|
177
|
-
columns_count =
|
166
|
+
columns_count = layout_columns.count + 1
|
178
167
|
perc_width = (perc_width).floor
|
179
168
|
|
180
169
|
if layout == "bootstrap"
|
181
|
-
col_identifer = "col"
|
170
|
+
col_identifer = "col-md-2"
|
182
171
|
style_with_flex_basis = ""
|
183
172
|
else
|
184
173
|
style_with_flex_basis = " style='flex-basis: #{perc_width}%'"
|
185
174
|
col_identifer = "scaffold-cell"
|
186
175
|
end
|
187
176
|
|
177
|
+
result = layout_columns.map{ |column|
|
178
|
+
"<div class='#{col_identifer}'#{style_with_flex_basis}>" +
|
188
179
|
|
189
|
-
columns.map { |col|
|
190
|
-
type = eval("#{singular_class}.columns_hash['#{col}']").type
|
191
|
-
limit = eval("#{singular_class}.columns_hash['#{col}']").limit
|
192
|
-
sql_type = eval("#{singular_class}.columns_hash['#{col}']").sql_type
|
193
180
|
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
181
|
+
column.map { |col|
|
182
|
+
type = eval("#{singular_class}.columns_hash['#{col}']").type
|
183
|
+
limit = eval("#{singular_class}.columns_hash['#{col}']").limit
|
184
|
+
sql_type = eval("#{singular_class}.columns_hash['#{col}']").sql_type
|
198
185
|
|
199
|
-
|
186
|
+
case type
|
187
|
+
when :integer
|
188
|
+
# look for a belongs_to on this object
|
189
|
+
if col.to_s.ends_with?("_id")
|
200
190
|
|
191
|
+
assoc_name = col.to_s.gsub("_id","")
|
201
192
|
|
202
|
-
assoc = eval("#{singular_class}.reflect_on_association(:#{assoc_name})")
|
203
193
|
|
204
|
-
|
205
|
-
exit_message = "*** Oops. on the #{singular_class} object, there doesn't seem to be an association called '#{assoc_name}'"
|
206
|
-
puts exit_message
|
207
|
-
exit
|
208
|
-
# raise(HotGlue::Error,exit_message)
|
209
|
-
end
|
194
|
+
assoc = eval("#{singular_class}.reflect_on_association(:#{assoc_name})")
|
210
195
|
|
211
|
-
|
196
|
+
if assoc.nil?
|
197
|
+
exit_message = "*** Oops. on the #{singular_class} object, there doesn't seem to be an association called '#{assoc_name}'"
|
198
|
+
puts exit_message
|
199
|
+
exit
|
200
|
+
# raise(HotGlue::Error,exit_message)
|
201
|
+
end
|
212
202
|
|
213
|
-
|
214
|
-
<%= #{singular}.#{assoc.name.to_s}.try(:#{display_column}) || '<span class=\"content alert-danger\">MISSING</span>'.html_safe %>
|
215
|
-
</div>"
|
203
|
+
display_column = HotGlue.derrive_reference_name(assoc.class_name)
|
216
204
|
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
<%= #{singular}.#{col}
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
<%= #{singular}.#{col} %>
|
233
|
-
</div>"
|
234
|
-
when :datetime
|
235
|
-
|
236
|
-
"<div class='#{col_identifer}' #{style_with_flex_basis} >
|
237
|
-
<% unless #{singular}.#{col}.nil? %>
|
238
|
-
<%= #{singular}.#{col}.in_time_zone(current_timezone).strftime('%m/%d/%Y @ %l:%M %p ') + timezonize(current_timezone) %>
|
239
|
-
<% else %>
|
240
|
-
<span class='alert-danger'>MISSING</span>
|
241
|
-
<% end %>
|
242
|
-
</div>"
|
243
|
-
when :date
|
244
|
-
"<div class='#{col_identifer}' #{style_with_flex_basis} >
|
245
|
-
<% unless #{singular}.#{col}.nil? %>
|
246
|
-
<%= #{singular}.#{col} %>
|
205
|
+
"<%= #{singular}.#{assoc.name.to_s}.try(:#{display_column}) || '<span class=\"content alert-danger\">MISSING</span>'.html_safe %>"
|
206
|
+
|
207
|
+
else
|
208
|
+
"<%= #{singular}.#{col}%>"
|
209
|
+
end
|
210
|
+
when :float
|
211
|
+
width = (limit && limit < 40) ? limit : (40)
|
212
|
+
"<%= #{singular}.#{col}%>"
|
213
|
+
when :string
|
214
|
+
width = (limit && limit < 40) ? limit : (40)
|
215
|
+
"<%= #{singular}.#{col} %>"
|
216
|
+
when :text
|
217
|
+
"<%= #{singular}.#{col} %>"
|
218
|
+
when :datetime
|
219
|
+
"<% unless #{singular}.#{col}.nil? %>
|
220
|
+
<%= #{singular}.#{col}.in_time_zone(current_timezone).strftime('%m/%d/%Y @ %l:%M %p ') + timezonize(current_timezone) %>
|
247
221
|
<% else %>
|
248
222
|
<span class='alert-danger'>MISSING</span>
|
249
|
-
<% end %>
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
</
|
278
|
-
|
279
|
-
|
223
|
+
<% end %>"
|
224
|
+
when :date
|
225
|
+
"<% unless #{singular}.#{col}.nil? %>
|
226
|
+
<%= #{singular}.#{col} %>
|
227
|
+
<% else %>
|
228
|
+
<span class='alert-danger'>MISSING</span>
|
229
|
+
<% end %>"
|
230
|
+
when :time
|
231
|
+
"<% unless #{singular}.#{col}.nil? %>
|
232
|
+
<%= #{singular}.#{col}.in_time_zone(current_timezone).strftime('%l:%M %p ') + timezonize(current_timezone) %>
|
233
|
+
<% else %>
|
234
|
+
<span class='alert-danger'>MISSING</span>
|
235
|
+
<% end %>"
|
236
|
+
when :boolean
|
237
|
+
"
|
238
|
+
<% if #{singular}.#{col}.nil? %>
|
239
|
+
<span class='alert-danger'>MISSING</span>
|
240
|
+
<% elsif #{singular}.#{col} %>
|
241
|
+
YES
|
242
|
+
<% else %>
|
243
|
+
NO
|
244
|
+
<% end %>
|
245
|
+
|
246
|
+
" when :enum
|
247
|
+
enum_type = eval("#{singular_class}.columns.select{|x| x.name == '#{col.to_s}'}[0].sql_type")
|
248
|
+
|
249
|
+
"
|
250
|
+
<% if #{singular}.#{col}.nil? %>
|
251
|
+
<span class='alert-danger'>MISSING</span>
|
252
|
+
<% else %>
|
253
|
+
<%= #{singular_class}.defined_enums['#{enum_type}'][#{singular}.#{col}] %>
|
254
|
+
<% end %>
|
255
|
+
|
256
|
+
"
|
257
|
+
end #end of switch
|
258
|
+
}.join("<br />") + "</div>"
|
280
259
|
}.join("\n")
|
281
260
|
end
|
282
261
|
end
|
@@ -31,6 +31,7 @@ module HotGlue
|
|
31
31
|
show_only = args[0][:show_only]
|
32
32
|
singular_class = args[0][:singular_class]
|
33
33
|
|
34
|
+
|
34
35
|
# TODO: CLEAN ME
|
35
36
|
@singular = args[0][:singular]
|
36
37
|
singular = @singular
|
@@ -137,11 +138,15 @@ module HotGlue
|
|
137
138
|
show_only = args[0][:show_only]
|
138
139
|
singular_class = args[0][:singular_class]
|
139
140
|
singular = args[0][:singular]
|
141
|
+
layout = args[0][:layout]
|
140
142
|
|
141
143
|
columns_count = columns.count + 1
|
142
144
|
perc_width = (100/columns_count).floor
|
143
|
-
|
144
|
-
|
145
|
+
if @layout == 'bootstrap'
|
146
|
+
col_identifer = ".col-md-2"
|
147
|
+
else
|
148
|
+
col_identifer = ".col"
|
149
|
+
end
|
145
150
|
columns.map { |col|
|
146
151
|
type = eval("#{singular_class}.columns_hash['#{col}']").type
|
147
152
|
limit = eval("#{singular_class}.columns_hash['#{col}']").limit
|