Class: HotGlue::ErbTemplate

Inherits:
TemplateBase show all
Defined in:
lib/generators/hot_glue/markup_templates/erb.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(singular:, singular_class:, layout_strategy:, magic_buttons:, small_buttons:, show_only:, ownership_field:, form_labels_position:, inline_list_labels:, form_placeholder_labels:, hawk_keys:, update_show_only:, attachments:, columns_map:, pundit:, related_sets:, search:, search_fields:, search_query_fields:, search_position:, search_clear_button:, search_autosearch:, layout_object:, form_path:, stimmify:, stimmify_camel:, hidden_create:, hidden_update:, invisible_create:, invisible_update:, plural:, phantom_search:, pagination_style:, namespace: nil, controller_build_folder: nil) ⇒ ErbTemplate

Returns a new instance of ErbTemplate.



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/generators/hot_glue/markup_templates/erb.rb', line 19

def initialize(singular:, singular_class: ,
             layout_strategy: , magic_buttons: ,
             small_buttons: , show_only: ,
             ownership_field: , form_labels_position: ,
             inline_list_labels: ,
             form_placeholder_labels:, hawk_keys: ,
             update_show_only:, attachments: , columns_map:, pundit:, related_sets:,
             search:, search_fields:, search_query_fields: , search_position:,
             search_clear_button:, search_autosearch:, layout_object:,
             form_path: , stimmify: , stimmify_camel:, hidden_create:, hidden_update: ,
             invisible_create:, invisible_update: , plural: , phantom_search:,
               pagination_style:, namespace: nil, controller_build_folder: nil )


  @form_path = form_path
  @search = search
  @search_fields = search_fields
  @search_by_query = search_query_fields
  @search_position = search_position
  @layout_object = layout_object
  @stimmify = stimmify
  @stimmify_camel = stimmify_camel
  @hidden_create = hidden_create
  @hidden_update = hidden_update
  @invisible_create = invisible_create
  @invisible_update = invisible_update
  @plural = plural

  @singular = singular
  @singular_class = singular_class
  @search_clear_button = search_clear_button
  @search_autosearch = search_autosearch

  @columns_map = columns_map

  @magic_buttons = magic_buttons
  @small_buttons = small_buttons
  @layout_strategy = layout_strategy
  @show_only = show_only
  @pundit = pundit
  @ownership_field = ownership_field

  @form_labels_position = form_labels_position

  @inline_list_labels = inline_list_labels
  @singular = singular
  @form_placeholder_labels = form_placeholder_labels
  @hawk_keys = hawk_keys
  @update_show_only = update_show_only
  @attachments = attachments
  @related_sets = related_sets
  @phantom_search = phantom_search
  @pagination_style = pagination_style
  @namespace = namespace
  @controller_build_folder = controller_build_folder
end

Instance Attribute Details

#attachmentsObject

Returns the value of attribute attachments.



4
5
6
# File 'lib/generators/hot_glue/markup_templates/erb.rb', line 4

def attachments
  @attachments
end

#col_identifierObject

Returns the value of attribute col_identifier.



4
5
6
# File 'lib/generators/hot_glue/markup_templates/erb.rb', line 4

def col_identifier
  @col_identifier
end

#columnsObject

Returns the value of attribute columns.



4
5
6
# File 'lib/generators/hot_glue/markup_templates/erb.rb', line 4

def columns
  @columns
end

#columns_mapObject

Returns the value of attribute columns_map.



4
5
6
# File 'lib/generators/hot_glue/markup_templates/erb.rb', line 4

def columns_map
  @columns_map
end

#controller_build_folderObject

Returns the value of attribute controller_build_folder.



4
5
6
# File 'lib/generators/hot_glue/markup_templates/erb.rb', line 4

def controller_build_folder
  @controller_build_folder
end

#form_labels_positionObject

Returns the value of attribute form_labels_position.



4
5
6
# File 'lib/generators/hot_glue/markup_templates/erb.rb', line 4

def form_labels_position
  @form_labels_position
end

#form_pathObject

Returns the value of attribute form_path.



4
5
6
# File 'lib/generators/hot_glue/markup_templates/erb.rb', line 4

def form_path
  @form_path
end

#form_placeholder_labelsObject

Returns the value of attribute form_placeholder_labels.



4
5
6
# File 'lib/generators/hot_glue/markup_templates/erb.rb', line 4

def form_placeholder_labels
  @form_placeholder_labels
end

#hawk_keysObject

Returns the value of attribute hawk_keys.



4
5
6
# File 'lib/generators/hot_glue/markup_templates/erb.rb', line 4

def hawk_keys
  @hawk_keys
end

#hidden_createObject

Returns the value of attribute hidden_create.



4
5
6
# File 'lib/generators/hot_glue/markup_templates/erb.rb', line 4

def hidden_create
  @hidden_create
end

#hidden_updateObject

Returns the value of attribute hidden_update.



4
5
6
# File 'lib/generators/hot_glue/markup_templates/erb.rb', line 4

def hidden_update
  @hidden_update
end

#inline_list_labelsObject

Returns the value of attribute inline_list_labels.



4
5
6
# File 'lib/generators/hot_glue/markup_templates/erb.rb', line 4

def inline_list_labels
  @inline_list_labels
end

#invisible_createObject

Returns the value of attribute invisible_create.



4
5
6
# File 'lib/generators/hot_glue/markup_templates/erb.rb', line 4

def invisible_create
  @invisible_create
end

#invisible_updateObject

Returns the value of attribute invisible_update.



4
5
6
# File 'lib/generators/hot_glue/markup_templates/erb.rb', line 4

def invisible_update
  @invisible_update
end

#layout_objectObject

Returns the value of attribute layout_object.



4
5
6
# File 'lib/generators/hot_glue/markup_templates/erb.rb', line 4

def layout_object
  @layout_object
end

#layout_strategyObject

Returns the value of attribute layout_strategy.



4
5
6
# File 'lib/generators/hot_glue/markup_templates/erb.rb', line 4

def layout_strategy
  @layout_strategy
end

#magic_buttonsObject

Returns the value of attribute magic_buttons.



4
5
6
# File 'lib/generators/hot_glue/markup_templates/erb.rb', line 4

def magic_buttons
  @magic_buttons
end

#namespaceObject

Returns the value of attribute namespace.



4
5
6
# File 'lib/generators/hot_glue/markup_templates/erb.rb', line 4

def namespace
  @namespace
end

#ownership_fieldObject

Returns the value of attribute ownership_field.



4
5
6
# File 'lib/generators/hot_glue/markup_templates/erb.rb', line 4

def ownership_field
  @ownership_field
end

#pagination_styleObject

Returns the value of attribute pagination_style.



4
5
6
# File 'lib/generators/hot_glue/markup_templates/erb.rb', line 4

def pagination_style
  @pagination_style
end

#pathObject

Returns the value of attribute path.



4
5
6
# File 'lib/generators/hot_glue/markup_templates/erb.rb', line 4

def path
  @path
end

#perc_widthObject

Returns the value of attribute perc_width.



4
5
6
# File 'lib/generators/hot_glue/markup_templates/erb.rb', line 4

def perc_width
  @perc_width
end

#phantom_searchObject

Returns the value of attribute phantom_search.



4
5
6
# File 'lib/generators/hot_glue/markup_templates/erb.rb', line 4

def phantom_search
  @phantom_search
end

#pluralObject

Returns the value of attribute plural.



4
5
6
# File 'lib/generators/hot_glue/markup_templates/erb.rb', line 4

def plural
  @plural
end

#punditObject

Returns the value of attribute pundit.



4
5
6
# File 'lib/generators/hot_glue/markup_templates/erb.rb', line 4

def pundit
  @pundit
end

Returns the value of attribute related_sets.



4
5
6
# File 'lib/generators/hot_glue/markup_templates/erb.rb', line 4

def related_sets
  @related_sets
end

#searchObject

Returns the value of attribute search.



4
5
6
# File 'lib/generators/hot_glue/markup_templates/erb.rb', line 4

def search
  @search
end

#search_autosearchObject

Returns the value of attribute search_autosearch.



4
5
6
# File 'lib/generators/hot_glue/markup_templates/erb.rb', line 4

def search_autosearch
  @search_autosearch
end

#search_clear_buttonObject

Returns the value of attribute search_clear_button.



4
5
6
# File 'lib/generators/hot_glue/markup_templates/erb.rb', line 4

def search_clear_button
  @search_clear_button
end

#search_fieldsObject

Returns the value of attribute search_fields.



4
5
6
# File 'lib/generators/hot_glue/markup_templates/erb.rb', line 4

def search_fields
  @search_fields
end

#search_positionObject

Returns the value of attribute search_position.



4
5
6
# File 'lib/generators/hot_glue/markup_templates/erb.rb', line 4

def search_position
  @search_position
end

#search_query_fieldsObject

Returns the value of attribute search_query_fields.



4
5
6
# File 'lib/generators/hot_glue/markup_templates/erb.rb', line 4

def search_query_fields
  @search_query_fields
end

#show_onlyObject

Returns the value of attribute show_only.



4
5
6
# File 'lib/generators/hot_glue/markup_templates/erb.rb', line 4

def show_only
  @show_only
end

#singularObject

Returns the value of attribute singular.



4
5
6
# File 'lib/generators/hot_glue/markup_templates/erb.rb', line 4

def singular
  @singular
end

#singular_classObject

Returns the value of attribute singular_class.



4
5
6
# File 'lib/generators/hot_glue/markup_templates/erb.rb', line 4

def singular_class
  @singular_class
end

#small_buttonsObject

Returns the value of attribute small_buttons.



4
5
6
# File 'lib/generators/hot_glue/markup_templates/erb.rb', line 4

def small_buttons
  @small_buttons
end

#stimmifyObject

Returns the value of attribute stimmify.



4
5
6
# File 'lib/generators/hot_glue/markup_templates/erb.rb', line 4

def stimmify
  @stimmify
end

#stimmify_camelObject

Returns the value of attribute stimmify_camel.



4
5
6
# File 'lib/generators/hot_glue/markup_templates/erb.rb', line 4

def stimmify_camel
  @stimmify_camel
end

#update_show_onlyObject

Returns the value of attribute update_show_only.



4
5
6
# File 'lib/generators/hot_glue/markup_templates/erb.rb', line 4

def update_show_only
  @update_show_only
end

Instance Method Details

#add_spaces_each_line(text, num_spaces) ⇒ Object



80
81
82
83
# File 'lib/generators/hot_glue/markup_templates/erb.rb', line 80

def add_spaces_each_line(text, num_spaces)
  add_spaces = " " * num_spaces
  text.lines.collect{|line| add_spaces + line}.join("")
end

#all_form_fields(layout_strategy:) ⇒ Object



202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
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
280
281
282
283
284
# File 'lib/generators/hot_glue/markup_templates/erb.rb', line 202

def all_form_fields(layout_strategy:)
  columns = layout_object[:columns][:container]

  result = columns.map{ |column|
    size  = layout_object[:columns][:bootstrap_column_width][columns.index(column)]

    "  <div class='#{layout_strategy.column_classes_for_form_fields(size)} cell--#{singular}--#{column.join("-")}' >" +
      column.map { |full_col|

        col = full_col.to_s.gsub("=", "").gsub("-", "").to_sym

        if col.to_s.starts_with?("**") && layout_object[:columns][:fields][col][:form]
          the_output = "<%= render partial: '#{pickup_partial_path(col.to_s.gsub!("**",""))}', locals: {#{singular}: #{singular} } %>"
        elsif ! layout_object[:columns][:fields][col][:form]
          # omit from show action
        else

          field_error_name = columns_map[col].field_error_name

          label_class = columns_map[col].label_class
          label_for = columns_map[col].label_for

          the_label = "\n<label class='#{label_class}' for='#{label_for}'>#{col.to_s.humanize}</label>"


          field_result =
            if show_only.include?(col)
              columns_map[col].form_show_only_output
            elsif update_show_only.include?(col) && !@pundit
              "<% if @action == 'edit' %>" + columns_map[col].form_show_only_output + "<% else %>" + columns_map[col].form_field_output + "<% end %>"
            elsif update_show_only.include?(col) && @pundit && eval("defined? #{singular_class}Policy") && eval("#{singular_class}Policy").instance_methods.include?("#{col}_able?".to_sym)
              "<% if @action == 'new' && policy(@#{singular}).#{col}_able? %>" + columns_map[col].form_field_output + "<% else %>" + columns_map[col].form_show_only_output + "<% end %>"
               # show only on the update action overrides any pundit policy
            elsif @pundit && eval("defined? #{singular_class}Policy") && eval("#{singular_class}Policy").instance_methods.include?("#{col}_able?".to_sym)
              "<% if policy(@#{singular}).#{col}_able? %>" + columns_map[col].form_field_output + "<% else %>" + columns_map[col].form_show_only_output  + "<% end %>"
            elsif update_show_only.include?(col)
              "<% if @action == 'edit' %>" + columns_map[col].form_show_only_output + "<% else %>" + columns_map[col].form_field_output + "<% end %>"
            else
              columns_map[col].form_field_output
            end


          @tinymce_stimulus_controller = (columns_map[col].modify_as == {tinymce: 1} ?  "data-controller='tiny-mce' " : "")

          if @stimmify
            col_target = HotGlue.to_camel_case(col.to_s.gsub("_", " "))
            data_attr = " data-#{@stimmify}-target='#{col_target}Wrapper'"
          end


          the_output =   add_spaces_each_line( "\n  <div #{@tinymce_stimulus_controller}class='<%= \"alert alert-danger\" if #{singular}.errors.details.keys.include?(:#{field_error_name}) %>' #{data_attr} >\n" +
                                                           add_spaces_each_line( (form_labels_position == 'before' ? (the_label || "") + "<br />\n"  : "") +
                                                                                   +  field_result +
                                                                                   (form_labels_position == 'after' ? (  columns_map[col].newline_after_field? ? "<br />\n" : "") + (the_label || "") : "")  , 4) +
                                                           "\n  </div>\n ", 2)


          if hidden_create.include?(col.to_sym) || hidden_update.include?(col.to_sym)
            if_statements = []
            if_statements << "@action == 'edit'" if hidden_update.include?(col.to_sym)
            if_statements << "@action == 'new'" if hidden_create.include?(col.to_sym)

            the_output = "<% if " + if_statements.join(" || ") + " %>" +
              columns_map[col].hidden_output + "<% else %>" +  the_output + "<% end %>"
          end

          if invisible_create.include?(col) || invisible_update.include?(col)
            if_statements = []
            if_statements << "@action == 'edit'" if invisible_update.include?(col.to_sym)
            if_statements << "@action == 'new'" if invisible_create.include?(col.to_sym)

            the_output = "<% if !(" + if_statements.join(" || ") + ") || policy(@#{singular}).#{col}_able? %>" +
              +  the_output + "<% end %>"
          end

        end # end of if col.to_s.starts_with?("**")


        the_output
      }.join("") + "\n  </div>"
  }.join("\n")
  return result
end

#all_line_fields(layout_strategy:, perc_width:) ⇒ Object

THE SHOW ACTION



315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
# File 'lib/generators/hot_glue/markup_templates/erb.rb', line 315

def all_line_fields(layout_strategy:,
                    perc_width:)

  inline_list_labels = @inline_list_labels  || 'omit'
  columns = layout_object[:columns][:container]

  columns_count = columns.count + 1
  perc_width = (perc_width).floor

  style_with_flex_basis = layout_strategy.style_with_flex_basis(perc_width)

  result = columns.map.with_index{ |column,i|
    size = layout_object[:columns][:bootstrap_column_width][i]
    "<div class='hg-col #{layout_strategy.column_classes_for_line_fields(size)} #{singular}--#{column.join("-")}'#{style_with_flex_basis}> " +

    column.map { |full_col|
      col = full_col.to_s.gsub("=", "").gsub("-","").to_sym

      if layout_object[:columns][:fields][col].nil?
        raise "column #{col} not found on the layout data"
      end
      if col.starts_with?("**") && layout_object[:columns][:fields][col][:show]
        the_output = "<%= render partial: '#{pickup_partial_path(col.to_s.gsub!("**",""))}', locals: {#{singular}: #{singular} } %>"
      elsif ! layout_object[:columns][:fields][col][:show]
        the_output = ""
      elsif eval("#{singular_class}.columns_hash['#{col}']").nil? && !attachments.keys.include?(col) && !related_sets.include?(col)
        raise "Can't find column '#{col}' on #{singular_class}, are you sure that is the column name?"
        # omit from show action
      else

        field_output = columns_map[col].line_field_output

        label = "<label class='small form-text text-muted'>#{col.to_s.humanize}</label>"

        the_output = "#{inline_list_labels == 'before' ? label + "<br/>" : ''}#{field_output}#{inline_list_labels == 'after' ? "<br/>" + label : ''}"
        the_output += "\n"
        if invisible_create.include?(col) || invisible_update.include?(col)
          if_statements = []
          if invisible_update.include?(col.to_sym) && invisible_create.include?(col.to_sym)
          else
            if_statements << "@action == 'edit'"
          end

          if_statements << " policy(#{singular}).#{col}_able?"
          the_output = "<% if  " +  if_statements.join(" || ") + " %>" +
            +  the_output + "<% end %>"
        end
      end

      the_output
    }.join(  "<br />\n") + "</div>"
  }.join("\n")
  return result

end

#list_column_headings(column_width:, singular:) ⇒ Object



99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
# File 'lib/generators/hot_glue/markup_templates/erb.rb', line 99

def list_column_headings(column_width:, singular: )
  col_style = @layout_strategy.column_headings_col_style

  columns = layout_object[:columns][:container]
  result = columns.map.with_index{ |column,i|

    size = layout_object[:columns][:bootstrap_column_width][i]
    "<div class='#{layout_strategy.column_classes_for_column_headings(size)} hg-heading-row heading--#{singular}--#{column.join("-")}' " + col_style + ">" +
      column.map(&:to_s).map{|col_name|
        unless col_name.starts_with?("**")
          the_output = "#{col_name.humanize}"
        else
          the_output = ""
        end
        if invisible_update.include?(col_name.to_sym)
          if_statements = []
          if_statements << "false" if invisible_update.include?(col_name.to_sym)

          the_output = "<% if ( " +  if_statements.join(" || ") + " || policy(#{@plural}).#{col_name}_able? ) %>" +
            +  the_output + "<% end %>"

        end
        the_output
      }.join("<br />")  + "</div>"
  }.join("\n")
  return result
end

#magic_button_output(path:, singular:, big_edit:, magic_buttons:, small_buttons:) ⇒ Object



85
86
87
88
89
90
91
92
93
94
95
96
97
# File 'lib/generators/hot_glue/markup_templates/erb.rb', line 85

def magic_button_output(path:,
                        singular:,
                        big_edit: ,
                        magic_buttons:, small_buttons: )
  magic_buttons.collect{ |button_name|
    "<%= form_with model: #{singular}, url: #{path}, html: {style: 'display: inline', data: {\"turbo-confirm\": 'Are you sure you want to #{button_name} this #{singular}?'  " +
      (big_edit ? ", \"turbo\": false" : "") +
       "}} do |f| %>" +
      "<%= f.hidden_field :__#{button_name}, value: \"__#{button_name}\" %>" +
      "<%= f.submit '#{button_name.titleize}'.html_safe, disabled: (#{singular}.respond_to?(:#{button_name}_able?) && ! #{singular}.#{button_name}_able? ), class: '#{singular}-button #{@layout_strategy.button_applied_classes} #{@layout_strategy.magic_button_classes}' %>" +
    "<% end %>"
  }.join("\n")
end

#paginate(*args) ⇒ Object



288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
# File 'lib/generators/hot_glue/markup_templates/erb.rb', line 288

def paginate(*args)
  plural = args[0][:plural]

  if @pagination_style == "kaminari"
    "<% if #{plural}.respond_to?(:total_pages) %><%= paginate(#{plural}) %> <% end %>"
  elsif @pagination_style == "will_paginate"
    "<% if #{plural}.respond_to?(:total_pages) %><%= will_paginate(#{plural}) %> <% end %>"
  elsif @pagination_style == "pagy9"
    if !@layout_strategy == "bootstrap"
      "<%== pagy_nav(@pagy, anchor_string: 'data-turbo-action=\"advance\"') %>"
    else
      "<%== pagy_bootstrap_nav(@pagy, anchor_string: 'data-turbo-action=\"advance\"') %>"
    end
  elsif @pagination_style == "pagy43"
    if @layout_strategy.is_a?(LayoutStrategy::Bootstrap)
      "<%== @pagy.series_nav(:bootstrap) if @pagy && @pagy.pages > 1 %>"
    else
      "<%== @pagy.series_nav if @pagy && @pagy.pages > 1 %>"
    end
  end
end

#pickup_partial_path(partial_name) ⇒ Object



76
77
78
# File 'lib/generators/hot_glue/markup_templates/erb.rb', line 76

def pickup_partial_path(partial_name)
  "#{@namespace + "/" if @namespace}#{@controller_build_folder}/#{partial_name}"
end

#search_input_areaObject

THE FORM



132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
# File 'lib/generators/hot_glue/markup_templates/erb.rb', line 132

def search_input_area
  columns = layout_object[:columns][:container]

  res =+ "<\%= form_with url: #{form_path}, method: :get, html: {'data-turbo-action': 'advance', 'data-controller': 'search-form'} do |f| %>"
  res << "<div class=\"#{@layout_strategy.row_classes} search--#{@plural}\">"

  res << columns.map{ |column|
    cols_result = column.map { |col|
      if @search_fields.collect(&:to_sym).include?(col)
        label_class = columns_map[col].label_class
        label_for = columns_map[col].label_for
        the_label = "\n<label class='#{label_class}' for='search-#{label_for}'>#{col.to_s.humanize}</label>"
        search_field_result =  columns_map[col].search_field_output

        add_spaces_each_line( "\n  <span class='' >\n" +
                            add_spaces_each_line( (form_labels_position == 'before' ? the_label || "" : "") +
                              +  " <br />\n" + search_field_result +
                              (form_labels_position == 'after' ? the_label : "")   , 4) +
                                "\n  </span>\n  <br />", 2)
      end
    }.compact.join("\n")



    size = layout_object[:columns][:bootstrap_column_width][columns.index(column)]
    "  <div class='#{layout_strategy.column_classes_for_form_fields(size)} search-cell--#{singular}--#{column.join("-")}' >" +
      cols_result + "</div>"

  }.join("\n")

  # phantom searches
  @phantom_search.each_key do |search_field|
    data = @phantom_search[search_field]
    res << "<div>"
    res << "<label>#{data[:name]}</label><br />"

    data[:choices].each do |choice|
      dom_label = choice[:label].downcase.gsub(" ","_")
      if data[:type] == "radio"
        res << "\n<input type='radio'
                        id='#{search_field}_search__#{dom_label}'
                        name='q[0][#{search_field}_search]' value='#{dom_label}'
       <%= 'checked' if  @q['0'][:#{search_field}_search] == \"#{dom_label}\" %> />"
      elsif data[:type] == "checkboxes"
        res << "\n<input type='checkbox'
                        id='#{search_field}_search__#{dom_label}'
                        name='q[0][#{search_field}_search__#{dom_label}]'
                        value='1'
       <%= 'checked' if  @q['0'][:#{search_field}_search__#{dom_label}]  %> />"

      end
      res << "\n<label for='#{search_field}_search__#{dom_label}'>#{choice[:label]}</label> <br/>"
    end

    res << "</div>"

  end


  res << "</div>"
  res << "<div class='#{layout_strategy.column_classes_for_form_fields(nil)}'>"
  if @search_clear_button
    res << "<\%= f.button \"Clear\", name: nil, 'data-search-form-target': 'clearButton', class: 'btn btn-sm btn-secondary' %>"
  end
  res << "<\%= submit_tag \"Search\", name: nil, class: 'btn btn-sm btn-primary' %>"
  res << "</div><\% end %>"
  res
end