I'm trying to apply a simple radial gradient to the AlexaHeadline template. If you set the boolean param backgroundOverlayGradient to true, a linear gradient appears. Official document says:
When true, apply a gradient to the background.
...but I don't know where to set the gradient.
Any ideas?
Thanks for advice!
Found the answer by myself:
If your template (like in my case the AlexaHeadline template) does not support a property like "overlayGradient", you can use the "background" property. To use this property, APL version 1.3 is required.
Here's an example document customized from the example of the official docs:
{
"type": "APL",
"version": "1.6",
"import": [
{
"name": "alexa-layouts",
"version": "1.3.0"
}
],
"background": {
"type": "radial",
"colorRange": [
"blue",
"#000061"
],
"inputRange": [
0,
1
]
},
"mainTemplate": {
"parameters": [
"headlineData"
],
"items": [
{
"type": "AlexaHeadline",
"primaryText": "${headlineData.primaryText}",
"secondaryText": "${headlineData.secondaryText}",
"backgroundColor": "#colorRed800",
"backgroundImageSource": "https://.png",
"footerHintText": "${headlineData.footerHintText}",
"headerAttributionImage": "${headlineData.headerAttributionImage}",
"headerBackButton": true,
"headerBackButtonAccessibilityLabel": "back",
"headerDivider": false,
"headerSubtitle": "${headlineData.headerSubtitle}",
"headerTitle": "${headlineData.headerTitle}"
}
]
}
}
As you see, there's a "fake" backgroundImageSource-Url. Without that, the gradient does not appear. APL uses the backgroundColor property, if there's no proper backgroundImageSource. So, i think, backgroundColor overrides the background property, if it's used. I tried to apply gradient on the backgroundColor property, but that does not work for me.
Related
I am using surveyJS library in my react application for creating surveys, now my requirement is to add a welcome page before questions start. can some one help me on this?
One way you can do this is by adding a page to the beginning of the survey. Then place a single HTML widget on it and add your welcome page markup to it. Here's an example:
Update: add "firstPageIsStarted": true to your survey object if showing page numbers or progress bar. See docs: https://surveyjs.io/Documentation/Library?id=surveymodel#firstPageIsStarted
{
"pages": [
{
"name": "page1",
"elements": [
{
"type": "html",
"name": "question1",
"html": "<h1>Welcome!</h1>"
}
],
"questionTitleLocation": "hidden"
},
{
"name": "page2",
"elements": [
{
"type": "text",
"name": "question2"
},
{
"type": "checkbox",
"name": "question3",
"choices": [
"item1",
"item2",
"item3"
]
}
]
}
],
"firstPageIsStarted": true
}
This will show your welcome page plus the regular SurveyJS "Next" button, as part of the survey navigation. If you don't want to use the regular navigation buttons on your welcome page you can disable it like this:
{
"name": "page1",
"elements": [
{
"type": "html",
"name": "question1",
"html": "<h1>Welcome!</h1>"
}
],
"questionTitleLocation": "hidden",
"navigationButtonsVisibility": "hide"
},
Finally you can implement your own "Start Survey" button within your welcome page markup by assigning a value to currentPageNo when the button gets clicked. For example, survey.currentPageNo = 1. Here's the documentation for it: https://surveyjs.io/Documentation/Library?id=surveymodel#currentPageNo
I'm trying to create a slide show (2-3 images) using the Alexa authoring tool.I have managed to do this using the APL Pager which displays a series of components one at a time. The thing is that in order to switch from image A to image B..C I have to touch the screen and swipe left/right.
i want to make this happen automatically and have alexa swicth the images within a certain time, and it seems that this can be achieved using APL autopage but for some reason this is not working 😩
What I've done
Set up the APL using the APL pager
Added the auto page to the APL document
Component Id
duration
delay
After trying the simulation and directly in an echo show 5 it still only triggers when the display is touched.
Also tried:
Adding the standard command (auto pager) directly in the handler of alexa but same response.
Some doubts
Does it matter if i put the commands in the APLdocument.json[1] file or directly in the handler when i call .addDirective[2]..the only difference i see if i want the content or duration to be dynamic i should put it directly in the backend code(index.js) right?
[1]
{
"type": "APL",
"version": "1.4",
"settings": {},
"theme": "light",
"import": [],
"resources": [],
"styles": {},
"onMount": [],
"graphics": {},
"commands": [
{
"type": "AutoPage",
"componentId": "fisrtpager",
"duration": 1000,
"delay": 500
}
],
[2]
handlerInput.responseBuilder.addDirective({
type: 'Alexa.Presentation.APL.RenderDocument',
token:'arrugas',
document: physiolift,
commands: [{
"type": "AutoPage",
"componentId": "fisrtpager",
"duration": 1000,
"delay": 500
}]
});
}
Expected outPut
Have Alexa (echo show 5) to display a series of images like a carousel (without the need to touch the screen)
My code
APL Document
{
"type":"APL",
"version":"1.4",
"settings":{
},
"theme":"light",
"import":[
],
"resources":[
],
"styles":{
},
"onMount":[
],
"graphics":{
},
"commands":[
{
"type":"AutoPage",
"componentId":"fisrtpager",
"duration":1000,
"delay":500
}
],
"layouts":{
},
"mainTemplate":{
"parameters":[
"payload"
],
"items":[
{
"type":"Pager",
"id":"fisrtpager",
"width":"100%",
"height":"100%",
"items":[
{
"type":"Image",
"width":"100%",
"height":"100%",
"scale":"best-fill",
"source":"https://dyl80ryjxr1ke.cloudfront.net/external_assets/hero_examples/hair_beach_v1785392215/original.jpeg",
"align":"center"
},
{
"type":"Image",
"width":"100%",
"height":"100%",
"source":"https://interactive-examples.mdn.mozilla.net/media/cc0-images/grapefruit-slice-332-332.jpg",
"scale":"best-fill"
},
{
"type":"Text",
"text":"Just text content shown on page #3",
"textAlign":"center"
}
],
"navigation":"wrap"
}
]
}
}
index.js
// somewhere inside the intent im invoking
if (Alexa.getSupportedInterfaces(handlerInput.requestEnvelope)['Alexa.Presentation.APL']) {
// Create Render Directive.
handlerInput.responseBuilder.addDirective({
type: 'Alexa.Presentation.APL.RenderDocument',
token:'arrugas',
document: require('./documents/ImageTest.json')
});
}
speakOutput += ' just saying somthing'
return handlerInput.responseBuilder
.speak(speakOutput)
.reprompt('just saying something else')
.getResponse();
Just add the command in the "onMount" event handler. Here is the modified code which does exactly what you need:
{
"type": "APL",
"version": "1.4",
"settings": {},
"theme": "light",
"import": [],
"resources": [],
"styles": {},
"onMount": [],
"graphics": {},
"layouts": {},
"mainTemplate": {
"parameters": [
"payload"
],
"items": [
{
"type": "Pager",
"id": "fisrtpager",
"width": "100%",
"height": "100%",
"items": [
{
"type": "Image",
"width": "100%",
"height": "100%",
"scale": "best-fill",
"source": "https://dyl80ryjxr1ke.cloudfront.net/external_assets/hero_examples/hair_beach_v1785392215/original.jpeg",
"align": "center"
},
{
"type": "Image",
"width": "100%",
"height": "100%",
"source": "https://interactive-examples.mdn.mozilla.net/media/cc0-images/grapefruit-slice-332-332.jpg",
"scale": "best-fill"
},
{
"type": "Text",
"text": "Just text content shown on page #3",
"textAlign": "center"
}
],
"navigation": "none",
"onMount": [{
"type": "AutoPage",
"componentId": "fisrtpager",
"duration": 1000,
"delay": 500
}]
}
]
}
}
to update dynamically this feature from your backend code you can do the following:
// check if device supports APL
if (Alexa.getSupportedInterfaces(handlerInput.requestEnvelope)['Alexa.Presentation.APL']) {
// Create Render Directive.
handlerInput.responseBuilder.addDirective({
type: 'Alexa.Presentation.APL.RenderDocument',
token: "dialogManagementPagerDoc",
document: require('./PATH-TO/YOUR-APL-FILE.json')
})
.addDirective({
type: "Alexa.Presentation.APL.ExecuteCommands",
token: "dialogManagementPagerDoc",
commands: [
{
type: "AutoPage",
componentId: "YOUR_PAGER_ID",
delay: 1000,
duration: 5000
}
]
});
}
I'm creating a grouped list screen in ServiceNow's mobile app. I see that the Item View field is JSON that defines the layout options but I can't find ANY documentation on the format/schema or the JSON. They give examples that contain a few of the options but nothing that tells you all of the various parameters that you can use.
{
"Type": "ViewGroup",
"Orientation": "Vertical",
"Alignment": "Left",
"Distribution": "Auto",
"Children": [
{
"Type": "Text",
"Text": "PLACEHOLDER",
"CellId": "sys_group_by",
"TextColor": "#293e40",
"TextAlignment": "Left",
"MaxLines": 2,
"Font": {
"Weight": "regular",
"Size": 16
}
}
]
}
Has anyone found a reference for the entire JSON schema of the Item View?
My setting_data.json (Deput Shopify Theme)file:
{
"current": {
"checkout_error_color": "#ff6d6d",
"sections": {
"header": {
"type": "header",
"settings": {
"align_logo": "left",
"logo": "shopify:\/\/shop_images\/logo_9bb43dd5-21d6-442c-8a19-0f4adf03e13a.png",
"logo_max_width": 100,
"main_linklist": "main-menu",
"message": true,
"home_page_only": true,
"message_text": "Paw Paper – Edible Gift Wrap for Pets",
"message_link": "",
"color_bg": "#162950",
"color_text": "#ffffff"
}
},
How I can get section header variables in Shopify liquid template page?
I can get one variable:
{% assign text_color = settings.color_text %}
{{ text_color }}
I need to show custom block on page and get data for it from settings_data.json
"1543393771012": {
"type": "custom-content",
"blocks": {
"1543393771012-1": {
"type": "image",
"settings": {
"image": "shopify:\/\/shop_images\/info.png",
"width": "50%",
"alignment": "center"
}
},
"1543393802354": {
"type": "html",
"settings": {
"code": "<p>Paw Paper is the world's first edible wrapping paper designed specifically for pets. Our edible paper is 100% all-natural, made from potato starch with Omega-3 enhanced beef flavoring. It's water-soluble so no tape required!<\/p> <p>Just lick it like a stamp or dab water on the edges to bind the seams.<\/p>",
"width": "50%"
}
}
},
But, I can not get and display array with variables.
Help, please.
The settings_data.json file isn't something you can access directly in Liquid - but you can access the values stored within using the appropriate Liquid commands.
The global settings object in Liquid gives you access to all the variables defined in your settings_schema.json file, and nothing more.
However, your color_text setting isn't a theme setting, it's a section setting for the section named 'header'. This variable can be accessed as section.settings.color_text, so long as you are calling that from inside your header section.
Block settings are accessed in a similar way. Assuming that you have some sort of for block in section.blocks loop, those block-level settings can be accessed as block.settings.whatever_key_you_made
Remember - all of the settings you create have a corresponding scope and need to be accessed appropriately! settings_schema.json gives you your global settings object; each section has its private settings object; and each block has it's own personal settings object.
Hope this helps!
Assuming your JSONOBJ is correct.
var JSONOBJ={
"current": {
"checkout_error_color": "#ff6d6d",
"sections": {
"header": {
"type": "header",
"settings": {
"align_logo": "left",
"logo": "shopify:\/\/shop_images\/logo_9bb43dd5-21d6-442c-8a19-0f4adf03e13a.png",
"logo_max_width": 100,
"main_linklist": "main-menu",
"message": true,
"home_page_only": true,
"message_text": "Paw Paper – Edible Gift Wrap for Pets",
"message_link": "",
"color_bg": "#162950",
"color_text": "#ffffff"
}
}}}}
console.log(JSONOBJ.current.sections.header.settings.message_text)
Is it possible to define your own marker icons in GeoJSON?
I have tried many ways to get the desired effect but nothing works ..
Example code from geojson FeatureCollection where i want add custom icon:
{
"type": "Feature",
"id": "Point1",
"properties": {
"name": "Last point"
},
"geometry": {
"type": "Point",
"coordinates": [22.57031047873893, 51.25080964529834]
}
}
MapBox has created a CustomMarker plugin for Leaflet that should do the trick.
And another great example from Mapbox, GeoJSON Custom Markers and Style
Here's some sample code from that site:
var geoJsonData = {
"type": "FeatureCollection",
"features": [{
"type": "Feature",
"properties": {
"fillColor": "#eeffee",
"fillOpacity": 0.8
},
"geometry": {
"type": "Polygon",
"coordinates": [
[
[119.2895599, 21.718679],
[119.2895599, 25.373809],
[122.61840, 25.37380917],
[122.61840, 21.71867980],
[119.2895599, 21.718679]
]
]
}
}, {
"type": "Feature",
"properties": {
"marker-color": "#00ff00"
},
"geometry": {
"type": "Point",
"coordinates": [120.89355, 23.68477]
}
}]
};
var geoJson = L.geoJson(geoJsonData, {
pointToLayer: L.mapbox.marker.style,
style: function(feature) { return feature.properties; }
}).addTo(map);
NOTE: This is not part of the core LeafletJS library, it requires mapbox.js (and mapbox.css)
If you update to the latest version (at time of writing) the pointToLayer callback in your geojson object will start to work. It doesn't seem to be implemented in 0.7.7 but is currently available on master and I assume it will be in 0.8+.
If you just assign a geoJSON definition to your scope's geojson property with the function present leaflet will render it properly now.