gitlab-org--gitlab-foss/app/views/projects/issues/_form.html.haml

96 lines
3.1 KiB
Plaintext

%div.issue-form-holder
%h3.page-title= @issue.new_record? ? "New Issue" : "Edit Issue ##{@issue.iid}"
= form_for [@project, @issue] do |f|
-if @issue.errors.any?
.alert.alert-error
- @issue.errors.full_messages.each do |msg|
%span= msg
%br
.issue-box
.title
.control-group
= f.label :title do
%strong= "Subject *"
.controls
= f.text_field :title, maxlength: 255, class: "input-xxlarge js-gfm-input", autofocus: true, required: true
.context
.control-group
.issue_assignee.pull-left
= f.label :assignee_id do
%i.icon-user
Assign to
.controls
.pull-left
= f.select(:assignee_id, assignee_options(@issue), { include_blank: "Select a user" }, {class: 'chosen'})
.pull-right
 
= link_to 'Assign to me', '#', class: 'btn btn-small assign-to-me-link'
.issue_milestone.pull-left
= f.label :milestone_id do
%i.icon-time
Milestone
.controls= f.select(:milestone_id, milestone_options(@issue), { include_blank: "Select milestone" }, {class: 'chosen'})
.description
.control-group
= f.label :label_list do
%i.icon-tag
Labels
.controls
= f.text_field :label_list, maxlength: 2000, class: "input-xxlarge"
%p.hint Separate labels with commas.
.control-group
= f.label :description, "Details"
.controls
= f.text_area :description, class: "input-xxlarge js-gfm-input", rows: 14
%p.hint Issues are parsed with #{link_to "GitLab Flavored Markdown", help_markdown_path, target: '_blank'}.
.form-actions
- if @issue.new_record?
= f.submit 'Submit new issue', class: "btn btn-create"
-else
= f.submit 'Save changes', class: "btn-save btn"
- cancel_path = @issue.new_record? ? project_issues_path(@project) : project_issue_path(@project, @issue)
= link_to "Cancel", cancel_path, class: 'btn btn-cancel'
:javascript
$("#issue_label_list")
.bind( "keydown", function( event ) {
if ( event.keyCode === $.ui.keyCode.TAB &&
$( this ).data( "autocomplete" ).menu.active ) {
event.preventDefault();
}
})
.bind("click", function(event) {
$(this).autocomplete("search", "");
})
.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;
}
});
$('.assign-to-me-link').on('click', function(e){
$('#issue_assignee_id').val("#{current_user.id}").trigger("chosen:updated");
e.preventDefault();
});