Module: Crm::FloorPlanDisplaysHelper
- Defined in:
- app/helpers/crm/floor_plan_displays_helper.rb
Instance Method Summary collapse
- #floor_plan_display_actions(floor_plan_display) ⇒ Object
- #floor_plan_display_image_count(floor_plan_display) ⇒ Object
- #floor_plan_display_operating_cost(floor_plan_display) ⇒ Object
- #floor_plan_display_room_count(floor_plan_display) ⇒ Object
- #floor_plan_display_state_badge(state) ⇒ Object
Instance Method Details
#floor_plan_display_actions(floor_plan_display) ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'app/helpers/crm/floor_plan_displays_helper.rb', line 15 def floor_plan_display_actions(floor_plan_display) content_tag :div, class: 'btn-group', role: 'group' do concat link_to('View', floor_plan_display_path(floor_plan_display), class: 'btn btn-sm btn-outline-primary') concat link_to('Edit', edit_floor_plan_display_path(floor_plan_display), class: 'btn btn-sm btn-outline-secondary') concat link_to('Images', edit_images_floor_plan_display_path(floor_plan_display), class: 'btn btn-sm btn-outline-info') concat link_to('Preview', preview_floor_plan_display_path(floor_plan_display), class: 'btn btn-sm btn-outline-success', target: '_blank', rel: 'noopener') end end |
#floor_plan_display_image_count(floor_plan_display) ⇒ Object
24 25 26 27 |
# File 'app/helpers/crm/floor_plan_displays_helper.rb', line 24 def floor_plan_display_image_count(floor_plan_display) count = floor_plan_display.images.count content_tag :span, count, class: 'badge bg-info' end |
#floor_plan_display_operating_cost(floor_plan_display) ⇒ Object
34 35 36 37 38 39 |
# File 'app/helpers/crm/floor_plan_displays_helper.rb', line 34 def (floor_plan_display) return 'N/A' if floor_plan_display.total_cost_to_operate.zero? content_tag :span, "$#{number_with_precision(floor_plan_display.total_cost_to_operate, precision: 2)}", class: 'text-success fw-bold' end |
#floor_plan_display_room_count(floor_plan_display) ⇒ Object
29 30 31 32 |
# File 'app/helpers/crm/floor_plan_displays_helper.rb', line 29 def floor_plan_display_room_count(floor_plan_display) count = floor_plan_display.room_configurations.count content_tag :span, count, class: 'badge bg-primary' end |
#floor_plan_display_state_badge(state) ⇒ Object
2 3 4 5 6 7 8 9 10 11 12 13 |
# File 'app/helpers/crm/floor_plan_displays_helper.rb', line 2 def floor_plan_display_state_badge(state) case state when 'published' content_tag :span, state.humanize, class: 'badge bg-success' when 'draft' content_tag :span, state.humanize, class: 'badge bg-warning' when 'archived' content_tag :span, state.humanize, class: 'badge bg-secondary' else content_tag :span, state.humanize, class: 'badge bg-secondary' end end |