From 176750046a4232941f071bc8cc4ef3caccf163f3 Mon Sep 17 00:00:00 2001 From: Joan Sanchez Date: Thu, 5 Sep 2019 13:06:40 +0200 Subject: [PATCH] Scroll component #643 --- front/core/components/index.js | 2 +- .../core/components/scroll-up/scroll-up.html | 5 +++ front/core/components/scroll-up/scroll-up.js | 35 +++++++++++++++++++ front/core/components/scroll-up/style.scss | 6 ++++ front/core/locale/es.yml | 3 +- front/salix/styles/misc.scss | 4 +-- modules/agency/front/index/index.html | 3 +- modules/claim/front/index/index.html | 3 +- modules/client/front/index/index.html | 3 +- modules/invoiceOut/front/index/index.html | 1 + modules/item/front/diary/index.html | 4 ++- modules/item/front/index/index.html | 3 +- modules/order/front/index/index.html | 3 +- modules/route/front/index/index.html | 3 +- modules/ticket/front/index/index.html | 3 +- modules/travel/front/index/index.html | 3 +- modules/worker/front/index/index.html | 3 +- 17 files changed, 73 insertions(+), 14 deletions(-) create mode 100644 front/core/components/scroll-up/scroll-up.html create mode 100644 front/core/components/scroll-up/scroll-up.js create mode 100644 front/core/components/scroll-up/style.scss diff --git a/front/core/components/index.js b/front/core/components/index.js index 09ee97963..9064c9c5e 100644 --- a/front/core/components/index.js +++ b/front/core/components/index.js @@ -45,4 +45,4 @@ import './input-file'; import './treeview'; import './treeview/child'; import './calendar'; - +import './scroll-up/scroll-up'; diff --git a/front/core/components/scroll-up/scroll-up.html b/front/core/components/scroll-up/scroll-up.html new file mode 100644 index 000000000..3f3b309d5 --- /dev/null +++ b/front/core/components/scroll-up/scroll-up.html @@ -0,0 +1,5 @@ + \ No newline at end of file diff --git a/front/core/components/scroll-up/scroll-up.js b/front/core/components/scroll-up/scroll-up.js new file mode 100644 index 000000000..aab03847a --- /dev/null +++ b/front/core/components/scroll-up/scroll-up.js @@ -0,0 +1,35 @@ +import ngModule from '../../module'; +import Component from '../../lib/component'; +import './style.scss'; + +export default class Controller extends Component { + constructor($element, $scope, $window) { + super($element, $scope); + this.$window = $window; + + $window.addEventListener('scroll', () => { + console.log($element[0]); + if ($window.scrollY > 0) + $element[0].style.display = 'block'; + else + $element[0].style.display = 'none'; + }); + } + + goUp() { + this.$window.scrollTo(0, 0); + } +} + +Controller.$inject = ['$element', '$scope', '$window']; + +ngModule.component('vnScrollUp', { + template: require('./scroll-up.html'), + controller: Controller, + bindings: { + field: '=?', + options: ' - \ No newline at end of file + + \ No newline at end of file diff --git a/modules/claim/front/index/index.html b/modules/claim/front/index/index.html index 4d15eaba5..caeb756de 100644 --- a/modules/claim/front/index/index.html +++ b/modules/claim/front/index/index.html @@ -75,4 +75,5 @@ - \ No newline at end of file + + \ No newline at end of file diff --git a/modules/client/front/index/index.html b/modules/client/front/index/index.html index 8873e10ae..d4bbcd198 100644 --- a/modules/client/front/index/index.html +++ b/modules/client/front/index/index.html @@ -66,4 +66,5 @@ - \ No newline at end of file + + \ No newline at end of file diff --git a/modules/invoiceOut/front/index/index.html b/modules/invoiceOut/front/index/index.html index 8a7db4f25..744b52fad 100644 --- a/modules/invoiceOut/front/index/index.html +++ b/modules/invoiceOut/front/index/index.html @@ -78,3 +78,4 @@ + \ No newline at end of file diff --git a/modules/item/front/diary/index.html b/modules/item/front/diary/index.html index 33e92db40..c7ef2acdf 100644 --- a/modules/item/front/diary/index.html +++ b/modules/item/front/diary/index.html @@ -81,4 +81,6 @@ - \ No newline at end of file + + + \ No newline at end of file diff --git a/modules/item/front/index/index.html b/modules/item/front/index/index.html index cee442c64..40d816bb5 100644 --- a/modules/item/front/index/index.html +++ b/modules/item/front/index/index.html @@ -145,4 +145,5 @@ - \ No newline at end of file + + \ No newline at end of file diff --git a/modules/order/front/index/index.html b/modules/order/front/index/index.html index 141e98000..62094941e 100644 --- a/modules/order/front/index/index.html +++ b/modules/order/front/index/index.html @@ -90,4 +90,5 @@ - \ No newline at end of file + + \ No newline at end of file diff --git a/modules/route/front/index/index.html b/modules/route/front/index/index.html index 15c75a85c..969c5f380 100644 --- a/modules/route/front/index/index.html +++ b/modules/route/front/index/index.html @@ -74,4 +74,5 @@ - \ No newline at end of file + + \ No newline at end of file diff --git a/modules/ticket/front/index/index.html b/modules/ticket/front/index/index.html index b5eb250cd..5d05bd7c5 100644 --- a/modules/ticket/front/index/index.html +++ b/modules/ticket/front/index/index.html @@ -160,4 +160,5 @@ - \ No newline at end of file + + \ No newline at end of file diff --git a/modules/travel/front/index/index.html b/modules/travel/front/index/index.html index 9b5d4c829..c7f2a6d6e 100644 --- a/modules/travel/front/index/index.html +++ b/modules/travel/front/index/index.html @@ -51,4 +51,5 @@ - \ No newline at end of file + + \ No newline at end of file diff --git a/modules/worker/front/index/index.html b/modules/worker/front/index/index.html index 70c3b806f..3c254e7f7 100644 --- a/modules/worker/front/index/index.html +++ b/modules/worker/front/index/index.html @@ -72,4 +72,5 @@ - \ No newline at end of file + + \ No newline at end of file