implemented section resource and mocks to load in the sections (applications)
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* @ngdoc filter
|
||||
* @name umbraco.filters:sectionIcon
|
||||
* @description This will properly render the tree icon image based on the tree icon set on the server
|
||||
**/
|
||||
function sectionIconFilter(iconHelper) {
|
||||
return function (sectionIconClass) {
|
||||
if (iconHelper.isLegacyIcon(sectionIconClass)) {
|
||||
return iconHelper.convertFromLegacyIcon(sectionIconClass);
|
||||
}
|
||||
else {
|
||||
return sectionIconClass;
|
||||
}
|
||||
};
|
||||
}
|
||||
angular.module('umbraco.filters').filter("sectionIcon", sectionIconFilter);
|
||||
@@ -3,10 +3,10 @@
|
||||
* @name umbraco.filters:umbTreeIconClass
|
||||
* @description This will properly render the tree icon class based on the tree icon set on the server
|
||||
**/
|
||||
function treeIconClassFilter(treeIconHelper) {
|
||||
function treeIconClassFilter(iconHelper) {
|
||||
return function (treeNode, standardClasses) {
|
||||
if (treeNode.iconIsClass !== false) {
|
||||
return standardClasses + " " + treeIconHelper.convertFromLegacyTreeNodeIcon(treeNode);
|
||||
return standardClasses + " " + iconHelper.convertFromLegacyTreeNodeIcon(treeNode);
|
||||
}
|
||||
//we need an 'icon-' class in there for certain styles to work so if it is image based we'll add this
|
||||
return standardClasses + " icon-custom-file";
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
* @name umbraco.filters:umbTreeIconImage
|
||||
* @description This will properly render the tree icon image based on the tree icon set on the server
|
||||
**/
|
||||
function treeIconStyleFilter(treeIconHelper) {
|
||||
function treeIconStyleFilter(iconHelper) {
|
||||
return function (treeNode) {
|
||||
if (treeNode.iconIsClass) {
|
||||
var converted = treeIconHelper.convertFromLegacyTreeNodeIcon(treeNode);
|
||||
var converted = iconHelper.convertFromLegacyTreeNodeIcon(treeNode);
|
||||
if (converted.startsWith('.')) {
|
||||
//its legacy so add some width/height
|
||||
return "height:16px;width:16px;";
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
/**
|
||||
* @ngdoc factory
|
||||
* @name umbraco.mocks.sectionMocks
|
||||
* @description Mocks data retreival for the sections
|
||||
**/
|
||||
function sectionMocks($httpBackend, mocksUtills) {
|
||||
|
||||
/** internal method to mock the sections to be returned */
|
||||
function getSections() {
|
||||
var sections = [
|
||||
{ name: "Content", cssclass: "content", alias: "content" },
|
||||
{ name: "Media", cssclass: "media", alias: "media" },
|
||||
{ name: "Settings", cssclass: "settings", alias: "settings" },
|
||||
{ name: "Developer", cssclass: "developer", alias: "developer" },
|
||||
{ name: "Users", cssclass: "user", alias: "users" }
|
||||
];
|
||||
|
||||
return [200, sections, null];
|
||||
}
|
||||
|
||||
return {
|
||||
register: function () {
|
||||
$httpBackend
|
||||
.whenGET(mocksUtills.urlRegex('/umbraco/UmbracoApi/Section/GetSections'))
|
||||
.respond(getSections);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
angular.module('umbraco.mocks').factory('sectionMocks', ['$httpBackend', 'mocksUtills', sectionMocks]);
|
||||
@@ -1,11 +1,11 @@
|
||||
var umbracoAppDev = angular.module('umbraco.httpbackend', ['umbraco', 'ngMockE2E', 'umbraco.mocks']);
|
||||
|
||||
|
||||
function initBackEnd($httpBackend, contentMocks, treeMocks, userMocks, contentTypeMocks) {
|
||||
function initBackEnd($httpBackend, contentMocks, treeMocks, userMocks, contentTypeMocks, sectionMocks) {
|
||||
|
||||
//Register mocked http responses
|
||||
contentMocks.register();
|
||||
|
||||
sectionMocks.register();
|
||||
treeMocks.register();
|
||||
|
||||
userMocks.register();
|
||||
|
||||
@@ -10,6 +10,7 @@ Umbraco.Sys.ServerVariables = {
|
||||
"umbracoPath": "/umbraco",
|
||||
"contentApiBaseUrl": "/umbraco/UmbracoApi/Content/",
|
||||
"mediaApiBaseUrl": "/umbraco/UmbracoApi/Media/",
|
||||
"sectionApiBaseUrl": "/umbraco/UmbracoApi/Section/",
|
||||
"treeApplicationApiBaseUrl": "/umbraco/UmbracoTrees/ApplicationTreeApi/",
|
||||
"contentTypeApiBaseUrl": "/umbraco/Api/ContentType/",
|
||||
"mediaTypeApiBaseUrl": "/umbraco/Api/MediaTypeApi/",
|
||||
|
||||
@@ -13,7 +13,7 @@ function sectionResource($q, $http) {
|
||||
//the factory object returned
|
||||
return {
|
||||
/** Loads in the data to display the section list */
|
||||
getSections: function (options) {
|
||||
getSections: function () {
|
||||
|
||||
var deferred = $q.defer();
|
||||
|
||||
|
||||
@@ -50,17 +50,7 @@ angular.module('umbraco.services')
|
||||
currentNode: currentNode,
|
||||
mode: "default",
|
||||
ui: ui,
|
||||
|
||||
sections: function(){
|
||||
return [
|
||||
{ name: "Content", cssclass: "content", alias: "content" },
|
||||
{ name: "Media", cssclass: "media", alias: "media" },
|
||||
{ name: "Settings", cssclass: "settings", alias: "settings" },
|
||||
{ name: "Developer", cssclass: "developer", alias: "developer" },
|
||||
{ name: "Users", cssclass: "user", alias: "users" }
|
||||
];
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* @ngdoc function
|
||||
* @name loadLegacyIFrame
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
* @param myParam {object} Enter param description here
|
||||
*/
|
||||
function treeService($q, treeResource, treeIconHelper) {
|
||||
function treeService($q, treeResource, iconHelper) {
|
||||
//implement this in local storage
|
||||
var treeArray = [];
|
||||
var currentSection = "content";
|
||||
@@ -70,7 +70,7 @@ function treeService($q, treeResource, treeIconHelper) {
|
||||
|
||||
//need to convert the icons to new ones
|
||||
for (var i = 0; i < treeItem.node.menu.length; i++) {
|
||||
treeItem.node.menu[i].cssclass = treeIconHelper.convertFromLegacyIcon(treeItem.node.menu[i].cssclass);
|
||||
treeItem.node.menu[i].cssclass = iconHelper.convertFromLegacyIcon(treeItem.node.menu[i].cssclass);
|
||||
}
|
||||
return treeItem.node.menu;
|
||||
},
|
||||
|
||||
@@ -345,10 +345,10 @@ angular.module('umbraco.services').factory('umbDataFormatter', umbDataFormatter)
|
||||
|
||||
/**
|
||||
* @ngdoc factory
|
||||
* @name umbraco.services.tree:treeIconHelper
|
||||
* @description A helper service for dealing with tree icons, mostly dealing with legacy tree icons
|
||||
* @name umbraco.services.tree:iconHelper
|
||||
* @description A helper service for dealing with icons, mostly dealing with legacy tree icons
|
||||
**/
|
||||
function treeIconHelper() {
|
||||
function iconHelper() {
|
||||
|
||||
var converter = [
|
||||
{ oldIcon: ".sprNew", newIcon: "plus" },
|
||||
@@ -371,7 +371,16 @@ function treeIconHelper() {
|
||||
{ oldIcon: ".sprTreeFolder_o", newIcon: "icon-folder-open" },
|
||||
{ oldIcon: ".sprTreeMediaFile", newIcon: "icon-music" },
|
||||
{ oldIcon: ".sprTreeMediaMovie", newIcon: "icon-movie" },
|
||||
{ oldIcon: ".sprTreeMediaPhoto", newIcon: "icon-picture" }
|
||||
{ oldIcon: ".sprTreeMediaPhoto", newIcon: "icon-picture" },
|
||||
|
||||
//tray icons
|
||||
{ oldIcon: ".traycontent", newIcon: "content" },
|
||||
{ oldIcon: ".traymedia", newIcon: "media" },
|
||||
{ oldIcon: ".traysettings", newIcon: "settings" },
|
||||
{ oldIcon: ".traydeveloper", newIcon: "developer" },
|
||||
{ oldIcon: ".trayusers", newIcon: "user" },
|
||||
{ oldIcon: ".traymember", newIcon: "member" },
|
||||
{ oldIcon: ".traytranslation", newIcon: "translation" }
|
||||
];
|
||||
|
||||
return {
|
||||
@@ -409,4 +418,4 @@ function treeIconHelper() {
|
||||
}
|
||||
};
|
||||
}
|
||||
angular.module('umbraco.services').factory('treeIconHelper', treeIconHelper);
|
||||
angular.module('umbraco.services').factory('iconHelper', iconHelper);
|
||||
File diff suppressed because one or more lines are too long
@@ -52,7 +52,7 @@
|
||||
@import "../../lib/bootstrap/less/thumbnails.less";
|
||||
@import "../../lib/bootstrap/less/media.less";
|
||||
@import "../../lib/bootstrap/less/labels-badges.less";
|
||||
@import "../../lib/bootstrap/less/progress-bars.less";
|
||||
@import "../../lib/bootstrap/less/progress-bars.less";
|
||||
@import "../../lib/bootstrap/less/accordion.less";
|
||||
@import "../../lib/bootstrap/less/carousel.less";
|
||||
@import "../../lib/bootstrap/less/hero-unit.less";
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
*
|
||||
* @param navigationService {navigationService} A reference to the navigationService
|
||||
*/
|
||||
function NavigationController($scope, navigationService) {
|
||||
function NavigationController($scope, navigationService, sectionResource) {
|
||||
//load navigation service handlers
|
||||
$scope.changeSection = navigationService.changeSection;
|
||||
$scope.showTree = navigationService.showTree;
|
||||
@@ -21,7 +21,14 @@ function NavigationController($scope, navigationService) {
|
||||
$scope.ui = navigationService.ui;
|
||||
|
||||
$scope.selectedId = navigationService.currentId;
|
||||
$scope.sections = navigationService.sections();
|
||||
|
||||
sectionResource.getSections()
|
||||
.then(function(result) {
|
||||
$scope.sections = result;
|
||||
}, function (reason) {
|
||||
//TODO: handle error properly
|
||||
alert(reason);
|
||||
});
|
||||
|
||||
//events
|
||||
$scope.$on("treeOptionsClick", function (ev, args) {
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
ng-click="changeSection(section.alias)"
|
||||
ng-mouseenter="showTree(section.alias)"
|
||||
prevent-default>
|
||||
<i class="{{section.cssclass}}"></i><span>{{section.name}}</span>
|
||||
<i class="{{section.cssclass | sectionIcon}}"></i><span>{{section.name}}</span>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user