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

96 lines
3.2 KiB
Plaintext
Raw Normal View History

%div.issue-form-holder
%h3.page-title= @issue.new_record? ? "New Issue" : "Edit Issue ##{@issue.iid}"
2012-12-19 03:14:05 +00:00
= form_for [@project, @issue] do |f|
2012-01-17 22:46:13 +00:00
-if @issue.errors.any?
2013-01-30 14:53:18 +00:00
.alert.alert-error
2012-12-19 03:14:05 +00:00
- @issue.errors.full_messages.each do |msg|
%span= msg
%br
2013-01-04 21:35:31 +00:00
.ui-box.ui-box-show
.ui-box-head
.control-group
2012-08-17 06:26:59 +00:00
= f.label :title do
%strong= "Subject *"
.controls
2013-08-07 20:40:29 +00:00
= f.text_field :title, maxlength: 255, class: "input-xxlarge js-gfm-input", autofocus: true, required: true
2013-01-04 21:35:31 +00:00
.ui-box-body
.control-group
2013-01-04 21:35:31 +00:00
.issue_assignee.pull-left
= f.label :assignee_id do
%i.icon-user
Assign to
.controls
.pull-left
2013-06-17 11:55:41 +00:00
= f.select(:assignee_id, @project.team.members.sort_by(&:name).map {|p| [ p.name, p.id ] }, { include_blank: "Select a user" }, {class: 'chosen'})
.pull-right
 
= link_to 'Assign to me', '#', class: 'btn btn-small assign-to-me-link'
2013-01-04 21:35:31 +00:00
.issue_milestone.pull-left
= f.label :milestone_id do
%i.icon-time
Milestone
2013-12-14 13:43:48 +00:00
.controls= f.select(:milestone_id, @project.milestones.active.collect {|p| [ p.title, p.id ] }, { include_blank: "Select milestone" }, {class: 'chosen'})
2013-01-04 21:35:31 +00:00
.ui-box-bottom
.control-group
2012-08-17 06:26:59 +00:00
= f.label :label_list do
%i.icon-tag
Labels
.controls
2013-08-07 20:40:29 +00:00
= f.text_field :label_list, maxlength: 2000, class: "input-xxlarge"
2013-07-24 15:26:14 +00:00
%p.hint Separate labels with commas.
.control-group
= f.label :description, "Details"
.controls
2013-08-07 20:40:29 +00:00
= 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'}.
2013-08-07 20:35:24 +00:00
.form-actions
- if @issue.new_record?
2013-01-29 20:18:19 +00:00
= f.submit 'Submit new issue', class: "btn btn-create"
-else
2013-01-29 20:18:19 +00:00
= f.submit 'Save changes', class: "btn-save btn"
2012-01-27 23:49:14 +00:00
2012-12-19 03:14:05 +00:00
- cancel_path = @issue.new_record? ? project_issues_path(@project) : project_issue_path(@project, @issue)
2013-01-29 20:18:19 +00:00
= link_to "Cancel", cancel_path, class: 'btn btn-cancel'
2012-12-18 03:14:05 +00:00
:javascript
2013-05-29 10:16:30 +00:00
$("#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", "");
2013-06-09 16:36:08 +00:00
})
2013-05-29 10:16:30 +00:00
.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;
}
});
2012-12-18 03:14:05 +00:00
2013-05-29 10:16:30 +00:00
$('.assign-to-me-link').on('click', function(e){
2013-08-08 18:26:13 +00:00
$('#issue_assignee_id').val("#{current_user.id}").trigger("chosen:updated");
2013-05-29 10:16:30 +00:00
e.preventDefault();
});