assemblymade/coderwall

View on GitHub
app/views/protips/_head.html.haml

Summary

Maintainability
Test Coverage
- content_for :javascript do
  = javascript_include_tag 'hyphenator/hyphenator'
  = javascript_include_tag 'protips'
  = javascript_include_tag 'search'

  :javascript
    Hyphenator.run()

- cache ['v1', 'protip_index_page_meta_data', @topics.to_s], expires_in: 1.week do
  - content_for :page_title do
    = protip_topic_page_title(@topics)
  - content_for :page_description do
    = protip_topic_page_description(@topics)
  - content_for :page_keywords do
    = protip_topic_page_keywords(@topics)

- content_for :body_id do
  protip-multiple

%header.cf.second-level-header
  -if @topic_user
    %a{href: user_or_team_profile_path(@topic_user)}
      %h1
        = image_tag(user_or_team_image_path(@topic_user))
        = "#{@topic_user.display_name}'s Protips"
  -else
    %h1
      - if my_protips?(@topics)
        Your pro tips
      - else
        - unless @topics.blank?
          == #{@topics.to_sentence.html_safe}
  %ul.second-level-toplinks
    - unless on_trending_page? || unsubscribable_topic?(@topic, @topics) || !signed_in?
      -if @topic_user.is_a?(Team)
        %li.follow-team-option=follow_team_link(@topic_user)
      -else
        - unless @networks.blank?
          - unless @topics.blank?
            - if @networks.size > 1
              .about-networks{href: network_url(@networks.first.slug)}
                Part of the
                =raw @networks.map {|network| link_to(network.name, network_path(network.slug))}.join(", ")
                == Network#{"s" if @networks.size > 1}
            - elsif @networks.size != 0
              %a.about-networks{href: network_url(@networks.first.slug)}
                Part of the
                = @networks.first.name
                Network
    -else
      %li= link_to('Share', new_protip_path, class: 'share-a-tip track', 'data-action' => 'create protip', 'data-from' => @topic_user.nil? ? 'tagged protips page' : 'user protips page')