class UiBibz::Ui::Ux::Tables::Actions
Attributes
format_action[R]
Public Class Methods
new(store)
click to toggle source
# File lib/ui_bibz/ui/ux/tables/components/actions.rb, line 8 def initialize(store) @store = store @actions = [] @action_order = -1 end
Public Instance Methods
divider()
click to toggle source
# File lib/ui_bibz/ui/ux/tables/components/actions.rb, line 19 def divider @actions << UiBibz::Ui::Core::Forms::Dropdowns::Components::DropdownDivider.new.render end
format(&block)
click to toggle source
# File lib/ui_bibz/ui/ux/tables/components/actions.rb, line 35 def format(&block) @format_action = block end
header(content = nil, options = nil, html_options = nil, &block)
click to toggle source
# File lib/ui_bibz/ui/ux/tables/components/actions.rb, line 23 def header(content = nil, options = nil, html_options = nil, &block) @actions << UiBibz::Ui::Core::Forms::Dropdowns::Components::DropdownHeader.new(content, options, html_options, &block).render end
html(content)
click to toggle source
# File lib/ui_bibz/ui/ux/tables/components/actions.rb, line 27 def html(content) @actions << content end
link(content = nil, options = nil, html_options = nil, &block)
click to toggle source
Add link action in table
# File lib/ui_bibz/ui/ux/tables/components/actions.rb, line 15 def link(content = nil, options = nil, html_options = nil, &block) @actions << UiBibz::Ui::Core::Forms::Dropdowns::Components::DropdownLink.new(content, options, html_options, &block).render end
list()
click to toggle source
Get all actions
# File lib/ui_bibz/ui/ux/tables/components/actions.rb, line 40 def list @actions.empty? ? defaults_actions : @actions end
raw_list()
click to toggle source
# File lib/ui_bibz/ui/ux/tables/components/actions.rb, line 44 def raw_list @actions end
reset()
click to toggle source
# File lib/ui_bibz/ui/ux/tables/components/actions.rb, line 31 def reset @actions = [] end
Private Instance Methods
defaults_actions()
click to toggle source
# File lib/ui_bibz/ui/ux/tables/components/actions.rb, line 52 def defaults_actions [ UiBibz::Ui::Core::Forms::Dropdowns::Components::DropdownLink.new(show_name, url: { controller: @store.actions_controller, action: 'show', id: :id }, glyph: 'eye').render, UiBibz::Ui::Core::Forms::Dropdowns::Components::DropdownLink.new(edit_name, url: { controller: @store.actions_controller, action: 'edit', id: :id }, glyph: 'edit').render, UiBibz::Ui::Core::Forms::Dropdowns::Components::DropdownLink.new(delete_name, { glyph: 'trash', url: { controller: @store.actions_controller, action: 'destroy', id: :id }, link_html_options: { data: { confirm: 'Are you sure?', method: :delete } } }).render ] end
delete_name()
click to toggle source
# File lib/ui_bibz/ui/ux/tables/components/actions.rb, line 70 def delete_name defaults = ['ui_bibz.table.actions.defaults.delete', 'Delete'] UiBibz::Utils::Internationalization.new("ui_bibz.table.actions.#{@store.model.to_s.underscore}.delete", default: defaults).translate end
edit_name()
click to toggle source
# File lib/ui_bibz/ui/ux/tables/components/actions.rb, line 65 def edit_name defaults = ['ui_bibz.table.actions.defaults.edit', 'Edit'] UiBibz::Utils::Internationalization.new("ui_bibz.table.actions.#{@store.model.to_s.underscore}.edit", default: defaults).translate end
show_name()
click to toggle source
# File lib/ui_bibz/ui/ux/tables/components/actions.rb, line 60 def show_name defaults = ['ui_bibz.table.actions.defaults.show', 'Show'] UiBibz::Utils::Internationalization.new("ui_bibz.table.actions.#{@store.model.to_s.underscore}.show", default: defaults).translate end