Class: Aureus::Components::DataTableRowButton
- Inherits:
-
Renderable
- Object
- Renderable
- Aureus::Components::DataTableRowButton
- Defined in:
- lib/aureus/components/data_table.rb
Instance Method Summary collapse
-
#initialize(type, text, url, options) ⇒ DataTableRowButton
constructor
A new instance of DataTableRowButton.
- #render ⇒ Object
Methods inherited from Renderable
#compact, #compact_render, #content_tag, #init
Constructor Details
#initialize(type, text, url, options) ⇒ DataTableRowButton
Returns a new instance of DataTableRowButton.
107 108 109 110 111 112 |
# File 'lib/aureus/components/data_table.rb', line 107 def initialize(type, text, url, ) init , remote: true, confirm: 'Delete resource?' @type = type @text = text @url = url end |
Instance Method Details
#render ⇒ Object
114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 |
# File 'lib/aureus/components/data_table.rb', line 114 def render @text = ' ' unless @type == :text case @type when :text link_to @text, @url when :print link_to @text, @url, class: :print when :show link_to @text, @url, class: :show when :edit link_to @text, @url, class: :edit when :destroy if [:remote] link_to @text, @url, class: :destroy, method: :delete, data: { confirm: [:confirm] } else link_to @text, @url, class: :destroy end end end |