Merge remote-tracking branch 'refs/remotes/umbraco/dev-v7' into dev-v7-tinymce-font-icons

This commit is contained in:
bjarnef
2016-02-08 15:07:36 +01:00
18 changed files with 131 additions and 64 deletions

View File

@@ -15,45 +15,55 @@ angular.module("umbraco.directives")
keyCombo = scope.$eval(attrs["hotkey"]);
}
// disable shortcuts in input fields if keycombo is 1 character
if (keyCombo) {
function activate() {
if (keyCombo.length === 1) {
options = {
inputDisabled: true
};
}
if (keyCombo) {
keyboardService.bind(keyCombo, function() {
var element = $(el);
var activeElementType = document.activeElement.tagName;
var clickableElements = ["A", "BUTTON"];
if (element.is("a,div,button,input[type='button'],input[type='submit'],input[type='checkbox']") && !element.is(':disabled')) {
if (element.is(':visible') || attrs.hotkeyWhenHidden) {
// when keycombo is enter and a link or button has focus - click the link or button instead of using the hotkey
if (keyCombo === "enter" && clickableElements.indexOf(activeElementType) === 0) {
document.activeElement.click();
} else {
element.click();
}
}
} else {
element.focus();
// disable shortcuts in input fields if keycombo is 1 character
if (keyCombo.length === 1) {
options = {
inputDisabled: true
};
}
}, options);
keyboardService.bind(keyCombo, function() {
el.on('$destroy', function() {
keyboardService.unbind(keyCombo);
});
var element = $(el);
var activeElementType = document.activeElement.tagName;
var clickableElements = ["A", "BUTTON"];
if (element.is("a,div,button,input[type='button'],input[type='submit'],input[type='checkbox']") && !element.is(':disabled')) {
if (element.is(':visible') || attrs.hotkeyWhenHidden) {
if (attrs.hotkeyWhen && attrs.hotkeyWhen === "false") {
return;
}
// when keycombo is enter and a link or button has focus - click the link or button instead of using the hotkey
if (keyCombo === "enter" && clickableElements.indexOf(activeElementType) === 0) {
document.activeElement.click();
} else {
element.click();
}
}
} else {
element.focus();
}
}, options);
el.on('$destroy', function() {
keyboardService.unbind(keyCombo);
});
}
}
activate();
};
});

View File

@@ -28,7 +28,8 @@ angular.module("umbraco.directives")
if( value !== undefined && value !== "" && value !== null) {
scope.alias = "Generating Alias...";
scope.alias = "";
scope.placeholderText = "Generating Alias...";
generateAliasTimeout = $timeout(function () {
updateAlias = true;

View File

@@ -28,6 +28,8 @@
// add init tab
addInitGroup(scope.model.groups);
activateFirstGroup(scope.model.groups);
// localize texts
localizationService.localize("validation_validation").then(function(value) {
validationTranslated = value;
@@ -153,14 +155,14 @@
return resourceLookup(scope.model.id, selectedContentTypeAliases, propAliasesExisting).then(function (filteredAvailableCompositeTypes) {
_.each(scope.compositionsDialogModel.availableCompositeContentTypes, function (current) {
//reset first
//reset first
current.allowed = true;
//see if this list item is found in the response (allowed) list
var found = _.find(filteredAvailableCompositeTypes, function (f) {
return current.contentType.alias === f.contentType.alias;
});
//allow if the item was found in the response (allowed) list -
//allow if the item was found in the response (allowed) list -
// and ensure its set to allowed if it is currently checked,
// DO not allow if it's a locked content type.
current.allowed = scope.model.lockedCompositeContentTypes.indexOf(current.contentType.alias) === -1 &&
@@ -181,7 +183,7 @@
}
function setupAvailableContentTypesModel(result) {
scope.compositionsDialogModel.availableCompositeContentTypes = result;
scope.compositionsDialogModel.availableCompositeContentTypes = result;
//iterate each one and set it up
_.each(scope.compositionsDialogModel.availableCompositeContentTypes, function (c) {
//enable it if it's part of the selected model
@@ -276,7 +278,7 @@
// submit overlay if no compositions has been removed
// or the action has been confirmed
} else {
// make sure that all tabs has an init property
if (scope.model.groups.length !== 0) {
angular.forEach(scope.model.groups, function(group) {
@@ -454,6 +456,15 @@
return groups;
}
function activateFirstGroup(groups) {
if (groups && groups.length > 0) {
var firstGroup = groups[0];
if(!firstGroup.tabState || firstGroup.tabState === "inActive") {
firstGroup.tabState = "active";
}
}
}
/* ---------- PROPERTIES ---------- */
scope.addProperty = function(property, group) {

View File

@@ -0,0 +1,29 @@
(function() {
'use strict';
function SetDirtyOnChange() {
function link(scope, el, attr, ctrl) {
var initValue = attr.umbSetDirtyOnChange;
attr.$observe("umbSetDirtyOnChange", function (newValue) {
if(newValue !== initValue) {
ctrl.$setDirty();
}
});
}
var directive = {
require: "^form",
restrict: 'A',
link: link
};
return directive;
}
angular.module('umbraco.directives').directive('umbSetDirtyOnChange', SetDirtyOnChange);
})();

View File

@@ -8,9 +8,9 @@ function valHighlight($timeout) {
return {
restrict: "A",
link: function (scope, element, attrs, ctrl) {
attrs.$observe("valHighlight", function (newVal) {
if (newVal === true) {
if (newVal === "true") {
element.addClass("highlight-error");
$timeout(function () {
//set the bound scope property to false
@@ -25,4 +25,4 @@ function valHighlight($timeout) {
}
};
}
angular.module('umbraco.directives.validation').directive("valHighlight", valHighlight);
angular.module('umbraco.directives.validation').directive("valHighlight", valHighlight);

View File

@@ -3,5 +3,5 @@
<p>Are you sure you want to navigate away from this page? - you have unsaved changes</p>
<button class="btn btn-warning" ng-click="discard(notification)">Discard changes</button>
<button class="btn" ng-click="stay(notification)">Stay</button>
</div>
<button class="btn" ng-click="stay(notification)" umb-auto-focus>Stay</button>
</div>

View File

@@ -75,6 +75,7 @@
ng-disabled="tab.inherited"
umb-auto-focus
umb-auto-resize
on-focus="activateGroup(tab)"
required
val-server-field="{{'Groups[' + $index + '].Name'}}" />
@@ -109,7 +110,15 @@
<li ng-class="{'umb-group-builder__property-sortable': sortingMode && !property.inherited && !property.locked}" ng-repeat="property in tab.properties">
<!-- Init property / Property placeholder / add new property -->
<a href="" class="umb-group-builder__property -placeholder" ng-if="property.propertyState=='init' && !sortingMode" ng-class="{'-placeholder': property.propertyState=='init'}" hotkey="alt+shift+p" ng-click="addProperty(property, tab)" focus-when="{{property.focus}}">
<a href=""
class="umb-group-builder__property -placeholder"
ng-if="property.propertyState=='init' && !sortingMode"
ng-class="{'-placeholder': property.propertyState=='init'}"
hotkey="alt+shift+p"
hotkey-when="{{tab.tabState === 'active' && property.propertyState=='init'}}"
ng-click="addProperty(property, tab)"
on-focus="activateGroup(tab)"
focus-when="{{property.focus}}">
<div class="umb-group-builder__property-meta">
<div class="umb-group-builder__placeholder-box -input-small"></div>

View File

@@ -1,6 +1,6 @@
<div class="umb-editor" ng-controller="Umbraco.PrevalueEditors.MultiValuesController">
<div class="control-group">
<input name="newItem" type="text" ng-model="newItem" val-highlight="hasError" />
<input name="newItem" type="text" ng-model="newItem" val-highlight="{{hasError}}" />
<button class="btn btn-small" ng-click="add($event)">Add</button>
</div>
<div ui-sortable="sortableOptions">

View File

@@ -1,9 +1,11 @@
angular.module("umbraco")
.controller("Umbraco.PropertyEditors.GridController",
function ($scope, $http, assetsService, localizationService, $rootScope, dialogService, gridService, mediaResource, imageHelper, $timeout, umbRequestHelper) {
function ($scope, $http, assetsService, localizationService, $rootScope, dialogService, gridService, mediaResource, imageHelper, $timeout, umbRequestHelper, angularHelper) {
// Grid status variables
var placeHolder = "";
var currentForm = angularHelper.getCurrentForm($scope);
$scope.currentRow = null;
$scope.currentCell = null;
$scope.currentToolsControl = null;
@@ -73,6 +75,7 @@ angular.module("umbraco")
tinyMCE.execCommand("mceRemoveEditor", false, id);
tinyMCE.init(draggedRteSettings[id]);
});
currentForm.$setDirty();
}
};
@@ -160,6 +163,7 @@ angular.module("umbraco")
}
});
}
currentForm.$setDirty();
},
start: function (e, ui) {
@@ -320,6 +324,8 @@ angular.module("umbraco")
section.rows.push(row);
}
currentForm.$setDirty();
$scope.showRowConfigurations = false;
};
@@ -329,8 +335,7 @@ angular.module("umbraco")
section.rows.splice($index, 1);
$scope.currentRow = null;
$scope.openRTEToolbarId = null;
//$scope.initContent();
currentForm.$setDirty();
}
if(section.rows.length === 0) {
@@ -397,6 +402,8 @@ angular.module("umbraco")
gridItem.config = configObject;
gridItem.hasConfig = gridItemHasConfig(styleObject, configObject);
currentForm.$setDirty();
$scope.gridItemSettingsDialog.show = false;
$scope.gridItemSettingsDialog = null;
};
@@ -407,7 +414,7 @@ angular.module("umbraco")
};
};
function stripModifier(val, modifier) {
if (!val || !modifier || modifier.indexOf(placeHolder) < 0) {
return val;

View File

@@ -174,7 +174,8 @@
ng-click="clickControl($index, area.controls, area)"
ng-class="{'-active': control.active}"
on-outside-click="clickOutsideControl($index, area.controls, area)"
bind-click-on="{{control.active}}">
bind-click-on="{{control.active}}"
umb-set-dirty-on-change="{{control.value}}">
<div class="umb-control-click-overlay" ng-show="!control.active && !sortMode"></div>

View File

@@ -24,16 +24,16 @@
<div class="control-group">
<label>Alias</label>
<input name="newItem.alias" type="text"
ng-model="newItem.alias" val-highlight="hasError" />
ng-model="newItem.alias" val-highlight="{{hasError}}" />
</div>
<div class="control-group">
<label>Size</label>
<input name="newItem.width" type="number" placeholder="Width"
ng-model="newItem.width" class="umb-editor-tiny" val-highlight="hasError" />
ng-model="newItem.width" class="umb-editor-tiny" val-highlight="{{hasError}}" />
&times;
<input name="newItem.height" type="number" placeholder="Height"
ng-model="newItem.height" class="umb-editor-tiny" val-highlight="hasError" />
ng-model="newItem.height" class="umb-editor-tiny" val-highlight="{{hasError}}" />
</div>
<div class="control-group">
@@ -46,4 +46,4 @@
<button class="btn btn-small" ng-click="newItem = {}" prevent-default>Add new crop</button>
</div>
</div>
</div>

View File

@@ -54,7 +54,7 @@
<tfoot>
<tr>
<td></td>
<td><input type="text" ng-model="newCaption" localize="placeholder" placeholder="@relatedlinks_captionPlaceholder" val-highlight="hasError" /></td>
<td><input type="text" ng-model="newCaption" localize="placeholder" placeholder="@relatedlinks_captionPlaceholder" val-highlight="{{hasError}}" /></td>
<td>
<div ng-show="addExternal">
<input type="text" ng-model="newLink" localize="placeholder" placeholder="@relatedlinks_externalLinkPlaceholder" />