Created
October 20, 2017 20:10
-
-
Save kgiszewski/e1f2a876b23dbc70995f0fa405a44adf to your computer and use it in GitHub Desktop.
Create a simple property editor
This file contains hidden or 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
.sap a { | |
cursor: pointer; | |
} |
This file contains hidden or 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
<div class="sap" ng-controller="SuperAwesomePluginController"> | |
<h2>Super Awesome Plugin</h2> | |
<p>{{model.value}}</p> | |
<input type="text" ng-model="model.value"/> | |
<a ng-click="getCompliment()">Get compliment</a> | |
</div> |
This file contains hidden or 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
angular.module('umbraco').controller('SuperAwesomePluginController', function ($scope) { | |
console.log($scope.model); | |
$scope.model = $scope.model || "default value"; | |
$scope.getCompliment = function() { | |
if ($scope.model.config.isEnabled === "1") { | |
console.log('ouch!'); | |
$scope.model.value = "Have a good day!"; | |
} | |
} | |
}); |
This file contains hidden or 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
{ | |
"propertyEditors": [ | |
{ | |
"name": "Super Awesome Plugin", | |
"alias": "SuperAwesomePlugin", | |
"editor": { | |
"valueType": "TEXT", | |
"view": "~/App_Plugins/SuperAwesomePlugin/app.html" | |
}, | |
"prevalues": { | |
"fields": [ | |
{ | |
"label": "Is enabled?", | |
"description": "A long description", | |
"key": "isEnabled", | |
"view": "boolean" | |
} | |
] | |
} | |
} | |
], | |
"css": [ | |
"~/App_Plugins/SuperAwesomePlugin/app.css" | |
], | |
"javascript": [ | |
"~/App_Plugins/SuperAwesomePlugin/app.js" | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment