Merges in custom controller changes.

This commit is contained in:
Shannon
2013-06-10 13:01:17 -02:00
parent 3bd7fbfa9a
commit 77c8b22fe1
2 changed files with 42 additions and 21 deletions

View File

@@ -1,6 +1,22 @@
//used for the media picker dialog
angular.module("umbraco")
.controller("Umbraco.Dialogs.MediaPickerController",
function ($scope, mediaResource) {
$scope.images = mediaResource.rootMedia();
});
angular.module("umbraco")
.controller("Umbraco.Dialogs.MediaPickerController",
function($scope, mediaResource) {
mediaResource.rootMedia()
.then(function(data) {
$scope.images = data;
});
$scope.selectMediaItem = function(image) {
if (image.contentTypeAlias.toLowerCase() == 'folder') {
mediaResource.getChildren(image.id)
.then(function(data) {
$scope.images = data;
});
} else if (image.contentTypeAlias.toLowerCase() == 'image') {
$scope.select(image);
}
};
});

View File

@@ -17,11 +17,11 @@ angular.module("umbraco")
toolbar: "bold italic | styleselect | alignleft aligncenter alignright | bullist numlist | outdent indent | link image mediapicker",
setup : function(editor) {
editor.on('blur', function(e) {
$scope.$apply(function(){
//$scope.model.value = e.getBody().innerHTML;
$scope.model.value = editor.getContent();
})
editor.on('blur', function(e) {
$scope.$apply(function() {
//$scope.model.value = e.getBody().innerHTML;
$scope.model.value = editor.getContent();
});
});
editor.addButton('mediapicker', {
@@ -31,12 +31,17 @@ angular.module("umbraco")
dialogService.mediaPicker({scope: $scope, callback: function(data){
//really simple example on how to intergrate a service with tinyMCE
$(data.selection).each(function(i,img){
var data = {
src: img.thumbnail,
style: 'width: 100px; height: 100px',
id : '__mcenew'
};
$(data.selection).each(function (i, img) {
var imageProperty = _.find(img.properties, function(item) {
return item.alias == 'umbracoFile';
});
var data = {
src: imageProperty != null ? imageProperty.value : "nothing.jpg",
style: 'width: 100px; height: 100px',
id: '__mcenew'
};
editor.insertContent(editor.dom.createHTML('img', data));
var imgElm = editor.dom.get('__mcenew');
@@ -58,11 +63,11 @@ angular.module("umbraco")
};
function bindValue(inst){
$log.log("woot");
$scope.$apply(function(){
$scope.model.value = inst.getBody().innerHTML;
})
$log.log("woot");
$scope.$apply(function() {
$scope.model.value = inst.getBody().innerHTML;
});
}
function myHandleEvent(e){