diff --git a/src/Umbraco.Web.UI.Client/bower.json b/src/Umbraco.Web.UI.Client/bower.json index 4c57235c69..ab78d10380 100644 --- a/src/Umbraco.Web.UI.Client/bower.json +++ b/src/Umbraco.Web.UI.Client/bower.json @@ -1,30 +1,31 @@ { - "name": "Umbraco", - "version": "7", - "homepage": "https://github.com/umbraco/Umbraco-CMS", - "authors": [ - "Shannon " - ], - "description": "Umbraco CMS", - "license": "MIT", - "private": true, - "ignore": [ - "**/.*", - "node_modules", - "bower_components", - "test", - "tests" - ], - "dependencies": { - "typeahead.js": "~0.10.5", - "underscore": "~1.7.0", - "rgrove-lazyload": "*", - "bootstrap-social": "~4.8.0", - "jquery": "2.0.3", - "jquery-ui": "1.11.4", - "angular-dynamic-locale": "0.1.28", - "ng-file-upload": "~7.3.8", - "tinymce": "~4.1.10", - "codemirror": "~5.3.0" - } + "name": "Umbraco", + "version": "7", + "homepage": "https://github.com/umbraco/Umbraco-CMS", + "authors": [ + "Shannon " + ], + "description": "Umbraco CMS", + "license": "MIT", + "private": true, + "ignore": [ + "**/.*", + "node_modules", + "bower_components", + "test", + "tests" + ], + "dependencies": { + "typeahead.js": "~0.10.5", + "underscore": "~1.7.0", + "rgrove-lazyload": "*", + "bootstrap-social": "~4.8.0", + "jquery": "2.0.3", + "jquery-ui": "1.11.4", + "angular-dynamic-locale": "0.1.28", + "ng-file-upload": "~7.3.8", + "tinymce": "~4.1.10", + "codemirror": "~5.3.0", + "angular-local-storage": "~0.2.3" + } } diff --git a/src/Umbraco.Web.UI.Client/gruntFile.js b/src/Umbraco.Web.UI.Client/gruntFile.js index 2fb9b026a5..0500e24c31 100644 --- a/src/Umbraco.Web.UI.Client/gruntFile.js +++ b/src/Umbraco.Web.UI.Client/gruntFile.js @@ -492,6 +492,10 @@ module.exports = function (grunt) { keepExpandedHierarchy: false, files: ['ng-file-upload.min.js'] }, + 'angular-local-storage': { + keepExpandedHierarchy: false, + files: ['dist/angular-local-storage.min.js'] + }, 'codemirror': { files: [ 'lib/codemirror.js', diff --git a/src/Umbraco.Web.UI.Client/src/app.js b/src/Umbraco.Web.UI.Client/src/app.js index 60583852b3..e2a12bc876 100644 --- a/src/Umbraco.Web.UI.Client/src/app.js +++ b/src/Umbraco.Web.UI.Client/src/app.js @@ -10,7 +10,8 @@ var app = angular.module('umbraco', [ 'ngSanitize', 'ngMobile', 'tmh.dynamicLocale', - 'ngFileUpload' + 'ngFileUpload', + 'LocalStorageModule' ]); var packages = angular.module("umbraco.packages", []); diff --git a/src/Umbraco.Web.UI.Client/src/common/services/listviewhelper.service.js b/src/Umbraco.Web.UI.Client/src/common/services/listviewhelper.service.js index e7bfe59d42..428b9f4323 100644 --- a/src/Umbraco.Web.UI.Client/src/common/services/listviewhelper.service.js +++ b/src/Umbraco.Web.UI.Client/src/common/services/listviewhelper.service.js @@ -1,16 +1,17 @@ (function() { 'use strict'; - function listViewHelper($cookieStore) { + function listViewHelper(localStorageService) { var firstSelectedIndex = 0; + var localStorageKey = "umblistViewLayout"; function getLayout(nodeId, availableLayouts) { var storedLayouts = []; - if ($cookieStore.get("umblistViewLayout")) { - storedLayouts = $cookieStore.get("umblistViewLayout"); + if(localStorageService.get(localStorageKey)) { + storedLayouts = localStorageService.get(localStorageKey); } if (storedLayouts && storedLayouts.length > 0) { @@ -47,19 +48,18 @@ activeLayout = getFirstAllowedLayout(availableLayouts); } - setLayoutCookie(nodeId, activeLayout); + saveLayoutInLocalStorage(nodeId, activeLayout); return activeLayout; } - function setLayoutCookie(nodeId, selectedLayout) { - + function saveLayoutInLocalStorage(nodeId, selectedLayout) { var layoutFound = false; var storedLayouts = []; - if($cookieStore.get("umblistViewLayout")) { - storedLayouts = $cookieStore.get("umblistViewLayout"); + if(localStorageService.get(localStorageKey)) { + storedLayouts = localStorageService.get(localStorageKey); } if(storedLayouts.length > 0) { @@ -73,14 +73,14 @@ } if(!layoutFound) { - var cookieObject = { + var storageObject = { "nodeId": nodeId, "path": selectedLayout.path }; - storedLayouts.push(cookieObject); + storedLayouts.push(storageObject); } - document.cookie="umblistViewLayout=" + JSON.stringify(storedLayouts); + localStorageService.set(localStorageKey, storedLayouts); } @@ -106,7 +106,7 @@ var item = null; if ($event.shiftKey === true) { - + if(selectedIndex > firstSelectedIndex) { start = firstSelectedIndex; @@ -266,7 +266,7 @@ getLayout: getLayout, getFirstAllowedLayout: getFirstAllowedLayout, setLayout: setLayout, - setLayoutCookie: setLayoutCookie, + saveLayoutInLocalStorage: saveLayoutInLocalStorage, selectHandler: selectHandler, selectItem: selectItem, deselectItem: deselectItem, diff --git a/src/Umbraco.Web/UI/JavaScript/JsInitialize.js b/src/Umbraco.Web/UI/JavaScript/JsInitialize.js index 9c4ea749b4..0314c65fae 100644 --- a/src/Umbraco.Web/UI/JavaScript/JsInitialize.js +++ b/src/Umbraco.Web/UI/JavaScript/JsInitialize.js @@ -9,16 +9,17 @@ 'lib/angular/1.1.5/angular-cookies.min.js', 'lib/angular/1.1.5/angular-mobile.js', 'lib/angular/1.1.5/angular-sanitize.min.js', - + 'lib/angular/angular-ui-sortable.js', 'lib/angular-dynamic-locale/tmhDynamicLocale.min.js', 'lib/ng-file-upload/ng-file-upload.min.js', + 'lib/angular-local-storage/angular-local-storage.min.js', 'lib/bootstrap/js/bootstrap.2.3.2.min.js', 'lib/bootstrap-tabdrop/bootstrap-tabdrop.js', 'lib/umbraco/Extensions.js', - + 'lib/umbraco/NamespaceManager.js', 'lib/umbraco/LegacyUmbClientMgr.js', 'lib/umbraco/LegacySpeechBubble.js',