Commits temp js files needed for demo to work

This commit is contained in:
Shannon Deminick
2013-06-09 06:16:56 -02:00
parent e888bd39d6
commit b341cf8b93
2 changed files with 76 additions and 0 deletions

View File

@@ -0,0 +1,40 @@
//Sample file to simplify setting up a property editor
//without any serverside processing
//defines that the below JS code needs angular to be loaded
//this is strictly a require.js convention
//we are working in making that simpler (and been advised to ditch requirejs)
define(['app','angular'], function (app, angular) {
//Next we get the umbraco module, so we can register a controller on it
angular.module('umbraco')
.controller("Sample.PropertyEditorController", function($scope, $log, dialog){
//we could then output the scope data to the log:
$log.log($scope.model);
//or we could set the model value
$scope.model.value = "Test data";
//we could have a function:
//which appends something to the model data
$scope.doStuff = function(input){
$scope.model.value = input + " Appended value";
};
//we could use one of the internal services to wire up a dialog
$scope.openDialog = function(){
var d = dialog.mediaPicker({scope: $scope, callback: myCallBack});
};
function myCallBack(data){
$.each(data.selection, function(i, img){
$log.log(img);
$scope.model.value += img.url;
});
}
});
return angular;
});

View File

@@ -0,0 +1,36 @@
//Sample file to simplify setting up a property editor
//without any serverside processing
//defines that the below JS code needs angular to be loaded
//this is strictly a require.js convention
//we are working in making that simpler (and been advised to ditch requirejs)
define(['app','angular'], function (app, angular) {
//Next we get the umbraco module, so we can register a controller on it
angular.module('umbraco')
.controller("SampleTwo.PropertyEditorController", function($scope, $log, dialog){
//we could then output the scope data to the log:
$log.log($scope.model);
//we could have a function:
//which appends something to the model data
$scope.doStuff = function(input){
$scope.model.value = input + " Appended value";
};
//we could use one of the internal services to wire up a dialog
$scope.openDialog = function(){
var d = dialog.mediaPicker({scope: $scope, callback: myCallBack});
};
function myCallBack(data){
$.each(data.selection, function(i, img){
$scope.model.value += img.url;
});
}
});
return angular;
});