Skip to content

Commit

Permalink
Add 'save' case for button to rename_vm method to save a new name of VM
Browse files Browse the repository at this point in the history
  • Loading branch information
Hilda Stastna committed Jul 30, 2018
1 parent a7c2322 commit 814a182
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions app/controllers/vm_common.rb
Original file line number Diff line number Diff line change
Expand Up @@ -831,6 +831,24 @@ def rename_vm
flash_to_session(msg)
javascript_redirect(previous_breadcrumb_url)
end
when 'save'
begin
@record.rename(@edit[:new][:name])
rescue StandardError => bang
add_flash(_("Error during 'VM update': %{message}") % {:message => bang.message}, :error)
else
flash = _("VM \"%{name}\" was saved") % {:name => @record.name}
end
params[:id] = @record.id.to_s # reset id in params for show
@record = nil
add_flash(flash)
if @edit[:explorer]
@sb[:action] = nil
replace_right_cell
else
flash_to_session
javascript_redirect(previous_breadcrumb_url)
end
when 'reset'
vm_rename
flash_to_session(_('All changes have been reset'), :warning)
Expand Down

0 comments on commit 814a182

Please sign in to comment.