%h3.page-title
  Issue ##{@issue.iid}

  %span.pull-right.issue-btn-group
    - if can?(current_user, :write_issue, @project)
      = link_to new_project_issue_path(@project), class: "btn btn-grouped", title: "New Issue", id: "new_issue_link" do
        %i.fa.fa-plus
        New Issue
    - if can?(current_user, :modify_issue, @issue)
      - if @issue.closed?
        = link_to 'Reopen', project_issue_path(@project, @issue, issue: {state_event: :reopen }, status_only: true), method: :put,  class: "btn btn-grouped btn-reopen"
      - else
        = link_to 'Close', project_issue_path(@project, @issue, issue: {state_event: :close }, status_only: true), method: :put, class: "btn btn-grouped btn-close", title: "Close Issue"

      = link_to edit_project_issue_path(@project, @issue), class: "btn btn-grouped" do
        %i.fa.fa-pencil-square-o
        Edit

.clearfix
  .votes-holder
    #votes= render 'votes/votes_block', votable: @issue

  .back-link
    = link_to project_issues_path(@project) do
      &larr; To issues list
    %span.milestone-nav-link
      - if @issue.milestone
        |
        %span.light Milestone
        = link_to project_milestone_path(@project, @issue.milestone) do
          = @issue.milestone.title

.issue-box{ class: issue_box_class(@issue) }
  .state.clearfix
    .state-label
      - if @issue.closed?
        Closed
      - else
        Open

    .creator
      Created by #{link_to_member(@project, @issue.author)} #{issue_timestamp(@issue)}

  %h4.title
    = gfm escape_once(@issue.title)

  - if @issue.description.present?
    .description
      .wiki
        = preserve do
          = markdown(@issue.description, parse_tasks: true)
  .context
    %cite.cgray
      = render partial: 'issue_context', locals: { issue: @issue }


- content_for :note_actions do
  - if can?(current_user, :modify_issue, @issue)
    - if @issue.closed?
      = link_to 'Reopen Issue', project_issue_path(@project, @issue, issue: {state_event: :reopen }, status_only: true), method: :put, class: "btn btn-grouped btn-reopen js-note-target-reopen", title: 'Reopen Issue'
    - else
      = link_to 'Close Issue', project_issue_path(@project, @issue, issue: {state_event: :close }, status_only: true), method: :put, class: "btn btn-grouped btn-close js-note-target-close", title: "Close Issue"

.participants
  %cite.cgray
    = pluralize(@issue.participants.count, 'participant')
  - @issue.participants.each do |participant|
    = link_to_member(@project, participant, name: false, size: 24)

  .issue-show-labels.pull-right
    - @issue.labels.each do |label|
      = link_to project_issues_path(@project, label_name: label.name) do
        = render_colored_label(label)

.voting_notes#notes= render "projects/notes/notes_with_form"
