Class: Trestle::Table::ActionsColumn::ActionsBuilder
- Inherits:
-
Trestle::Toolbar::Builder
- Object
- Trestle::Toolbar::Builder
- Trestle::Table::ActionsColumn::ActionsBuilder
- Defined in:
- lib/trestle/table/actions_column.rb
Instance Attribute Summary collapse
-
#admin ⇒ Object
readonly
Returns the value of attribute admin.
-
#instance ⇒ Object
readonly
Returns the value of attribute instance.
Instance Method Summary collapse
- #delete ⇒ Object
- #edit ⇒ Object
-
#initialize(template, instance, admin) ⇒ ActionsBuilder
constructor
A new instance of ActionsBuilder.
- #show ⇒ Object
Methods inherited from Trestle::Toolbar::Builder
builder_method, #dropdown, #link
Constructor Details
#initialize(template, instance, admin) ⇒ ActionsBuilder
Returns a new instance of ActionsBuilder.
30 31 32 33 34 |
# File 'lib/trestle/table/actions_column.rb', line 30 def initialize(template, instance, admin) super(template) @instance, @admin = instance, admin end |
Instance Attribute Details
#admin ⇒ Object (readonly)
Returns the value of attribute admin.
28 29 30 |
# File 'lib/trestle/table/actions_column.rb', line 28 def admin @admin end |
#instance ⇒ Object (readonly)
Returns the value of attribute instance.
28 29 30 |
# File 'lib/trestle/table/actions_column.rb', line 28 def instance @instance end |
Instance Method Details
#delete ⇒ Object
44 45 46 |
# File 'lib/trestle/table/actions_column.rb', line 44 def delete link(t("buttons.delete", default: "Delete"), instance, admin: admin, action: :destroy, icon: "fa fa-trash", style: :danger, data: { turbo_method: "delete", controller: "confirm-delete", confirm_delete_placement_value: "left" }) end |
#edit ⇒ Object
40 41 42 |
# File 'lib/trestle/table/actions_column.rb', line 40 def edit link(t("buttons.edit", default: "Edit"), instance, admin: admin, action: :edit, icon: "fa fa-pencil", style: :warning) end |
#show ⇒ Object
36 37 38 |
# File 'lib/trestle/table/actions_column.rb', line 36 def show link(t("buttons.show", default: "Show"), instance, admin: admin, action: :show, icon: "fa fa-info", style: :info) end |