Skip to content

Instantly share code, notes, and snippets.

@Fannon
Last active August 29, 2015 14:24
Show Gist options
  • Save Fannon/de232ec97e53616a062a to your computer and use it in GitHub Desktop.
Save Fannon/de232ec97e53616a062a to your computer and use it in GitHub Desktop.
Model Expansion Example
###################################
# Development Model #
###################################
$extend: /field/parentField
title: Field Title
type: string
format: email
smw_form:
input type: combobox
values from property: hasEmail
smw_overwriteDisplay: '[[mailto:{{{fieldName|}}}]]'
###################################
# After Input Stage (Parser) #
###################################
# Adds ID and metadata like $path
{
"$extend": "/field/parentField",
"$path": "C:/the/path/to/someFieldId.yaml",
"title": "Field Title",
"type": "string",
"format": "email",
"smw_form": {
"input type": "combobox",
"values from property": "hasEmail"
},
"smw_overwriteDisplay": "[[mailto:{{{fieldName|}}}]]"
}
###################################
# After CompatibilityLayer #
###################################
# renames deprecated smw_form to sf_form
{
"$extend": "/field/parentField",
"$path": "C:/the/path/to/someFieldId.yaml",
"title": "Field Title",
"type": "string",
"format": "email",
"sf_form": {
"input type": "combobox",
"values from property": "hasEmail"
},
"smw_overwriteDisplay": "[[mailto:{{{fieldName|}}}]]"
}
###################################
# After IntermediaryLayer #
###################################
# Inherits a new sf_form option
# Removes the $extend property
{
"$path": "C:/the/path/to/someFieldId.yaml",
"title": "Field Title",
"type": "string",
"format": "email",
"sf_form": {
"input type": "combobox",
"values from property": "hasEmail",
"existing values only": true
},
"smw_overwriteDisplay": "[[mailto:{{{fieldName|}}}]]"
}
###################################
# After PlatformLayer #
###################################
# Infers platform specific "smw_type"
# from domain specific "type" and "format"
{
"$path": "C:/the/path/to/someFieldId.yaml",
"title": "Field Title",
"type": "string",
"format": "email",
"smw_type": "Email",
"sf_form": {
"input type": "combobox",
"values from property": "hasEmail",
"existing values only": true
},
"smw_overwriteDisplay": "[[mailto:{{{fieldName|}}}]]"
}
###################################
# Code Generator #
###################################
# Each Field is translated into a SMW Property.
# Property:SomeFieldId
<noinclude><div class="mobo-generated">This page is autogenerated, do not edit it manually!</div> [[Category:mobo-generated]]
</noinclude>* This is an attribute of the datatype [[Has type::Email]].
# Most field information end up as parts of the more complex Semantic Forms
# (I have added whitespaces and linebreaks for better readability)
# Form:SomeFormId
[...]
<div class="sfFieldContent col-sm-8 col-md-9">
{{{field|checklisteZuweisung|class=attr_checklisteZuweisung|input type=combobox|max values=1|existing values only|values from property=hasEmail}}}
</div>
[...]
# And some template information (like it is multiple)
# (I have added whitespaces and linebreaks for better readability)
# Template:SomeModelId
[...]
{{#if: {{{prozessKategorie|}}} |
<div class="row">
<div class="col-sm-4 col-md-3 row-label">Prozess Kategorie</div>
<div class="col-sm-8 col-md-9 row-value" data-property="prozessKategorie">{{#arraymap:{{{prozessKategorie|}}}|;|@@@@|@@@@|;&nbsp;}}</div>
</div> |}}
[...]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment