diff --git a/app/controllers/user_signatures_controller.rb b/app/controllers/user_signatures_controller.rb index 69d0e795..e7c5b962 100644 --- a/app/controllers/user_signatures_controller.rb +++ b/app/controllers/user_signatures_controller.rb @@ -28,6 +28,12 @@ class UserSignaturesController < ApplicationController end end + def destroy + @user_config.destroy + + redirect_to settings_profile_index_path, notice: 'Signature has been removed' + end + private def load_user_config diff --git a/app/views/profile/index.html.erb b/app/views/profile/index.html.erb index 96db7027..27ab55e8 100644 --- a/app/views/profile/index.html.erb +++ b/app/views/profile/index.html.erb @@ -25,7 +25,8 @@

Signature

<% signature = UserConfigs.load_signature(current_user) %> <% if signature %> -
+
+ <%= button_to button_title(title: 'Remove', disabled_with: 'Removing'), user_signature_path, method: :delete, class: 'right-0 top-0 absolute link' %>
<% end %> diff --git a/config/routes.rb b/config/routes.rb index 25d55107..6cd7e0ae 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -59,7 +59,7 @@ Rails.application.routes.draw do resource :newsletter, only: %i[show update] resources :enquiries, only: %i[create] resources :users, only: %i[new create edit update destroy] - resource :user_signature, only: %i[edit update] + resource :user_signature, only: %i[edit update destroy] resources :submissions, only: %i[show destroy] resources :console_redirect, only: %i[index] resource :templates_upload, only: %i[create]