[refs #194] fix manage issue executor

This commit is contained in:
Alexander Machehin 2012-03-06 22:31:07 +06:00
parent b9de81f4df
commit 1791160b09
4 changed files with 16 additions and 11 deletions

View File

@ -140,8 +140,9 @@ $(document).ready(function() {
var form_edit = $('form.edit_form.issue');
form_new.find('#people-span').fadeOut(0);
remExecutor(form_new);
form_new.find('#issue_executor').html($(this).clone().removeClass('add_executor').addClass('remove_executor'));
form_edit.find('#issue_user').val($(this).find("input[name='user_id']").val());
var clone = $(this).clone().removeClass('add_executor').addClass('remove_executor');
form_new.find('#issue_executor').html(clone);
$('.current_executor').html(clone.removeClass('select'));
$(this).addClass('select');
});
@ -242,23 +243,22 @@ $(document).ready(function() {
$('.button.manage_executor').live('click', function() {
$('form#search_user, .button.update_executor').fadeIn(0);
$('.current_executor .people').addClass('remove_executor selected');
$(this).fadeOut(0);
});
$('.button.manage_labels').live('click', function() {
$('form#search_labels, .button.update_labels').fadeIn(0);
//~ $('.current_labels').
$(this).fadeOut(0);
});
$('.button.update_executor').live('click', function() {
var form = $('form.edit_form.issue');
var form = $('form.edit_executor.issue');
$.ajax({
type: 'POST',
url: form.attr("action"),
data: form.serialize(),
success: function(data){
$('.current_executor').html($('#manage_issue_users_list .add_executor.people.selected.select').clone());
$('form#search_user, .button.update_executor').fadeOut(0);
$('.button.manage_executor').fadeIn(0);
$('#manage_issue_users_list').html('');

View File

@ -9,16 +9,22 @@
- if can_manage
=form_tag [@project, @issue], :id => 'update_issue_status', :method => :put do
=hidden_field_tag "issue_status", @issue.closed? ? 'closed' : 'open', :name => "issue[status]"
.bordered.nopadding
%h3=t('layout.issues.executor')
- if @issue.persisted?
-if can_manage
=form_for :issue, :url => [@project, @issue], :method => :put, :html => { :class => 'edit_executor issue'} do |f|
.current_executor
- if @issue.user
#user-0.people
.avatar=image_tag(@issue.user.avatar(25), :alt => 'avatar')
.name="#{@issue.user.uname} (#{@issue.user.name})"
=hidden_field_tag "user-0", @issue.user.id, :name => 'issue[user_id]'
.both
- else
.people.nopointer
.avatar=image_tag(@issue.user.avatar(25), :alt => 'avatar')
.name="#{@issue.user.uname} (#{@issue.user.name})"
=hidden_field_tag "user-0", @issue.user.id, :name => 'user_id'
.both
=link_to(t('layout.issues.label_manage'), '#', :class => "button tmargin10 manage_executor") if can_manage
- if can_manage

View File

@ -2,5 +2,5 @@
.people.selected{:id => "user-#{index}", :class => 'add_executor'}
.avatar=image_tag(user.avatar(25), :alt => 'avatar')
.name="#{user.uname} (#{user.name})"
=hidden_field_tag "user-#{index}", user.id, :name => 'user_id'
=hidden_field_tag "user-#{index}", user.id, :name => 'issue[user_id]'
.both

View File

@ -24,7 +24,6 @@
.leftlist= t('activerecord.attributes.issue.body') + ':'
.rightlist= f.text_area :body
.both
=hidden_field_tag "issue_user", @issue.user.id, :name => "issue[user_id]"
=f.submit t('layout.update'), :id => 'update_issue_content'
=link_to t('layout.issues.cancel_button'), '#', :id => 'cancel_edit_issue_content', :class => 'button'
%br