mayth/parasol

View on GitHub
app/views/home/index.html.haml

Summary

Maintainability
Test Coverage
.header
  %h1= Setting.ctf_name
  %h2 Spare Umbrella Limited Express Night Carnival

.content
  - unless player_signed_in?
    %p= link_to 'Sign in', new_player_session_path, class: 'pure-button pure-button-primary'
    %p
      Don't have an account?
      = link_to 'Sign up', new_player_registration_path

  %section
    %h1 Announcements
    .pure-g
      - @posts.take(3).each do |post|
        %article.pure-u-1.pure-u-md-1-3
          %h2= link_to post.title, post
          %p.post-date= post.updated_at
          %p= truncate_html(markdown_render(post.body), length: 80)
    %p= link_to 'All posts', posts_path

    %section
      %h1 Ranking
      %table.pure-table.pure-table-horizontal
        %tbody
          - @teams.each.with_index(1) do |team, rank|
            %tr
              %td= rank.ordinalize
              %td= team.name
              %td= team.point

    %section
      %h1 Point History
      %ul
        - Answer.valid.order(created_at: :desc).limit(10).each do |ans|
          %li [#{ans.created_at}] #{ans.player.team.name}: #{ans.valid_answer? ? '+' + ans.flag.point.to_s : 0} pt. (#{ans.challenge.name})