Merge branch 'v8/dev' into temp8-4217-datatype-edits-updates-content-editor
This commit is contained in:
@@ -32,16 +32,27 @@ angular.module("umbraco.directives")
|
||||
restrict: 'E',
|
||||
scope:{
|
||||
key: '@',
|
||||
tokens: '='
|
||||
tokens: '=',
|
||||
watchTokens: '@'
|
||||
},
|
||||
replace: true,
|
||||
|
||||
link: function (scope, element, attrs) {
|
||||
var key = scope.key;
|
||||
var tokens = scope.tokens ? scope.tokens : null;
|
||||
localizationService.localize(key, tokens).then(function(value){
|
||||
element.html(value);
|
||||
scope.text = "";
|
||||
|
||||
// A render function to be able to update tokens as values update.
|
||||
function render() {
|
||||
element.html(localizationService.tokenReplace(scope.text, scope.tokens || null));
|
||||
}
|
||||
|
||||
localizationService.localize(key).then(function(value){
|
||||
scope.text = value;
|
||||
render();
|
||||
});
|
||||
if (scope.watchTokens === 'true') {
|
||||
scope.$watch("tokens", render, true);
|
||||
}
|
||||
}
|
||||
};
|
||||
})
|
||||
|
||||
@@ -62,8 +62,8 @@ function valPropertyMsg(serverValidationManager) {
|
||||
if (!watcher) {
|
||||
watcher = scope.$watch("currentProperty.value",
|
||||
function (newValue, oldValue) {
|
||||
|
||||
if (!newValue || angular.equals(newValue, oldValue)) {
|
||||
|
||||
if (angular.equals(newValue, oldValue)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -78,10 +78,12 @@ function valPropertyMsg(serverValidationManager) {
|
||||
// based on other errors. We'll also check if there's no other validation errors apart from valPropertyMsg, if valPropertyMsg
|
||||
// is the only one, then we'll clear.
|
||||
|
||||
if ((errCount === 1 && angular.isArray(formCtrl.$error.valPropertyMsg)) || (formCtrl.$invalid && angular.isArray(formCtrl.$error.valServer))) {
|
||||
if (errCount === 0 || (errCount === 1 && angular.isArray(formCtrl.$error.valPropertyMsg)) || (formCtrl.$invalid && angular.isArray(formCtrl.$error.valServer))) {
|
||||
scope.errorMsg = "";
|
||||
formCtrl.$setValidity('valPropertyMsg', true);
|
||||
stopWatch();
|
||||
} else if (showValidation && scope.errorMsg === "") {
|
||||
formCtrl.$setValidity('valPropertyMsg', false);
|
||||
scope.errorMsg = getErrorMsg();
|
||||
}
|
||||
}, true);
|
||||
}
|
||||
@@ -152,6 +154,7 @@ function valPropertyMsg(serverValidationManager) {
|
||||
showValidation = true;
|
||||
if (hasError && scope.errorMsg === "") {
|
||||
scope.errorMsg = getErrorMsg();
|
||||
startWatch();
|
||||
}
|
||||
else if (!hasError) {
|
||||
scope.errorMsg = "";
|
||||
|
||||
@@ -43,16 +43,11 @@ angular.module('umbraco.services')
|
||||
|
||||
var entry = dictionary[value];
|
||||
if (entry) {
|
||||
if (tokens) {
|
||||
for (var i = 0; i < tokens.length; i++) {
|
||||
entry = entry.replace("%" + i + "%", tokens[i]);
|
||||
}
|
||||
}
|
||||
return entry;
|
||||
return service.tokenReplace(entry, tokens);
|
||||
}
|
||||
return "[" + value + "]";
|
||||
}
|
||||
|
||||
|
||||
var service = {
|
||||
// array to hold the localized resource string entries
|
||||
dictionary: [],
|
||||
@@ -127,7 +122,29 @@ angular.module('umbraco.services')
|
||||
}
|
||||
return value;
|
||||
},
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name umbraco.services.localizationService#tokenReplace
|
||||
* @methodOf umbraco.services.localizationService
|
||||
*
|
||||
* @description
|
||||
* Helper to replace tokens
|
||||
* @param {String} value the text-string to manipulate
|
||||
* @param {Array} tekens An array of tokens values
|
||||
* @returns {String} Replaced test-string
|
||||
*/
|
||||
tokenReplace: function (text, tokens) {
|
||||
if (tokens) {
|
||||
for (var i = 0; i < tokens.length; i++) {
|
||||
text = text.replace("%" + i + "%", tokens[i]);
|
||||
}
|
||||
}
|
||||
return text;
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name umbraco.services.localizationService#localize
|
||||
@@ -146,8 +163,7 @@ angular.module('umbraco.services')
|
||||
*/
|
||||
localize: function (value, tokens) {
|
||||
return service.initLocalizedResources().then(function (dic) {
|
||||
var val = _lookup(value, tokens, dic);
|
||||
return val;
|
||||
return _lookup(value, tokens, dic);
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
@@ -85,17 +85,17 @@ angular.module('umbraco.services')
|
||||
nArray.push(item);
|
||||
|
||||
if(!item.sticky) {
|
||||
$timeout(function() {
|
||||
var found = _.find(nArray, function(i) {
|
||||
return i.id === item.id;
|
||||
});
|
||||
|
||||
if (found) {
|
||||
var index = nArray.indexOf(found);
|
||||
nArray.splice(index, 1);
|
||||
}
|
||||
|
||||
}, 7000);
|
||||
$timeout(
|
||||
function() {
|
||||
var found = _.find(nArray, function(i) {
|
||||
return i.id === item.id;
|
||||
});
|
||||
if (found) {
|
||||
var index = nArray.indexOf(found);
|
||||
nArray.splice(index, 1);
|
||||
}
|
||||
}
|
||||
, 10000);
|
||||
}
|
||||
|
||||
return item;
|
||||
|
||||
@@ -137,6 +137,7 @@
|
||||
@import "components/umb-iconpicker.less";
|
||||
@import "components/umb-insert-code-box.less";
|
||||
@import "components/umb-packages.less";
|
||||
@import "components/umb-logviewer.less";
|
||||
@import "components/umb-package-local-install.less";
|
||||
@import "components/umb-panel-group.less";
|
||||
@import "components/umb-lightbox.less";
|
||||
|
||||
@@ -22,7 +22,14 @@
|
||||
font-size: 14px;
|
||||
border: none;
|
||||
position: relative;
|
||||
margin-bottom: 0;
|
||||
border-radius: 10px;
|
||||
margin: 10px;
|
||||
|
||||
.close {
|
||||
top: 0;
|
||||
right: -6px;
|
||||
opacity: 0.4;
|
||||
}
|
||||
}
|
||||
|
||||
.umb-notifications__notification.-extra-padding {
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
/* PACKAGE DETAILS */
|
||||
|
||||
.umb-logviewer {
|
||||
display: flex;
|
||||
flex-flow: row wrap;
|
||||
}
|
||||
|
||||
@sidebarwidth: 350px; // Width of sidebar. Ugly hack because of old version of Less
|
||||
|
||||
.umb-logviewer__main-content {
|
||||
flex: 1 1 auto;
|
||||
margin-right: 20px;
|
||||
width: calc(~'100%' - ~'@{sidebarwidth}' - ~'20px'); // Make sure that the main content area doesn't gets affected by inline styling
|
||||
min-width: 500px;
|
||||
|
||||
.btn-link {
|
||||
text-align: left;
|
||||
}
|
||||
}
|
||||
|
||||
.umb-logviewer__sidebar {
|
||||
flex: 0 0 @sidebarwidth;
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
|
||||
.umb-logviewer {
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.umb-logviewer__main-content {
|
||||
flex: 1 1 auto;
|
||||
width: 100%;
|
||||
margin-bottom: 30px;
|
||||
margin-right: 0;
|
||||
}
|
||||
|
||||
.umb-logviewer__sidebar {
|
||||
flex: 1 1 auto;
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
@@ -52,7 +52,17 @@
|
||||
bottom: 0px;
|
||||
left: 0px;
|
||||
right: 0px;
|
||||
position: absolute;;
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
.--notInFront .umb-modalcolumn::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
left: 0;
|
||||
background: rgba(0,0,0,.4);
|
||||
}
|
||||
|
||||
/* re-align loader */
|
||||
|
||||
@@ -16,6 +16,75 @@
|
||||
border-left: 1px solid @gray-10;
|
||||
}
|
||||
|
||||
.date-wrapper__date .flatpickr-input > a {
|
||||
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-weight: 700;
|
||||
padding: 4px 15px;
|
||||
box-sizing: border-box;
|
||||
min-width: 200px;
|
||||
|
||||
color: @ui-action-discreet-type;
|
||||
border: 1px dashed @ui-action-discreet-border;
|
||||
border-radius: 3px;
|
||||
|
||||
&:hover, &:focus {
|
||||
text-decoration: none;
|
||||
color: @ui-action-discreet-type-hover;
|
||||
border-color: @ui-action-discreet-border-hover;
|
||||
|
||||
localize {
|
||||
text-decoration: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//----- VARIANTS SCHEDULED PUBLISH ------
|
||||
|
||||
.date-wrapper-mini {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
}
|
||||
|
||||
.date-wrapper-mini__date {
|
||||
display: flex;
|
||||
|
||||
margin-left: 5px;
|
||||
margin-top: 5px;
|
||||
margin-bottom: 10px;
|
||||
|
||||
&:first-of-type {
|
||||
margin-left: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.date-wrapper-mini__date .flatpickr-input > a {
|
||||
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-weight: 700;
|
||||
padding: 1px 15px;
|
||||
box-sizing: border-box;
|
||||
min-width: 180px;
|
||||
|
||||
color: @ui-action-discreet-type;
|
||||
border: 1px dashed @ui-action-discreet-border;
|
||||
border-radius: 3px;
|
||||
|
||||
&:hover, &:focus {
|
||||
text-decoration: none;
|
||||
color: @ui-action-discreet-type-hover;
|
||||
border-color: @ui-action-discreet-border-hover;
|
||||
|
||||
localize {
|
||||
text-decoration: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//------------------- HISTORY ------------------
|
||||
|
||||
.history {
|
||||
@@ -71,4 +140,4 @@
|
||||
.history-line {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -112,7 +112,7 @@
|
||||
@blueExtraDark: #1b264f;// added 2019
|
||||
@blueLight: #ADD8E6;
|
||||
@blueNight: #162335;// added 2019
|
||||
@orange: #f79c37;// updated 2019
|
||||
//@orange: #f79c37;// updated 2019
|
||||
@pink: #D93F4C;// #C3325F;// update 2019
|
||||
@pinkLight: #f5c1bc;// added 2019
|
||||
@pinkRedLight: #ff8a89;// added 2019
|
||||
@@ -199,6 +199,16 @@
|
||||
.turquoise{color: @turquoise;}
|
||||
.turquoise-d1{color: @turquoise-d1;}
|
||||
|
||||
.text-warning {
|
||||
color: @orange;
|
||||
}
|
||||
.text-error {
|
||||
color: @red;
|
||||
}
|
||||
.text-success {
|
||||
color: @green;
|
||||
}
|
||||
|
||||
|
||||
//icon colors for tree icons
|
||||
.color-red, .color-red i{color: @red-d1 !important;}
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
<div class="umb-rte">
|
||||
<div id="{{uniqueId}}"></div>
|
||||
<div class="umb-rte"
|
||||
id="{{uniqueId}}">
|
||||
</div>
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
{{vm.variants[0].releaseDateFormatted}}
|
||||
</button>
|
||||
|
||||
<a ng-hide="vm.variants[0].releaseDate" href="" class="bold" style="color: #00aea2; text-decoration: underline;">
|
||||
<a ng-hide="vm.variants[0].releaseDate" href="">
|
||||
<localize key="content_setDate">Set date</localize>
|
||||
</a>
|
||||
</div>
|
||||
@@ -59,7 +59,7 @@
|
||||
{{vm.variants[0].expireDateFormatted}}
|
||||
</button>
|
||||
|
||||
<a ng-hide="vm.variants[0].expireDate" href="" class="bold" style="color: #00aea2; text-decoration: underline;">
|
||||
<a ng-hide="vm.variants[0].expireDate" href="">
|
||||
<localize key="content_setDate">Set date</localize>
|
||||
</a>
|
||||
</div>
|
||||
@@ -84,8 +84,8 @@
|
||||
|
||||
<div class="umb-list umb-list--condensed">
|
||||
|
||||
<div class="umb-list-item" ng-repeat="variant in vm.variants | filter:vm.dirtyVariantFilter">
|
||||
<ng-form name="scheduleSelectorForm">
|
||||
<div class="umb-list-item" ng-repeat="variant in vm.variants">
|
||||
<ng-form name="scheduleSelectorForm" style="width:100%;">
|
||||
<div class="flex">
|
||||
|
||||
<umb-checkbox
|
||||
@@ -106,9 +106,9 @@
|
||||
</span>
|
||||
</label>
|
||||
|
||||
<div class="flex items-center" style="margin-top: 10px; margin-bottom: 10px;">
|
||||
<div class="date-wrapper-mini">
|
||||
<div class="date-wrapper-mini__date" ng-if="vm.dirtyVariantFilter(variant) && (variant.releaseDate || variant.save)">
|
||||
|
||||
<div class="flex items-center" ng-if="variant.releaseDate || variant.save">
|
||||
<div style="font-size: 13px; margin-right: 5px;">Publish:<em ng-show="!variant.save"> {{variant.releaseDateFormatted}}</em></div>
|
||||
|
||||
<div class="btn-group flex" style="font-size: 14px; margin-right: 10px;" ng-if="variant.save">
|
||||
@@ -123,7 +123,7 @@
|
||||
{{variant.releaseDateFormatted}}
|
||||
</button>
|
||||
|
||||
<a ng-hide="variant.releaseDate" href="" class="bold" style="color: #00aea2; text-decoration: underline;">
|
||||
<a ng-hide="variant.releaseDate" href="">
|
||||
<localize key="content_setDate">Set date</localize>
|
||||
</a>
|
||||
</div>
|
||||
@@ -134,7 +134,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex items-center" ng-if="variant.expireDate || variant.save">
|
||||
<div class="date-wrapper-mini__date" ng-if="variant.expireDate || variant.save">
|
||||
<div style="font-size: 13px; margin-right: 5px;">Unpublish:<em ng-show="!variant.save"> {{variant.expireDateFormatted}}</em></div>
|
||||
|
||||
<div class="btn-group flex" style="font-size: 14px;" ng-if="variant.save">
|
||||
@@ -149,7 +149,7 @@
|
||||
{{variant.expireDateFormatted}}
|
||||
</button>
|
||||
|
||||
<a ng-hide="variant.expireDate" href="" class="bold" style="color: #00aea2; text-decoration: underline;">
|
||||
<a ng-hide="variant.expireDate" href="">
|
||||
<localize key="content_setDate">Set date</localize>
|
||||
</a>
|
||||
</div>
|
||||
@@ -182,24 +182,6 @@
|
||||
<br />
|
||||
</div>
|
||||
|
||||
<div class="umb-list umb-list--condensed" ng-if="vm.hasPristineVariants">
|
||||
<div style="margin-bottom: 15px; font-weight: bold;">
|
||||
<p><localize key="content_publishedLanguages"></localize></p>
|
||||
</div>
|
||||
|
||||
<div class="umb-list-item" ng-repeat="variant in vm.variants | filter:vm.pristineVariantFilter track by variant.language.culture">
|
||||
<div>
|
||||
<div style="margin-bottom: 2px;">
|
||||
<span>{{ variant.language.name }}</span>
|
||||
</div>
|
||||
<div class="umb-permission__description">
|
||||
<umb-variant-state variant="variant"></umb-variant-state>
|
||||
<span ng-show="variant.language.isMandatory"> - <localize key="languages_mandatoryLanguage"></localize></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
@@ -13,7 +13,8 @@
|
||||
type="button"
|
||||
size="s"
|
||||
action="vm.disableUrlTracker($event)"
|
||||
label-key="redirectUrls_disableUrlTracker">
|
||||
label-key="redirectUrls_disableUrlTracker"
|
||||
button-style="white">
|
||||
</umb-button>
|
||||
|
||||
<umb-button
|
||||
@@ -22,7 +23,8 @@
|
||||
size="s"
|
||||
button-style="success"
|
||||
action="vm.enableUrlTracker()"
|
||||
label-key="redirectUrls_enableUrlTracker">
|
||||
label-key="redirectUrls_enableUrlTracker"
|
||||
button-style="success">
|
||||
</umb-button>
|
||||
|
||||
</umb-editor-sub-header-section>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<div data-element="editor-logs" ng-controller="Umbraco.Editors.LogViewer.OverviewController as vm" class="clearfix">
|
||||
<div data-element="editor-logs" ng-controller="Umbraco.Editors.LogViewer.OverviewController as vm" class="clearfix" id="logview">
|
||||
|
||||
<umb-editor-view footer="false">
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
</umb-box>
|
||||
</div>
|
||||
|
||||
<div class="umb-package-details" ng-show="!vm.loading && vm.canLoadLogs">
|
||||
<div class="umb-package-details__main-content">
|
||||
<div class="umb-logviewer" ng-show="!vm.loading && vm.canLoadLogs">
|
||||
<div class="umb-logviewer__main-content">
|
||||
<!-- Saved Searches -->
|
||||
<umb-box>
|
||||
<umb-box-header title="Saved Searches"></umb-box-header>
|
||||
@@ -68,7 +68,7 @@
|
||||
</umb-box>
|
||||
</div>
|
||||
|
||||
<div class="umb-package-details__sidebar">
|
||||
<div class="umb-logviewer__sidebar">
|
||||
<!-- No of Errors -->
|
||||
<umb-box ng-click="vm.searchLogQuery('Has(@Exception)')" style="cursor:pointer;">
|
||||
<umb-box-header title="Number of Errors"></umb-box-header>
|
||||
@@ -95,4 +95,4 @@
|
||||
</div>
|
||||
</umb-editor-container>
|
||||
</umb-editor-view>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
||||
<div ng-controller="Umbraco.PropertyEditors.GridController" class="umb-grid umb-property-editor clearfix" id="umb-grid">
|
||||
|
||||
<umb-editor-sub-header ng-if="showReorderButton()" style="background-color: white; border-color: white;">
|
||||
<umb-editor-sub-header ng-if="showReorderButton()" style="background-color: white;">
|
||||
|
||||
<umb-editor-sub-header-content-right>
|
||||
<umb-button
|
||||
@@ -187,10 +187,10 @@
|
||||
|
||||
<div class="umb-control-inner" ng-hide="sortMode">
|
||||
|
||||
<div class="umb-control-bar umb-control-handle">
|
||||
<div class="umb-control-bar umb-control-handle">
|
||||
|
||||
<div class="umb-control-title" ng-if="control.active">
|
||||
{{control.editor.name}}
|
||||
{{control.editor.name}}
|
||||
</div>
|
||||
|
||||
<div class="umb-tools" ng-if="control.active">
|
||||
@@ -199,25 +199,24 @@
|
||||
<i class="umb-control-tool-icon icon-settings" ng-click="editGridItemSettings(control, 'control')"></i>
|
||||
</div>
|
||||
|
||||
<div class="umb-control-tool">
|
||||
<i class="umb-control-tool-icon icon-trash" ng-click="togglePrompt(control)"></i>
|
||||
<umb-confirm-action
|
||||
ng-if="control.deletePrompt"
|
||||
direction="left"
|
||||
on-confirm="removeControl(area, $index)"
|
||||
on-cancel="hidePrompt(control)">
|
||||
</umb-confirm-action>
|
||||
</div>
|
||||
<div class="umb-control-tool">
|
||||
<i class="umb-control-tool-icon icon-trash" ng-click="togglePrompt(control)"></i>
|
||||
<umb-confirm-action ng-if="control.deletePrompt"
|
||||
direction="left"
|
||||
on-confirm="removeControl(area, $index)"
|
||||
on-cancel="hidePrompt(control)">
|
||||
</umb-confirm-action>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Redering the editor for specific control -->
|
||||
<div ng-if="control && control.$editorPath"
|
||||
<!-- Redering the editor for specific control -->
|
||||
<div ng-if="control && control.$editorPath"
|
||||
ng-include="control.$editorPath"
|
||||
class="umb-cell-{{control.editor.view}}">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -13,25 +13,11 @@ function textAreaController($scope) {
|
||||
$scope.model.maxlength = false;
|
||||
if ($scope.model.config && $scope.model.config.maxChars) {
|
||||
$scope.model.maxlength = true;
|
||||
if($scope.model.value == undefined) {
|
||||
$scope.model.count = ($scope.model.config.maxChars * 1);
|
||||
} else {
|
||||
$scope.model.count = ($scope.model.config.maxChars * 1) - $scope.model.value.length;
|
||||
}
|
||||
}
|
||||
|
||||
$scope.model.change = function() {
|
||||
if ($scope.model.config && $scope.model.config.maxChars) {
|
||||
if($scope.model.value == undefined) {
|
||||
$scope.model.count = ($scope.model.config.maxChars * 1);
|
||||
} else {
|
||||
$scope.model.count = ($scope.model.config.maxChars * 1) - $scope.model.value.length;
|
||||
}
|
||||
if($scope.model.count < 0) {
|
||||
$scope.model.value = $scope.model.value.substring(0, ($scope.model.config.maxChars * 1));
|
||||
$scope.model.count = 0;
|
||||
}
|
||||
}
|
||||
|
||||
$scope.model.change = function () {
|
||||
$scope.model.count = $scope.model.value.length;
|
||||
}
|
||||
$scope.model.change();
|
||||
}
|
||||
angular.module('umbraco').controller("Umbraco.PropertyEditors.textAreaController", textAreaController);
|
||||
angular.module('umbraco').controller("Umbraco.PropertyEditors.textAreaController", textAreaController);
|
||||
|
||||
@@ -7,9 +7,12 @@
|
||||
<span class="help-inline" ng-message="valServer">{{textareaFieldForm.textarea.errorMsg}}</span>
|
||||
</span>
|
||||
|
||||
<div class="help" ng-if="model.maxlength">
|
||||
<strong>{{model.count}}</strong>
|
||||
<localize key="textbox_characters_left">characters left</localize>
|
||||
<div class="help" ng-if="model.maxlength === true && model.count >= (model.config.maxChars*.8) && model.count <= model.config.maxChars">
|
||||
<localize key="textbox_characters_left" tokens="[model.config.maxChars - model.count]" watch-tokens="true">%0% characters left.</localize>
|
||||
</div>
|
||||
<div class="help text-error" ng-if="model.maxlength === true && model.count > model.config.maxChars">
|
||||
<localize key="textbox_characters_exceed" tokens="[model.config.maxChars, model.count - model.config.maxChars]" watch-tokens="true">Maximum %0% characters, <strong>%1%</strong> too many.</localize>
|
||||
</div>
|
||||
|
||||
</ng-form>
|
||||
</div>
|
||||
|
||||
@@ -4,39 +4,18 @@ function textboxController($scope) {
|
||||
if (!$scope.model.config) {
|
||||
$scope.model.config = {};
|
||||
}
|
||||
|
||||
$scope.model.maxlength = false;
|
||||
if ($scope.model.config && $scope.model.config.maxChars) {
|
||||
$scope.model.maxlength = true;
|
||||
}
|
||||
|
||||
|
||||
if (!$scope.model.config.maxChars) {
|
||||
// 500 is the maximum number that can be stored
|
||||
// in the database, so set it to the max, even
|
||||
// if no max is specified in the config
|
||||
$scope.model.config.maxChars = 500;
|
||||
}
|
||||
|
||||
if ($scope.model.maxlength) {
|
||||
if ($scope.model.value === undefined) {
|
||||
$scope.model.count = ($scope.model.config.maxChars * 1);
|
||||
} else {
|
||||
$scope.model.count = ($scope.model.config.maxChars * 1) - $scope.model.value.length;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$scope.model.change = function () {
|
||||
if ($scope.model.config && $scope.model.config.maxChars) {
|
||||
if ($scope.model.value === undefined) {
|
||||
$scope.model.count = ($scope.model.config.maxChars * 1);
|
||||
} else {
|
||||
$scope.model.count = ($scope.model.config.maxChars * 1) - $scope.model.value.length;
|
||||
}
|
||||
if ($scope.model.count < 0) {
|
||||
$scope.model.value = $scope.model.value.substring(0, ($scope.model.config.maxChars * 1));
|
||||
$scope.model.count = 0;
|
||||
}
|
||||
}
|
||||
$scope.model.count = $scope.model.value.length;
|
||||
}
|
||||
$scope.model.change();
|
||||
|
||||
}
|
||||
angular.module('umbraco').controller("Umbraco.PropertyEditors.textboxController", textboxController);
|
||||
|
||||
@@ -12,9 +12,12 @@
|
||||
<span class="help-inline" ng-message="required"><localize key="general_required">Required</localize></span>
|
||||
</span>
|
||||
|
||||
<div class="help" ng-if="model.maxlength">
|
||||
<strong>{{model.count}}</strong>
|
||||
<localize key="textbox_characters_left">characters left</localize>
|
||||
<div class="help" ng-if="model.count >= (model.config.maxChars*.8) && model.count <= model.config.maxChars">
|
||||
<localize key="textbox_characters_left" tokens="[model.config.maxChars - model.count]" watch-tokens="true">%0% characters left.</localize>
|
||||
</div>
|
||||
<div class="help text-error" ng-if="model.count > model.config.maxChars">
|
||||
<localize key="textbox_characters_exceed" tokens="[model.config.maxChars, model.count - model.config.maxChars]" watch-tokens="true">Maximum %0% characters, <strong>%1%</strong> too many.</localize>
|
||||
</div>
|
||||
|
||||
</ng-form>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user