Only show umbraco.tv and our.umbraco.org content to admin users in the help drawer (#2513)

This commit is contained in:
Dave Woestenborghs
2018-07-25 16:01:33 +03:00
committed by Sebastiaan Janssen
parent fd2137ec8d
commit 2669a51fe1
2 changed files with 20 additions and 13 deletions

View File

@@ -43,15 +43,17 @@
setSectionName();
userService.getCurrentUser().then(function (user) {
vm.userType = user.userType;
vm.userLang = user.locale;
vm.hasAccessToSettings = _.contains(user.allowedSections, 'settings');
evts.push(eventsService.on("appState.treeState.changed", function (e, args) {
handleSectionChange();
}));
findHelp(vm.section, vm.tree, vm.usertype, vm.userLang);
findHelp(vm.section, vm.tree, vm.userType, vm.userLang);
});
@@ -76,17 +78,20 @@
vm.tree = $routeParams.tree;
setSectionName();
findHelp(vm.section, vm.tree, vm.usertype, vm.userLang);
findHelp(vm.section, vm.tree, vm.userType, vm.userLang);
}
});
}
function findHelp(section, tree, usertype, userLang) {
if (vm.hasAccessToSettings) {
helpService.getContextHelpForPage(section, tree).then(function (topics) {
vm.topics = topics;
});
}
helpService.getContextHelpForPage(section, tree).then(function (topics) {
vm.topics = topics;
});
var rq = {};
rq.section = vm.section;
@@ -108,10 +113,12 @@
rq.path = rq.section + "/" + $routeParams.tree + "/" + $routeParams.method;
}
helpService.findVideos(rq).then(function(videos){
vm.videos = videos;
});
if (vm.hasAccessToSettings) {
helpService.findVideos(rq).then(function (videos) {
vm.videos = videos;
});
}
}
function setSectionName() {

View File

@@ -80,7 +80,7 @@
</div>
<!-- Umbraco tv content -->
<div class="umb-help-section" data-element="help-videos">
<div class="umb-help-section" data-element="help-videos" ng-if="vm.hasAccessToSettings">
<h5 class="umb-help-section__title" ng-if="vm.videos.length > 0">Videos</h5>
<ul class="umb-help-list">
<li class="umb-help-list-item" ng-repeat="video in vm.videos track by $index">
@@ -94,7 +94,7 @@
</div>
<!-- Links -->
<div class="umb-help-section" data-element="help-links">
<div class="umb-help-section" data-element="help-links" ng-if="vm.hasAccessToSettings">
<a data-element="help-link-umbraco-tv" class="umb-help-badge" target="_blank" href="http://umbraco.tv?utm_source=core&utm_medium=help&utm_content=link&utm_campaign=tv">
<i class="umb-help-badge__icon icon-tv-old"></i>
<div class="umb-help-badge__title">Visit umbraco.tv</div>
@@ -128,4 +128,4 @@
</umb-drawer-footer>
</umb-drawer-view>
</umb-drawer-view>