Class: Oversee::Resources::Index
- Inherits:
-
Base
- Object
- Base
- Oversee::Resources::Index
- Defined in:
- app/components/oversee/resources/index.rb
Instance Method Summary collapse
- #around_template ⇒ Object
-
#initialize(resources:, resource_class:, pagy:, params:) ⇒ Index
constructor
A new instance of Index.
- #view_template ⇒ Object
Constructor Details
#initialize(resources:, resource_class:, pagy:, params:) ⇒ Index
Returns a new instance of Index.
4 5 6 7 8 9 |
# File 'app/components/oversee/resources/index.rb', line 4 def initialize(resources:, resource_class:, pagy:, params:) @resources = resources @resource_class = resource_class @pagy = pagy @params = params end |
Instance Method Details
#around_template ⇒ Object
12 13 14 |
# File 'app/components/oversee/resources/index.rb', line 12 def around_template render Oversee::Layout::Application.new { super } end |
#view_template ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'app/components/oversee/resources/index.rb', line 16 def view_template render Oversee::Dashboard::Header.new(title: @resource_class.to_s.pluralize) do |h| h.left h.right do a( href: helpers.new_resource_path(@params[:resource_class_name]), target: "_top", class: "inline-flex items-center justify-center gap-1.5 h-8 px-4 rounded-full bg-transparent text-gray-900 hover:bg-gray-100 text-sm font-medium transition group" ) do render Phlex::Icons::Iconoir::Plus.new(class: "size-4 text-gray-500 group-hover:text-blue-500", stroke_width: 2.5) plain "Add new" end end end hr(class: "my-4") render Oversee::Dashboard::Actions.new(params: @params) hr(class: "mt-4") render Oversee::Resources::Table.new(resource_class: @resource_class, resources: @resources, params: @params) hr() render Oversee::Dashboard::Pagination.new(pagy: @pagy, params: @params) end |