hummingbird-me/hummingbird

View on GitHub
app/views/shared/_header.html.haml

Summary

Maintainability
Test Coverage
.hummingbird-header-1
  .hummingbird-header-actual.fixed.nav-attached
    .contain-to-grid.rounded-panel
      %nav.top-bar.cf
        %ul.title-area
          %li.name
            = link_to image_tag("https://hummingbird.me/assets/logo-new.jpg", :height => "20px", :width => "119px"), "/"
          %li.toggle-topbar.menu-icon
            %a{:href => "#"}
              %span Menu
        %section.top-bar-section
          / Left Nav Section
          %ul.left.topnav-links
            %li.has-dropdown
              = link_to "Library", "#"
              %ul.dropdown.rounded-panel
                %li
                  = link_to "Anime Library", user_signed_in? ? main_app.user_library_path(current_user) : "/sign-in"
                %li
                  = link_to "Manga Library", user_signed_in? ? "/users/#{current_user.name}/library/manga" : "/sign-in"
            %li.has-dropdown
              %a{:href => "/anime"} Explore
              %ul.dropdown.rounded-panel
                %li
                  // change me to upcoming link
                  = link_to "Upcoming", main_app.anime_season_path
            %li
              = link_to "Community", "https://forums.hummingbird.me/"

          / Right Nav Section
          %ul.right.right-top-nav
            %li.has-form.search-form
              .row.collapse.header-search
                .small-12.columns
                  %form#live_search_form{:action => "/search", :autocomplete => "off"}
                    %input.typeahead#nav_search_input(type="text" name="query"){:placeholder => "Search...", :value => params[:query], :autocomplete => "off"}
                    %input#nav_search_submit.submit.ss-icon{:type => "submit", :value => "search"}

            %li.divider.show-for-small
            - if user_signed_in?
              %li.notification-block.has-dropdown
                %a.notification-button{href: "/notifications", class: ("active" if Notification.unseen_count(current_user) > 0)}
                  %i.fa.fa-bell-o
                    - if Notification.unseen_count(current_user) > 0
                      %span.notification-count= "%02d" % Notification.unseen_count(current_user)

                %ul.dropdown.rounded-panel
                  = render partial: "notifications/notification", collection: Notification.recent_notifications(current_user)
                  %li
                    %a.view-all-notifications.single-notification.large-12.columns.center(href="/notifications")
                      view all

              %li.user-block.has-dropdown
                = link_to image_tag(current_user.avatar_url, :class => "avatar"), main_app.user_path(current_user), :class => "avatar-link-selector"
                %ul.dropdown.rounded-panel
                  %li
                    = link_to "View Profile", main_app.user_path(current_user)
                  %li
                    = link_to "Settings", main_app.edit_user_registration_path
                  - if current_user.admin?
                    %li 
                      = link_to "Admin panel", "/kotodama"
                  %li
                    = link_to "Sign out", main_app.destroy_user_session_path, :method => :delete
            - else
              %li.guest-block
                %span 
                  %a{href: "/sign-in"} Sign In
                  or 
                  %a{href: "/sign-up"} Create an Account

    - if not user_signed_in?
      .guest-banner.hide-for-small
        .large-12.columns
          = link_to "Hummingbird is the easiest way to track, share and discover new anime. Join now, for free!", "/sign-up"
          %span.guest-button= link_to "Get Started", main_app.new_user_registration_path

    - if user_signed_in? and not current_user.confirmed?
      .guest-banner.hide-for-small
        .large-12.columns
          %a(data-tooltip data-width=500 title="You can confirm your email address by clicking on the link in the email you received after registration. If you didn't receive a confirmation email, click on the 'Resend Confirmation Email' button.") Please confirm your email address.
          %span.guest-button= link_to "Resend Confirmation Email", new_confirmation_path(User)

  - flash.each do |style, message|
    .alert-box{:class => style.to_s}= message