From 1791160b092b4ac679836b5ece58b6f70efe48c7 Mon Sep 17 00:00:00 2001 From: Alexander Machehin Date: Tue, 6 Mar 2012 22:31:07 +0600 Subject: [PATCH] [refs #194] fix manage issue executor --- app/assets/javascripts/extra/tracker.js | 10 +++++----- app/views/issues/_manage_sidebar.html.haml | 14 ++++++++++---- app/views/issues/_search_collaborators.html.haml | 2 +- app/views/issues/show.html.haml | 1 - 4 files changed, 16 insertions(+), 11 deletions(-) diff --git a/app/assets/javascripts/extra/tracker.js b/app/assets/javascripts/extra/tracker.js index e84469ffe..735f9998f 100644 --- a/app/assets/javascripts/extra/tracker.js +++ b/app/assets/javascripts/extra/tracker.js @@ -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(''); diff --git a/app/views/issues/_manage_sidebar.html.haml b/app/views/issues/_manage_sidebar.html.haml index c360f1410..f1da69a84 100644 --- a/app/views/issues/_manage_sidebar.html.haml +++ b/app/views/issues/_manage_sidebar.html.haml @@ -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? - .current_executor - - if @issue.user + -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 diff --git a/app/views/issues/_search_collaborators.html.haml b/app/views/issues/_search_collaborators.html.haml index 46d20276a..479281b15 100644 --- a/app/views/issues/_search_collaborators.html.haml +++ b/app/views/issues/_search_collaborators.html.haml @@ -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 diff --git a/app/views/issues/show.html.haml b/app/views/issues/show.html.haml index 03c16ca8b..fb1dbef33 100644 --- a/app/views/issues/show.html.haml +++ b/app/views/issues/show.html.haml @@ -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