Module: Shopapp3Helper

Defined in:
app/helpers/shopapp3_helper.rb

Instance Method Summary collapse

Instance Method Details

#shopapp3_sidebar_iconsObject



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'app/helpers/shopapp3_helper.rb', line 2

def shopapp3_sidebar_icons
  controller.sidebar_actions_list.map do |sidebar_action|
    active = if controller.request.path == sidebar_action[:path]
               'active'
             end
    <<~HTML
      <li class="nav-item p-1 #{active}">
        <a class="nav-link d-flex flex-column justify-content-start align-items-center" href="#{sidebar_action[:path]}">
          #{image_tag sidebar_action[:icon].to_s, width: '20', class: 'img-fluid mb-1' if sidebar_action[:icon].present?}
          #{mdi_tag sidebar_action[:mdi].to_s, class: 'mdi-36px text-light' if sidebar_action[:mdi].present?}
          <label class="text-light mt-0 text-center">#{ sidebar_action[:tooltip]}</label>
        </a>
      </li>
    HTML
  end.join("\n").html_safe
end