Merge branch '7.0.0' of github.com:umbraco/Umbraco-CMS into 7.0.0
This commit is contained in:
@@ -5,22 +5,13 @@
|
||||
angular.module("umbraco.directives")
|
||||
.directive('hotkey', function ($window, keyboardService, $log) {
|
||||
return function (scope, el, attrs) {
|
||||
|
||||
var keyCombo = attrs["hotkey"];
|
||||
$log.log(keyCombo);
|
||||
|
||||
keyboardService.bind(keyCombo, function() {
|
||||
var element = $(el);
|
||||
|
||||
$log.log(element);
|
||||
|
||||
if(element.is("a,button,input[type='button'],input[type='submit']")){
|
||||
element.click();
|
||||
$log.log("click");
|
||||
|
||||
}else{
|
||||
element.focus();
|
||||
$log.log("focus");
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@ angular.module('umbraco.services')
|
||||
elt = document.getElementById(opt.target);
|
||||
}
|
||||
|
||||
|
||||
fct = function (e) {
|
||||
e = e || $window.event;
|
||||
|
||||
@@ -217,7 +218,6 @@ angular.module('umbraco.services')
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
// Store shortcut
|
||||
keyboardManagerService.keyboardEvent[label] = {
|
||||
|
||||
@@ -2,7 +2,7 @@ app.config(function ($routeProvider) {
|
||||
$routeProvider
|
||||
.when('/:section', {
|
||||
templateUrl: function (rp) {
|
||||
if (rp.section === "default")
|
||||
if (rp.section === "default" || rp.section === "")
|
||||
{
|
||||
rp.section = "content";
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
angular.module("umbraco").controller("Umbraco.Dialogs.LoginController", function ($scope, userService, legacyJsLoader) {
|
||||
angular.module("umbraco").controller("Umbraco.Dialogs.LoginController", function ($scope, userService, legacyJsLoader, $routeParams) {
|
||||
|
||||
/**
|
||||
* @ngdoc function
|
||||
@@ -13,11 +13,9 @@
|
||||
var weekday = new Array("Super Sunday", "Manic Monday", "Tremendous Tuesday", "Wonderfull Wednesday", "Thunder Thursday", "Friendly Friday", "Shiny Saturday");
|
||||
|
||||
$scope.today = weekday[d.getDay()];
|
||||
|
||||
$scope.errorMsg = "";
|
||||
|
||||
$scope.loginSubmit = function (login, password) {
|
||||
|
||||
$scope.loginSubmit = function (login, password) {
|
||||
if ($scope.loginForm.$invalid) {
|
||||
return;
|
||||
}
|
||||
@@ -27,11 +25,15 @@
|
||||
//We need to load in the legacy tree js.
|
||||
legacyJsLoader.loadLegacyTreeJs($scope).then(
|
||||
function(result) {
|
||||
var iframe = document.getElementById("right");
|
||||
var iframe = $("#right");
|
||||
if(iframe){
|
||||
iframe.contentDocument.location.reload(true);
|
||||
var url = decodeURIComponent($routeParams.url);
|
||||
if(!url){
|
||||
url ="dashboard.aspx";
|
||||
}
|
||||
iframe.attr("src", url);
|
||||
}
|
||||
|
||||
|
||||
$scope.submit(true);
|
||||
});
|
||||
}, function (reason) {
|
||||
|
||||
@@ -8,11 +8,12 @@
|
||||
*
|
||||
*/
|
||||
function LegacyController($scope, $routeParams, $element) {
|
||||
//set the legacy path
|
||||
$scope.legacyPath = decodeURIComponent($routeParams.url);
|
||||
|
||||
$scope.legacyPath = decodeURIComponent($routeParams.url);
|
||||
|
||||
//$scope.$on('$routeChangeSuccess', function () {
|
||||
// var asdf = $element;
|
||||
//});
|
||||
}
|
||||
|
||||
angular.module("umbraco").controller('Umbraco.LegacyController', LegacyController);
|
||||
@@ -1,3 +1,3 @@
|
||||
<div ng-controller="Umbraco.LegacyController" id="legacyContainer" style="width: 100%; height: 100%;overflow: hidden;">
|
||||
<iframe name="right" id="right" ng-src="{{legacyPath}}"></iframe>
|
||||
<div ng-controller="Umbraco.LegacyController" id="legacyContainer" style="width: 100%; height: 100%;overflow: hidden;">
|
||||
<iframe name="right" id="right" ng-src="{{legacyPath}}" data-src="{{legacyPath}}"></iframe>
|
||||
</div>
|
||||
@@ -8,7 +8,7 @@
|
||||
* The main application controller
|
||||
*
|
||||
*/
|
||||
function MainController($scope, $routeParams, $rootScope, $timeout, notificationsService, userService, navigationService, legacyJsLoader) {
|
||||
function MainController($scope, $routeParams, $rootScope, $timeout, $http, notificationsService, userService, navigationService, legacyJsLoader) {
|
||||
//debugmode so I can easily turn on/off json output of property models:
|
||||
//TODO: find a better way
|
||||
$scope.$umbdebugmode = true;
|
||||
@@ -17,6 +17,7 @@ function MainController($scope, $routeParams, $rootScope, $timeout, notification
|
||||
|
||||
//the null is important because we do an explicit bool check on this in the view
|
||||
$scope.authenticated = null;
|
||||
$scope.avatar = "assets/img/application/logo.png";
|
||||
|
||||
//subscribes to notifications in the notification service
|
||||
$scope.notifications = notificationsService.current;
|
||||
@@ -58,6 +59,15 @@ function MainController($scope, $routeParams, $rootScope, $timeout, notification
|
||||
|
||||
$scope.authenticated = data.authenticated;
|
||||
$scope.user = data.user;
|
||||
|
||||
|
||||
if($scope.user.avatar){
|
||||
$http.get($scope.user.avatar).then(function(){
|
||||
alert($scope.user.avatar);
|
||||
$scope.avatar = $scope.user.avatar;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}, function (reason) {
|
||||
notificationsService.error("An error occurred checking authentication.");
|
||||
|
||||
@@ -18,7 +18,7 @@ function NavigationController($scope,$rootScope, $location, $log, navigationServ
|
||||
|
||||
//trigger search with a hotkey:
|
||||
keyboardService.bind("ctrl+shift+s", function(){
|
||||
$scope.nav.showTree($scope.ui.currentSection);
|
||||
$scope.nav.showTree($scope.nav.currentSection);
|
||||
});
|
||||
|
||||
//the tree event handler i used to subscribe to the main tree click events
|
||||
@@ -90,8 +90,7 @@ function NavigationController($scope,$rootScope, $location, $log, navigationServ
|
||||
});
|
||||
|
||||
/** Opens a dialog but passes in this scope instance to be used for the dialog */
|
||||
$scope.openDialog = function (currentNode, action, currentSection) {
|
||||
|
||||
$scope.openDialog = function (currentNode, action, currentSection) {
|
||||
navigationService.showDialog({
|
||||
scope: $scope,
|
||||
node: currentNode,
|
||||
|
||||
@@ -1,114 +1,114 @@
|
||||
/**
|
||||
* @ngdoc controller
|
||||
* @name Umbraco.Editors.Content.EditController
|
||||
* @function
|
||||
*
|
||||
* @description
|
||||
* The controller for the content editor
|
||||
*/
|
||||
function ContentEditController($scope, $routeParams, $location, contentResource, notificationsService, angularHelper, serverValidationManager, contentEditingHelper) {
|
||||
|
||||
if ($routeParams.create) {
|
||||
//we are creating so get an empty content item
|
||||
contentResource.getScaffold($routeParams.id, $routeParams.doctype)
|
||||
.then(function(data) {
|
||||
$scope.loaded = true;
|
||||
$scope.content = data;
|
||||
});
|
||||
}
|
||||
else {
|
||||
//we are editing so get the content item from the server
|
||||
contentResource.getById($routeParams.id)
|
||||
.then(function(data) {
|
||||
$scope.loaded = true;
|
||||
$scope.content = data;
|
||||
|
||||
//in one particular special case, after we've created a new item we redirect back to the edit
|
||||
// route but there might be server validation errors in the collection which we need to display
|
||||
// after the redirect, so we will bind all subscriptions which will show the server validation errors
|
||||
// if there are any and then clear them so the collection no longer persists them.
|
||||
serverValidationManager.executeAndClearAllSubscriptions();
|
||||
});
|
||||
}
|
||||
|
||||
$scope.files = [];
|
||||
$scope.addFiles = function (propertyId, files) {
|
||||
//this will clear the files for the current property and then add the new ones for the current property
|
||||
$scope.files = _.reject($scope.files, function (item) {
|
||||
return item.id == propertyId;
|
||||
});
|
||||
for (var i = 0; i < files.length; i++) {
|
||||
//save the file object to the scope's files collection
|
||||
$scope.files.push({ id: propertyId, file: files[i] });
|
||||
}
|
||||
};
|
||||
|
||||
//TODO: Need to figure out a way to share the saving and event broadcasting with all editors!
|
||||
|
||||
$scope.saveAndPublish = function () {
|
||||
$scope.$broadcast("saving", { scope: $scope });
|
||||
|
||||
var currentForm = angularHelper.getRequiredCurrentForm($scope);
|
||||
|
||||
//don't continue if the form is invalid
|
||||
if (currentForm.$invalid) return;
|
||||
|
||||
serverValidationManager.reset();
|
||||
|
||||
contentResource.publish($scope.content, $routeParams.create, $scope.files)
|
||||
.then(function (data) {
|
||||
|
||||
contentEditingHelper.handleSuccessfulSave({
|
||||
scope: $scope,
|
||||
newContent: data,
|
||||
rebindCallback: contentEditingHelper.reBindChangedProperties(
|
||||
contentEditingHelper.getAllProps($scope.content),
|
||||
contentEditingHelper.getAllProps(data))
|
||||
});
|
||||
|
||||
}, function (err) {
|
||||
|
||||
var allNewProps = contentEditingHelper.getAllProps(err.data);
|
||||
var allOrigProps = contentEditingHelper.getAllProps($scope.content);
|
||||
|
||||
contentEditingHelper.handleSaveError({
|
||||
err: err,
|
||||
redirectOnFailure: true,
|
||||
allNewProps: allNewProps,
|
||||
allOrigProps: contentEditingHelper.getAllProps($scope.content),
|
||||
rebindCallback: contentEditingHelper.reBindChangedProperties(allOrigProps, allNewProps)
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
$scope.save = function () {
|
||||
$scope.$broadcast("saving", { scope: $scope });
|
||||
|
||||
var currentForm = angularHelper.getRequiredCurrentForm($scope);
|
||||
|
||||
//don't continue if the form is invalid
|
||||
if (currentForm.$invalid) return;
|
||||
|
||||
serverValidationManager.reset();
|
||||
|
||||
contentResource.save($scope.content, $routeParams.create, $scope.files)
|
||||
.then(function (data) {
|
||||
|
||||
contentEditingHelper.handleSuccessfulSave({
|
||||
scope: $scope,
|
||||
newContent: data,
|
||||
rebindCallback: contentEditingHelper.reBindChangedProperties(scope.content, data)
|
||||
});
|
||||
|
||||
}, function (err) {
|
||||
contentEditingHelper.handleSaveError({
|
||||
err: err,
|
||||
allNewProps: contentEditingHelper.getAllProps(err.data),
|
||||
allOrigProps: contentEditingHelper.getAllProps($scope.content)
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
angular.module("umbraco").controller("Umbraco.Editors.Content.EditController", ContentEditController);
|
||||
/**
|
||||
* @ngdoc controller
|
||||
* @name Umbraco.Editors.Content.EditController
|
||||
* @function
|
||||
*
|
||||
* @description
|
||||
* The controller for the content editor
|
||||
*/
|
||||
function ContentEditController($scope, $routeParams, $location, contentResource, notificationsService, angularHelper, serverValidationManager, contentEditingHelper) {
|
||||
|
||||
if ($routeParams.create) {
|
||||
//we are creating so get an empty content item
|
||||
contentResource.getScaffold($routeParams.id, $routeParams.doctype)
|
||||
.then(function(data) {
|
||||
$scope.loaded = true;
|
||||
$scope.content = data;
|
||||
});
|
||||
}
|
||||
else {
|
||||
//we are editing so get the content item from the server
|
||||
contentResource.getById($routeParams.id)
|
||||
.then(function(data) {
|
||||
$scope.loaded = true;
|
||||
$scope.content = data;
|
||||
|
||||
//in one particular special case, after we've created a new item we redirect back to the edit
|
||||
// route but there might be server validation errors in the collection which we need to display
|
||||
// after the redirect, so we will bind all subscriptions which will show the server validation errors
|
||||
// if there are any and then clear them so the collection no longer persists them.
|
||||
serverValidationManager.executeAndClearAllSubscriptions();
|
||||
});
|
||||
}
|
||||
|
||||
$scope.files = [];
|
||||
$scope.addFiles = function (propertyId, files) {
|
||||
//this will clear the files for the current property and then add the new ones for the current property
|
||||
$scope.files = _.reject($scope.files, function (item) {
|
||||
return item.id == propertyId;
|
||||
});
|
||||
for (var i = 0; i < files.length; i++) {
|
||||
//save the file object to the scope's files collection
|
||||
$scope.files.push({ id: propertyId, file: files[i] });
|
||||
}
|
||||
};
|
||||
|
||||
//TODO: Need to figure out a way to share the saving and event broadcasting with all editors!
|
||||
|
||||
$scope.saveAndPublish = function () {
|
||||
$scope.$broadcast("saving", { scope: $scope });
|
||||
|
||||
var currentForm = angularHelper.getRequiredCurrentForm($scope);
|
||||
|
||||
//don't continue if the form is invalid
|
||||
if (currentForm.$invalid) return;
|
||||
|
||||
serverValidationManager.reset();
|
||||
|
||||
contentResource.publish($scope.content, $routeParams.create, $scope.files)
|
||||
.then(function (data) {
|
||||
|
||||
contentEditingHelper.handleSuccessfulSave({
|
||||
scope: $scope,
|
||||
newContent: data,
|
||||
rebindCallback: contentEditingHelper.reBindChangedProperties(
|
||||
contentEditingHelper.getAllProps($scope.content),
|
||||
contentEditingHelper.getAllProps(data))
|
||||
});
|
||||
|
||||
}, function (err) {
|
||||
|
||||
var allNewProps = contentEditingHelper.getAllProps(err.data);
|
||||
var allOrigProps = contentEditingHelper.getAllProps($scope.content);
|
||||
|
||||
contentEditingHelper.handleSaveError({
|
||||
err: err,
|
||||
redirectOnFailure: true,
|
||||
allNewProps: allNewProps,
|
||||
allOrigProps: contentEditingHelper.getAllProps($scope.content),
|
||||
rebindCallback: contentEditingHelper.reBindChangedProperties(allOrigProps, allNewProps)
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
$scope.save = function () {
|
||||
$scope.$broadcast("saving", { scope: $scope });
|
||||
|
||||
var currentForm = angularHelper.getRequiredCurrentForm($scope);
|
||||
|
||||
//don't continue if the form is invalid
|
||||
if (currentForm.$invalid) return;
|
||||
|
||||
serverValidationManager.reset();
|
||||
|
||||
contentResource.save($scope.content, $routeParams.create, $scope.files)
|
||||
.then(function (data) {
|
||||
|
||||
contentEditingHelper.handleSuccessfulSave({
|
||||
scope: $scope,
|
||||
newContent: data,
|
||||
rebindCallback: contentEditingHelper.reBindChangedProperties($scope.content, data)
|
||||
});
|
||||
|
||||
}, function (err) {
|
||||
contentEditingHelper.handleSaveError({
|
||||
err: err,
|
||||
allNewProps: contentEditingHelper.getAllProps(err.data),
|
||||
allOrigProps: contentEditingHelper.getAllProps($scope.content)
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
angular.module("umbraco").controller("Umbraco.Editors.Content.EditController", ContentEditController);
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
<li class="avatar">
|
||||
<a href="#" ng-click="nav.showUserDialog()" title="{{user.name}}" prevent-default>
|
||||
<img ng-src="{{user.avatar}}" />
|
||||
<img ng-src="{{avatar}}" />
|
||||
</a>
|
||||
</li>
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ describe('keyboard service tests', function () {
|
||||
var keyboardService, $window;
|
||||
|
||||
var createKeyEvent = function (mainKey, alt, ctrl, shift, meta) {
|
||||
var keyEvent = jQuery.Event("keypress");
|
||||
var keyEvent = jQuery.Event("keydown");
|
||||
keyEvent.keyCode = mainKey.charCodeAt(0);
|
||||
keyEvent.altKey = alt;
|
||||
keyEvent.ctrlKey = ctrl;
|
||||
@@ -26,17 +26,8 @@ describe('keyboard service tests', function () {
|
||||
var el = $("<span></span>");
|
||||
var ev = createKeyEvent("s", false, true, false);
|
||||
|
||||
el.keypress(function(ev) {
|
||||
console.log(ev);
|
||||
console.log("Handler for .keypress() called.");
|
||||
});
|
||||
|
||||
|
||||
console.log("loaded");
|
||||
|
||||
keyboardService.bind("ctrl+s", function(){
|
||||
ctrls = true;
|
||||
console.log("triggered");
|
||||
}, el);
|
||||
|
||||
//initially it should be false
|
||||
@@ -45,12 +36,9 @@ describe('keyboard service tests', function () {
|
||||
//trigger the ctrls+s event
|
||||
el.trigger(ev);
|
||||
|
||||
//it should now be true
|
||||
// expect(ctrls).toBe(true);
|
||||
|
||||
// expect(iconHelper.isFileBasedIcon(legacyBased)).toBe(false);
|
||||
// expect(iconHelper.isFileBasedIcon(belleBased)).toBe(false);
|
||||
});
|
||||
//it should now be true - this failes for some reason
|
||||
//expect(ctrls).toBe(true);
|
||||
});
|
||||
|
||||
/*
|
||||
it('detects a legacy icon', function () {
|
||||
|
||||
Reference in New Issue
Block a user