Module: StateMachinesHelper
- Defined in:
- app/helpers/state_machines_helper.rb
Instance Method Summary collapse
- #event_status(status, condition, possition, hide_when_not_present = false, description = nil) ⇒ Object
- #event_status_rooms(status, condition, hide_when_not_present = false) ⇒ Object
- #friendly_status(state) ⇒ Object
- #possible_state_machine_names(klass) ⇒ Object
Instance Method Details
#event_status(status, condition, possition, hide_when_not_present = false, description = nil) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'app/helpers/state_machines_helper.rb', line 10 def event_status(status, condition, possition, hide_when_not_present = false, description = nil) return if !condition and hide_when_not_present content_tag(:li, if condition raw(status.html_safe) + ( unless description.nil? content_tag(:div, content_tag(:div, content_tag(:div, nil, class: 'popover-arrow') + content_tag(:div, content_tag(:p, description, class: nil), class: 'popover-content'), class: 'popover bottom'), class: 'statusdescription') end) else content_tag(:i, nil, class: 'glyphicon glyphicon-ok', 'aria-hidden': 'true', style: (if condition nil else (possition ? 'display:none' : nil) end)) end, class: (if condition 'currentstatus' else (possition ? 'aftercurrent' : 'beforecurrent') end), title: status, data: condition ? nil : { content: description, toggle: 'popover', trigger: 'hover', placement: 'top' }) end |
#event_status_rooms(status, condition, hide_when_not_present = false) ⇒ Object
32 33 34 35 36 |
# File 'app/helpers/state_machines_helper.rb', line 32 def event_status_rooms(status, condition, hide_when_not_present = false) return if !condition and hide_when_not_present content_tag(:li, icon('') + ' ' + raw(status.html_safe), class: (condition ? 'fa fa-arrow-circle-right current-status' : 'fa fa-arrow-circle-right')) end |
#friendly_status(state) ⇒ Object
2 3 4 |
# File 'app/helpers/state_machines_helper.rb', line 2 def friendly_status(state) state.humanize.capitalize unless state.nil? end |
#possible_state_machine_names(klass) ⇒ Object
6 7 8 |
# File 'app/helpers/state_machines_helper.rb', line 6 def possible_state_machine_names(klass) klass.state_machines[:state].states.map { |s| s.name }.sort end |