module ActiveLeonardo::Leosca::Activeadmin
Constants
- ACTIVEADMIN_INDENT_SPACES
Public Instance Methods
attributes_to_aa_csv(attributes)
click to toggle source
# File lib/generators/active_leonardo.rb, line 215 def attributes_to_aa_csv(attributes) attributes.map{|attr| " # column(:#{attr.name})#{' ' * (ACTIVEADMIN_INDENT_SPACES-attr.name.size).abs}{|#{singular_table_name}| #{singular_table_name}.#{attr.name}}"}.join("\n") end
attributes_to_aa_filter(attributes)
click to toggle source
# File lib/generators/active_leonardo.rb, line 204 def attributes_to_aa_filter(attributes) attributes.map{|attr| " #filter :#{attr.name}"}.join("\n") end
attributes_to_aa_form(attributes)
click to toggle source
# File lib/generators/active_leonardo.rb, line 207 def attributes_to_aa_form(attributes) attributes.map do |attr| case attr.type when :date then " # f.input :#{attr.name}, as: :datepicker, input_html: { class: 'calendar' }" else " # f.input :#{attr.name}" end end.join("\n") end
attributes_to_aa_index(attributes)
click to toggle source
# File lib/generators/active_leonardo.rb, line 186 def attributes_to_aa_index(attributes) attributes.map do |attr| case attr.type when :references, :belongs_to then " # column(:#{attr.name})" when :boolean then " # column(:#{attr.name})#{' ' * (ACTIVEADMIN_INDENT_SPACES-attr.name.size).abs}{|#{singular_table_name}| status_tag #{singular_table_name}.#{attr.name}}" else " # column(:#{attr.name})#{' ' * (ACTIVEADMIN_INDENT_SPACES-attr.name.size).abs}{|#{singular_table_name}| #{singular_table_name}.#{attr.name}}" end end.join("\n") end
attributes_to_aa_permit_params(attributes)
click to toggle source
# File lib/generators/active_leonardo.rb, line 178 def attributes_to_aa_permit_params(attributes) attributes.map do |attr| case attr.type when :references, :belongs_to then ":#{attr.name}_id" else ":#{attr.name}" end end.join(', ') end
attributes_to_aa_show(attributes)
click to toggle source
# File lib/generators/active_leonardo.rb, line 195 def attributes_to_aa_show(attributes) attributes.map do |attr| case attr.type when :references, :belongs_to then " # row(:#{attr.name})" when :boolean then " # row(:#{attr.name})#{' ' * (ACTIVEADMIN_INDENT_SPACES-attr.name.size).abs}{|#{singular_table_name}| status_tag #{singular_table_name}.#{attr.name}}" else " # row(:#{attr.name})#{' ' * (ACTIVEADMIN_INDENT_SPACES-attr.name.size).abs}{|#{singular_table_name}| #{singular_table_name}.#{attr.name}}" end end.join("\n") end