-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Starting on robots on content level * Finish up the robot setting on content level
- Loading branch information
1 parent
bbe8607
commit 0e43367
Showing
9 changed files
with
99 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 74 additions & 0 deletions
74
...ot/MetaFields/Interface/SeoFieldEditors/PropertyEditor/noSelectCheckboxList.controller.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
(function () { | ||
function noSelectCheckboxListController($scope) { | ||
var vm = this; | ||
|
||
const noneValue = 'none'; | ||
|
||
vm.items = []; | ||
|
||
vm.change = change; | ||
|
||
function change(model, value) { | ||
var index = $scope.model.value.indexOf(value); | ||
if (model === true) { | ||
|
||
if (value === noneValue) { | ||
$scope.model.value = []; | ||
vm.items.forEach(item => { | ||
if (item.value !== noneValue) { | ||
item.checked = false; | ||
} | ||
}); | ||
} else { | ||
if ($scope.model.value.includes(noneValue)) { | ||
var noneIndex = $scope.model.value.indexOf(noneValue); | ||
if (noneIndex !== -1) { | ||
$scope.model.value.splice(noneIndex, 1); | ||
} | ||
|
||
var item = vm.items.find(item => item.value === noneValue); | ||
if (item) { | ||
item.checked = false; | ||
} | ||
} | ||
} | ||
|
||
//if it doesn't exist in the model, then add it | ||
if (index < 0) { | ||
$scope.model.value.push(value); | ||
} | ||
} else { | ||
//if it exists in the model, then remove it | ||
if (index >= 0) { | ||
$scope.model.value.splice(index, 1); | ||
} | ||
} | ||
} | ||
|
||
function init() { | ||
if (!Array.isArray($scope.model.value)) { | ||
$scope.model.value = []; | ||
} | ||
|
||
$scope.model.config.prevalues.forEach(function (prevalue) { | ||
var newItem = { ...prevalue }; | ||
if ($scope.model.value.find(item => item === newItem.value)) { | ||
newItem.checked = true; | ||
} | ||
|
||
vm.items.push(newItem); | ||
}); | ||
|
||
var noneItem = { | ||
value: noneValue, | ||
label: 'None', | ||
checked: $scope.model.value.find(item => item === noneValue) != null | ||
}; | ||
vm.items.push(noneItem); | ||
} | ||
|
||
init(); | ||
} | ||
|
||
angular.module("umbraco").controller("SeoToolkit.SeoFieldEditors.NoSelectCheckboxList", noSelectCheckboxListController); | ||
})(); |
8 changes: 8 additions & 0 deletions
8
...lds/wwwroot/MetaFields/Interface/SeoFieldEditors/PropertyEditor/noSelectCheckboxList.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<div ng-controller="SeoToolkit.SeoFieldEditors.NoSelectCheckboxList as vm"> | ||
<umb-checkbox value="{{item.value}}" | ||
model="item.checked" | ||
text="{{item.label}}" | ||
ng-repeat="item in vm.items track by item.value" | ||
on-change="vm.change(model, value)"> | ||
</umb-checkbox> | ||
</div> |