Class: FloatField
- Defined in:
- lib/generators/hot_glue/fields/float_field.rb
Instance Attribute Summary
Attributes inherited from Field
#alt_lookup, #assoc_class, #assoc_label, #assoc_model, #assoc_name, #associations, #attachment_data, #auth, #class_name, #default_boolean_display, #display_as, #form_labels_position, #form_placeholder_labels, #god, #hawk_keys, #hidden_create, #hidden_update, #layout_strategy, #limit, #modify_as, #name, #namespace, #object, #ownership_field, #plural, #polymorphic_parents, #pundit, #sample_file_path, #self_auth, #singular, #singular_class, #sql_type, #stimmify, #update_show_only
Instance Method Summary collapse
- #form_field_output ⇒ Object
- #load_all_query_statement ⇒ Object
-
#search_field_output ⇒ Object
def line_field_output width = (limit && limit < 40) ? limit : (40).
- #spec_setup_and_change_act(which_partial = nil) ⇒ Object
- #spec_setup_let_arg ⇒ Object
- #where_query_statement ⇒ Object
Methods inherited from Field
#code_to_reset_match_if_search_is_blank, #display_boolean_as, #field_error_name, #field_output, #field_view_output, #form_show_only_output, #getName, #hidden_output, #initialize, #label_class, #label_for, #line_field_output, #modified_display_output, #modify_binary?, #newline_after_field?, #prelookup_syntax, #spec_list_view_assertion, #spec_list_view_natural_assertion, #spec_make_assertion, #spec_random_data, #spec_related_column_lets, #testing_name, #text_area_output, #viewable_output
Constructor Details
This class inherits a constructor from Field
Instance Method Details
#form_field_output ⇒ Object
13 14 15 |
# File 'lib/generators/hot_glue/fields/float_field.rb', line 13 def form_field_output field_output(nil, 5) end |
#load_all_query_statement ⇒ Object
38 39 40 |
# File 'lib/generators/hot_glue/fields/float_field.rb', line 38 def load_all_query_statement "#{name}_query = integer_query_constructor(@q['0'][:#{name}_match], @q['0'][:#{name}_search])" end |
#search_field_output ⇒ Object
def line_field_output
width = (limit && limit < 40) ? limit : (40)
"<%= #{singular}.#{name} %>"
end
23 24 25 26 27 28 29 30 31 |
# File 'lib/generators/hot_glue/fields/float_field.rb', line 23 def search_field_output " <div>" + "\n <%= f.select 'q[0][#{name}_match]', options_for_select([['', ''], ['=', '='], " + "\n ['≥', '≥'], ['>', '>'], " + "\n ['≤', '≤'], ['<', '<']], @q[\'0\']['#{name}_match'] ), {} ," + "\n { class: 'form-control match' } %>"+ "\n <%= f.text_field 'q[0][#{name}_search]', {value: @q[\'0\'][:#{name}_search], autocomplete: 'off', size: 4, class: 'form-control', type: 'number'} %>" + "\n </div>" end |
#spec_setup_and_change_act(which_partial = nil) ⇒ Object
2 3 4 5 6 |
# File 'lib/generators/hot_glue/fields/float_field.rb', line 2 def spec_setup_and_change_act(which_partial = nil) " " + "new_#{name} = rand(10) \n" + " find(\"[name='#{testing_name}[#{ name.to_s }]']\").fill_in(with: new_#{name.to_s})" end |
#spec_setup_let_arg ⇒ Object
9 10 11 |
# File 'lib/generators/hot_glue/fields/float_field.rb', line 9 def spec_setup_let_arg "#{name}: rand(1)*10000" end |
#where_query_statement ⇒ Object
34 35 36 |
# File 'lib/generators/hot_glue/fields/float_field.rb', line 34 def where_query_statement ".where(\"#{name} \#{#{name}_query }\")" end |