2011-11-25 16:40:12 -05:00
|
|
|
%div.issue-form-holder
|
2013-07-13 01:45:48 -04:00
|
|
|
%h3.page-title= @issue.new_record? ? "New Issue" : "Edit Issue ##{@issue.id}"
|
2012-12-18 22:14:05 -05:00
|
|
|
= form_for [@project, @issue] do |f|
|
2012-01-17 17:46:13 -05:00
|
|
|
-if @issue.errors.any?
|
2013-01-30 09:53:18 -05:00
|
|
|
.alert.alert-error
|
2012-12-18 22:14:05 -05:00
|
|
|
- @issue.errors.full_messages.each do |msg|
|
|
|
|
%span= msg
|
|
|
|
%br
|
2013-01-04 16:35:31 -05:00
|
|
|
.ui-box.ui-box-show
|
|
|
|
.ui-box-head
|
2013-08-07 16:22:46 -04:00
|
|
|
.control-group
|
2012-08-17 02:26:59 -04:00
|
|
|
= f.label :title do
|
2012-06-27 14:30:35 -04:00
|
|
|
%strong= "Subject *"
|
2013-08-07 16:22:46 -04:00
|
|
|
.controls
|
2013-08-07 16:40:29 -04:00
|
|
|
= f.text_field :title, maxlength: 255, class: "input-xxlarge js-gfm-input", autofocus: true, required: true
|
2013-01-04 16:35:31 -05:00
|
|
|
.ui-box-body
|
2013-08-07 16:22:46 -04:00
|
|
|
.control-group
|
2013-01-04 16:35:31 -05:00
|
|
|
.issue_assignee.pull-left
|
|
|
|
= f.label :assignee_id do
|
|
|
|
%i.icon-user
|
|
|
|
Assign to
|
2013-08-07 16:22:46 -04:00
|
|
|
.controls
|
2013-06-10 12:44:32 -04:00
|
|
|
.pull-left
|
2013-06-17 07:55:41 -04: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 12:44:32 -04:00
|
|
|
.pull-right
|
|
|
|
|
|
|
|
= link_to 'Assign to me', '#', class: 'btn btn-small assign-to-me-link'
|
2013-01-04 16:35:31 -05:00
|
|
|
.issue_milestone.pull-left
|
|
|
|
= f.label :milestone_id do
|
|
|
|
%i.icon-time
|
|
|
|
Milestone
|
2013-08-07 16:22:46 -04: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 17:22:59 -04:00
|
|
|
|
2013-01-04 16:35:31 -05:00
|
|
|
.ui-box-bottom
|
2013-08-07 16:22:46 -04:00
|
|
|
.control-group
|
2012-08-17 02:26:59 -04:00
|
|
|
= f.label :label_list do
|
|
|
|
%i.icon-tag
|
2012-06-27 14:30:35 -04:00
|
|
|
Labels
|
2013-08-07 16:22:46 -04:00
|
|
|
.controls
|
2013-08-07 16:40:29 -04:00
|
|
|
= f.text_field :label_list, maxlength: 2000, class: "input-xxlarge"
|
2013-07-24 11:26:14 -04:00
|
|
|
%p.hint Separate labels with commas.
|
2012-06-03 18:37:27 -04:00
|
|
|
|
2013-08-07 16:22:46 -04:00
|
|
|
.control-group
|
2012-06-27 14:30:35 -04:00
|
|
|
= f.label :description, "Details"
|
2013-08-07 16:22:46 -04:00
|
|
|
.controls
|
2013-08-07 16:40:29 -04:00
|
|
|
= f.text_area :description, class: "input-xxlarge js-gfm-input", rows: 14
|
2012-09-06 03:50:47 -04:00
|
|
|
%p.hint Issues are parsed with #{link_to "GitLab Flavored Markdown", help_markdown_path, target: '_blank'}.
|
2011-11-25 16:40:12 -05:00
|
|
|
|
2012-06-27 14:20:35 -04:00
|
|
|
|
2013-08-07 16:35:24 -04:00
|
|
|
.form-actions
|
2012-03-17 12:02:48 -04:00
|
|
|
- if @issue.new_record?
|
2013-01-29 15:18:19 -05:00
|
|
|
= f.submit 'Submit new issue', class: "btn btn-create"
|
2012-03-17 12:02:48 -04:00
|
|
|
-else
|
2013-01-29 15:18:19 -05:00
|
|
|
= f.submit 'Save changes', class: "btn-save btn"
|
2012-01-27 18:49:14 -05:00
|
|
|
|
2012-12-18 22:14:05 -05:00
|
|
|
- cancel_path = @issue.new_record? ? project_issues_path(@project) : project_issue_path(@project, @issue)
|
2013-01-29 15:18:19 -05:00
|
|
|
= link_to "Cancel", cancel_path, class: 'btn btn-cancel'
|
2012-12-17 22:14:05 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
:javascript
|
2013-05-29 06:16:30 -04:00
|
|
|
$("#issue_label_list")
|
|
|
|
.bind( "keydown", function( event ) {
|
|
|
|
if ( event.keyCode === $.ui.keyCode.TAB &&
|
|
|
|
$( this ).data( "autocomplete" ).menu.active ) {
|
|
|
|
event.preventDefault();
|
|
|
|
}
|
|
|
|
})
|
2013-06-09 12:36:08 -04:00
|
|
|
.bind( "click", function( event ) {
|
|
|
|
$( this ).autocomplete("search", "");
|
|
|
|
})
|
2013-05-29 06:16:30 -04: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-17 22:14:05 -05:00
|
|
|
|
2013-05-29 06:16:30 -04:00
|
|
|
$('.assign-to-me-link').on('click', function(e){
|
2013-08-08 14:26:13 -04:00
|
|
|
$('#issue_assignee_id').val("#{current_user.id}").trigger("chosen:updated");
|
2013-05-29 06:16:30 -04:00
|
|
|
e.preventDefault();
|
|
|
|
});
|