Class: RubyUI::BulkActionTable
- Includes:
- Phlex::Rails::Helpers::FormAuthenticityToken, Phlex::Rails::Helpers::TurboFrameTag
- Defined in:
- lib/generators/ruby_cms/templates/components/ruby_ui/bulk_action_table/bulk_action_table.rb
Defined Under Namespace
Classes: Context
Constant Summary
Constants inherited from Base
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(controller_name: "ruby-ui--bulk-action-table", turbo_frame: nil, pagination: nil, pagination_path: nil, bulk_actions_url: nil, bulk_actions_buttons: [], item_name: "item", active_color: nil, **user_attrs) ⇒ BulkActionTable
constructor
A new instance of BulkActionTable.
- #view_template ⇒ Object
Constructor Details
#initialize(controller_name: "ruby-ui--bulk-action-table", turbo_frame: nil, pagination: nil, pagination_path: nil, bulk_actions_url: nil, bulk_actions_buttons: [], item_name: "item", active_color: nil, **user_attrs) ⇒ BulkActionTable
Returns a new instance of BulkActionTable.
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/generators/ruby_cms/templates/components/ruby_ui/bulk_action_table/bulk_action_table.rb', line 12 def initialize( controller_name: "ruby-ui--bulk-action-table", turbo_frame: nil, pagination: nil, pagination_path: nil, bulk_actions_url: nil, bulk_actions_buttons: [], item_name: "item", active_color: nil, **user_attrs ) @controller_name = controller_name @turbo_frame = turbo_frame @pagination = pagination @pagination_path = pagination_path @bulk_actions_url = bulk_actions_url @bulk_actions_buttons = Array() @item_name = item_name @active_color = active_color @has_bulk_actions = bulk_actions_url.present? super(**user_attrs) end |
Instance Method Details
#view_template ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/generators/ruby_cms/templates/components/ruby_ui/bulk_action_table/bulk_action_table.rb', line 35 def view_template(&) self.class.current_context = Context.new( checkbox: @has_bulk_actions, controller_name: @controller_name ) render_with_turbo_frame do div(**component_attrs) do render_table_wrapper(&) render_delete_modal if @has_bulk_actions div(class: "flex flex-col sticky bottom-0") do render_bulk_actions if @has_bulk_actions render_pagination if @pagination end end end ensure self.class.current_context = nil end |