Sha256: 4a89d35b8e36e17ecf775fcaff7cf657021672a7419eed876b508b77a74c2b56

Contents?: true

Size: 1.23 KB

Versions: 128

Compression:

Stored size: 1.23 KB

Contents

<% if available_view_types.count > 1 %>
  <%
    info = {
      table: {
        new_view_type: 'table',
        new_icon: 'table-view-type',
        translation_key: 'avo.table_view',
      },
      grid: {
        new_view_type: 'grid',
        new_icon: 'grid-view-type',
        translation_key: 'avo.grid_view',
      },
      list: {
        new_view_type: 'list',
        new_icon: 'queue-list',
      },
      map: {
        new_view_type: 'map',
        new_icon: 'map-view-type',
        translation_key: 'avo.map_view',
      },
    }
  %>
  <div class="flex">
    <div class="button-group">
      <% available_view_types.each do |type| %>
        <% is_active_view = view_type.to_s == type.to_s %>

        <%= a_link url_for(params.permit!.merge(view_type: type)).to_s,
          icon: info[type][:new_icon],
          color: is_active_view ? :primary : :gray,
          rounded: false,
          size: :sm,
          class: is_active_view ? "z-20" : "bg-gray-100 border-gray-300",
          title: t('avo.switch_to_view', view_type: type),
          data: {
            tippy: 'tooltip',
            'turbo-frame': turbo_frame,
            control: "view-type-toggle-#{type}"
          }
        %>
      <% end %>
    </div>
  </div>
<% end %>

Version data entries

128 entries across 128 versions & 1 rubygems

Version Path
avo-3.0.0.pre18 app/views/avo/partials/_view_toggle_button.html.erb
avo-3.0.0.pre14 app/views/avo/partials/_view_toggle_button.html.erb
avo-3.0.0.pre16 app/views/avo/partials/_view_toggle_button.html.erb
avo-3.0.0.pre15 app/views/avo/partials/_view_toggle_button.html.erb
avo-3.0.0.pre13 app/views/avo/partials/_view_toggle_button.html.erb
avo-3.0.0.pre12 app/views/avo/partials/_view_toggle_button.html.erb
avo-3.0.0.pre10 app/views/avo/partials/_view_toggle_button.html.erb
avo-3.0.0.pre11 app/views/avo/partials/_view_toggle_button.html.erb
avo-3.0.0.pre9 app/views/avo/partials/_view_toggle_button.html.erb
avo-3.2.2 app/views/avo/partials/_view_toggle_button.html.erb
avo-3.2.1 app/views/avo/partials/_view_toggle_button.html.erb
avo-3.2.0 app/views/avo/partials/_view_toggle_button.html.erb
avo-3.1.7 app/views/avo/partials/_view_toggle_button.html.erb
avo-3.1.6 app/views/avo/partials/_view_toggle_button.html.erb
avo-3.1.5 app/views/avo/partials/_view_toggle_button.html.erb
avo-3.1.4 app/views/avo/partials/_view_toggle_button.html.erb
avo-3.1.3 app/views/avo/partials/_view_toggle_button.html.erb
avo-3.1.2 app/views/avo/partials/_view_toggle_button.html.erb
avo-3.1.1 app/views/avo/partials/_view_toggle_button.html.erb
avo-3.1.0 app/views/avo/partials/_view_toggle_button.html.erb