app/components/solidus_admin/ui/pages/index/component.rb in solidus_admin-0.2.0 vs app/components/solidus_admin/ui/pages/index/component.rb in solidus_admin-0.3.0
- old
+ new
@@ -3,75 +3,50 @@
class SolidusAdmin::UI::Pages::Index::Component < SolidusAdmin::BaseComponent
include SolidusAdmin::Layout::PageHelpers
Tab = Struct.new(:text, :href, :current, keyword_init: true)
- def tabs
- nil
- end
+ # Template methods
+ def tabs; end
+ def model_class; end
+ def back_url; end
+ def search_key; end
+ def search_url; end
+ def page_actions; end
+ def sidebar; end
+ def sortable_options; end
+ def row_url(_record); end
+ def batch_actions; []; end
+ def scopes; []; end
+ def filters; []; end
+ def columns; []; end
def initialize(page:)
@page = page
@tabs = tabs&.map { |tab| Tab.new(**tab) }
end
def row_fade(_record)
false
end
- def model_class
- nil
- end
-
def title
model_class.model_name.human.pluralize
end
- def search_key
- nil
- end
-
def search_params
params[:q]
end
def search_name
:q
end
- def search_url
- nil
- end
-
- def table_id
- stimulus_id
- end
-
def rows
@page.records
end
- def row_url(_record)
- nil
- end
-
- def batch_actions
- []
- end
-
- def scopes
- []
- end
-
- def filters
- []
- end
-
- def columns
- []
- end
-
def prev_page_path
solidus_admin.url_for(**request.params, page: @page.number - 1, only_path: true) unless @page.first?
end
def next_page_path
@@ -89,12 +64,17 @@
filters: filters,
scopes: scopes,
}
end
- def sortable_options
- nil
+ def render_title
+ back_url = self.back_url
+
+ safe_join [
+ (page_header_back back_url if back_url),
+ page_header_title(title),
+ ]
end
def render_table
render component('ui/table').new(
id: stimulus_id,
@@ -111,9 +91,15 @@
search: search_options,
sortable: sortable_options,
)
end
- def page_actions
- nil
+ def render_sidebar
+ sidebar = self.sidebar
+
+ page_with_sidebar_aside { sidebar } if sidebar
+ end
+
+ def turbo_frames
+ []
end
end