This page last changed on Aug 17, 2012 by yuriy.kalynovskiy@involver.com.

Overview

Used to allow an SML developer to assign string and/or boolean settings in the SML template. Admins can edit the values of the settings from a simple auto-generated form.

To configure an editable_setting item, click the "Settings" tab in your SML editor window.

Use Case Scenarios

The main purposes of this tag are to

  1. Provide SML developers a way to build in custom settings into their template.
  2. Provide non-technical app admins a way to update the settings without having to dig into the code.

For example, an SML developer can specify a 'boolean' editable setting that allows an admin to toggle the showing/hiding of a particular section of the page. An SML developer could also create a setting for a particular ID that they want to template in the application and make configurable by an admin.


Caching Considerations

This tag has no caching considerations.


Attributes

name type required value
type string yes valid options are "string", "boolean", or "list"
default string or boolean yes The default value of the variable.
label string no Allows you to customize the label for the setting instead of using the variable name

Examples

Creating a setting for a string

Pasting this code into the template will render out the default value "my default string".

{% editable_setting my_string type:"string" default:"my default string" %}
{{ my_string }}

The default value can be changed by an admin by going to the "Settings" section of the SML editor:

Go ahead and change the field to "my custom string" and click "Save Settings".

You should see "my custom string" display on the tab now.

Creating a setting for a boolean

Pasting this code into the template will render out "I am true".

{% editable_setting my_boolean type:"boolean" default:true %}

{% if my_boolean == true %}
    I am true
{% endif %}

The default value can be changed by an admin by going to the "Settings" section of the SML editor:

Go ahead and select the "False" button and click "Save Settings".

You should no longer see "I am true" on the tab now.

Creating a setting for a list

Pasting this code into the template will render out the default value "option 1".

{% editable_setting nameofvar label:'label' options:'option 1,option 2, option 3' default:'option 1' type:'string' %}
{{ nameofvar }}

The default value can be changed by an admin by going to the "Settings" section of the SML editor:
Go ahead and change the dropdown value to "option 2" and click "Save Settings".
You should see "option 2" display on the tab now.


FAQ

This tag currently has no FAQ questions.


Related Topics


Document generated by Confluence on Feb 12, 2013 09:09