Skip to content

Commit

Permalink
Merge pull request kobotoolbox#2076 from kobotoolbox/enable-file-rang…
Browse files Browse the repository at this point in the history
…e-simple

Enable file and range question types (simple)
  • Loading branch information
jnm authored Dec 10, 2018
2 parents ab6e8c4 + 77b566b commit fafea5d
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 4 deletions.
6 changes: 6 additions & 0 deletions jsapp/scss/stylesheets/partials/_icons.scss
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
.fa.fa-lato-text:before,
.fa.fa-lato-integer:before,
.fa.fa-lato-decimal:before,
.fa.fa-lato-range:before,
.fa.fa-lato-calculate:before {
font-family: $font;
font-weight: 600;
Expand All @@ -55,6 +56,11 @@
font-size: 0.9em;
}

.fa.fa-lato-range:before {
content: "1..1";
font-size: 0.9em;
}

.fa.fa-lato-calculate:before {
content: "1+1";
font-size: 0.9em;
Expand Down
7 changes: 5 additions & 2 deletions jsapp/scss/stylesheets/partials/form_builder/_card.scss
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,11 @@ $cardIndicatorIconWidth: 21px;
font-size: 0.95em;
background-color: #8595A5;
}
.fa-lato-calculate, .fa-lato-decimal,
.fa-lato-integer, .fa-lato-text {
.fa-lato-range,
.fa-lato-calculate,
.fa-lato-decimal,
.fa-lato-integer,
.fa-lato-text {
font-size: 15px;
width: $cardIndicatorIconWidth;
}
Expand Down
8 changes: 8 additions & 0 deletions jsapp/xlform/src/model.configs.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,9 @@ module.exports = do ->
audio:
label:
value: "Use the camera's microphone to record a sound"
file:
label:
value: "Upload a file"
note:
label:
value: "This note can be read out loud"
Expand All @@ -150,6 +153,9 @@ module.exports = do ->
date:
label:
value: "Enter a date"
range:
label:
value: "Enter a number within a specified range"
calculate:
calculation:
value: ""
Expand Down Expand Up @@ -187,6 +193,7 @@ module.exports = do ->
["text", "Text"], # expects text
["integer", "Integer"], #e.g. 42
["decimal", "Decimal"], #e.g. 3.14
["range", "Range"], #e.g. 1-5
["geopoint", "Geopoint (GPS)"], # Can use satelite GPS coordinates
["geotrace", "Geotrace (GPS)"], # Can use satelite GPS coordinates
["geoshape", "Geoshape (GPS)"], # Can use satelite GPS coordinates
Expand All @@ -197,6 +204,7 @@ module.exports = do ->
["datetime", "Date and Time"], #e.g. (2012-Jan-4 3:04PM)
["audio", "Audio", isMedia: true], # Can use phone microphone to record audio
["video", "Video", isMedia: true], # Can use phone camera to record video
["file", "File"],
["calculate", "Calculate"],
["select_one", "Select", orOtherOption: true, specifyChoice: true],
["score", "Score"],
Expand Down
14 changes: 13 additions & 1 deletion jsapp/xlform/src/view.icons.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,22 @@ module.exports = do ->
grouping: "r5"
id: "rank"
,

# r6
label: _t("Calculate")
faClass: "lato-calculate"
grouping: "r4"
grouping: "r6"
id: "calculate"
,
label: _t("File")
faClass: "file"
grouping: "r6"
id: "file"
,
label: _t("Range")
faClass: "lato-range"
grouping: "r6"
id: "range"
,
]

Expand Down
5 changes: 4 additions & 1 deletion jsapp/xlform/src/view.rowSelector.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,10 @@ module.exports = do ->
for mrow in $icons.grouped()
menurow = $("<div>", class: "questiontypelist__row").appendTo $menu
for mitem, i in mrow when mitem
menurow.append $viewTemplates.$$render('xlfRowSelector.cell', mitem.attributes)
if mitem.id is 'range'
console.warn("range question type is not fully supported yet")
else
menurow.append $viewTemplates.$$render('xlfRowSelector.cell', mitem.attributes)

@scrollFormBuilder('+=220')
@$('.questiontypelist__item').click _.bind(@selectMenuItem, @)
Expand Down

0 comments on commit fafea5d

Please sign in to comment.