Last active
December 1, 2020 08:29
-
-
Save jPurush/bfd2255583f9f93f8d625776f39868a1 to your computer and use it in GitHub Desktop.
s123 ember setGeometry
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Route from '@ember/routing/route'; | |
export default Route.extend({ | |
beforeModel (transition) { | |
this._super(...arguments); | |
return new Promise((resolve, reject) => { | |
if (window) { | |
const script = document.createElement('script'); | |
script.onload = resolve; | |
script.onerror = reject; | |
script.async = true; | |
script.src = "https://survey123qa.arcgis.com/api/jsapi"; | |
document.body.appendChild(script); | |
} else { | |
return reject(new Error('not a webpage!')); | |
} | |
}); | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Component from '@glimmer/component'; | |
import { action } from '@ember/object'; | |
export default class extends Component { | |
@action | |
initWebForm () { | |
if (window && window.Survey123WebForm) { | |
this.webform = new window.Survey123WebForm({ | |
clientId: 'LznLxfjHubEsXuzB', | |
container: 'survey123webform-polygon', | |
itemId: 'f7e6ce5c0eb2476187f295e20f9664ca', | |
portalUrl: 'https://qa-pre-a-hub.mapsqa.arcgis.com', | |
hideElements: ['navbar','footer','header','subheader','description', 'field:polygon_map_question'], | |
version: 'latest', | |
autoRefresh: 1}); | |
let xformPolygon = '33 -98;37 -92;42 -100;33 -98'; | |
this.webform.setGeometry(xformPolygon); | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Controller from '@ember/controller'; | |
export default class ApplicationController extends Controller { | |
appName = 'S123 Set Geometry in Ember'; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"version": "0.17.1", | |
"EmberENV": { | |
"FEATURES": {}, | |
"_TEMPLATE_ONLY_GLIMMER_COMPONENTS": false, | |
"_APPLICATION_TEMPLATE_WRAPPER": true, | |
"_JQUERY_INTEGRATION": true | |
}, | |
"options": { | |
"use_pods": false, | |
"enable-testing": false | |
}, | |
"dependencies": { | |
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.js", | |
"ember": "3.18.1", | |
"ember-template-compiler": "3.18.1", | |
"ember-testing": "3.18.1" | |
}, | |
"addons": { | |
"@glimmer/component": "1.0.0", | |
"@ember/render-modifiers": "1.0.2" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment