assemblymade/coderwall

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

Summary

Maintainability
Test Coverage
= content_for :content_wrapper do
  false

%section.new-main-content
  .inside
    = render partial: "head", locals: {topic: Protip::USER_SCOPE}
    - if signed_in?
      %section.my-protips.tips-section
        %header.cf
          %h2 My Protips
        - if current_user.protips.any?
          - authored_protips = current_user.authored_protips(12)
          #author.cf
            = render partial: "grid", locals: {protips: authored_protips.try(:results), collection: authored_protips, url: :protips_path, hide_more: false, section: "author", mode: 'popup'}
        - else
          .secondary-notice
            %p
              You don't have any protips. Share your expertise, interesting websites, articles and images by
              = link_to 'creating a protip', new_protip_path
      %section.my-protips.tips-section
        %header.cf
          %h2 Bookmarked / Upvoted Protips
        - if current_user.bookmarked_protips.any?
          - bookmarks = current_user.bookmarked_protips(12)
          #bookmark.cf
            = render partial: "grid", locals: {protips: bookmarks.try(:results), collection: bookmarks, url: :protips_path, hide_more: false, section: "bookmark", mode: 'popup'}
        - else
          .secondary-notice
            %p
              You haven't bookmarked any protips. Browse
              = link_to 'trending protips', protips_path