Module: Binda::FieldGroupsHelper
- Defined in:
- app/helpers/binda/field_groups_helper.rb
Instance Method Summary collapse
- #get_entries_number ⇒ Object
- #get_form_field_group_url ⇒ Object
- #get_relationable_boards(field_setting) ⇒ Object
- #get_relationable_components(field_setting) ⇒ Object
Instance Method Details
#get_entries_number ⇒ Object
26 27 28 29 30 31 32 33 |
# File 'app/helpers/binda/field_groups_helper.rb', line 26 def get_entries_number instance_type = @structure.instance_type if ['board', 'component'].include? instance_type "Binda::#{instance_type.classify}".constantize.where(structure_id:@structure.id).count else 0 end end |
#get_form_field_group_url ⇒ Object
5 6 7 8 |
# File 'app/helpers/binda/field_groups_helper.rb', line 5 def get_form_field_group_url return structure_field_groups_path if action_name == 'new' return structure_field_group_path if action_name == 'edit' end |
#get_relationable_boards(field_setting) ⇒ Object
18 19 20 21 22 23 24 |
# File 'app/helpers/binda/field_groups_helper.rb', line 18 def get_relationable_boards(field_setting) if @instance.class.to_s == 'Binda::Component' Binda::Board.where(structure_id: Binda::Structure.where(id: field_setting.accepted_structure_ids)) elsif @instance.class.to_s == 'Binda::Board' Binda::Board.where(structure_id: Binda::Structure.where(id: field_setting.accepted_structure_ids)).where.not(id: @instance.id) end end |
#get_relationable_components(field_setting) ⇒ Object
10 11 12 13 14 15 16 |
# File 'app/helpers/binda/field_groups_helper.rb', line 10 def get_relationable_components(field_setting) if @instance.class.to_s == 'Binda::Component' Binda::Component.where(structure_id: Binda::Structure.where(id: field_setting.accepted_structure_ids)).where.not(id: @instance.id) elsif @instance.class.to_s == 'Binda::Board' Binda::Component.where(structure_id: Binda::Structure.where(id: field_setting.accepted_structure_ids)) end end |