buckybox/webstore

View on GitHub
app/views/layouts/_banner.html.haml

Summary

Maintainability
Test Coverage
#bucky-box-controls.containter-fluid
  .container
    .row
      .span6
        = link_to root_path, title: "Bucky Box, easy-to-use software for your CSA, Vege Box Scheme, or Food Hub" do
          = image_tag "bucky-box-powered.png"

      #auth-controls.span6.text-right
        - if current_customer
          .btn-group
            = link_to "#{t('my_account')} (#{current_customer.name})", customer_dashboard_path, class: 'btn btn-inverse'
            = link_to '#', { class: 'btn btn-inverse dropdown-toggle', "data-toggle" => "dropdown" } do
              %span.caret
            .account-dropdown.dropdown-menu.pull-right
              .current-account.text-left
                %p
                  %strong= current_customer.webstore_id
                %p
                  = current_customer.name
                  %br
                  = current_customer.email
                %p.logout.text-right
                  = link_to t('log_out'), customer_sign_out_path, method: :delete

              - other_accounts = current_customers.reject { |customer| current_customer && customer.id == current_customer.id }
              - if other_accounts.any?
                .switch-accounts.text-left
                  %p
                    %strong Switch Accounts
                  - other_accounts.each do |customer|
                    %li
                      %i.icon-user.icon-white
                      = link_to customer_can_switch_account? ? webstore_url(customer.webstore_id) : 'javascript:alert("You cannot switch account now because you have an ongoing order.")' do
                        = customer.webstore_name

        - else
          = link_to t('log_in'), customer_sign_in_url(webstore_id: current_webstore.id)

#public-banner.containter-fluid
  .container
    .row
      = link_to webstore_path(current_webstore.id) do
        #company-logo.span12.text-center
          - if current_webstore.company_logo
            = image_tag(current_webstore.company_logo)
          - else
            %h1= current_webstore.name