diff --git a/app/javascript/controllers/flash_controller.js b/app/javascript/controllers/flash_controller.js new file mode 100644 index 0000000..20cf7a9 --- /dev/null +++ b/app/javascript/controllers/flash_controller.js @@ -0,0 +1,8 @@ +import { Controller } from "@hotwired/stimulus" + +export default class extends Controller { + close(event) { + const target = event.target.closest('.alert') + target.remove() + } +} \ No newline at end of file diff --git a/app/javascript/controllers/index.js b/app/javascript/controllers/index.js index 40cfc50..e099ff0 100644 --- a/app/javascript/controllers/index.js +++ b/app/javascript/controllers/index.js @@ -3,12 +3,10 @@ // ./bin/rails generate stimulus controllerName import { application } from "./application" - import HelloController from "./hello_controller" -application.register("hello", HelloController) - import PhotoSwipeLightBoxController from "./photo_swipe_lightbox_controller" +import FlashMessageController from "./flash_controller" -console.log("ready to register photo-swipe") +application.register("hello", HelloController) application.register("photo-swipe-lightbox", PhotoSwipeLightBoxController) -console.log("successful to register photo-swipe") +application.register("flash", FlashMessageController) diff --git a/app/views/devise/registrations/edit.html.erb b/app/views/devise/registrations/edit.html.erb index b82e336..12398a8 100644 --- a/app/views/devise/registrations/edit.html.erb +++ b/app/views/devise/registrations/edit.html.erb @@ -1,43 +1,86 @@ -
Once you delete your account, there is no going back. Please be certain.
+ <%= button_to registration_path(resource_name), + class: "btn btn-error", + data: { + confirm: "Are you sure?", + turbo_confirm: "Are you sure you want to delete your account? This action cannot be undone." + }, + method: :delete do %> + Delete Account + <% end %> ++ Don't have an account? + <%= link_to "Create an account", new_registration_path(resource_name), class: "link link-primary" %> +
+