diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/editors/umbcontentname.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/editors/umbcontentname.directive.js new file mode 100644 index 0000000000..5ccfeb047b --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/common/directives/editors/umbcontentname.directive.js @@ -0,0 +1,46 @@ +/** +* @ngdoc directive +* @name umbraco.directives.directive:umbContentName +* @restrict E +* @function +* @description +* Used by editors that require naming an entity. Shows a textbox/headline with a required validator within it's own form. +**/ +angular.module("umbraco.directives") + .directive('umbContentName', function ($timeout) { + return { + require: "ngModel", + restrict: 'E', + replace: true, + templateUrl: 'views/directives/umb-content-name.html', + scope: { + placeholder: '@placeholder', + model: '=ngModel' + }, + link: function(scope, element, attrs, ngModel) { + + ngModel.$render = function(){ + $timeout(function(){ + if(scope.model === ""){ + scope.goEdit(); + } + }, 100); + }; + + scope.goEdit = function(){ + scope.editMode = true; + $timeout(function(){ + element.find("input").focus(); + }, 100); + }; + + scope.exitEdit = function(){ + scope.editMode = false; + + if(scope.model === ""){ + scope.model = "Empty..."; + } + }; + } + }; + }); \ No newline at end of file diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/localize.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/localize.directive.js new file mode 100644 index 0000000000..70c412465b --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/common/directives/localize.directive.js @@ -0,0 +1,20 @@ +angular.module("umbraco.directives") +.directive('localize', function ($log, localizationService) { + return { + restrict: 'E', + scope:{ + key: '@' + }, + replace: true, + link: function (scope, element, attrs) { + var key = scope.key; + if(key[0] === '#') + { + key = key.slice(1); + } + + var value = localizationService.getLocalizedString(key); + element.html(value); + } + }; +}); \ No newline at end of file diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/umbcontentname.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/umbcontentname.directive.js deleted file mode 100644 index 3245950795..0000000000 --- a/src/Umbraco.Web.UI.Client/src/common/directives/umbcontentname.directive.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @ngdoc directive -* @name umbraco.directives.directive:umbContentName -* @restrict E -* @function -* @description -* Used by editors that require naming an entity. Shows a textbox/headline with a required validator within it's own form. -**/ -angular.module("umbraco.directives") - .directive('umbContentName', function ($timeout) { - return { - require: "ngModel", - restrict: 'E', - replace: true, - templateUrl: 'views/directives/umb-content-name.html', - scope: { - placeholder: '@placeholder', - model: '=ngModel' - }, - link: function(scope, element, attrs, modelCtrl) { - - var input = $(element).find('input'); - var h1 = $(element).find('h1'); - input.hide(); - - - input.on("blur", function () { - //Don't hide the input field if there is no value in it - var val = input.val() || "empty"; - input.hide(); - - h1.text(val); - h1.show(); - }); - - - h1.on("click", function () { - h1.hide(); - input.show().focus(); - }); - - $timeout(function(){ - if(!scope.model){ - h1.hide(); - input.show().focus(); - } - }, 500); - } - }; - }); \ No newline at end of file diff --git a/src/Umbraco.Web.UI.Client/src/common/resources/log.resource.js b/src/Umbraco.Web.UI.Client/src/common/resources/log.resource.js new file mode 100644 index 0000000000..ad74cd44e7 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/common/resources/log.resource.js @@ -0,0 +1,107 @@ +/** + * @ngdoc service + * @name umbraco.resources.logResource + * @description Retrives log history from umbraco + * + * + **/ +function logResource($q, $http, umbRequestHelper) { + + //the factory object returned + return { + + /** + * @ngdoc method + * @name umbraco.resources.userResource#getEntityLog + * @methodOf umbraco.resources.logResource + * + * @description + * Gets the log history for a give entity id + * + * ##usage + *
+ * logResource.getEntityLog(1234)
+ * .then(function(log) {
+ * alert('its here!');
+ * });
+ *
+ *
+ * @param {Int} id id of entity to return log history
+ * @returns {Promise} resourcePromise object containing the log.
+ *
+ */
+ getEntityLog: function (id) {
+ return umbRequestHelper.resourcePromise(
+ $http.get(
+ umbRequestHelper.getApiUrl(
+ "logApiBaseUrl",
+ "GetEntityLog",
+ [{ id: id }])),
+ 'Failed to retreive user data for id ' + id);
+ },
+
+ /**
+ * @ngdoc method
+ * @name umbraco.resources.userResource#getUserLog
+ * @methodOf umbraco.resources.logResource
+ *
+ * @description
+ * Gets the current users' log history for a given type of log entry
+ *
+ * ##usage
+ *
+ * logResource.getUserLog("save", new Date())
+ * .then(function(log) {
+ * alert('its here!');
+ * });
+ *
+ *
+ * @param {String} type logtype to query for
+ * @param {DateTime} since query the log back to this date, by defalt 7 days ago
+ * @returns {Promise} resourcePromise object containing the log.
+ *
+ */
+ getUserLog: function (type, since) {
+ return umbRequestHelper.resourcePromise(
+ $http.get(
+ umbRequestHelper.getApiUrl(
+ "logApiBaseUrl",
+ "GetUserLog",
+ [{ logtype: type, sinceDate: since }])),
+ 'Failed to retreive user data for id ' + id);
+ },
+
+ /**
+ * @ngdoc method
+ * @name umbraco.resources.userResource#getLog
+ * @methodOf umbraco.resources.logResource
+ *
+ * @description
+ * Gets the log history for a given type of log entry
+ *
+ * ##usage
+ *
+ * logResource.getLog("save", new Date())
+ * .then(function(log) {
+ * alert('its here!');
+ * });
+ *
+ *
+ * @param {String} type logtype to query for
+ * @param {DateTime} since query the log back to this date, by defalt 7 days ago
+ * @returns {Promise} resourcePromise object containing the log.
+ *
+ */
+ getLog: function (type, since) {
+ return umbRequestHelper.resourcePromise(
+ $http.get(
+ umbRequestHelper.getApiUrl(
+ "logApiBaseUrl",
+ "GetLog",
+ [{ logtype: type, sinceDate: since }])),
+ 'Failed to retreive user data for id ' + id);
+ }
+ };
+}
+
+angular.module('umbraco.resources').factory('logResource', logResource);
diff --git a/src/Umbraco.Web.UI.Client/src/common/services/localization.service.js b/src/Umbraco.Web.UI.Client/src/common/services/localization.service.js
new file mode 100644
index 0000000000..b7b7b99b98
--- /dev/null
+++ b/src/Umbraco.Web.UI.Client/src/common/services/localization.service.js
@@ -0,0 +1,84 @@
+angular.module('umbraco.services')
+.factory('localizationService', function ($http, $q, $rootScope, $window, $filter, userService) {
+ var localize = {
+ // use the $window service to get the language of the user's browser
+ language: userService.getCurrentUser().locale,
+ // array to hold the localized resource string entries
+ dictionary:[],
+ // location of the resource file
+ url: "js/language.aspx",
+ // flag to indicate if the service hs loaded the resource file
+ resourceFileLoaded:false,
+
+ // success handler for all server communication
+ successCallback:function (data) {
+ // store the returned array in the dictionary
+ localize.dictionary = data;
+ // set the flag that the resource are loaded
+ localize.resourceFileLoaded = true;
+ // broadcast that the file has been loaded
+ $rootScope.$broadcast('localizeResourcesUpdates');
+ },
+
+ // allows setting of language on the fly
+ setLanguage: function(value) {
+ localize.language = value;
+ localize.initLocalizedResources();
+ },
+
+ // allows setting of resource url on the fly
+ setUrl: function(value) {
+ localize.url = value;
+ localize.initLocalizedResources();
+ },
+
+ // builds the url for locating the resource file
+ buildUrl: function() {
+ return '/i18n/resources-locale_' + localize.language + '.js';
+ },
+
+ // loads the language resource file from the server
+ initLocalizedResources:function () {
+ var deferred = $q.defer();
+ // build the url to retrieve the localized resource file
+ $http({ method:"GET", url:localize.url, cache:false })
+ .then(function(response){
+ localize.resourceFileLoaded = true;
+ localize.dictionary = response.data;
+
+ $rootScope.$broadcast('localizeResourcesUpdates');
+
+ return deferred.resolve(localize.dictionary);
+ }, function(err){
+ return deferred.reject("Something broke");
+ });
+ return deferred.promise;
+ },
+
+ // checks the dictionary for a localized resource string
+ getLocalizedString: function(value) {
+ if(localize.resourceFileLoaded){
+ return _lookup(value);
+ }else{
+ localize.initLocalizedResources().then(function(dic){
+ return _lookup(value);
+ });
+ }
+ },
+ _lookup: function(value){
+ var entry = localize.dictionary[value];
+ if(entry){
+ return entry;
+ }
+ return "[" + value + "]";
+ }
+
+
+ };
+
+ // force the load of the resource file
+ localize.initLocalizedResources();
+
+ // return the local instance when called
+ return localize;
+ });
\ No newline at end of file
diff --git a/src/Umbraco.Web.UI.Client/src/less/forms.less b/src/Umbraco.Web.UI.Client/src/less/forms.less
index e74c0ddc20..b5396efc13 100644
--- a/src/Umbraco.Web.UI.Client/src/less/forms.less
+++ b/src/Umbraco.Web.UI.Client/src/less/forms.less
@@ -22,6 +22,11 @@ label.control-label {
padding-top: 8px !important;
}
+.umb-status-label{
+ color: @gray !important;
+ }
+
+
.controls-row label{padding: 0px 10px 0px 10px; vertical-align: center}
diff --git a/src/Umbraco.Web.UI.Client/src/less/panel.less b/src/Umbraco.Web.UI.Client/src/less/panel.less
index e5187da1c6..a59a4da001 100644
--- a/src/Umbraco.Web.UI.Client/src/less/panel.less
+++ b/src/Umbraco.Web.UI.Client/src/less/panel.less
@@ -63,16 +63,7 @@ h1.headline{height: 40px; padding: 30px 0 0 20px;}
margin: -2px 0 0 0;
}
-.umb-headline-editor-wrapper input{
- display: none;
- font-size: @fontSizeMedium
-}
-
-.umb-headline-editor-wrapper h1.umb-headline-editor:hover, .umb-headline-editor-wrapper input {
- border-bottom: 1px dashed @grayLight;
-}
-
-.umb-headline-editor-wrapper input:focus {
+.umb-headline-editor-wrapper input {
background: none;
border: none;
width: auto;
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 bef16e2b72..d2d2113ad0 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
@@ -42,7 +42,7 @@ data-file-upload="options" data-file-upload-progress="" data-ng-class="{'fileupl
ng-show="showFolderInput"
ng-model="newFolderName"
ng-keyup="submitFolder($event)"
- ng-blur="showFolderInput = false">
+ on-blur="showFolderInput = false">
diff --git a/src/Umbraco.Web.UI.Client/src/views/content/content.edit.controller.js b/src/Umbraco.Web.UI.Client/src/views/content/content.edit.controller.js
index 8d04c4531c..28746df55e 100644
--- a/src/Umbraco.Web.UI.Client/src/views/content/content.edit.controller.js
+++ b/src/Umbraco.Web.UI.Client/src/views/content/content.edit.controller.js
@@ -6,7 +6,7 @@
* @description
* The controller for the content editor
*/
-function ContentEditController($scope, $routeParams, contentResource, notificationsService, angularHelper, serverValidationManager, contentEditingHelper, fileManager, editorContextService) {
+function ContentEditController($scope, $routeParams, $q, $timeout, $window, contentResource, notificationsService, angularHelper, serverValidationManager, contentEditingHelper, fileManager, editorContextService) {
//initialize the file manager
fileManager.clearFiles();
@@ -68,7 +68,28 @@ function ContentEditController($scope, $routeParams, contentResource, notificati
});
};
+ $scope.preview = function(content){
+ if(!content.id){
+ $scope.save().then(function(data){
+ $window.open('dialogs/preview.aspx?id='+data.id,'umbpreview');
+ });
+ }else{
+ $window.open('dialogs/preview.aspx?id='+content.id,'umbpreview');
+ }
+ };
+
+ $scope.setStatus = function(status){
+ //add localization
+ $scope.status = status;
+ $timeout(function(){
+ $scope.status = undefined;
+ }, 2500);
+ };
+
$scope.save = function () {
+ var deferred = $q.defer();
+
+ $scope.setStatus("Saving...");
$scope.$broadcast("saving", { scope: $scope });
var currentForm = angularHelper.getRequiredCurrentForm($scope);
@@ -86,6 +107,8 @@ function ContentEditController($scope, $routeParams, contentResource, notificati
newContent: data,
rebindCallback: contentEditingHelper.reBindChangedProperties($scope.content, data)
});
+
+ deferred.resolve(data);
}, function (err) {
contentEditingHelper.handleSaveError({
@@ -93,7 +116,11 @@ function ContentEditController($scope, $routeParams, contentResource, notificati
allNewProps: contentEditingHelper.getAllProps(err.data),
allOrigProps: contentEditingHelper.getAllProps($scope.content)
});
+
+ deferred.reject(err);
});
+
+ return deferred.promise;
};
}
diff --git a/src/Umbraco.Web.UI.Client/src/views/content/edit.html b/src/Umbraco.Web.UI.Client/src/views/content/edit.html
index 18cdfebb66..9bdc494d50 100644
--- a/src/Umbraco.Web.UI.Client/src/views/content/edit.html
+++ b/src/Umbraco.Web.UI.Client/src/views/content/edit.html
@@ -13,13 +13,18 @@