diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index de6be794..b2ddb195 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,2 +1,10 @@ module ApplicationHelper + def classes_for_flash(flash_type) + case flash_type.to_sym + when :error + 'bg-red-100 text-red-700 border-red-300' + else + 'bg-blue-100 text-blue-700 border-blue-300' + end + end end diff --git a/app/javascript/application.js b/app/javascript/application.js index 22b4d7e5..caea8389 100644 --- a/app/javascript/application.js +++ b/app/javascript/application.js @@ -1,4 +1,5 @@ // Configure your import map in config/importmap.rb. Read more: https://github.com/rails/importmap-rails import "@rails/actioncable" +import "controllers" import "@hotwired/turbo-rails" diff --git a/app/javascript/controllers/application.js b/app/javascript/controllers/application.js new file mode 100644 index 00000000..1213e85c --- /dev/null +++ b/app/javascript/controllers/application.js @@ -0,0 +1,9 @@ +import { Application } from "@hotwired/stimulus" + +const application = Application.start() + +// Configure Stimulus development experience +application.debug = false +window.Stimulus = application + +export { application } diff --git a/app/javascript/controllers/index.js b/app/javascript/controllers/index.js new file mode 100644 index 00000000..02977bf0 --- /dev/null +++ b/app/javascript/controllers/index.js @@ -0,0 +1,5 @@ +import { application } from "controllers/application" + +// Eager load all controllers defined in the import map under controllers/**/*_controller +import { eagerLoadControllersFrom } from "@hotwired/stimulus-loading" +eagerLoadControllersFrom("controllers", application) diff --git a/app/javascript/controllers/removals_controller.js b/app/javascript/controllers/removals_controller.js new file mode 100644 index 00000000..9d4172df --- /dev/null +++ b/app/javascript/controllers/removals_controller.js @@ -0,0 +1,7 @@ +import { Controller } from "@hotwired/stimulus" + +export default class extends Controller { + remove() { + this.element.remove() + } +} diff --git a/app/views/devise/registrations/edit.html.erb b/app/views/devise/registrations/edit.html.erb index 1467b9ec..9400a564 100644 --- a/app/views/devise/registrations/edit.html.erb +++ b/app/views/devise/registrations/edit.html.erb @@ -1,5 +1,5 @@
And change this text!
diff --git a/app/views/devise/registrations/new.html.erb b/app/views/devise/registrations/new.html.erb index c73cb58d..2088f026 100644 --- a/app/views/devise/registrations/new.html.erb +++ b/app/views/devise/registrations/new.html.erb @@ -1,5 +1,5 @@And change this text!
diff --git a/app/views/devise/sessions/new.html.erb b/app/views/devise/sessions/new.html.erb index d89afc2c..b0653930 100644 --- a/app/views/devise/sessions/new.html.erb +++ b/app/views/devise/sessions/new.html.erb @@ -1,5 +1,5 @@And change this text!
diff --git a/app/views/devise/shared/_links.html.erb b/app/views/devise/shared/_links.html.erb index 7a75304b..7cea86dc 100644 --- a/app/views/devise/shared/_links.html.erb +++ b/app/views/devise/shared/_links.html.erb @@ -1,25 +1,37 @@ -<%- if controller_name != 'sessions' %> - <%= link_to "Log in", new_session_path(resource_name) %>