assemblymade/coderwall

View on GitHub
app/views/teams/_team_blog.html.slim

Summary

Maintainability
Test Coverage
section#team-blog class=section_enabled_class(@team.has_team_blog?)
  -unless @team.has_team_blog?
    .inactive-box
      h2 Team Blog Inactive
      p Team Blog RSS Feed
      = link_to 'Activate', '#team-blog', class: 'activate-editor'

  -if can_edit?
    .edit
      = link_to('edit', '#team-blog', class: 'launch-editor')
    .form.hide.cf
      = link_to(' ', '#team-blog', class: 'close-editor circle')
      = form_for(@team, remote: true) do |f|
        header
          h2 Team Blog RSS Feed.
        aside
          .hint
            h3 Pro tip
            p URL of your team blog rss/atom feed
          .form-inputs
            fieldset
              =f.label :blog_feed, 'RSS URL of your team blog'
              =f.text_field :blog_feed

        = hidden_field_tag(:section_id, '#team-blog')
        footer
          = f.submit('Save')
          = link_to('Close', '#team-blog', class: 'close-editor')

  -cache ['teams', 'blogs', @team], :expires_in => 1.day do
    -if @team.blog_posts.any?
      header
        h2 = "From the #{@team.name} blog"
        .inside.cf
          -@team.blog_posts.first(2).each_with_index do |entry, index|
            article
              .date style="background-color:#{@team.branding_hex_color}"
                p =entry.published.try(:day) || (index+1).ordinalize
                span
                  =entry.published && entry.published.strftime("%b")
              h3
                =link_to entry.title,entry.url , class: '',style: "color:#{@team.branding_hex_color}", target: :new

              p = blog_content(entry)
                =link_to 'Read more',entry.url , class: 'read-more',style: "background-color:#{@team.branding_hex_color}", target: :new