Browse Source

Add width option to schema

pull/129/head
Paul Robert Lloyd 3 years ago
parent
commit
4267335e59
  1. 1
      README.md
  2. 3
      app/models/form/question.rb
  3. 4
      config/forms/schema/2021_2022.json

1
README.md

@ -123,6 +123,7 @@ The JSON should follow the structure:
"min": Integer, // numeric only "min": Integer, // numeric only
"max": Integer, // numeric only "max": Integer, // numeric only
"step": Integer, // numeric only "step": Integer, // numeric only
"width": Integer, // text and numeric only
"answer_options": { // checkbox and radio only "answer_options": { // checkbox and radio only
"0": String, "0": String,
"1": String "1": String

3
app/models/form/question.rb

@ -1,6 +1,6 @@
class Form::Question class Form::Question
attr_accessor :id, :header, :hint_text, :description, :questions, attr_accessor :id, :header, :hint_text, :description, :questions,
:type, :min, :max, :step, :fields_to_add, :result_field, :type, :min, :max, :step, :width, :fields_to_add, :result_field,
:conditional_for, :readonly, :answer_options, :page, :check_answer_label :conditional_for, :readonly, :answer_options, :page, :check_answer_label
def initialize(id, hsh, page) def initialize(id, hsh, page)
@ -12,6 +12,7 @@ class Form::Question
@min = hsh["min"] @min = hsh["min"]
@max = hsh["max"] @max = hsh["max"]
@step = hsh["step"] @step = hsh["step"]
@width = hsh["width"]
@fields_to_add = hsh["fields-to-add"] @fields_to_add = hsh["fields-to-add"]
@result_field = hsh["result-field"] @result_field = hsh["result-field"]
@readonly = hsh["readonly"] @readonly = hsh["readonly"]

4
config/forms/schema/2021_2022.json

@ -80,6 +80,10 @@
"description": "", "description": "",
"type": "string" "type": "string"
}, },
"width": {
"description": "",
"type": "integer"
},
"answer_options": { "answer_options": {
"description": "", "description": "",
"type": "object" "type": "object"

Loading…
Cancel
Save