_form.html.haml 1.53 KB
%div.issue-form-holder
  = form_for [@project, @issue], :remote => request.xhr? do |f|
    %div
      %span.entity-info
        - if request.xhr? 
          = link_to "#back", :onclick => "backToIssues();" do 
            .entity-button
              Issues
              %i
        - else 
          - if @issue.new_record?
            = link_to project_issues_path(@project) do 
              .entity-button
                Issues
                %i
          - else    
            = link_to project_issue_path(@project, @issue) do 
              .entity-button
                Show Issue
                %i

      %h2= @issue.new_record? ? "New Issue" : "Edit Issue ##{@issue.id}"
      %hr
    -if @issue.errors.any?
      %ul.errors_holder
        - @issue.errors.full_messages.each do |msg|
          %li= msg

    %table.no-borders
      %tr
        %td= f.label :assignee_id
        %td= f.select(:assignee_id, @project.users.all.collect {|p| [ p.name, p.id ] }, { :include_blank => "Select user" })

      %tr
        %td= f.label :critical, "Critical"
        %td= f.check_box :critical
      
      - unless @issue.new_record?
        %tr
          %td= f.label :closed
          %td= f.check_box :closed
    
    = f.text_area :title, :style => "width:718px; height:100px", :maxlength => 255
    %br
    %br
    .merge-tabs
      = f.submit 'Save', :class => "grey-button"
       
      - unless @issue.new_record?
        .right
          = link_to 'Remove', [@project, @issue], :confirm => 'Are you sure?', :method => :delete, :class => "red-button"