Class: EasyAdmin::QuickFiltersComponent
- Inherits:
-
Phlex::HTML
- Object
- Phlex::HTML
- EasyAdmin::QuickFiltersComponent
- Defined in:
- app/components/easy_admin/quick_filters_component.rb
Instance Method Summary collapse
-
#initialize(resource_class:, current_period: nil, current_params: nil) ⇒ QuickFiltersComponent
constructor
A new instance of QuickFiltersComponent.
- #view_template ⇒ Object
Constructor Details
#initialize(resource_class:, current_period: nil, current_params: nil) ⇒ QuickFiltersComponent
Returns a new instance of QuickFiltersComponent.
3 4 5 6 7 |
# File 'app/components/easy_admin/quick_filters_component.rb', line 3 def initialize(resource_class:, current_period: nil, current_params: nil) @resource_class = resource_class @current_period = current_period @current_params = current_params || ActionController::Parameters.new.permit! end |
Instance Method Details
#view_template ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'app/components/easy_admin/quick_filters_component.rb', line 9 def view_template div(class: "bg-white rounded-xl shadow-sm border border-gray-200 mb-4 sm:mb-6") do div(class: "px-4 sm:px-6 py-3 border-b border-gray-100") do h3(class: "text-sm font-semibold text-gray-900") { "Quick Filters" } end div(class: "p-4 sm:p-6") do div(class: "flex flex-wrap gap-2") do render_quick_filter_link("Today", "today") render_quick_filter_link("Last 7 Days", "7d") render_quick_filter_link("Last 30 Days", "30d") render_quick_filter_link("Last 90 Days", "90d") render_quick_filter_link("Last Year", "1y") render_clear_filter_link end end end end |