Update edit form after aspect rename. Closes #2363.
This commit is contained in:
parent
beeb02dcd6
commit
c7c46d2b7b
2 changed files with 8 additions and 2 deletions
|
|
@ -118,7 +118,7 @@ class AspectsController < ApplicationController
|
|||
else
|
||||
flash[:error] = I18n.t 'aspects.update.failure', :name => @aspect.name
|
||||
end
|
||||
render :nothing => true, :status => 204
|
||||
render :json => { :name => @aspect.name }
|
||||
end
|
||||
|
||||
def toggle_contact_visibility
|
||||
|
|
|
|||
|
|
@ -8,12 +8,18 @@ function toggleAspectTitle(){
|
|||
$("#aspect_name_edit").toggleClass('hidden');
|
||||
}
|
||||
|
||||
function updateAspectName(new_name) {
|
||||
$('#aspect_name_title .name').html(new_name);
|
||||
$('input#aspect_name').val(new_name);
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
$('#rename_aspect_link').live('click', function(){
|
||||
toggleAspectTitle();
|
||||
});
|
||||
|
||||
$(".edit_aspect").live('ajax:success', function(data, json, xhr) {
|
||||
$('form.edit_aspect').live('ajax:success', function(evt, data, status, xhr) {
|
||||
updateAspectName(data['name']);
|
||||
toggleAspectTitle();
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue