diff --git a/src/Umbraco.Web.UI.Client/lib/jquery/jquery.upload/js/jquery.fileupload-angular.js b/src/Umbraco.Web.UI.Client/lib/jquery/jquery.upload/js/jquery.fileupload-angular.js index 7372d74a7c..8ddfc47c72 100755 --- a/src/Umbraco.Web.UI.Client/lib/jquery/jquery.upload/js/jquery.fileupload-angular.js +++ b/src/Umbraco.Web.UI.Client/lib/jquery/jquery.upload/js/jquery.fileupload-angular.js @@ -324,7 +324,7 @@ } ]) - // Provide File Upload progress feedback: + /* Provide File Upload progress feedback: .controller('FileUploadProgressController', [ '$scope', '$attrs', '$parse', function ($scope, $attrs, $parse) { @@ -360,14 +360,14 @@ $element.append(file.preview); } } - ]) + ])*/ .directive('fileUpload', function () { return { controller: 'FileUploadController' }; }) - +/* .directive('fileUploadProgress', function () { return { controller: 'FileUploadProgressController' @@ -378,7 +378,7 @@ return { controller: 'FileUploadPreviewController' }; - }) + })*/ // Enhance the HTML5 download attribute to // allow drag&drop of files to the desktop: diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/autoscale.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/autoscale.directive.js index e6d581c115..daa432d5ba 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/autoscale.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/autoscale.directive.js @@ -28,7 +28,7 @@ angular.module("umbraco.directives") setTimeout(function () { el.height(window.height() - (el.offset().top + totalOffset)); - }, 300); + }, 500); window.bind("resize", function () { el.height(window.height() - (el.offset().top + totalOffset)); diff --git a/src/Umbraco.Web.UI.Client/src/common/resources/entity.resource.js b/src/Umbraco.Web.UI.Client/src/common/resources/entity.resource.js index 7ea411df02..dca97d35ac 100644 --- a/src/Umbraco.Web.UI.Client/src/common/resources/entity.resource.js +++ b/src/Umbraco.Web.UI.Client/src/common/resources/entity.resource.js @@ -11,6 +11,21 @@ * the entity only contains the basic node data, name, id and guid, whereas content * nodes fetched through the entity service also contains additional meta data such * as icon, document type, path and so on. + * + * ##Entity object types? + * As an optional parameter, you can pass in the specific type name. So if you know you + * are looking for a specific type, you should pass in the object name, to make lookup faster + * and to return more data. + * + * The core object types are: + * + * - Document + * - Media + * - Member + * - Template + * - DocumentType + * - MediaType + * - MemberType **/ function entityResource($q, $http, umbRequestHelper) { @@ -32,19 +47,27 @@ function entityResource($q, $http, umbRequestHelper) { * var myDoc = ent; * alert('its here!'); * }); + * + * //Only return users + * entityResource.getEntityById(0, "User") + * .then(function(ent) { + * var myDoc = ent; + * alert('its here!'); + * }); * * - * @param {Int} id id of entity to return + * @param {Int} id id of entity to return + * @param {string} type optional Object type name * @returns {Promise} resourcePromise object containing the entity. * */ - getEntityById: function (id) { + getById: function (id, type) { return umbRequestHelper.resourcePromise( $http.get( umbRequestHelper.getApiUrl( "entityApiBaseUrl", - "GetEntityById", - [{ id: id }])), + "GetById", + [{ id: id, type: type }])), 'Failed to retreive entity data for id ' + id); }, @@ -63,13 +86,21 @@ function entityResource($q, $http, umbRequestHelper) { * var myDoc = contentArray; * alert('they are here!'); * }); + * + * //Only return templates + * entityResource.getEntitiesByIds( [1234,2526,28262], "Template") + * .then(function(templateArray) { + * var myDoc = contentArray; + * alert('they are here!'); + * }); * * - * @param {Array} ids ids of entities to return as an array + * @param {Array} ids ids of entities to return as an array + * @param {string} type optional type name * @returns {Promise} resourcePromise object containing the entity array. * */ - getEntitiesByIds: function (ids) { + getByIds: function (ids) { var idQuery = ""; _.each(ids, function(item) { @@ -80,11 +111,90 @@ function entityResource($q, $http, umbRequestHelper) { $http.get( umbRequestHelper.getApiUrl( "entityApiBaseUrl", - "GetEntitiesByIds", + "GetByIds", idQuery)), 'Failed to retreive entity data for ids ' + idQuery); }, + /** + * @ngdoc method + * @name umbraco.resources.entityResource#getEntityById + * @methodOf umbraco.resources.entityResource + * + * @description + * Gets an entity with a given id + * + * ##usage + *
+ * //returns all entities, you should NEVER do that
+ * entityResource.getAll()
+ * .then(function(ent) {
+ * var myDoc = ent;
+ * alert('its here!');
+ * });
+ *
+ * //Only return users
+ * entityResource.getAll("User")
+ * .then(function(ent) {
+ * var myDoc = ent;
+ * alert('its here!');
+ * });
+ *
+ *
+ * @param {string} type Object type name
+ * @returns {Promise} resourcePromise object containing the entity.
+ *
+ */
+ getAll: function (type) {
+ return umbRequestHelper.resourcePromise(
+ $http.get(
+ umbRequestHelper.getApiUrl(
+ "entityApiBaseUrl",
+ "GetAll",
+ [{type: type }])),
+ 'Failed to retreive entity data for id ' + id);
+ },
+
+ /**
+ * @ngdoc method
+ * @name umbraco.resources.entityResource#getEntityById
+ * @methodOf umbraco.resources.entityResource
+ *
+ * @description
+ * Gets an entity with a given id
+ *
+ * ##usage
+ *
+ * //returns all entities, you should NEVER do that
+ * entityResource.getAll()
+ * .then(function(ent) {
+ * var myDoc = ent;
+ * alert('its here!');
+ * });
+ *
+ * //Only return users
+ * entityResource.getAll("User")
+ * .then(function(ent) {
+ * var myDoc = ent;
+ * alert('its here!');
+ * });
+ *
+ *
+ * @param {string} type Object type name
+ * @returns {Promise} resourcePromise object containing the entity.
+ *
+ */
+ getAncestors: function (id) {
+ return umbRequestHelper.resourcePromise(
+ $http.get(
+ umbRequestHelper.getApiUrl(
+ "entityApiBaseUrl",
+ "GetAncestors",
+ [{id: id}])),
+ 'Failed to retreive entity data for id ' + id);
+ },
+
+
/**
* @ngdoc method
* @name umbraco.resources.entityResource#getDocumentById
diff --git a/src/Umbraco.Web.UI.Client/src/common/resources/media.resource.js b/src/Umbraco.Web.UI.Client/src/common/resources/media.resource.js
index 3df61e4d5a..87e90fbe40 100644
--- a/src/Umbraco.Web.UI.Client/src/common/resources/media.resource.js
+++ b/src/Umbraco.Web.UI.Client/src/common/resources/media.resource.js
@@ -108,6 +108,18 @@ function mediaResource($q, $http, umbDataFormatter, umbRequestHelper) {
/** saves or updates a media object */
save: function (media, isNew, files) {
return saveMediaItem(media, "save" + (isNew ? "New" : ""), files);
+ },
+
+ //** shorthand for creating a new folder under a given parent **/
+ addFolder: function(name, parentId){
+ return umbRequestHelper.resourcePromise(
+ $http.post(umbRequestHelper
+ .getApiUrl("mediaApiBaseUrl", "PostAddFolder"),
+ {
+ name: name,
+ parentId: parentId
+ }),
+ 'Failed to add folder');
}
};
}
diff --git a/src/Umbraco.Web.UI.Client/src/common/services/dialog.service.js b/src/Umbraco.Web.UI.Client/src/common/services/dialog.service.js
index b979b36632..d7d5a34734 100644
--- a/src/Umbraco.Web.UI.Client/src/common/services/dialog.service.js
+++ b/src/Umbraco.Web.UI.Client/src/common/services/dialog.service.js
@@ -173,8 +173,11 @@ angular.module('umbraco.services')
};
scope.select = function(item) {
- if (scope.dialogData.selection.indexOf(item) < 0) {
+ var i = scope.dialogData.selection.indexOf(item);
+ if (i < 0) {
scope.dialogData.selection.push(item);
+ }else{
+ scope.dialogData.selection.splice(i, 1);
}
};
diff --git a/src/Umbraco.Web.UI.Client/src/less/forms.less b/src/Umbraco.Web.UI.Client/src/less/forms.less
index 110502b558..9fa781c401 100644
--- a/src/Umbraco.Web.UI.Client/src/less/forms.less
+++ b/src/Umbraco.Web.UI.Client/src/less/forms.less
@@ -15,6 +15,13 @@
.hover-show{visibility: hidden;}
*:hover > .hover-show{visibility: visible;}
+//breadcrumb modifications
+
+.breadcrumb{height: 30px; display: block; margin-top: 10px;}
+.breadcrumb li{height: 30px; vertical-align: middle;}
+.breadcrumb li a{vertical-align: middle; height: 30px;}
+.breadcrumb input{font-size: 11px !Important;}
+
/* SEACH FORM */
diff --git a/src/Umbraco.Web.UI.Client/src/less/tree.less b/src/Umbraco.Web.UI.Client/src/less/tree.less
index 7fae143b47..a61078b711 100644
--- a/src/Umbraco.Web.UI.Client/src/less/tree.less
+++ b/src/Umbraco.Web.UI.Client/src/less/tree.less
@@ -313,7 +313,7 @@ height:1px;
overflow:hidden;
}
-.umb-tree li div.l div{
+.umb-tree li div.l div, div.umb-loader{
background-color: @blue;
margin-top:0;
margin-left:-100%;
diff --git a/src/Umbraco.Web.UI.Client/src/views/common/dialogs/mediapicker.controller.js b/src/Umbraco.Web.UI.Client/src/views/common/dialogs/mediapicker.controller.js
index 7229c34cfe..3ffdad1546 100644
--- a/src/Umbraco.Web.UI.Client/src/views/common/dialogs/mediapicker.controller.js
+++ b/src/Umbraco.Web.UI.Client/src/views/common/dialogs/mediapicker.controller.js
@@ -1,16 +1,41 @@
//used for the media picker dialog
angular.module("umbraco")
.controller("Umbraco.Dialogs.MediaPickerController",
- function ($scope, mediaResource, $log, imageHelper) {
+ function ($scope, mediaResource, umbRequestHelper, entityResource, $log, imageHelper) {
$scope.options = {
- url: "/umbraco/UmbracoApi/MediaUpload/Post",
+ url: umbRequestHelper.getApiUrl("mediaApiBaseUrl", "PostAddFile"),
+ autoUpload: true,
formData:{
currentFolder: -1
}
};
+ $scope.submitFolder = function(e){
+ if(e.keyCode === 13){
+ $scope.showFolderInput = false;
+
+ mediaResource
+ .addFolder($scope.newFolderName, $scope.options.formData.currentFolder)
+ .then(function(data){
+
+ $scope.gotoFolder(data.id);
+ });
+ }
+ };
+
$scope.gotoFolder = function(folderId){
+
+ if(folderId > 0){
+ entityResource.getAncestors(folderId)
+ .then(function(anc){
+ anc.splice(0,1);
+ $scope.path = anc;
+ });
+ }else{
+ $scope.path = [];
+ }
+
//mediaResource.rootMedia()
mediaResource.getChildren(folderId)
.then(function(data) {
@@ -20,33 +45,25 @@ angular.module("umbraco")
img.thumbnail = imageHelper.getThumbnail({ imageModel: img, scope: $scope });
});
});
- }
-
- $scope.$on('fileuploadadd', function(event, files){
- $scope.submitFiles();
- });
+ $scope.options.formData.currentFolder = folderId;
+ };
+
$scope.$on('fileuploadstop', function(event, files){
- alert("done");
+ $scope.gotoFolder($scope.options.formData.currentFolder);
});
$scope.selectMediaItem = function(image) {
- if (image.contentTypeAlias.toLowerCase() == 'folder') {
- options.formData.currentFolder = image.id;
- mediaResource.getChildren(image.id)
- .then(function(data) {
- $scope.images = data;
- //update the thumbnail property
- _.each($scope.images, function (img) {
- img.thumbnail = imageHelper.getThumbnail({ imageModel: img, scope: $scope });
- });
- });
+ if (image.contentTypeAlias.toLowerCase() == 'folder') {
+ $scope.options.formData.currentFolder = image.id;
+ $scope.gotoFolder(image.id);
}
else if (image.contentTypeAlias.toLowerCase() == 'image') {
$scope.select(image);
}
};
+ $scope.gotoFolder(-1);
});
\ No newline at end of file
diff --git a/src/Umbraco.Web.UI.Client/src/views/common/dialogs/mediapicker.html b/src/Umbraco.Web.UI.Client/src/views/common/dialogs/mediapicker.html
index ff8fb83842..75b588aff3 100644
--- a/src/Umbraco.Web.UI.Client/src/views/common/dialogs/mediapicker.html
+++ b/src/Umbraco.Web.UI.Client/src/views/common/dialogs/mediapicker.html
@@ -1,5 +1,5 @@