lfzawacki/musical-artifacts

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

Summary

Maintainability
Test Coverage
!!!
%html
  %head
    %meta{:content => "text/html; charset=UTF-8", "http-equiv" => "Content-Type"}/
    %meta{:charset => "utf-8"}/
    %meta{:content => "IE=edge", "http-equiv" => "X-UA-Compatible"}/
    %meta{:content => "width=device-width, initial-scale=1", :name => "viewport"}/
    %meta{:content => "", :name => "description"}/
    %meta{:content => "", :name => "author"}/
    %title= application_title
    / HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries
    /[if lt IE 9]
      = javascript_include_tag "https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js", "https://oss.maxcdn.com/respond/1.4.2/respond.min.js"

    = stylesheet_link_tag    'application', media: 'all', 'data-turbolinks-track' => true
    = javascript_include_tag 'application', 'data-turbolinks-track' => true
    = favicon_link_tag 'favicon.ico'
    = csrf_meta_tags
  %body#page-top
    %nav.navbar.navbar-inverse.navbar-fixed-top{:role => "navigation"}
      .container
        .navbar-header.page-scroll
          %button.navbar-toggle{"aria-controls" => "navbar", "aria-expanded" => "false", "data-target" => "#navbar", "data-toggle" => "collapse", :type => "button"}
            %span.sr-only= t('.toggle_navigation')
            %span.icon-bar
            %span.icon-bar
            %span.icon-bar
          - show_search = !(controller.controller_name == 'artifacts' && controller.action_name == 'index')
          %a.navbar-brand{href: '/'}
            - if !show_search
              = @setting.site_name || '/'
              %p.subtitle Beta

          - if show_search
            %form.navbar-search-field{method: :get, action: artifacts_path}
              .input-group
                %input.input-lg{name: 'q', placeholder: t('artifacts.index.search_for'), type: 'text' }

                %span.input-group-btn
                  %button#artifacts_search_btn.btn.btn-lg{type: "submit", value: 'submit'}
                    %i.fa.fa-search

        #navbar.collapse.navbar-collapse
          %ul.nav.navbar-nav.navbar-right
            %li.hidden
              %a{:href => "#page-top"}

            - if can? :edit, @setting
              %li
                = link_to settings_path, title: t('.settings') do
                  %i.fa.fa-cogs

            - if can? :read, ActiveAdmin::Page
              %li
                = link_to admin_path_for_current_page, title: t('.admin') do
                  - if @unapproved_artifacts.present?
                    %span.badge.badge-unapproved= @unapproved_artifacts
                  %i.fa.fa-wrench

            - if can? :manage, :queues
              %li
                = link_to resque_server_path, title: t('.queues') do
                  %i.fa.fa-bar-chart

            - if current_user.present?
              %li
                = link_to my_artifacts_path do
                  %span.badge.badge-artifacts= current_user.artifacts.count
                  = t('.current_user', user: current_user.username || current_user.email)

              %li= link_to t('_other.logout'), destroy_user_session_path
            - else
              %li= link_to t('_other.login'), new_user_session_path
              %li= link_to t('_other.signup'), new_user_registration_path

            %li= link_to t('.recent_activity'), activities_path

            - if !current_user.try(:admin)
              %li= link_to t('_other.about'), info_about_path
              %li= link_to t('_other.contact'), info_contact_path


    - # Don't use a container wrapping the content only on the 'about' section
    %div{class: "#{'container with-navbar-on-top' unless controller.controller_name == 'info' && controller.action_name == 'about'}"}

      %noscript
        %p.noscript.alert.alert-warning
          =t('.no_script_warning')

      - flash.each do |name, msg|
        = render 'notifications/alert', name: name, message: msg

      = render 'notifications/current_notifications'

      = render 'cookies_eu/consent_banner', link: terms_and_conditions_path, target: '_blank'

      = yield

    %footer.text-center
      .footer-above
        .container
          .row
            .footer-col.col-md-3
              %h3= t('.footer.legal')
              %h4
                = link_to t('.footer.terms'), terms_and_conditions_path

              #opt-out= link_to t('info.optout.title'), analytics_optout_path

            .footer-col.col-md-3
              %h3
                = t('.footer.contact')
              %h4
                = link_to t('.footer.contact_us'), info_contact_path

            .footer-col.col-md-4
              %h3= t('.footer.more_links')
              %ul.list-inline
                %li
                  %a.btn-social.btn-outline{:href => 'https://github.com/lfzawacki/musical-artifacts'}
                    %i.fa.fa-fw.fa-github{title: 'Github'}

                %li
                  %a.btn-social.btn-outline{:href => 'https://twitter.com/musartifacts'}
                    %i.fa.fa-fw.fa-twitter{title: 'Twitter'}

                %li
                  %a.btn-social.btn-outline{:href => 'https://diasporabr.com.br/people/3ab93650177b013386be005056ba3b3d'}
                    %i.fa.fa-fw.fa-asterisk{title: 'Diaspora'}

                %li
                  %a.btn-social.btn-outline{:href => artifacts_path(format: :atom)}
                    %i.fa.fa-fw.fa-rss{title: 'RSS'}

            .footer-col.col-md-2
              %h3= t('.footer.language')
              .dropdown#locale-selector-dropdown{role: 'menu'}
                %button.btn.btn-default.dropdown-toggle{type: 'button', id: 'locale-selector-button', :'data-toggle' => 'dropdown'}
                  = t('.footer.switch_language')
                  %span.caret
                %ul.dropdown-menu
                  - I18n.available_locales.each do |l|
                    %li= link_to t('locale_name', locale: l), set_locale_path(locale: l), method: :post

      .footer-below
        .container
          .row
            .col-sm-5
              %p.small
                = @setting.site_name
                = Time.now.year
                ,
                = t('.footer.author_html')

              %p.small
                = t('.footer.theme_credit')
                %a{href: 'http://startbootstrap.com/template-overviews/freelancer/'} Bootstrap Freelancer

            .col-sm-3
              %a{href: "http://www.adfreeblog.org/", target: "_blank"}
                = image_tag 'icons/adfreesite_buttonsm.png'

              = link_to 'http://www.adfreeblog.org/' do
                %p.smallest= t('.footer.adfree')

            .col-sm-4
              %a{href: 'http://creativecommons.org/licenses/by-sa/4.0/', rel: 'license'}
                = image_tag 'licenses/by-sa.svg'

              = link_to 'http://creativecommons.org/licenses/by-sa/4.0/', rel: 'license' do
                %p.smallest= t('.footer.site_license')


    / Scroll to Top Button (Only visible on small and extra-small screen sizes)
    .scroll-top.page-scroll.visible-xs.visible-sm
      %a.btn.btn-scroll-top{:href => "#page-top"}
        %i.fa.fa-chevron-up

    = render 'application/analytics' if Rails.env.production?

    %div#audiojs-data{imageLocation: asset_path('player-graphics.gif'), swfLocation: asset_path('audiojs.swf') }