mirror of
https://github.com/redmine/redmine.git
synced 2025-12-16 05:20:28 +01:00
Add "Assign to me" shortcut to issue edit form (#29285).
Patch by Marius BALTEANU. git-svn-id: http://svn.redmine.org/redmine/trunk@19539 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -15,8 +15,13 @@
|
||||
<% end %>
|
||||
|
||||
<% if @issue.safe_attribute? 'assigned_to_id' %>
|
||||
<p><%= f.select :assigned_to_id, principals_options_for_select(@issue.assignable_users, @issue.assigned_to),
|
||||
:include_blank => true, :required => @issue.required_attribute?('assigned_to_id') %></p>
|
||||
<p>
|
||||
<%= f.select :assigned_to_id, principals_options_for_select(@issue.assignable_users, @issue.assigned_to),
|
||||
:include_blank => true, :required => @issue.required_attribute?('assigned_to_id') %>
|
||||
<% if @issue.assignable_users.include?(User.current) %>
|
||||
<a class="assign-to-me-link<%= ' hidden' if @issue.assigned_to_id == User.current.id %>" href="#" data-id="<%= User.current.id %>"><%= l(:label_assign_to_me) %></a>
|
||||
<% end %>
|
||||
</p>
|
||||
<% end %>
|
||||
|
||||
<% if @issue.safe_attribute?('category_id') && @issue.project.issue_categories.any? %>
|
||||
|
||||
@@ -60,5 +60,25 @@ $(document).ready(function(){
|
||||
$("#issue_tracker_id, #issue_status_id").each(function(){
|
||||
$(this).val($(this).find("option[selected=selected]").val());
|
||||
});
|
||||
$(".assign-to-me-link").click(function(event){
|
||||
event.preventDefault();
|
||||
var element = $(event.target);
|
||||
$('#issue_assigned_to_id').val(element.data('id'));
|
||||
element.hide();
|
||||
});
|
||||
$('#issue_assigned_to_id').change(function(event){
|
||||
var assign_to_me_link = $(".assign-to-me-link");
|
||||
|
||||
if (assign_to_me_link.length > 0) {
|
||||
var user_id = $(event.target).val();
|
||||
var current_user_id = assign_to_me_link.data('id');
|
||||
|
||||
if (user_id == current_user_id) {
|
||||
assign_to_me_link.hide();
|
||||
} else {
|
||||
assign_to_me_link.show();
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
<% end %>
|
||||
|
||||
Reference in New Issue
Block a user