mirror of
https://github.com/semaphoreui/semaphore.git
synced 2024-11-24 22:06:43 +01:00
feat(template): display hide/show hidden button only if hidden templates exists
This commit is contained in:
parent
345ff4d182
commit
eaf05e9c9e
@ -1,7 +1,7 @@
|
||||
h3 Task Templates
|
||||
button.btn.btn-success.btn-xs.pull-right(ng-click="add()" style="margin-left: 5px;") New Template
|
||||
button.btn.btn-default.btn-xs.pull-right(ng-if="allShown" ng-click="hideHidden()") Hide Hidden
|
||||
button.btn.btn-default.btn-xs.pull-right(ng-if="!allShown" ng-click="showAll()") Show Hidden
|
||||
button.btn.btn-default.btn-xs.pull-right(ng-if="allShown && hasHiddenTemplates()" ng-click="hideHidden()") Hide Hidden
|
||||
button.btn.btn-default.btn-xs.pull-right(ng-if="!allShown && hasHiddenTemplates()" ng-click="showAll()") Show Hidden
|
||||
|
||||
table.table.table-hover
|
||||
thead: tr
|
||||
|
@ -41,7 +41,7 @@ define(['controllers/projects/taskRunner'], function () {
|
||||
|
||||
function getHiddenTemplates() {
|
||||
try {
|
||||
return JSON.parse($window.localStorage.getItem('hidden-templates') || '[]')
|
||||
return JSON.parse($window.localStorage.getItem('hidden-templates') || '[]');
|
||||
} catch(e) {
|
||||
return [];
|
||||
}
|
||||
@ -51,10 +51,14 @@ define(['controllers/projects/taskRunner'], function () {
|
||||
$window.localStorage.setItem('hidden-templates', JSON.stringify(hiddenTemplates));
|
||||
}
|
||||
|
||||
function hasHiddenTemplates() {
|
||||
return getHiddenTemplates().length > 0;
|
||||
}
|
||||
|
||||
$scope.reload = function () {
|
||||
$http.get(Project.getURL() + '/templates?sort=alias&order=asc').success(function (templates) {
|
||||
var hiddenTemplates = getHiddenTemplates();
|
||||
for (var i in templates) {
|
||||
for (var i = 0; i < templates.length; i++) {
|
||||
var template = templates[i];
|
||||
if (hiddenTemplates.indexOf(template.id) !== -1) {
|
||||
template.hidden = true;
|
||||
|
Loading…
Reference in New Issue
Block a user