summaryrefslogtreecommitdiff
path: root/app/views/issues/_form.html.haml
blob: 030f797c088101d01f73f054e569cd4a8c60d1d6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
%div.issue-form-holder
  %h3.page_title= @issue.new_record? ? "New Issue" : "Edit Issue ##{@issue.id}"
  = form_for [@project, @issue] do |f|
    -if @issue.errors.any?
      .alert-message.block-message.error
        - @issue.errors.full_messages.each do |msg|
          %span= msg
          %br
    .issue_form_box
      .issue_title
        .clearfix
          = f.label :title do
            %strong= "Subject *"
          .input
            = f.text_field :title, maxlength: 255, class: "xxlarge js-gfm-input", autofocus: true, required: true
      .issue_middle_block
        .issue_assignee
          = f.label :assignee_id do
            %i.icon-user
            Assign to
          .input= f.select(:assignee_id, @project.users.all.collect {|p| [ p.name, p.id ] }, { include_blank: "Select a user" }, {class: 'chosen'})
        .issue_milestone
          = f.label :milestone_id do
            %i.icon-time
            Milestone
          .input= f.select(:milestone_id, @project.milestones.active.all.collect {|p| [ p.title, p.id ] }, { include_blank: "Select milestone" }, {class: 'chosen'})

      .issue_description
        .clearfix
          = f.label :label_list do
            %i.icon-tag
            Labels
          .input
            = f.text_field :label_list, maxlength: 2000, class: "xxlarge"
            %p.hint Separate with comma.

        .clearfix
          = f.label :description, "Details"
          .input
            = f.text_area :description, maxlength: 2000, class: "xxlarge js-gfm-input", rows: 14
            %p.hint Issues are parsed with #{link_to "GitLab Flavored Markdown", help_markdown_path, target: '_blank'}.


    .actions
      - if @issue.new_record?
        = f.submit 'Submit new issue', class: "btn save-btn"
      -else
        = f.submit 'Save changes', class: "save-btn btn"

      - cancel_path = @issue.new_record? ? project_issues_path(@project) : project_issue_path(@project, @issue)
      = link_to "Cancel", cancel_path, class: 'btn cancel-btn'




:javascript
  $(function(){
    $("#issue_label_list")
      .bind( "keydown", function( event ) {
        if ( event.keyCode === $.ui.keyCode.TAB &&
          $( this ).data( "autocomplete" ).menu.active ) {
          event.preventDefault();
        }
      })
      .autocomplete({
        minLength: 0,
        source: function( request, response ) {
          response( $.ui.autocomplete.filter(
            #{raw labels_autocomplete_source}, extractLast( request.term ) ) );
        },
        focus: function() {
          return false;
        },
        select: function(event, ui) {
          var terms = split( this.value );
          terms.pop();
          terms.push( ui.item.value );
          terms.push( "" );
          this.value = terms.join( ", " );
          return false;
        }
      });
  });