diff --git a/build/Build.bat b/build/Build.bat index ccbf2cd6ad..f680ebf7b0 100644 --- a/build/Build.bat +++ b/build/Build.bat @@ -1,6 +1,6 @@ @ECHO OFF SET release=7.0.0 -SET comment=RC +SET comment= SET version=%release% IF [%comment%] EQU [] (SET version=%release%) ELSE (SET version=%release%-%comment%) @@ -20,6 +20,9 @@ echo This file is only here so that the containing folder will be included in th echo This file is only here so that the containing folder will be included in the NuGet package, it is safe to delete. > .\_BuildOutput\WebApp\Views\Partials\dummy.txt echo This file is only here so that the containing folder will be included in the NuGet package, it is safe to delete. > .\_BuildOutput\WebApp\Views\MacroPartials\dummy.txt +ren .\_BuildOutput\WebApp\MacroScripts\Web.config Web.config.transform +ren .\_BuildOutput\WebApp\Views\Web.config Web.config.transform + ..\src\.nuget\NuGet.exe pack NuSpecs\UmbracoCms.Core.nuspec -Version %version% ..\src\.nuget\NuGet.exe pack NuSpecs\UmbracoCms.nuspec -Version %version% diff --git a/build/NuSpecs/UmbracoCms.nuspec b/build/NuSpecs/UmbracoCms.nuspec index 858407f80a..f93d2fdc6b 100644 --- a/build/NuSpecs/UmbracoCms.nuspec +++ b/build/NuSpecs/UmbracoCms.nuspec @@ -23,7 +23,7 @@ - + diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/RepositoryElement.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/RepositoryElement.cs index 21319f01e4..b7a1157c40 100644 --- a/src/Umbraco.Core/Configuration/UmbracoSettings/RepositoryElement.cs +++ b/src/Umbraco.Core/Configuration/UmbracoSettings/RepositoryElement.cs @@ -19,7 +19,7 @@ namespace Umbraco.Core.Configuration.UmbracoSettings set { base["guid"] = value; } } - [ConfigurationProperty("repositoryurl", DefaultValue = "http://our.umbraco.org")] + [ConfigurationProperty("repositoryurl", DefaultValue = "http://packages.umbraco.org")] public string RepositoryUrl { get { return (string)base["repositoryurl"]; } diff --git a/src/Umbraco.Core/Configuration/UmbracoVersion.cs b/src/Umbraco.Core/Configuration/UmbracoVersion.cs index ff8b0fc34f..e15e365ba4 100644 --- a/src/Umbraco.Core/Configuration/UmbracoVersion.cs +++ b/src/Umbraco.Core/Configuration/UmbracoVersion.cs @@ -23,7 +23,7 @@ namespace Umbraco.Core.Configuration /// Gets the version comment (like beta or RC). /// /// The version comment. - public static string CurrentComment { get { return "RC"; } } + public static string CurrentComment { get { return ""; } } // Get the version of the umbraco.dll by looking at a class in that dll // Had to do it like this due to medium trust issues, see: http://haacked.com/archive/2010/11/04/assembly-location-and-medium-trust.aspx diff --git a/src/Umbraco.Web.UI.Client/src/assets/img/application/logo.png b/src/Umbraco.Web.UI.Client/src/assets/img/application/logo.png index 2f02570583..2b2ff80a1d 100644 Binary files a/src/Umbraco.Web.UI.Client/src/assets/img/application/logo.png and b/src/Umbraco.Web.UI.Client/src/assets/img/application/logo.png differ diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/html/umbphotofolder.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/html/umbphotofolder.directive.js index 83d30e7c3c..9422bba925 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/html/umbphotofolder.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/html/umbphotofolder.directive.js @@ -139,6 +139,7 @@ angular.module("umbraco.directives.html") $timeout(function () { var photos = ngModel.$modelValue; + scope.imagesOnly = element.attr('imagesOnly'); scope.baseline = element.attr('baseline') ? parseInt(element.attr('baseline'), 10) : 0; scope.minWidth = element.attr('min-width') ? parseInt(element.attr('min-width'), 10) : 420; scope.minHeight = element.attr('min-height') ? parseInt(element.attr('min-height'), 10) : 200; diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/umbsections.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/umbsections.directive.js index d5dc36bcbf..5dec6c3586 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/umbsections.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/umbsections.directive.js @@ -60,6 +60,12 @@ function sectionsDirective($timeout, $window, navigationService, treeService, se } }); + scope.$on("appState.sectionState.changed", function (e, args) { + if (args.key === "currentSection") { + scope.currentSection = args.value; + } + }); + //on page resize window.onresize = calculateHeight; diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/umbtree.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/umbtree.directive.js index 30af946da3..2c60a87db2 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/umbtree.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/umbtree.directive.js @@ -13,8 +13,8 @@ function umbTreeDirective($compile, $log, $q, $rootScope, treeService, notificat scope: { section: '@', treealias: '@', - showoptions: '@', - showheader: '@', + hideoptions: '@', + hideheader: '@', cachekey: '@', isdialog: '@', //Custom query string arguments to pass in to the tree as a string, example: "startnodeid=123&something=value" @@ -24,18 +24,13 @@ function umbTreeDirective($compile, $log, $q, $rootScope, treeService, notificat compile: function(element, attrs) { //config - var hideheader = (attrs.showheader === 'false') ? true : false; - var hideoptions = (attrs.showoptions === 'false') ? "hide-options" : ""; - - var template = '
    ' + - '
  • '; - - if (!hideheader) { - template += '
    ' + - '
    {{tree.name}}
    ' + - '' + - '
    '; - } + //var showheader = (attrs.showheader !== 'false'); + var hideoptions = (attrs.hideoptions === 'true') ? "hide-options" : ""; + var template = '
    • '; + template += '
      ' + + '
      {{tree.name}}
      ' + + '' + + '
      '; template += '
        ' + '' + '
      ' + diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/util.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/util.directive.js index 572f22e297..1005ecd903 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/util.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/util.directive.js @@ -36,17 +36,21 @@ angular.module('umbraco.directives') }) .directive('onRightClick',function(){ + document.oncontextmenu = function (e) { if(e.target.hasAttribute('on-right-click')) { + e.preventDefault(); + e.stopPropagation(); return false; } }; + return function(scope,el,attrs){ el.bind('contextmenu',function(e){ e.preventDefault(); e.stopPropagation(); - scope.$apply(attrs.onRightClick); - }) ; + return false; + }); }; }); \ No newline at end of file diff --git a/src/Umbraco.Web.UI.Client/src/common/resources/content.resource.js b/src/Umbraco.Web.UI.Client/src/common/resources/content.resource.js index a7bf00954b..a69524b43a 100644 --- a/src/Umbraco.Web.UI.Client/src/common/resources/content.resource.js +++ b/src/Umbraco.Web.UI.Client/src/common/resources/content.resource.js @@ -565,10 +565,57 @@ function contentResource($q, $http, umbDataFormatter, umbRequestHelper) { return saveContentItem(content, "publish" + (isNew ? "New" : ""), files); }, + + /** + * @ngdoc method + * @name umbraco.resources.contentResource#sendToPublish + * @methodOf umbraco.resources.contentResource + * + * @description + * Saves changes made to a content item, and notifies any subscribers about a pending publication + * + * ##usage + *
      +         * contentResource.getById(1234)
      +         *    .then(function(content) {
      +         *          content.name = "I want a new name, and be published!";
      +         *          contentResource.sendToPublish(content, false)
      +         *            .then(function(content){
      +         *                alert("Retrieved, updated and notication send off");
      +         *            });
      +         *    });
      +         * 
      + * + * @param {Object} content The content item object with changes applied + * @param {Bool} isNew set to true to create a new item or to update an existing + * @param {Array} files collection of files for the document + * @returns {Promise} resourcePromise object containing the saved content item. + * + */ sendToPublish: function (content, isNew, files) { return saveContentItem(content, "sendPublish" + (isNew ? "New" : ""), files); }, + /** + * @ngdoc method + * @name umbraco.resources.contentResource#publishByid + * @methodOf umbraco.resources.contentResource + * + * @description + * Publishes a content item with a given ID + * + * ##usage + *
      +         * contentResource.publishById(1234)
      +         *    .then(function(content) {
      +         *        alert("published");
      +         *    });
      +         * 
      + * + * @param {Int} id The ID of the conten to publish + * @returns {Promise} resourcePromise object containing the published content item. + * + */ publishById: function(id){ if (!id) { diff --git a/src/Umbraco.Web.UI.Client/src/common/resources/contenttype.resource.js b/src/Umbraco.Web.UI.Client/src/common/resources/contenttype.resource.js index ed88495ec2..a86bb24509 100644 --- a/src/Umbraco.Web.UI.Client/src/common/resources/contenttype.resource.js +++ b/src/Umbraco.Web.UI.Client/src/common/resources/contenttype.resource.js @@ -7,7 +7,25 @@ function contentTypeResource($q, $http, umbRequestHelper) { return { - //return a content type with a given ID + /** + * @ngdoc method + * @name umbraco.resources.contentTypeResource#getContentType + * @methodOf umbraco.resources.contentTypeResource + * + * @description + * Returns a content type with a given ID + * + * ##usage + *
      +         * contentTypeResource.getContentType(1234)
      +         *    .then(function(type) {
      +         *        $scope.type = type;
      +         *    });
      +         * 
      + * @param {Int} id id of the content type to retrieve + * @returns {Promise} resourcePromise object. + * + */ getContentType: function (id) { var deferred = $q.defer(); @@ -22,7 +40,25 @@ function contentTypeResource($q, $http, umbRequestHelper) { return deferred.promise; }, - //return all types allowed under given document + /** + * @ngdoc method + * @name umbraco.resources.contentTypeResource#getAllowedTypes + * @methodOf umbraco.resources.contentTypeResource + * + * @description + * Returns a list of allowed content types underneath a content item with a given ID + * + * ##usage + *
      +         * contentTypeResource.getAllowedTypes(1234)
      +         *    .then(function(array) {
      +         *        $scope.type = type;
      +         *    });
      +         * 
      + * @param {Int} contentId id of the content item to retrive allowed child types for + * @returns {Promise} resourcePromise object. + * + */ getAllowedTypes: function (contentId) { return umbRequestHelper.resourcePromise( diff --git a/src/Umbraco.Web.UI.Client/src/common/resources/dashboard.resource.js b/src/Umbraco.Web.UI.Client/src/common/resources/dashboard.resource.js index 0eef79c326..ca3ae03876 100644 --- a/src/Umbraco.Web.UI.Client/src/common/resources/dashboard.resource.js +++ b/src/Umbraco.Web.UI.Client/src/common/resources/dashboard.resource.js @@ -6,6 +6,19 @@ function dashboardResource($q, $http, umbRequestHelper) { //the factory object returned return { + + /** + * @ngdoc method + * @name umbraco.resources.dashboardResource#getDashboard + * @methodOf umbraco.resources.dashboardResource + * + * @description + * Retrieves the dashboard configuration for a given section + * + * @param {string} section Alias of section to retrieve dashboard configuraton for + * @returns {Promise} resourcePromise object containing the user array. + * + */ getDashboard: function (section) { return umbRequestHelper.resourcePromise( diff --git a/src/Umbraco.Web.UI.Client/src/common/resources/datatype.resource.js b/src/Umbraco.Web.UI.Client/src/common/resources/datatype.resource.js index 7eb04082ee..b38fa4d0a0 100644 --- a/src/Umbraco.Web.UI.Client/src/common/resources/datatype.resource.js +++ b/src/Umbraco.Web.UI.Client/src/common/resources/datatype.resource.js @@ -7,7 +7,28 @@ function dataTypeResource($q, $http, umbDataFormatter, umbRequestHelper) { return { - getPreValues: function (editorId, dataTypeId) { + /** + * @ngdoc method + * @name umbraco.resources.dataTypeResource#getPreValues + * @methodOf umbraco.resources.dataTypeResource + * + * @description + * Retrieves available prevalues for a given data type + editor + * + * ##usage + *
      +         * dataTypeResource.getPrevalyes("Umbraco.MediaPicker", 1234)
      +         *    .then(function(prevalues) {
      +         *        alert('its gone!');
      +         *    });
      +         * 
      + * + * @param {String} editorAlias string alias of editor type to retrive prevalues configuration for + * @param {Int} id id of datatype to retrieve prevalues for + * @returns {Promise} resourcePromise object. + * + */ + getPreValues: function (editorAlias, dataTypeId) { if (!dataTypeId) { dataTypeId = -1; @@ -18,10 +39,30 @@ function dataTypeResource($q, $http, umbDataFormatter, umbRequestHelper) { umbRequestHelper.getApiUrl( "dataTypeApiBaseUrl", "GetPreValues", - [{ editorAlias: editorId }, { dataTypeId: dataTypeId }])), + [{ editorAlias: editorAlias }, { dataTypeId: dataTypeId }])), 'Failed to retreive pre values for editor id ' + editorId); }, + /** + * @ngdoc method + * @name umbraco.resources.dataTypeResource#getById + * @methodOf umbraco.resources.dataTypeResource + * + * @description + * Gets a data type item with a given id + * + * ##usage + *
      +         * dataTypeResource.getById(1234)
      +         *    .then(function() {
      +         *        alert('its gone!');
      +         *    });
      +         * 
      + * + * @param {Int} id id of data type to retrieve + * @returns {Promise} resourcePromise object. + * + */ getById: function (id) { return umbRequestHelper.resourcePromise( @@ -39,21 +80,45 @@ function dataTypeResource($q, $http, umbDataFormatter, umbRequestHelper) { $http.get( umbRequestHelper.getApiUrl( "dataTypeApiBaseUrl", - "GetAll", - [{ id: id }])), - 'Failed to retreive data for data type id ' + id); + "GetAll")), + 'Failed to retreive data'); }, - /** returns an empty content object which can be persistent on the content service - requires the parent id and the alias of the content type to base the scaffold on */ - getScaffold: function (parentId, alias) { + /** + * @ngdoc method + * @name umbraco.resources.contentResource#getScaffold + * @methodOf umbraco.resources.contentResource + * + * @description + * Returns a scaffold of an empty data type item + * + * The scaffold is used to build editors for data types that has not yet been populated with data. + * + * ##usage + *
      +         * dataTypeResource.getScaffold()
      +         *    .then(function(scaffold) {
      +         *        var myType = scaffold;
      +         *        myType.name = "My new data type"; 
      +         *
      +         *        dataTypeResource.save(myType, myType.preValues, true)
      +         *            .then(function(type){
      +         *                alert("Retrieved, updated and saved again");
      +         *            });
      +         *    });
      +         * 
      + * + * @returns {Promise} resourcePromise object containing the data type scaffold. + * + */ + getScaffold: function () { return umbRequestHelper.resourcePromise( $http.get( umbRequestHelper.getApiUrl( "dataTypeApiBaseUrl", "GetEmpty")), - 'Failed to retreive data for empty datatype ' + alias); + 'Failed to retreive data for empty datatype'); }, /** * @ngdoc method @@ -61,7 +126,7 @@ function dataTypeResource($q, $http, umbDataFormatter, umbRequestHelper) { * @methodOf umbraco.resources.dataTypeResource * * @description - * Deletes a content item with a given id + * Deletes a data type with a given id * * ##usage *
      @@ -84,7 +149,33 @@ function dataTypeResource($q, $http, umbDataFormatter, umbRequestHelper) {
                               [{ id: id }])),
                       'Failed to delete item ' + id);
               },
      -        /** saves or updates a data type object */
      +        
      +        /**
      +         * @ngdoc method
      +         * @name umbraco.resources.dataTypeResource#deleteById
      +         * @methodOf umbraco.resources.dataTypeResource
      +         *
      +         * @description
      +         * Saves or update a data typw
      +         *
      +         * ##usage
      +         * 
      +         * dataTypeResource.getById(1234)
      +         *    .then(function(type) {
      +         *        type.name ="hibba";
      +         *  
      +         *        dataTypeResource.save(type, type.preValues, false).then(function(type){
      +         *          alert('its done!');
      +         *        }): 
      +         *    });
      +         * 
      + * + * @param {Object} dataType data type object to create/update + * @param {Array} preValues collection of prevalues on the datatype + * @param {Bool} isNew set to true if type should be create instead of updated + * @returns {Promise} resourcePromise object. + * + */ save: function (dataType, preValues, isNew) { var saveModel = umbDataFormatter.formatDataTypePostData(dataType, preValues, "save" + (isNew ? "New" : "")); 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 9510a00185..75d2f47a28 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 @@ -264,6 +264,28 @@ function entityResource($q, $http, umbRequestHelper) { 'Failed to retreive entity data for query ' + query); }, + + /** + * @ngdoc method + * @name umbraco.resources.entityResource#searchAll + * @methodOf umbraco.resources.entityResource + * + * @description + * Gets an array of entities from all available search indexes, given a lucene query + * + * ##usage + *
      +         * entityResource.searchAll("bob")
      +         *    .then(function(array) {
      +         *        var myDoc = array; 
      +         *        alert('they are here!');
      +         *    });
      +         * 
      + * + * @param {String} Query search query + * @returns {Promise} resourcePromise object containing the entity array. + * + */ searchAll: function (query) { return umbRequestHelper.resourcePromise( 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 30d7ef1cf6..aea7ff1d97 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 @@ -329,12 +329,59 @@ function mediaResource($q, $http, umbDataFormatter, umbRequestHelper) { 'Failed to retreive children for media item ' + parentId); }, - /** saves or updates a media object */ + /** + * @ngdoc method + * @name umbraco.resources.mediaResource#save + * @methodOf umbraco.resources.mediaResource + * + * @description + * Saves changes made to a media item, if the media item is new, the isNew paramater must be passed to force creation + * if the media item needs to have files attached, they must be provided as the files param and passed seperately + * + * + * ##usage + *
      +         * mediaResource.getById(1234)
      +         *    .then(function(media) {
      +         *          media.name = "I want a new name!";
      +         *          mediaResource.save(media, false)
      +         *            .then(function(media){
      +         *                alert("Retrieved, updated and saved again");
      +         *            });
      +         *    });
      +         * 
      + * + * @param {Object} media The media item object with changes applied + * @param {Bool} isNew set to true to create a new item or to update an existing + * @param {Array} files collection of files for the media item + * @returns {Promise} resourcePromise object containing the saved media item. + * + */ save: function (media, isNew, files) { return saveMediaItem(media, "save" + (isNew ? "New" : ""), files); }, - //** shorthand for creating a new folder under a given parent **/ + /** + * @ngdoc method + * @name umbraco.resources.mediaResource#addFolder + * @methodOf umbraco.resources.mediaResource + * + * @description + * Shorthand for adding a media item of the type "Folder" under a given parent ID + * + * ##usage + *
      +         * mediaResource.addFolder("My gallery", 1234)
      +         *    .then(function(folder) {
      +         *        alert('New folder');
      +         *    });
      +         * 
      + * + * @param {string} name Name of the folder to create + * @param {int} parentId Id of the media item to create the folder underneath + * @returns {Promise} resourcePromise object. + * + */ addFolder: function(name, parentId){ return umbRequestHelper.resourcePromise( $http.post(umbRequestHelper diff --git a/src/Umbraco.Web.UI.Client/src/common/resources/mediatype.resource.js b/src/Umbraco.Web.UI.Client/src/common/resources/mediatype.resource.js index a6c4393d97..fce6455f1d 100644 --- a/src/Umbraco.Web.UI.Client/src/common/resources/mediatype.resource.js +++ b/src/Umbraco.Web.UI.Client/src/common/resources/mediatype.resource.js @@ -7,16 +7,34 @@ function mediaTypeResource($q, $http, umbRequestHelper) { return { - //return all types allowed under given document - getAllowedTypes: function (contentId) { + /** + * @ngdoc method + * @name umbraco.resources.mediaTypeResource#getAllowedTypes + * @methodOf umbraco.resources.mediaTypeResource + * + * @description + * Returns a list of allowed media types underneath a media item with a given ID + * + * ##usage + *
      +         * mediaTypeResource.getAllowedTypes(1234)
      +         *    .then(function(array) {
      +         *        $scope.type = type;
      +         *    });
      +         * 
      + * @param {Int} mediaId id of the media item to retrive allowed child types for + * @returns {Promise} resourcePromise object. + * + */ + getAllowedTypes: function (mediaId) { return umbRequestHelper.resourcePromise( $http.get( umbRequestHelper.getApiUrl( "mediaTypeApiBaseUrl", "GetAllowedChildren", - [{ contentId: contentId }])), - 'Failed to retreive data for media id ' + contentId); + [{ contentId: mediaId }])), + 'Failed to retreive data for media id ' + mediaId); } }; diff --git a/src/Umbraco.Web.UI.Client/src/common/resources/member.resource.js b/src/Umbraco.Web.UI.Client/src/common/resources/member.resource.js index cf03f7fcca..a10454f666 100644 --- a/src/Umbraco.Web.UI.Client/src/common/resources/member.resource.js +++ b/src/Umbraco.Web.UI.Client/src/common/resources/member.resource.js @@ -138,7 +138,34 @@ function memberResource($q, $http, umbDataFormatter, umbRequestHelper) { }, - /** saves or updates a member object */ + /** + * @ngdoc method + * @name umbraco.resources.memberResource#save + * @methodOf umbraco.resources.memberResource + * + * @description + * Saves changes made to a member, if the member is new, the isNew paramater must be passed to force creation + * if the member needs to have files attached, they must be provided as the files param and passed seperately + * + * + * ##usage + *
      +         * memberResource.getBykey("23234-sd8djsd-3h8d3j-sdh8d")
      +         *    .then(function(member) {
      +         *          member.name = "Bob";
      +         *          memberResource.save(member, false)
      +         *            .then(function(member){
      +         *                alert("Retrieved, updated and saved again");
      +         *            });
      +         *    });
      +         * 
      + * + * @param {Object} media The member item object with changes applied + * @param {Bool} isNew set to true to create a new item or to update an existing + * @param {Array} files collection of files for the media item + * @returns {Promise} resourcePromise object containing the saved media item. + * + */ save: function (member, isNew, files) { return saveMember(member, "save" + (isNew ? "New" : ""), files); } diff --git a/src/Umbraco.Web.UI.Client/src/common/resources/stylesheet.resource.js b/src/Umbraco.Web.UI.Client/src/common/resources/stylesheet.resource.js index 20279cb675..a68798f38b 100644 --- a/src/Umbraco.Web.UI.Client/src/common/resources/stylesheet.resource.js +++ b/src/Umbraco.Web.UI.Client/src/common/resources/stylesheet.resource.js @@ -38,24 +38,61 @@ function stylesheetResource($q, $http, umbRequestHelper) { 'Failed to retreive stylesheets '); }, + /** + * @ngdoc method + * @name umbraco.resources.stylesheetResource#getRules + * @methodOf umbraco.resources.stylesheetResource + * + * @description + * Returns all defined child rules for a stylesheet with a given ID + * + * ##usage + *
      +         * stylesheetResource.getRules(2345)
      +         *    .then(function(rules) {
      +         *        alert('its here!');
      +         *    });
      +         * 
      + * + * @returns {Promise} resourcePromise object containing the rules. + * + */ getRules: function (id) { return umbRequestHelper.resourcePromise( $http.get( umbRequestHelper.getApiUrl( "stylesheetApiBaseUrl", "GetRules", - [{ id: id }] - )), + [{ id: id }]) +"&rnd=" + Math.floor(Math.random()*1001), {cache: false}), 'Failed to retreive stylesheets '); }, + /** + * @ngdoc method + * @name umbraco.resources.stylesheetResource#getRulesByName + * @methodOf umbraco.resources.stylesheetResource + * + * @description + * Returns all defined child rules for a stylesheet with a given name + * + * ##usage + *
      +         * stylesheetResource.getRulesByName("ie7stylesheet")
      +         *    .then(function(rules) {
      +         *        alert('its here!');
      +         *    });
      +         * 
      + * + * @returns {Promise} resourcePromise object containing the rules. + * + */ getRulesByName: function (name) { return umbRequestHelper.resourcePromise( $http.get( umbRequestHelper.getApiUrl( "stylesheetApiBaseUrl", "GetRulesByName", - [{ name: name }])), + [{ name: name }]) +"&rnd=" + Math.floor(Math.random()*1001), {cache: false}), 'Failed to retreive stylesheets '); } }; diff --git a/src/Umbraco.Web.UI.Client/src/common/services/appstate.service.js b/src/Umbraco.Web.UI.Client/src/common/services/appstate.service.js index 8160dfccea..1714ec7526 100644 --- a/src/Umbraco.Web.UI.Client/src/common/services/appstate.service.js +++ b/src/Umbraco.Web.UI.Client/src/common/services/appstate.service.js @@ -5,6 +5,32 @@ * * @description * Tracks the various application state variables when working in the back office, raises events when state changes. + * + * ##Samples + * + * ####Subscribe to global state changes: + * + *
      +  *    scope.showTree = appState.getGlobalState("showNavigation");
      +  *
      +  *    scope.$on("appState.globalState.changed", function (e, args) {
      +  *               if (args.key === "showNavigation") {
      +  *                   scope.showTree = args.value;
      +  *               }
      +  *           });  
      +  * 
      + * + * ####Subscribe to section-state changes + * + *
      + *    scope.currentSection = appState.getSectionState("currentSection");
      + *
      + *    scope.$on("appState.sectionState.changed", function (e, args) {
      + *               if (args.key === "currentSection") {
      + *                   scope.currentSection = args.value;
      + *               }
      + *           });  
      + * 
      */ function appState($rootScope) { @@ -75,7 +101,7 @@ function appState($rootScope) { * @function * * @description - * Returns the current global state value by key - we do not return an object here - we do NOT want this + * Returns the current global state value by key - we do not return an object reference here - we do NOT want this * to be publicly mutable and allow setting arbitrary values * */ @@ -203,13 +229,52 @@ angular.module('umbraco.services').factory("editorState", function() { var current = null; var state = { + + /** + * @ngdoc function + * @name umbraco.services.angularHelper#set + * @methodOf umbraco.services.editorState + * @function + * + * @description + * Sets the current entity object for the currently active editor + * This is only used when implementing an editor with a complex model + * like the content editor, where the model is modified by several + * child controllers. + */ set: function (entity) { current = entity; }, + + /** + * @ngdoc function + * @name umbraco.services.angularHelper#reset + * @methodOf umbraco.services.editorState + * @function + * + * @description + * Since the editorstate entity is read-only, you cannot set it to null + * only through the reset() method + */ reset: function() { current = null; } - + + /** + * @ngdoc function + * @name umbraco.services.angularHelper#current + * @methodOf umbraco.services.editorState + * @function + * + * @description + * Returns an object reference to the current editor entity. + * the entity is the root object of the editor. + * EditorState is used by property/parameter editors that need + * access to the entire entity being edited, not just the property/parameter + * + * editorState.current can not be overwritten, you should only read values from it + * since modifying individual properties should be handled by the property editors + */ }; //create a get/set property but don't allow setting diff --git a/src/Umbraco.Web.UI.Client/src/common/services/search.service.js b/src/Umbraco.Web.UI.Client/src/common/services/search.service.js index e9b41c9fc5..0bf691bb89 100644 --- a/src/Umbraco.Web.UI.Client/src/common/services/search.service.js +++ b/src/Umbraco.Web.UI.Client/src/common/services/search.service.js @@ -1,3 +1,25 @@ +/** + * @ngdoc service + * @name umbraco.services.searchService + * + * + * @description + * Service for handling the main application search, can currently search content, media and members + * + * ##usage + * To use, simply inject the searchService into any controller that needs it, and make + * sure the umbraco.services module is accesible - which it should be by default. + * + *
      + *      searchService.searchMembers({term: 'bob'}).then(function(results){
      + *          angular.forEach(results, function(result){
      + *                  //returns:
      + *                  {name: "name", id: 1234, menuUrl: "url", editorPath: "url", metaData: {}, subtitle: "/path/etc" }
      + *           })          
      + *           var result = 
      + *       }) 
      + * 
      + */ angular.module('umbraco.services') .factory('searchService', function ($q, $log, entityResource, contentResource, umbRequestHelper) { @@ -23,6 +45,18 @@ angular.module('umbraco.services') } return { + + /** + * @ngdoc method + * @name umbraco.services.searchService#searchMembers + * @methodOf umbraco.services.searchService + * + * @description + * Searches the default member search index + * @param {Object} args argument object + * @param {String} args.term seach term + * @returns {Promise} returns promise containing all matching members + */ searchMembers: function(args) { if (!args.term) { @@ -36,6 +70,18 @@ angular.module('umbraco.services') return data; }); }, + + /** + * @ngdoc method + * @name umbraco.services.searchService#searchContent + * @methodOf umbraco.services.searchService + * + * @description + * Searches the default internal content search index + * @param {Object} args argument object + * @param {String} args.term seach term + * @returns {Promise} returns promise containing all matching content items + */ searchContent: function(args) { if (!args.term) { @@ -49,6 +95,18 @@ angular.module('umbraco.services') return data; }); }, + + /** + * @ngdoc method + * @name umbraco.services.searchService#searchMedia + * @methodOf umbraco.services.searchService + * + * @description + * Searches the default media search index + * @param {Object} args argument object + * @param {String} args.term seach term + * @returns {Promise} returns promise containing all matching media items + */ searchMedia: function(args) { if (!args.term) { @@ -62,6 +120,18 @@ angular.module('umbraco.services') return data; }); }, + + /** + * @ngdoc method + * @name umbraco.services.searchService#searchAll + * @methodOf umbraco.services.searchService + * + * @description + * Searches all available indexes and returns all results in one collection + * @param {Object} args argument object + * @param {String} args.term seach term + * @returns {Promise} returns promise containing all matching items + */ searchAll: function (args) { if (!args.term) { diff --git a/src/Umbraco.Web.UI.Client/src/common/services/tinymce.service.js b/src/Umbraco.Web.UI.Client/src/common/services/tinymce.service.js index c41bd45f14..af3f9e9dfd 100644 --- a/src/Umbraco.Web.UI.Client/src/common/services/tinymce.service.js +++ b/src/Umbraco.Web.UI.Client/src/common/services/tinymce.service.js @@ -86,6 +86,7 @@ function tinyMceService(dialogService, $log, imageHelper, $http, $timeout, macro tooltip: 'Media Picker', onclick: function () { dialogService.mediaPicker({ + onlyImages: true, scope: $scope, callback: function (img) { if (img) { diff --git a/src/Umbraco.Web.UI.Client/src/common/services/tree.service.js b/src/Umbraco.Web.UI.Client/src/common/services/tree.service.js index ba62feff60..44e405ef76 100644 --- a/src/Umbraco.Web.UI.Client/src/common/services/tree.service.js +++ b/src/Umbraco.Web.UI.Client/src/common/services/tree.service.js @@ -121,7 +121,20 @@ function treeService($q, treeResource, iconHelper, notificationsService, $rootSc return undefined; }, - /** clears the tree cache - with optional cacheKey, optional section or optional filter */ + /** + * @ngdoc method + * @name umbraco.services.treeService#clearCache + * @methodOf umbraco.services.treeService + * @function + * + * @description + * Clears the tree cache - with optional cacheKey, optional section or optional filter. + * + * @param {Object} args arguments + * @param {String} args.cacheKey optional cachekey - this is used to clear specific trees in dialogs + * @param {String} args.section optional section alias - clear tree for a given section + * @param {String} args.childrenOf optional parent ID - only clear the cache below a specific node + */ clearCache: function (args) { //clear all if not specified if (!args) { @@ -252,7 +265,16 @@ function treeService($q, treeResource, iconHelper, notificationsService, $rootSc }, - /** Removes a given tree node from the tree */ + /** + * @ngdoc method + * @name umbraco.services.treeService#removeNode + * @methodOf umbraco.services.treeService + * @function + * + * @description + * Removes a given node from the tree + * @param {object} treeNode the node to remove + */ removeNode: function(treeNode) { if (treeNode.parent() == null) { throw "Cannot remove a node that doesn't have a parent"; @@ -261,14 +283,33 @@ function treeService($q, treeResource, iconHelper, notificationsService, $rootSc treeNode.parent().children.splice(treeNode.parent().children.indexOf(treeNode), 1); }, - /** Removes all child nodes from a given tree node */ + /** + * @ngdoc method + * @name umbraco.services.treeService#removeChildNodes + * @methodOf umbraco.services.treeService + * @function + * + * @description + * Removes all child nodes from a given tree node + * @param {object} treeNode the node to remove children from + */ removeChildNodes : function(treeNode) { treeNode.expanded = false; treeNode.children = []; treeNode.hasChildren = false; }, - /** Gets a child node by id */ + /** + * @ngdoc method + * @name umbraco.services.treeService#getChildNode + * @methodOf umbraco.services.treeService + * @function + * + * @description + * Gets a child node with a given ID, from a specific treeNode + * @param {object} treeNode to retrive child node from + * @param {int} id id of child node + */ getChildNode: function (treeNode, id) { if (!treeNode.children) { return null; @@ -279,7 +320,18 @@ function treeService($q, treeResource, iconHelper, notificationsService, $rootSc return found === undefined ? null : found; }, - /** Gets a descendant node by id */ + /** + * @ngdoc method + * @name umbraco.services.treeService#getDescendantNode + * @methodOf umbraco.services.treeService + * @function + * + * @description + * Gets a descendant node by id + * @param {object} treeNode to retrive descendant node from + * @param {int} id id of descendant node + * @param {string} treeAlias - optional tree alias, if fetching descendant node from a child of a listview document + */ getDescendantNode: function(treeNode, id, treeAlias) { //validate if it is a section container since we'll need a treeAlias if it is one @@ -332,7 +384,16 @@ function treeService($q, treeResource, iconHelper, notificationsService, $rootSc return found === undefined ? null : found; }, - /** Gets the root node of the current tree type for a given tree node */ + /** + * @ngdoc method + * @name umbraco.services.treeService#getTreeRoot + * @methodOf umbraco.services.treeService + * @function + * + * @description + * Gets the root node of the current tree type for a given tree node + * @param {object} treeNode to retrive tree root node from + */ getTreeRoot: function (treeNode) { if (!treeNode) { throw "treeNode cannot be null"; @@ -354,6 +415,16 @@ function treeService($q, treeResource, iconHelper, notificationsService, $rootSc }, /** Gets the node's tree alias, this is done by looking up the meta-data of the current node's root node */ + /** + * @ngdoc method + * @name umbraco.services.treeService#getTreeAlias + * @methodOf umbraco.services.treeService + * @function + * + * @description + * Gets the node's tree alias, this is done by looking up the meta-data of the current node's root node + * @param {object} treeNode to retrive tree alias from + */ getTreeAlias : function(treeNode) { var root = this.getTreeRoot(treeNode); if (root) { @@ -362,7 +433,18 @@ function treeService($q, treeResource, iconHelper, notificationsService, $rootSc return ""; }, - /** gets the tree, returns a promise */ + /** + * @ngdoc method + * @name umbraco.services.treeService#getTree + * @methodOf umbraco.services.treeService + * @function + * + * @description + * gets the tree, returns a promise + * @param {object} args Arguments + * @param {string} args.section Section alias + * @param {string} args.cacheKey Optional cachekey + */ getTree: function (args) { var deferred = $q.defer(); @@ -409,6 +491,17 @@ function treeService($q, treeResource, iconHelper, notificationsService, $rootSc return deferred.promise; }, + /** + * @ngdoc method + * @name umbraco.services.treeService#getMenu + * @methodOf umbraco.services.treeService + * @function + * + * @description + * Returns available menu actions for a given tree node + * @param {object} args Arguments + * @param {string} args.treeNode tree node object to retrieve the menu for + */ getMenu: function (args) { if (!args) { @@ -428,7 +521,18 @@ function treeService($q, treeResource, iconHelper, notificationsService, $rootSc }); }, - /** Gets the children from the server for a given node */ + /** + * @ngdoc method + * @name umbraco.services.treeService#getChildren + * @methodOf umbraco.services.treeService + * @function + * + * @description + * Gets the children from the server for a given node + * @param {object} args Arguments + * @param {object} args.node tree node object to retrieve the children for + * @param {string} args.section current section alias + */ getChildren: function (args) { if (!args) { @@ -451,7 +555,16 @@ function treeService($q, treeResource, iconHelper, notificationsService, $rootSc }); }, - /** This re-loads the single node from the server */ + /** + * @ngdoc method + * @name umbraco.services.treeService#reloadNode + * @methodOf umbraco.services.treeService + * @function + * + * @description + * Re-loads the single node from the server + * @param {object} node Tree node to reload + */ reloadNode: function(node) { if (!node) { throw "node cannot be null"; @@ -495,7 +608,16 @@ function treeService($q, treeResource, iconHelper, notificationsService, $rootSc return deferred.promise; }, - /** This will return the current node's path by walking up the tree */ + /** + * @ngdoc method + * @name umbraco.services.treeService#getPath + * @methodOf umbraco.services.treeService + * @function + * + * @description + * This will return the current node's path by walking up the tree + * @param {object} node Tree node to retrieve path for + */ getPath: function(node) { if (!node) { throw "node cannot be null"; diff --git a/src/Umbraco.Web.UI.Client/src/common/services/util.service.js b/src/Umbraco.Web.UI.Client/src/common/services/util.service.js index 9ede02934b..e32f881628 100644 --- a/src/Umbraco.Web.UI.Client/src/common/services/util.service.js +++ b/src/Umbraco.Web.UI.Client/src/common/services/util.service.js @@ -165,41 +165,53 @@ function imageHelper() { if (!options && !options.imageModel) { throw "The options objet does not contain the required parameters: imageModel"; } - if (options.imageModel.contentTypeAlias.toLowerCase() === "image") { - //combine all props, TODO: we really need a better way then this - var props = []; - if(options.imageModel.properties){ - props = options.imageModel.properties; - }else{ - $(options.imageModel.tabs).each(function(i, tab){ - props = props.concat(tab.properties); - }); - } - - var imageProp = _.find(props, function (item) { - return item.alias === 'umbracoFile'; - }); - - if (!imageProp) { - return ""; - } - - var imageVal; - - //our default images might store one or many images (as csv) - var split = imageProp.value.split(','); - var self = this; - imageVal = _.map(split, function(item) { - return { file: item, isImage: self.detectIfImageByExtension(item) }; - }); - - //for now we'll just return the first image in the collection. - //TODO: we should enable returning many to be displayed in the picker if the uploader supports many. - if (imageVal.length && imageVal.length > 0 && imageVal[0].isImage) { - return imageVal[0].file; - } + + //combine all props, TODO: we really need a better way then this + var props = []; + if(options.imageModel.properties){ + props = options.imageModel.properties; + }else{ + $(options.imageModel.tabs).each(function(i, tab){ + props = props.concat(tab.properties); + }); } + + var mediaRoot = Umbraco.Sys.ServerVariables.umbracoSettings.mediaPath; + var imageProp = _.find(props, function (item) { + if(item.alias === "umbracoFile") + { + return true; + } + + //this performs a simple check to see if we have a media file as value + //it doesnt catch everything, but better then nothing + if(item.value.indexOf(mediaRoot) === 0){ + return true; + } + + return false; + }); + + if (!imageProp) { + return ""; + } + + var imageVal; + + //our default images might store one or many images (as csv) + var split = imageProp.value.split(','); + var self = this; + imageVal = _.map(split, function(item) { + return { file: item, isImage: self.detectIfImageByExtension(item) }; + }); + + //for now we'll just return the first image in the collection. + //TODO: we should enable returning many to be displayed in the picker if the uploader supports many. + if (imageVal.length && imageVal.length > 0 && imageVal[0].isImage) { + return imageVal[0].file; + } + return ""; }, /** formats the display model used to display the content to the model used to save the content */ diff --git a/src/Umbraco.Web.UI.Client/src/less/panel.less b/src/Umbraco.Web.UI.Client/src/less/panel.less index c757dcd345..29bd86c8fc 100644 --- a/src/Umbraco.Web.UI.Client/src/less/panel.less +++ b/src/Umbraco.Web.UI.Client/src/less/panel.less @@ -26,7 +26,7 @@ overflow: auto; } .umb-panel-body.no-header { - top: 0px; + top: 20px; } .umb-panel-body.with-footer { diff --git a/src/Umbraco.Web.UI.Client/src/less/property-editors.less b/src/Umbraco.Web.UI.Client/src/less/property-editors.less index de019d3f79..3f42be1acf 100644 --- a/src/Umbraco.Web.UI.Client/src/less/property-editors.less +++ b/src/Umbraco.Web.UI.Client/src/less/property-editors.less @@ -148,7 +148,6 @@ ul.color-picker li a { margin: 0; padding: 0; display: block; - width: 520px; } @@ -159,6 +158,7 @@ ul.color-picker li a { background: white; margin: 5px; position: relative; + text-align: center } .umb-sortable-thumbnails li:hover a{ @@ -167,10 +167,20 @@ ul.color-picker li a { .umb-sortable-thumbnails li img { -max-width:100%; -max-height:100%; -margin:auto; -display:block; + max-width:100%; + max-height:100%; + margin:auto; + display:block; +} + +.umb-sortable-thumbnails .icon-holder .icon{ + font-size: 60px; + line-height: 70px; +} +.umb-sortable-thumbnails .icon-holder * +{ + color: @grayLight; + display: block } @@ -221,14 +231,16 @@ display:block; .umb-photo-folder .picrow{ overflow-y: hidden; + position: relative; } -.umb-photo-folder .picrow a, .umb-photo-preview{ +.umb-photo-folder .picrow div, .umb-photo-preview{ margin: 0px; padding: 0px; border: none; display: inline-block; vertical-align: top; + position: relative; } .umb-photo-folder a:hover{text-decoration: none} @@ -241,6 +253,21 @@ display:block; text-decoration: none; } +//this is a temp hack, to provide selectors in the dialog: +.umb-dialogs-mediapicker .umb-photo-folder .pic:hover .selector-overlay{ + position: absolute; + bottom: 0px; + left: 0px; + right: 0px; + padding: 5px; + background: black; + z-index: 100; + display: block; + text-align: center; + color: white; + opacity: 0.4; +} + .umb-photo-folder .umb-non-thumbnail i{ color: @grayLight; font-size: 70px; @@ -257,6 +284,7 @@ display:block; .umb-photo-folder .selected:before{ content: "\e165"; font-family: Icomoon; + position: absolute; bottom: 10px; right: 10px; @@ -275,6 +303,7 @@ display:block; width: 32px; overflow: hidden; display: block; + z-index: 100; } diff --git a/src/Umbraco.Web.UI.Client/src/views/common/dialogs/contentpicker.html b/src/Umbraco.Web.UI.Client/src/views/common/dialogs/contentpicker.html index 7890421360..0932b63286 100644 --- a/src/Umbraco.Web.UI.Client/src/views/common/dialogs/contentpicker.html +++ b/src/Umbraco.Web.UI.Client/src/views/common/dialogs/contentpicker.html @@ -38,8 +38,7 @@
      diff --git a/src/Umbraco.Web.UI.Client/src/views/common/dialogs/linkpicker.controller.js b/src/Umbraco.Web.UI.Client/src/views/common/dialogs/linkpicker.controller.js index ff75f595bf..b0ad65477e 100644 --- a/src/Umbraco.Web.UI.Client/src/views/common/dialogs/linkpicker.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/common/dialogs/linkpicker.controller.js @@ -21,7 +21,7 @@ angular.module("umbraco").controller("Umbraco.Dialogs.LinkPickerController", } contentResource.getNiceUrl($scope.target.id).then(function(url){ - $scope.target.url = angular.fromJson(url); + $scope.target.url = url; }); } } @@ -53,7 +53,7 @@ angular.module("umbraco").controller("Umbraco.Dialogs.LinkPickerController", $scope.target.url = "/"; } else { contentResource.getNiceUrl(args.node.id).then(function (url) { - $scope.target.url = angular.fromJson(url); + $scope.target.url = url; }); } } else { diff --git a/src/Umbraco.Web.UI.Client/src/views/common/dialogs/linkpicker.html b/src/Umbraco.Web.UI.Client/src/views/common/dialogs/linkpicker.html index b3cd07cb44..bf01c5e23c 100644 --- a/src/Umbraco.Web.UI.Client/src/views/common/dialogs/linkpicker.html +++ b/src/Umbraco.Web.UI.Client/src/views/common/dialogs/linkpicker.html @@ -22,8 +22,8 @@
      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 8e1de23cf9..986a52c595 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 @@ -4,6 +4,8 @@ angular.module("umbraco") function($scope, mediaResource, umbRequestHelper, entityResource, $log, imageHelper, eventsService, treeService) { var dialogOptions = $scope.$parent.dialogOptions; + $scope.onlyImages = dialogOptions.onlyImages; + $scope.options = { url: umbRequestHelper.getApiUrl("mediaApiBaseUrl", "PostAddFile"), autoUpload: true, @@ -27,15 +29,19 @@ angular.module("umbraco") childrenOf: data.parentId //clear the children of the parent }); - $scope.gotoFolder(data.id); + $scope.gotoFolder(data); }); } }; - $scope.gotoFolder = function(folderId) { + $scope.gotoFolder = function(folder) { - if (folderId > 0) { - entityResource.getAncestors(folderId, "media") + if(!folder){ + folder = {id: -1, name: "Media", icon: "icon-folder"}; + } + + if (folder.id > 0) { + entityResource.getAncestors(folder.id, "media") .then(function(anc) { // anc.splice(0,1); $scope.path = anc; @@ -44,25 +50,33 @@ angular.module("umbraco") else { $scope.path = []; } + //mediaResource.rootMedia() - mediaResource.getChildren(folderId) + mediaResource.getChildren(folder.id) .then(function(data) { $scope.images = []; $scope.searchTerm = ""; $scope.images = data.items; + //update the thumbnail property _.each($scope.images, function(img) { img.thumbnail = imageHelper.getThumbnail({ imageModel: img, scope: $scope }); }); + //reject all images that have an empty thumbnail - this can occur if there's an image item // that doesn't have an uploaded image. - $scope.images = _.reject($scope.images, function(item) { - return item.contentTypeAlias.toLowerCase() !== "folder" && item.thumbnail === ""; - }); + + if($scope.onlyImages){ + $scope.images = _.reject($scope.images, function(item) { + return item.contentTypeAlias.toLowerCase() !== "folder" && item.thumbnail === ""; + }); + } }); - $scope.options.formData.currentFolder = folderId; + $scope.options.formData.currentFolder = folder.id; + $scope.currentFolder = folder; + }; @@ -70,14 +84,11 @@ angular.module("umbraco") $scope.gotoFolder($scope.options.formData.currentFolder); }); - $scope.clickHandler = function(image, ev) { - - if (image.contentTypeAlias.toLowerCase() == 'folder') { - $scope.options.formData.currentFolder = image.id; - $scope.gotoFolder(image.id); - } - else if (image.contentTypeAlias.toLowerCase() == 'image') { + $scope.clickHandler = function(image, ev, select) { + if (image.contentTypeAlias.toLowerCase() == 'folder' && !select) { + $scope.gotoFolder(image); + }else{ eventsService.publish("Umbraco.Dialogs.MediaPickerController.Select", image); if (dialogOptions && dialogOptions.multiPicker) { @@ -92,13 +103,19 @@ angular.module("umbraco") ev.preventDefault(); }; + $scope.selectFolder= function(folder) { + if (dialogOptions && dialogOptions.multiPicker) { + $scope.select(folder); + } + else { + $scope.submit(folder); + } + }; + $scope.selectMediaItem = function(image) { if (image.contentTypeAlias.toLowerCase() == 'folder') { - $scope.options.formData.currentFolder = image.id; - $scope.gotoFolder(image.id); - } - else if (image.contentTypeAlias.toLowerCase() == 'image') { - + $scope.gotoFolder(image); + }else{ eventsService.publish("Umbraco.Dialogs.MediaPickerController.Select", image); if (dialogOptions && dialogOptions.multiPicker) { @@ -110,5 +127,6 @@ angular.module("umbraco") } }; - $scope.gotoFolder(-1); + //default root item + $scope.gotoFolder(); }); \ 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 a4c4b82638..b0155bfec4 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,7 +1,7 @@
      -
      +
      @@ -26,10 +26,10 @@ data-file-upload="options" data-file-upload-progress="" data-ng-class="{'fileupl
      -
      + + filter-by="searchTerm"/> +