make it possible to remove default signature

This commit is contained in:
Pete Matsyburka
2024-01-05 22:48:55 +02:00
parent 80a3ef9193
commit 7dc342a6f9
3 changed files with 9 additions and 2 deletions
@@ -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
+2 -1
View File
@@ -25,7 +25,8 @@
<p class="text-2xl font-bold mt-8 mb-4">Signature</p>
<% signature = UserConfigs.load_signature(current_user) %>
<% if signature %>
<div class="flex justify-center mb-4">
<div class="flex justify-center mb-4 relative">
<%= button_to button_title(title: 'Remove', disabled_with: 'Removing'), user_signature_path, method: :delete, class: 'right-0 top-0 absolute link' %>
<img src="<%= signature.url %>" style="max-height: 200px; width: auto" width="<%= signature.metadata['width'] %>" height="<%= signature.metadata['height'] %>">
</div>
<% end %>