oneclickorgs/one-click-orgs

View on GitHub
app/views/resolutions/show.html.haml

Summary

Maintainability
Test Coverage
%h2
  = @resolution.title

%p
  A
  - if @resolution.draft?
    draft
  resolution
  submitted by
  = image_tag(@resolution.proposer.gravatar_url(24), :alt => @resolution.proposer.name, :class => 'gravatar', :width => '24', :height => '24')
  = link_to(@resolution.proposer.name, @resolution.proposer)
  = @resolution.creation_date.to_s(:at_on)

- if @resolution.description?
  %h3 Description
  = render 'description', :proposal => @resolution

- if @resolution.open? || @resolution.closed?

  %h3 Voting

  %p
    Votes:
    = render 'vote_count', :proposal => @resolution

  - if @resolution.open?
    %p
      Voting ends in
      %strong
        = distance_of_time_in_words_to_now(@resolution.end_date)
      = "(" + @resolution.end_date.to_s(:at_on) + ")"

    - if can?(:create, Vote)
      %p
        = render 'vote', :proposal => @resolution
    - else
      %p
        You cannot vote on this proposal.
  - elsif
    %p
      This proposal
      -if @resolution.accepted?
        %strong succeeded
      -else
        %strong failed

%h3 Comments
- @comments.each do |comment|
  .comment
    %p.attribution
      = image_tag(comment.author.gravatar_url(24), :alt => comment.author.name, :class => 'gravatar', :width => '24', :height => '24')
      = link_to(comment.author.name, member_path(comment.author))
      = comment.created_at.to_s(:at_on) + ':'
    = simple_format(html_escape(comment.body))
= form_for(@comment, :url => resolution_comments_path(:resolution_id => @resolution)) do |f|
  %p
    = f.label :body, "Add a comment to this resolution:"
    = f.text_area :body
  %p
    = f.submit "Save comment"