Browse Source

Stimulus 3

pull/29/head
baarkerlounger 4 years ago
parent
commit
5022d5ab6c
  1. 2
      app/javascript/controllers/conditional_question_controller.js
  2. 7
      app/javascript/controllers/hello_controller.js
  3. 12
      app/javascript/controllers/index.js
  4. 2
      app/views/form/_radio_question.html.erb
  5. 4
      package.json
  6. 2777
      yarn.lock

2
app/javascript/controllers/conditional_question_controller.js

@ -1,4 +1,4 @@
import { Controller } from "stimulus"
import { Controller } from "@hotwired/stimulus"
export default class extends Controller {
displayConditional() {

7
app/javascript/controllers/hello_controller.js

@ -1,7 +0,0 @@
import { Controller } from "@hotwired/stimulus"
export default class extends Controller {
connect() {
this.element.textContent = "Hello World!"
}
}

12
app/javascript/controllers/index.js

@ -1,7 +1,9 @@
// This file is auto-generated by ./bin/rails stimulus:manifest:update
// Run that command whenever you add a new controller
// Load all the controllers within this directory and all subdirectories.
// Controller files must be named *_controller.js.
import { application } from "./application"
import { Application } from "@hotwired/stimulus"
import { definitionsFromContext } from "@hotwired/stimulus-webpack-helpers"
import HelloController from "./hello_controller"
application.register("hello", HelloController)
const application = Application.start()
const context = require.context("controllers", true, /_controller\.js$/)
application.load(definitionsFromContext(context))

2
app/views/form/_radio_question.html.erb

@ -10,7 +10,7 @@
<%= f.govuk_radio_button question_key, key, label: { text: val },
"data-controller": "conditional-question",
"data-action": "click->conditional-question#displayConditional",
"data-info": "#{question["conditional_for"].to_json}"
"data-info": question["conditional_for"].to_json
%>
<% else %>
<%= f.govuk_radio_button question_key, val, label: { text: val } %>

4
package.json

@ -3,6 +3,7 @@
"private": true,
"dependencies": {
"@hotwired/stimulus": "^3.0.0",
"@hotwired/stimulus-webpack-helpers": "^1.0.1",
"@hotwired/turbo": "^7.0.0-rc.3",
"@hotwired/turbo-rails": "^7.0.0-rc.3",
"@rails/actioncable": "^6.0.0",
@ -10,8 +11,7 @@
"@rails/ujs": "^6.0.0",
"@rails/webpacker": "5.4.0",
"govuk-frontend": "^3.13.0",
"stimulus": "^2.0.0",
"stimulus-use": "^0.26.0",
"stimulus": "^3.0.0",
"webpack": "^4.46.0",
"webpack-cli": "^3.3.12"
},

2777
yarn.lock

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save