Skip to content

Creating new panels

Raitis Berzins edited this page May 11, 2020 · 20 revisions

inject 'hs.layout.service' in app.js controller as layoutService and 'hs.sidebar.service' as sidebarService Optionally inject also 'gettext' module if you want the button to be translated

Expose panelVisible function:

$scope.panelVisible = layoutService.panelVisible;
$scope.$on("scope_loaded", function (event, args) {`
            `if (args == 'Sidebar') {`
                `var el = angular.element('<div hs.weather.directive hs.draggable ng-controller="hs.weather.controller" ng-if="Core.exists(\'hs.weather.controller\')" ng-show="panelVisible(\'weather\', this)"></div>')[0];`
                `layoutService.panelListElement.appendChild(el);`
                `$compile(el)($scope);`
            `}`
        `})

Add new button to the sidebar:

sidebarService.buttons.push({ panel: 'weather', module: 'hs.weather', order: 10, title: gettext('Weather watcher'), description: gettext('Get weather satellite crossings'), icon: 'icon-time' })
Clone this wiki locally