Class: Trestle::Table::ActionsColumn::ActionsBuilder

Inherits:
Trestle::Toolbar::Builder show all
Defined in:
lib/trestle/table/actions_column.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#adminObject (readonly)

Returns the value of attribute admin.



28
29
30
# File 'lib/trestle/table/actions_column.rb', line 28

def admin
  @admin
end

#instanceObject (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

#deleteObject



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

#editObject



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

#showObject



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