Method: ModelModalHelper#dynamic_related_modal
- Defined in:
- app/helpers/model_modal_helper.rb
#dynamic_related_modal(related_model, edit_path, _options = {}) ⇒ Object
Only show the trigger with the edit path, let the rest be generated later
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'app/helpers/model_modal_helper.rb', line 23 def (, edit_path, = {}) model_name = .class.to_s.underscore datum = { view_url: edit_path.gsub('/edit', '') } anchor_id = "#{model_name}-#{.id}" title = .respond_to?(:short_name) ? .short_name : .name content_tag(:div) do concat(content_tag(:a, href: "##{anchor_id}", class: 'modal-trigger') do concat(content_tag(:span, title)) end) concat(content_tag(:div, id: anchor_id, class: 'modal', data: datum) do concat(content_tag(:div, class: 'modal-content') do concat(content_tag(:h2, class: 'center') do concat(content_tag(:span, .name)) end) concat(content_tag(:div, class: 'center-align') do concat(content_tag(:div, class: 'progress red lighten-4') do tag(:div, class: 'indeterminate red') end) end) end) concat((, edit_path)) end) end end |