From 18584f1de662c2b99852d7e6ff42d816d2403a6f Mon Sep 17 00:00:00 2001 From: Leszek Pietrzak Date: Mon, 3 Dec 2018 21:43:30 +0100 Subject: [PATCH 1/2] add guidance hint as default question property --- jsapp/xlform/src/model.base.coffee | 2 +- jsapp/xlform/src/model.configs.coffee | 14 +++++++++++++- jsapp/xlform/src/view.rowDetail.coffee | 7 +++++++ 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/jsapp/xlform/src/model.base.coffee b/jsapp/xlform/src/model.base.coffee index 91599731f8..37cc5638d6 100644 --- a/jsapp/xlform/src/model.base.coffee +++ b/jsapp/xlform/src/model.base.coffee @@ -161,7 +161,7 @@ module.exports = do -> # @_parent.trigger "change", @key, val, ctxt # when attributes change, register changes with parent survey - if @key in ["name", "label", "hint", "required", + if @key in ["name", "label", "hint", "guidance_hint", "required", "calculation", "default", "appearance", "constraint_message", "tags"] or @key.match(/^.+::.+/) @on "change", (changes)=> diff --git a/jsapp/xlform/src/model.configs.coffee b/jsapp/xlform/src/model.configs.coffee index c49f76a305..d4c966f4f3 100644 --- a/jsapp/xlform/src/model.configs.coffee +++ b/jsapp/xlform/src/model.configs.coffee @@ -168,7 +168,17 @@ module.exports = do -> label: value: "Acknowledge" - configs.columns = ["type", "name", "label", "hint", "required", "relevant", "default", "constraint"] + configs.columns = [ + "type", + "name", + "label", + "hint", + "guidance_hint", + "required", + "relevant", + "default", + "constraint" + ] configs.lookupRowType = do-> typeLabels = [ @@ -232,6 +242,8 @@ module.exports = do -> hint: value: "" _hideUnlessChanged: true + guidance_hint: + value: "" required: value: false _hideUnlessChanged: true diff --git a/jsapp/xlform/src/view.rowDetail.coffee b/jsapp/xlform/src/view.rowDetail.coffee index 7ba3b3d356..f1909e7366 100644 --- a/jsapp/xlform/src/view.rowDetail.coffee +++ b/jsapp/xlform/src/view.rowDetail.coffee @@ -167,6 +167,13 @@ module.exports = do -> afterRender: -> @listenForInputChange() + viewRowDetail.DetailViewMixins.guidance_hint = + html: -> + @$el.addClass("card__settings__fields--active") + viewRowDetail.Templates.textbox @cid, @model.key, _t("Guidance hint"), 'text' + afterRender: -> + @listenForInputChange() + viewRowDetail.DetailViewMixins.constraint_message = html: -> @$el.addClass("card__settings__fields--active") From 69ff05a8576cf4a896200729872bb3ce58b2f20e Mon Sep 17 00:00:00 2001 From: Leszek Pietrzak Date: Tue, 4 Dec 2018 13:51:02 +0100 Subject: [PATCH 2/2] change label and icon for barcode type --- jsapp/xlform/src/model.configs.coffee | 2 +- jsapp/xlform/src/view.icons.coffee | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/jsapp/xlform/src/model.configs.coffee b/jsapp/xlform/src/model.configs.coffee index d4c966f4f3..95385e1439 100644 --- a/jsapp/xlform/src/model.configs.coffee +++ b/jsapp/xlform/src/model.configs.coffee @@ -191,7 +191,7 @@ module.exports = do -> ["geotrace", "Geotrace (GPS)"], # Can use satelite GPS coordinates ["geoshape", "Geoshape (GPS)"], # Can use satelite GPS coordinates ["image", "Image", isMedia: true], # Can use phone camera, for example - ["barcode", "Barcode"], # Can scan a barcode using the phone camera + ["barcode", "Barcode / QR code"], # Can scan a barcode using the phone camera ["date", "Date"], #e.g. (4 July, 1776) ["time", "Time"], #e.g. (4 July, 1776) ["datetime", "Date and Time"], #e.g. (2012-Jan-4 3:04PM) diff --git a/jsapp/xlform/src/view.icons.coffee b/jsapp/xlform/src/view.icons.coffee index 1e287fe24c..bb7038660d 100644 --- a/jsapp/xlform/src/view.icons.coffee +++ b/jsapp/xlform/src/view.icons.coffee @@ -82,8 +82,8 @@ module.exports = do -> grouping: "r4" id: "note" , - label: _t("Barcode") - faClass: "barcode" + label: _t("Barcode / QR Code") + faClass: "qrcode" grouping: "r4" id: "barcode" ,