%h3
  Milestone ##{@milestone.id}
  %small
    = @milestone.expires_at

  %span.right
    - if can?(current_user, :admin_milestone, @project)
      = link_to edit_project_milestone_path(@project, @milestone), :class => "btn" do 
        Edit

.back_link
  = link_to project_milestones_path(@project) do 
    &larr; To milestones list

.main_box
  .top_box_content
    %h5
      - if @milestone.closed
        .alert-message.error.status_info Closed
      - else 
        .alert-message.success.status_info Open
      = @milestone.title

  .middle_box_content
    .row
      .span2
        = link_to 'Browse Issues', project_issues_path(@milestone.project, :milestone_id => @milestone.id), :class => "btn small edit-milestone-link"
      .span4
        %span
          = @milestone.expires_at

      .span4.right
        .progress
        %br
        %span
          #{@milestone.issues.opened.count} open
          &ndash;
          #{@milestone.issues.closed.count} closed

  - if @milestone.description.present?
    .bottom_box_content
      = preserve do
        = markdown @milestone.description

.row
  .span6
    %h4 Open Issues:
    - @issues.each do |issue|
      = link_to [@project, issue] do 
        %h5
          = image_tag gravatar_icon(issue.assignee_email, 16), :width => "16"
          &nbsp;
          Issue ##{issue.id}
          &ndash;
          = truncate issue.title, :length => 50
          %small
            updated at 
            = issue.updated_at.stamp("Aug 25, 2011")
    %br
    = paginate @issues, :theme => "gitlab"

  .span6
    %h4 Participants:
    - @users.each do |user|
      %h5
        = image_tag gravatar_icon(user.email, 16), :width => "16"
        &nbsp;
        = user.name

:javascript
  $(function() {
    $( ".progress" ).progressbar({
      value: #{@milestone.percent_complete}
     });
  });
