diff --git a/app/javascript/controllers/hello_controller.js b/app/javascript/controllers/hello_controller.js index 5975c078..3bc2e515 100644 --- a/app/javascript/controllers/hello_controller.js +++ b/app/javascript/controllers/hello_controller.js @@ -1,7 +1,16 @@ import { Controller } from "@hotwired/stimulus" export default class extends Controller { - connect() { - this.element.textContent = "Hello World!" + + static get targets() { + return ['name', 'output'] + } + + initialize() { + console.log("Hello Controller Initialized!"); + } + + greet() { + alert(`Hello, ${this.nameTarget.value}!`); } } diff --git a/app/views/pages/demo.html.erb b/app/views/pages/demo.html.erb new file mode 100644 index 00000000..50fc5a9f --- /dev/null +++ b/app/views/pages/demo.html.erb @@ -0,0 +1,22 @@ +<%# 404 Template from https://tailwindui.com/components/marketing/feedback/404-pages#component-9e31dc71bccd709e04de0ed11a1328b0 %> +
+
+

Platform Console Demo Page

+

Platform Console Demo Page

+ +
+
+

Stimulus Controller

+

Type your name and click Greet!

+
+
+ + + + +
+
+
+
diff --git a/config/routes.rb b/config/routes.rb index 2ca7cff4..3fda964a 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -11,6 +11,9 @@ root to: redirect('/teams'), constraints: ->(request) { AuthenticatableConstraint.new(request).current_user.present? } root 'pages#home', as: :unauthenticated_root + # Demo Page + get '/demo', to: 'pages#demo' + # Session get '/login' => 'sessions#new' post '/login' => 'sessions#create'