2011-11-25 21:40:12 +00:00
|
|
|
%div.issue-form-holder
|
2013-07-13 05:45:48 +00:00
|
|
|
%h3.page-title= @issue.new_record? ? "New Issue" : "Edit Issue ##{@issue.id}"
|
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
|
2013-08-07 20:22:46 +00:00
|
|
|
.control-group
|
2012-08-17 06:26:59 +00:00
|
|
|
= f.label :title do
|
2012-06-27 18:30:35 +00:00
|
|
|
%strong= "Subject *"
|
2013-08-07 20:22:46 +00:00
|
|
|
.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
|
2013-08-07 20:22:46 +00:00
|
|
|
.control-group
|
2013-01-04 21:35:31 +00:00
|
|
|
.issue_assignee.pull-left
|
|
|
|
= f.label :assignee_id do
|
|
|
|
%i.icon-user
|
|
|
|
Assign to
|
2013-08-07 20:22:46 +00:00
|
|
|
.controls
|
2013-06-10 16:44:32 +00:00
|
|
|
.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'})
|
2013-06-10 16:44:32 +00:00
|
|
|
.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-08-07 20:22:46 +00:00
|
|
|
.controls= f.select(:milestone_id, @project.milestones.active.all.collect {|p| [ p.title, p.id ] }, { include_blank: "Select milestone" }, {class: 'chosen'})
|
2012-04-16 21:22:59 +00:00
|
|
|
|
2013-01-04 21:35:31 +00:00
|
|
|
.ui-box-bottom
|
2013-08-07 20:22:46 +00:00
|
|
|
.control-group
|
2012-08-17 06:26:59 +00:00
|
|
|
= f.label :label_list do
|
|
|
|
%i.icon-tag
|
2012-06-27 18:30:35 +00:00
|
|
|
Labels
|
2013-08-07 20:22:46 +00:00
|
|
|
.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.
|
2012-06-03 22:37:27 +00:00
|
|
|
|
2013-08-07 20:22:46 +00:00
|
|
|
.control-group
|
2012-06-27 18:30:35 +00:00
|
|
|
= f.label :description, "Details"
|
2013-08-07 20:22:46 +00:00
|
|
|
.controls
|
2013-08-07 20:40:29 +00:00
|
|
|
= f.text_area :description, class: "input-xxlarge js-gfm-input", rows: 14
|
2012-09-06 07:50:47 +00:00
|
|
|
%p.hint Issues are parsed with #{link_to "GitLab Flavored Markdown", help_markdown_path, target: '_blank'}.
|
2011-11-25 21:40:12 +00:00
|
|
|
|
2012-06-27 18:20:35 +00:00
|
|
|
|
2013-08-07 20:35:24 +00:00
|
|
|
.form-actions
|
2012-03-17 16:02:48 +00:00
|
|
|
- if @issue.new_record?
|
2013-01-29 20:18:19 +00:00
|
|
|
= f.submit 'Submit new issue', class: "btn btn-create"
|
2012-03-17 16:02:48 +00:00
|
|
|
-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();
|
|
|
|
}
|
|
|
|
})
|
2013-09-12 17:15:10 +00:00
|
|
|
.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();
|
|
|
|
});
|