-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(pci): scroll top at object page init (#9667)
ref: DTRSD-94224 Signed-off-by: Quentin Pavy <[email protected]>
- Loading branch information
Showing
7 changed files
with
62 additions
and
5 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
8 changes: 8 additions & 0 deletions
8
packages/components/ng-ovh-utils/src/scroll/scroll-directive.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,8 @@ | ||
export default /* @ngInject */ function scrollTopDirective(ScrollService) { | ||
return { | ||
restrict: 'A', | ||
link() { | ||
ScrollService.scrollTop(); | ||
}, | ||
}; | ||
} |
36 changes: 36 additions & 0 deletions
36
packages/components/ng-ovh-utils/src/scroll/scroll-service.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,36 @@ | ||
/** | ||
* @type service | ||
* @name ovhServices:ScrollService | ||
* @description | ||
* Provide scroll methods | ||
* @example | ||
* # Usage | ||
* <code:js> | ||
* export default class PciStoragesContainersContainerController { | ||
* */ /* @ngInject */ /* | ||
* constructor(ScrollService) { | ||
* this.ScrollService = ScrollService | ||
* } | ||
* | ||
* $onInit() { | ||
* ScrollService.scrollTop(); | ||
* }; | ||
*}; | ||
* | ||
* </code> | ||
*/ | ||
export default /* @ngInject */ function scrollService( | ||
$document, | ||
$timeout, | ||
$anchorScroll, | ||
) { | ||
this.scrollTop = function scrollTop() { | ||
$document[0].body.style.setProperty('height', 'auto', 'important'); | ||
$document[0].body.style.setProperty('overflow', 'auto'); | ||
$anchorScroll(); | ||
$timeout(function() { | ||
$document[0].body.style.removeProperty('height'); | ||
$document[0].body.style.removeProperty('overflow'); | ||
}); | ||
}; | ||
} |
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,12 @@ | ||
import angular from 'angular'; | ||
import scrollService from './scroll-service'; | ||
import scrollTopDirective from './scroll-directive'; | ||
|
||
const moduleName = 'ua.scroll'; | ||
|
||
angular | ||
.module(moduleName, ['ui.router']) | ||
.service('ScrollService', scrollService) | ||
.directive('ovhScrollTop', scrollTopDirective); | ||
|
||
export default moduleName; |
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
2 changes: 1 addition & 1 deletion
2
...ges/manager/modules/pci/src/projects/project/storages/containers/container/container.html
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