Commit 04cc6dd6 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Assign to me link on issue form

parent 003f18c2
...@@ -19,7 +19,9 @@ ...@@ -19,7 +19,9 @@
= f.label :assignee_id do = f.label :assignee_id do
%i.icon-user %i.icon-user
Assign to Assign to
.input= f.select(:assignee_id, @project.users.alphabetically.collect {|p| [ p.name, p.id ] }, { include_blank: "Select a user" }, {class: 'chosen'}) .input
= f.select(:assignee_id, @project.users.alphabetically.collect {|p| [ p.name, p.id ] }, { include_blank: "Select a user" }, {class: 'chosen'})
= link_to 'Assign to me', '#', class: 'btn btn-small assign-to-me-link'
.issue_milestone.pull-left .issue_milestone.pull-left
= f.label :milestone_id do = f.label :milestone_id do
%i.icon-time %i.icon-time
...@@ -55,31 +57,33 @@ ...@@ -55,31 +57,33 @@
:javascript :javascript
$(function(){ $("#issue_label_list")
$("#issue_label_list") .bind( "keydown", function( event ) {
.bind( "keydown", function( event ) { if ( event.keyCode === $.ui.keyCode.TAB &&
if ( event.keyCode === $.ui.keyCode.TAB && $( this ).data( "autocomplete" ).menu.active ) {
$( this ).data( "autocomplete" ).menu.active ) { event.preventDefault();
event.preventDefault(); }
} })
}) .autocomplete({
.autocomplete({ minLength: 0,
minLength: 0, source: function( request, response ) {
source: function( request, response ) { response( $.ui.autocomplete.filter(
response( $.ui.autocomplete.filter( #{raw labels_autocomplete_source}, extractLast( request.term ) ) );
#{raw labels_autocomplete_source}, extractLast( request.term ) ) ); },
}, focus: function() {
focus: function() { return false;
return false; },
}, select: function(event, ui) {
select: function(event, ui) { var terms = split( this.value );
var terms = split( this.value ); terms.pop();
terms.pop(); terms.push( ui.item.value );
terms.push( ui.item.value ); terms.push( "" );
terms.push( "" ); this.value = terms.join( ", " );
this.value = terms.join( ", " ); return false;
return false; }
} });
});
});
$('.assign-to-me-link').on('click', function(e){
$('#issue_assignee_id').val("#{current_user.id}").trigger("liszt:updated");
e.preventDefault();
});
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment