|
1 | 1 | <%= content_tag :div,
|
2 |
| - class: class_names("index-#{@index_params[:view_type]}-view", {"has-record-selector": @resource.record_selector}), |
| 2 | + class: class_names("index-#{@resource.view_type}-view", {"has-record-selector": @resource.record_selector}), |
3 | 3 | data: {
|
4 | 4 | component_name: self.class.to_s.underscore,
|
5 | 5 | model_name: @resource.model_name.to_s,
|
|
48 | 48 |
|
49 | 49 | <%= render Avo::FiltersComponent.new filters: @filters, resource: @resource, applied_filters: @applied_filters, parent_record: @parent_record %>
|
50 | 50 |
|
51 |
| - <%= render partial: "avo/partials/view_toggle_button", locals: { available_view_types: available_view_types, view_type: view_type, turbo_frame: @turbo_frame } %> |
| 51 | + <%= render partial: "avo/partials/view_toggle_button", locals: { available_view_types: @resource.available_view_types, view_type: @resource.view_type, turbo_frame: @turbo_frame } %> |
52 | 52 | </div>
|
53 | 53 | </div>
|
54 | 54 | <% if has_dynamic_filters? %>
|
55 | 55 | <%= render Avo::DynamicFilters::FiltersComponent.new resource: resource, turbo_frame: @turbo_frame, dynamic_filters_component_id: dynamic_filters_component_id, parent_record: @parent_record, parent_resource: @parent_resource %>
|
56 | 56 | <% end %>
|
57 | 57 | </div>
|
58 | 58 | </div>
|
59 |
| - <% if view_type.to_sym == :table %> |
| 59 | + <% if @resource.view_type.to_sym == :table %> |
60 | 60 | <% if @resources.present? %>
|
61 | 61 | <div class="w-full relative flex-1 flex mt-0">
|
62 | 62 | <%= render(@resource.resolve_component(Avo::Index::ResourceTableComponent).new(resources: @resources, resource: @resource, reflection: @reflection, parent_record: @parent_record, parent_resource: @parent_resource, pagy: @pagy, query: @query, actions: @actions)) %>
|
63 | 63 | </div>
|
64 | 64 | <% else %>
|
65 |
| - <%= helpers.empty_state by_association: params[:related_name].present?, view_type: view_type, add_background: true %> |
| 65 | + <%= helpers.empty_state by_association: params[:related_name].present?, view_type: @resource.view_type, add_background: true %> |
66 | 66 | <% end %>
|
67 | 67 | <% end %>
|
68 | 68 | <% end %>
|
69 | 69 | <% c.with_bare_content do %>
|
70 |
| - <% if view_type.to_sym == :map %> |
| 70 | + <% if @resource.view_type.to_sym == :map %> |
71 | 71 | <% if @resources.present? %>
|
72 | 72 | <div>
|
73 | 73 | <%= render(@resource.resolve_component(Avo::Index::ResourceMapComponent).new(resources: @resources, resource: @resource, reflection: @reflection, parent_record: @parent_record, parent_resource: @parent_resource, pagy: @pagy, query: @query)) %>
|
74 | 74 | </div>
|
75 | 75 | <% else %>
|
76 |
| - <%= helpers.empty_state by_association: params[:related_name].present?, view_type: view_type, add_background: true %> |
| 76 | + <%= helpers.empty_state by_association: params[:related_name].present?, view_type: @resource.view_type, add_background: true %> |
77 | 77 | <% end %>
|
78 | 78 | <% end %>
|
79 |
| - <% if view_type.to_sym == :table || view_type.to_sym == :map %> |
| 79 | + <% if @resource.view_type.to_sym == :table || @resource.view_type.to_sym == :map %> |
80 | 80 | <% if @records.present? %>
|
81 | 81 | <div class="mt-4 w-full">
|
82 | 82 | <%= render Avo::PaginatorComponent.new pagy: @pagy, turbo_frame: @turbo_frame, index_params: @index_params, resource: @resource, parent_record: @parent_record, parent_resource: @parent_resource, discreet_pagination: field&.discreet_pagination %>
|
83 | 83 | </div>
|
84 | 84 | <% end %>
|
85 | 85 | <% end %>
|
86 |
| - <% if view_type.to_sym == :grid %> |
| 86 | + <% if @resource.view_type.to_sym == :grid %> |
87 | 87 | <div id="records_panel">
|
88 | 88 | <%= render Avo::Index::ResourceGridComponent.new(resources: @resources, resource: @resource, reflection: @reflection, parent_record: @parent_record, parent_resource: @parent_resource, actions: @actions) %>
|
89 | 89 | </div>
|
|
0 commit comments