fix (app): pages didn't return to the top after changing tabs

Close#56
pull/95/head
tibing 2016-06-24 15:01:13 +03:00
parent dda370e61b
commit 349bf9fcf1
9 changed files with 22 additions and 8 deletions

View File

@ -19,7 +19,7 @@
.state('charts', {
url: '/charts',
abstract: true,
template: '<div ui-view></div>',
template: '<div ui-view autoscroll="true" autoscroll-body-top></div>',
title: 'Charts',
sidebarMeta: {
icon: 'ion-stats-bars',

View File

@ -17,7 +17,7 @@
$stateProvider
.state('components', {
url: '/components',
template : '<ui-view></ui-view>',
template : '<ui-view autoscroll="true" autoscroll-body-top></ui-view>',
abstract: true,
title: 'Components',
sidebarMeta: {

View File

@ -13,7 +13,7 @@
$stateProvider
.state('form', {
url: '/form',
template : '<ui-view></ui-view>',
template : '<ui-view autoscroll="true" autoscroll-body-top></ui-view>',
abstract: true,
title: 'Form Elements',
sidebarMeta: {

View File

@ -1,7 +1,7 @@
<div class="widgets">
<div class="row">
<div class="col-md-12" ui-view></div>
<div class="col-md-12" ui-view autoscroll="true" autoscroll-body-top></div>
</div>
</div>

View File

@ -13,7 +13,7 @@
$stateProvider
.state('tables', {
url: '/tables',
template : '<ui-view></ui-view>',
template : '<ui-view autoscroll="true" autoscroll-body-top></ui-view>',
abstract: true,
controller: 'TablesPageCtrl',
title: 'Tables',

View File

@ -25,7 +25,7 @@
$stateProvider
.state('ui', {
url: '/ui',
template : '<ui-view></ui-view>',
template : '<ui-view autoscroll="true" autoscroll-body-top></ui-view>',
abstract: true,
title: 'UI Features',
sidebarMeta: {

View File

@ -27,6 +27,11 @@
var g = parseInt( hex.slice(3,5), 16 );
var b = parseInt( hex.slice(5,7), 16 );
return 'rgba(' + r + ', ' + g + ', ' + b + ', ' + alpha + ')';
};
this.hasAttr = function (elem, attrName) {
var attr = $(elem).attr(attrName);
return (typeof attr !== typeof undefined && attr !== false);
}
}
})();

View File

@ -9,7 +9,16 @@
.config(config);
/** @ngInject */
function config(baConfigProvider, colorHelper) {
function config(baConfigProvider, colorHelper, $provide) {
$provide.decorator('$uiViewScroll', function ($delegate, $anchorScroll, baUtil) {
return function (uiViewElement) {
if (baUtil.hasAttr(uiViewElement, "autoscroll-body-top")) {
$anchorScroll();
} else {
$delegate(uiViewElement);
}
};
});
//baConfigProvider.changeTheme({blur: true});
//
//baConfigProvider.changeColors({

View File

@ -34,7 +34,7 @@
<div class="al-main">
<div class="al-content">
<content-top></content-top>
<div ui-view></div>
<div ui-view autoscroll="true" autoscroll-body-top></div>
</div>
</div>