feat(templates): automatically scroll up to the app template form after selecting a template

pull/384/head^2
Paul Kling 2016-12-13 14:25:23 -06:00 committed by Anthony Lapenna
parent 99d49a1f87
commit 8869a2c79c
2 changed files with 4 additions and 4 deletions

View File

@ -6,8 +6,7 @@
</rd-header-title>
<rd-header-content>Templates</rd-header-content>
</rd-header>
<div class="row" ng-if="state.selectedTemplate">
<div id="selectedTemplate" class="row" ng-if="state.selectedTemplate">
<div class="col-lg-12 col-md-12 col-xs-12">
<rd-widget>
<rd-widget-custom-header icon="state.selectedTemplate.logo" title="state.selectedTemplate.image">

View File

@ -1,6 +1,6 @@
angular.module('templates', [])
.controller('TemplatesController', ['$scope', '$q', '$state', '$filter', 'Config', 'Info', 'Container', 'ContainerHelper', 'Image', 'Volume', 'Network', 'Templates', 'TemplateHelper', 'Messages', 'Settings',
function ($scope, $q, $state, $filter, Config, Info, Container, ContainerHelper, Image, Volume, Network, Templates, TemplateHelper, Messages, Settings) {
.controller('TemplatesController', ['$scope', '$q', '$state', '$filter', '$anchorScroll', 'Config', 'Info', 'Container', 'ContainerHelper', 'Image', 'Volume', 'Network', 'Templates', 'TemplateHelper', 'Messages', 'Settings',
function ($scope, $q, $state, $filter, $anchorScroll, Config, Info, Container, ContainerHelper, Image, Volume, Network, Templates, TemplateHelper, Messages, Settings) {
$scope.state = {
selectedTemplate: null,
showAdvancedOptions: false
@ -179,6 +179,7 @@ function ($scope, $q, $state, $filter, Config, Info, Container, ContainerHelper,
var selectedTemplate = $scope.templates[id];
$scope.state.selectedTemplate = selectedTemplate;
$scope.formValues.ports = selectedTemplate.ports ? TemplateHelper.getPortBindings(selectedTemplate.ports) : [];
$anchorScroll('selectedTemplate');
}
};