-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added new cache level data type option
Sometimes it can be useful to control the cache level, so now there is an option for it.
- Loading branch information
1 parent
2932458
commit b6989ca
Showing
7 changed files
with
134 additions
and
7 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
37 changes: 37 additions & 0 deletions
37
src/Limbo.Umbraco.YouTube/wwwroot/Scripts/Controllers/CacheLevel.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,37 @@ | ||
angular.module("umbraco").controller("Limbo.Umbraco.YouTube.CacheLevel", function ($scope, $http, editorService) { | ||
|
||
const vm = this; | ||
|
||
vm.levels = [ | ||
{ alias: "Element", name: "Element", description: "Indicates that the property value can be cached at the element level, i.e. it can be cached until the element itself is modified." }, | ||
{ alias: "Elements", name: "Elements", description: "Indicates that the property value can be cached at the elements level, i.e. it can be cached until any element is modified." }, | ||
{ alias: "Snapshot", name: "Snapshot", description: "Indicates that the property value can be cached at the snapshot level, i.e. it can be cached for the duration of the current snapshot.", remarks: "In most cases, a snapshot is created per request, and therefore this is equivalent to cache the value for the duration of the request." }, | ||
{ alias: "None", name: "None", description: "Indicates that the property value cannot be cached and has to be converted each time it is requested." } | ||
]; | ||
|
||
vm.defaultLevel = vm.levels[1]; | ||
|
||
vm.selected = vm.defaultLevel; | ||
|
||
if ($scope.model.value) { | ||
vm.selected = vm.levels.find(x => x.alias === $scope.model.value) ?? vm.selected; | ||
vm.levels.forEach(function (l) { | ||
l.active = l.alias === vm.selected.alias; | ||
}); | ||
} else { | ||
vm.selected.active = true; | ||
} | ||
|
||
vm.select = function (level) { | ||
|
||
vm.selected = level; | ||
|
||
$scope.model.value = level.alias; | ||
|
||
vm.levels.forEach(function (l) { | ||
l.active = l.alias === level.alias; | ||
}); | ||
|
||
} | ||
|
||
}); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<div class="youtube-video" ng-controller="Limbo.Umbraco.YouTube.CacheLevel as vm"> | ||
<div class="button-list"> | ||
<button type="button" | ||
ng-repeat="level in vm.levels" | ||
ng-class="{'--active': level.active}" | ||
ng-click="vm.select(level)" | ||
title="{{level.description}}"> | ||
{{level.name}} | ||
</button> | ||
</div> | ||
</div> |