Module: Crm::FloorPlanDisplaysHelper

Defined in:
app/helpers/crm/floor_plan_displays_helper.rb

Overview

View helper: floor plan displays.

Instance Method Summary collapse

Instance Method Details

#floor_plan_display_actions(floor_plan_display) ⇒ Object



17
18
19
20
21
22
23
24
# File 'app/helpers/crm/floor_plan_displays_helper.rb', line 17

def floor_plan_display_actions(floor_plan_display)
   :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



26
27
28
29
# File 'app/helpers/crm/floor_plan_displays_helper.rb', line 26

def floor_plan_display_image_count(floor_plan_display)
  count = floor_plan_display.images.count
   :span, count, class: 'badge bg-info'
end

#floor_plan_display_operating_cost(floor_plan_display) ⇒ Object



36
37
38
39
40
41
# File 'app/helpers/crm/floor_plan_displays_helper.rb', line 36

def floor_plan_display_operating_cost(floor_plan_display)
  return 'N/A' if floor_plan_display.total_cost_to_operate.zero?

   :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



31
32
33
34
# File 'app/helpers/crm/floor_plan_displays_helper.rb', line 31

def floor_plan_display_room_count(floor_plan_display)
  count = floor_plan_display.room_configurations.count
   :span, count, class: 'badge bg-primary'
end

#floor_plan_display_state_badge(state) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
# File 'app/helpers/crm/floor_plan_displays_helper.rb', line 4

def floor_plan_display_state_badge(state)
  case state
  when 'published'
     :span, state.humanize, class: 'badge bg-success'
  when 'draft'
     :span, state.humanize, class: 'badge bg-warning'
  when 'archived'
     :span, state.humanize, class: 'badge bg-secondary'
  else
     :span, state.humanize, class: 'badge bg-secondary'
  end
end