hummingbird-me/hummingbird

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

Summary

Maintainability
Test Coverage
- content_for :content do
  .row.user-watchlist
    .large-2.columns.sidebar.hide-for-small
      .large-12.columns.avatar
        - if false and can? :update, @user
          .avatar-upload-button
            %a{"data-dropdown" => "avatar-upload", :href => "#"} 
              %i.fa.fa-picture-o
              %span Edit Avatar
            %ul#avatar-upload.f-dropdown.content{"data-dropdown-content" => ""}
              %li.help
                %span Avatar Size 190x190
              %li.upload
                = form_for(@user, url: user_avatar_path(@user), html: {method: :put, multipart: true, style: 'display: inline'}) do |f|
                  .file-upload
                    %i.fa.fa-upload
                    = f.file_field :avatar, id: 'user_avatar'
                    Upload from Computer

        = image_tag @user.avatar_url, class: "avatar-image", style: 'height: 190px; width: 190px'

      .large-12.columns.user-block
        %h4.username= @user.name
        %span.waifu.hide
          Waifu - 
          = link_to "Haruhi Suzumiya", "#"

      = render partial: "users/follow_button", locals: {user: @user}

      .large-12.columns.user-links
        .link-wrapper
          %ul
            %li{:class => ("active" if @active_tab == :feed)}= link_to "Activity Feed", user_path(@user)
            %li.hide= link_to "About", user_path(@user)
            %li{:class => ("active" if @active_tab == :library)}
              = link_to "Library", user_library_path(@user)
              %span.sidebar-number= @user.watchlists.count
            %li.hide
              = link_to "Reviews", user_reviews_path(@user)
              %span.sidebar-number= @user.reviews.count
            %li{:class => ("active" if @active_tab == :following)}
              = link_to "Following", user_following_path(@user)
              %span.sidebar-number= @user.following_count
            %li{:class => ("active" if @active_tab == :followers)}
              = link_to "Followers", user_followers_path(@user)
              %span.sidebar-number= @user.followers_count
            %li{:class => ("active" if @active_tab == :favorite_anime)}
              = link_to "Favorite Anime", user_favorite_anime_path(@user)
            - if @user == current_user
              %li{:class => ("active" if @active_tab == :account_settings)}= link_to "Account Settings", main_app.edit_user_registration_path

    .large-8.columns.large-offset-2.main-content
      .large-12.columns.cover-photo{:class => ("own-profile" if user_signed_in? and @user == current_user)}
        - if can? :update, @user
          .cover-upload-button.hide-for-small
            %a{"data-dropdown" => "cover-upload", :href => "#"} 
              %i.fa.fa-picture-o
              %span Edit Cover Photo
            %ul#cover-upload.f-dropdown.content{"data-dropdown-content" => ""}
              %li.help
                %span Cover Size 1400x330
              %li.upload
                = form_for(@user, url: user_cover_image_path(@user), html: {method: :put, multipart: true, style: 'display: inline'}) do |f|
                  .file-upload
                    %i.fa.fa-upload
                    = f.file_field :cover_image, id: 'user_avatar'
                    Upload from Computer
        .small-12.columns.small-centered.mobile-header.show-for-small
          = image_tag @user.avatar_url, :class => "mobile-avatar"
          %h3= @user.name
          .small-12.columns
            = render partial: "users/follow_button", locals: {user: @user}
          .small-12.columns.cover-buttons.hide
            %span.line-button.compare= link_to "Compare"
            %span.line-button= link_to "Suggest Anime"
          .row
            .small-10.columns.small-centered.mobile-navigation.hide
              %a.button.small.padded.dropdown{"data-dropdown" => "drop1", :href => "#"} Profile Navigation
              %br
              %ul#drop1.f-dropdown
                %li.hide= link_to "Activity Feed", "#"
                %li.hide= link_to "About", user_path(@user)
                %li= link_to "Library", user_library_path(@user)
                %li.hide= link_to "Reviews", user_reviews_path(@user)
                %li.hide= link_to "Following", "#"
                %li.hide= link_to "Followers", "#"
                - if @user == current_user
                  %li= link_to "Account Settings", main_app.edit_user_registration_path


        = image_tag @user.cover_image.url(:thumb), :class => "cover-image"

        .cover-photo-shadow
          .small-8.columns.anime-time.hide-for-small
            %p.anime-time-info I've watched #{format_minutes @user.life_spent_on_anime} of anime.
          .small-12.large-4.columns.cover-buttons.hide
            %span.line-button.compare= link_to "Compare"
            %span.line-button= link_to "Suggest Anime"


      = yield

    .large-2.columns.adzone.hide-for-small
      :javascript
        google_ad_client = "ca-pub-3410319844519574";
        google_ad_slot = "9458360043";
        google_ad_width = 160;
        google_ad_height = 600;
        //-->
      %script{:src => "http://pagead2.googlesyndication.com/pagead/show_ads.js", :type => "text/javascript"}


  :coffee
    $(".file-upload input").change ->
      $(this).closest("form").submit()

= render :template => 'layouts/application'