%h1= @discussion.display_title

- if @discussion.proposal
  %div
    This discussion has an associated proposal.
    = link_to "View Proposal Details here", proposal_path(@discussion.proposal)
- if can? :close, @discussion
  .admin_action
    = link_to "Close this discussion", close_discussion_path(@discussion), method: :put, data: { confirm: "This will prevent future comments and proposals based on this discussion. Continue?" }
%hr

%h3 Comments about this discussion:
= render partial: "start_of_discussion", locals: { discussion: @discussion }

- @discussion.comments.each do |comment|
  = render :partial => "/comments/show", :object => comment
- if can? :create, @comment
  = render :partial => "/comments/form", :object => @comment

- unless @discussion.proposal
  .admin_action
    Is this discussion ready to be made into a proposal?
    = link_to "Create a proposal from this discussion", "#", class: "js--toggle", data: { toggle: ".proposal_new"}

  .proposal_new.is--hidden
    - @committee = @discussion.committee
    - @proposal = Proposal.new(discussion: @discussion)
    - @revision = Revision.new
    - @proposal_owner = @discussion.owner
    = render partial: "proposals/form"

%h1= @discussion.display_title

- if @discussion.proposal
  %div
  - if can? :read, @discussion.proposal
    This discussion has an associated proposal. #{link_to "View Proposal Details here", proposal_path(@discussion.proposal)}.
  - elsif @discussion.proposal.status = "Submitted"
    This discussion has an associated proposal but it has not been approved yet.
- if can? :close, @discussion
  .admin_action
    = link_to "Close this discussion", close_discussion_path(@discussion), method: :put, data: { confirm: "This will prevent future comments and proposals based on this discussion. Continue?" }
%hr

%h3 Comments about this discussion:
= render partial: "start_of_discussion", locals: { discussion: @discussion }

- @discussion.comments.each do |comment|
  = render :partial => "/comments/show", :object => comment
- if can? :create, @comment
  = render :partial => "/comments/form", :object => @comment

- unless @discussion.proposal
  .admin_action
    Is this discussion ready to be made into a proposal?
    = link_to "Create a proposal from this discussion", "#", class: "js--toggle", data: { toggle: ".proposal_new"}

  .proposal_new.is--hidden
    - @committee = @discussion.committee
    - @proposal = Proposal.new(discussion: @discussion)
    - @revision = Revision.new
    - @proposal_owner = @discussion.owner
    = render partial: "proposals/form"

Fix link to associated proposal bug.
Fix link to associated proposal bug.
