Skip to content

Commit c2ed7bd

Browse files
committed
display count of placeholder items in multiple items setting in new task page
1 parent 89ec302 commit c2ed7bd

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

src/scripts/directives/setting.js

+13-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
link: function (scope, element, attrs, ngModel) {
1818
var pendingSaveRequest = null;
1919
var options = {
20+
showPlaceholderCount: false,
2021
deleteKeyAlwaysChangeValue: false,
2122
lazySaveTimeout: ariaNgConstants.lazySaveTimeout,
2223
errorTooltipPlacement: 'top',
@@ -85,7 +86,7 @@
8586
};
8687

8788
var getTotalCount = function (itemsText, separator, trim) {
88-
if (!itemsText || !angular.isString(itemsText)) {
89+
if (!itemsText || !separator || !angular.isString(itemsText)) {
8990
return 0;
9091
}
9192

@@ -180,6 +181,10 @@
180181
var fixedValueCount = getTotalCount(scope.fixedValue, scope.option.separator, scope.option.trimCount);
181182
var inputValueCount = getTotalCount(scope.optionValue, scope.option.separator, scope.option.trimCount);
182183

184+
if (!scope.optionValue && scope.showPlaceholderCount && scope.placeholderItemCount) {
185+
inputValueCount = scope.placeholderItemCount;
186+
}
187+
183188
return fixedValueCount + inputValueCount;
184189
};
185190

@@ -313,8 +318,15 @@
313318
}
314319

315320
scope.placeholder = getHumanReadableValue(displayValue);
321+
322+
if (scope.option) {
323+
scope.placeholderItemCount = getTotalCount(scope.placeholder, scope.option.separator, scope.option.trimCount);
324+
} else {
325+
scope.placeholderItemCount = 0;
326+
}
316327
});
317328

329+
scope.showPlaceholderCount = options.showPlaceholderCount === true || options.showPlaceholderCount === 'true';
318330
loadHistory();
319331
}
320332
};

src/views/new.html

+2-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,8 @@
8383
</div>
8484
</div>
8585
<ng-setting ng-repeat="option in context.availableOptions" ng-if="context.optionFilter[option.category]"
86-
option="option" lazy-save-timeout="0" delete-key-always-change-value="true"
86+
option="option" show-placeholder-count="true"
87+
lazy-save-timeout="0" delete-key-always-change-value="true"
8788
default-value="(option.overrideMode !== 'append' && !context.options[option.key] && context.options[option.key] !== '') ? context.globalOptions[option.key] : ''"
8889
fixed-value="option.overrideMode === 'append' ? context.globalOptions[option.key] : ''"
8990
on-change-value="setOption(key, value, optionStatus)"></ng-setting>

src/views/setting.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<em ng-bind="'(' + option.key + ')'"></em>
55
<i class="icon-primary fa fa-question-circle" ng-if="(option.descriptionKey | translate) !== ''"
66
data-toggle="popover" data-trigger="hover" data-placement="auto top" data-container="body" data-content="{{option.descriptionKey | translate}}"></i>
7-
<span class="description" ng-if="option.showCount && option.separator && (optionValue || fixedValue)"
7+
<span class="description" ng-if="option.showCount && option.separator && (optionValue || fixedValue || (placeholder && showPlaceholderCount))"
88
ng-bind="'format.settings.total-count' | translate: {count: getTotalCount()}"></span>
99
<i class="icon-primary fa fa-info-circle" ng-if="(option.since && option.since !== '')" ng-tooltip="{{('format.requires.aria2-version' | translate: {version: option.since})}}" ng-tooltip-container="body" ng-tooltip-placement="right"></i>
1010
</div>

0 commit comments

Comments
 (0)