Skip to content

Instantly share code, notes, and snippets.

@abjerner
Created October 13, 2014 19:47
Show Gist options
  • Save abjerner/b737a9af6a7aeb89457c to your computer and use it in GitHub Desktop.
Save abjerner/b737a9af6a7aeb89457c to your computer and use it in GitHub Desktop.
Example of a quick Umbraco package
{
propertyEditors: [
{
alias: "ExamplePropertyEditor",
name: "Example",
editor: {
view: "~/App_Plugins/Example/PropertyEditor.html",
hideLabel: false,
valueType: "JSON"
},
prevalues: {
fields: [
{
label: "Config",
description: "Some description about the configuration.",
key: "config",
view: "~/App_Plugins/Example/PreValueEditor.html"
}
]
}
}
],
javascript: [
'~/App_Plugins/Example/scripts.js'
],
css: [
'~/App_Plugins/Example/styles.css'
]
}
<div ng-controller="PreValueEditor.Controller">
<label>
<input type="checkbox" ng-model="model.value.a" />
Option A
</label>
<label>
<input type="checkbox" ng-model="model.value.b" />
Option B
</label>
<pre>{{model | json}}</pre>
</div>
<div ng-controller="PropertyEditor.Controller">
<input type="text" ng-model="model.value" />
<br /><br />
<pre>{{model | json}}</pre>
</div>
angular.module('umbraco').controller('PropertyEditor.Controller', ['$scope', function ($scope) {
}]);
angular.module('umbraco').controller('PreValueEditor.Controller', ['$scope', function ($scope) {
if (!$scope.model.value) {
$scope.model.value = {
a: false,
b: false
};
}
}]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment