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. 18
      config/forms/schema/2021_2022.json

1
README.md

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

3
app/models/form/question.rb

@ -1,6 +1,6 @@
class Form::Question
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
def initialize(id, hsh, page)
@ -12,6 +12,7 @@ class Form::Question
@min = hsh["min"]
@max = hsh["max"]
@step = hsh["step"]
@width = hsh["width"]
@fields_to_add = hsh["fields-to-add"]
@result_field = hsh["result-field"]
@readonly = hsh["readonly"]

18
config/forms/schema/2021_2022.json

@ -27,9 +27,9 @@
"properties": {
"label": {
"description": "",
"type": "string"
"type": "string"
},
"subsections": {
"subsections": {
"type": "object",
"patternProperties": {
"[a-z_]+": {
@ -41,7 +41,7 @@
"description": "",
"type": "string"
},
"pages": {
"pages": {
"type": "object",
"patternProperties": {
"[a-z_]+": {
@ -80,6 +80,10 @@
"description": "",
"type": "string"
},
"width": {
"description": "",
"type": "integer"
},
"answer_options": {
"description": "",
"type": "object"
@ -95,18 +99,18 @@
},
"minProperties": 1
}
}
}
}
},
"minProperties": 1
}
}
}
}
},
},
"minProperties": 2
}
},
"minProperties": 1
}
}
}
}

Loading…
Cancel
Save