oneclickorgs/one-click-orgs

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

Summary

Maintainability
Test Coverage
%h2
  = @proposal.title

%p
  A
  - if @proposal.open?
    proposal
  - elsif @proposal.accepted?
    decision
  - else
    failed proposal
  submitted by
  = image_tag(@proposal.proposer.gravatar_url(24), :alt => @proposal.proposer.name, :class => 'gravatar', :width => '24', :height => '24')
  = link_to(@proposal.proposer.name, @proposal.proposer)
  = @proposal.creation_date.to_s(:at_on)

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

%h3 Voting

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

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

- if @proposal.open?
  - if can?(:create, Vote)
    %p
      = render 'vote', :proposal => @proposal
  - else
    %p
      You cannot vote on this proposal.
- else
  %p
    This proposal
    -if @proposal.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 => proposal_comments_path(:proposal_id => @proposal)) do |f|
  %p
    = f.label :body, "Add a comment to this proposal:"
    = f.text_area :body
  %p
    = f.submit "Save comment"