vhx-quartz 0.8.8 → 0.8.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 352f2db7a0b6506e9e1b61c2ed333d0f999448b3
4
- data.tar.gz: ae7112fcb19fff9c7ea7c04929432e1cd3524b9f
3
+ metadata.gz: a4ba10b678c4d1b23884e57f8aeb41893f28f347
4
+ data.tar.gz: 007f6ae189b20586d7354a9ce52dd1eb704ab407
5
5
  SHA512:
6
- metadata.gz: 3fa8c3a4d24f870741185e66cd12e71d2776efc19e4e1e43e4860993e231d1d0f41acaaaa218eb0423037069b75941b8a3359b010d7833aaaece31b0b1e6ea06
7
- data.tar.gz: ac5872b12ccbb4e8f79a4b95ed49e8874c1de696bb41492bd24364011f15f7d077652669a9b4612584761dd8d08e15970131444278cc63208b0380120b6a3833
6
+ metadata.gz: 05217f729618fead1c7d192431eeb578bb0f1312cc7e1d4e6b6d952cdf61eaecde2cc0cd6a59ff932d3be4498a646303ce36cf71ec4357d824000b0b19848316
7
+ data.tar.gz: 3bf97c3c27b8901af8bd13b4e88cd4026f95cdc649b14723d1208aff578694409847d999de7a0d2f08aa8be489d2a23a075654449d0b104065322b0fb88cb7ea
@@ -1,5 +1,5 @@
1
1
  module Vhx
2
2
  module Quartz
3
- VERSION = "0.8.8"
3
+ VERSION = "0.8.9"
4
4
  end
5
5
  end
@@ -0,0 +1,60 @@
1
+ 'use strict';
2
+
3
+ vhxm.components.shared.load_more.controller = function (opts) {
4
+ var self = this;
5
+
6
+ self.state = new vhxm.components.shared.load_more.state();
7
+ self.action = opts.action ? opts.action : function () {};
8
+
9
+ self.loadMore = function () {
10
+ self.state.is_loading(true);
11
+ self.action(function () {
12
+ self.state.is_loading(false);
13
+ });
14
+ };
15
+
16
+ self.isElementInViewport = function (el, isInit, ctx) {
17
+ if (!isInit) {
18
+ var rect = el.getBoundingClientRect();
19
+ window.addEventListener('scroll', function () {
20
+ if (el.getBoundingClientRect().top < window.innerHeight && el.getBoundingClientRect().top > 0 && !self.state.in_view()) {
21
+ m.startComputation();
22
+ self.state.is_loading(true);
23
+ m.endComputation();
24
+ self.loadMore();
25
+ self.state.in_view(true);
26
+ return true;
27
+ } else if (el.getBoundingClientRect().bottom < 0 && self.state.in_view()) {
28
+ self.state.in_view(false);
29
+ return false;
30
+ } else if (el.getBoundingClientRect().top > window.innerHeight && self.state.in_view()) {
31
+ self.state.in_view(false);
32
+ return false;
33
+ }
34
+ });
35
+ }
36
+ };
37
+ };
38
+
39
+ vhxm.components.shared.load_more.state = function () {
40
+ this.in_view = m.prop(false);
41
+ this.is_loading = m.prop(false);
42
+ };
43
+
44
+ vhxm.components.shared.load_more.ui.container = {
45
+ controller: function controller(opts) {
46
+ return new vhxm.components.shared.load_more.controller(opts);
47
+ },
48
+ view: function view(ctrl, opts) {
49
+ var self = this;
50
+ return m('a.btn-white' + (ctrl.state.is_loading() ? '.is-loading' : ''), {
51
+ config: opts.onscroll ? ctrl.isElementInViewport : '',
52
+ onclick: !opts.onscroll ? function (e) {
53
+ e.preventDefault();
54
+ ctrl.loadMore();
55
+ } : '',
56
+ href: '#'
57
+ }, opts.label ? opts.label : 'Show More');
58
+ }
59
+
60
+ };
@@ -28,6 +28,12 @@ if (typeof vhxm !== 'undefined') {
28
28
  },
29
29
  header: {
30
30
  ui: {}
31
+ },
32
+ load_more: {
33
+ ui: {}
34
+ },
35
+ sidebar: {
36
+ ui: {}
31
37
  }
32
38
  };
33
39
  }
@@ -0,0 +1,81 @@
1
+ 'use strict';
2
+
3
+ vhxm.components.shared.sidebar.controller = function () {
4
+ var self = this;
5
+
6
+ self.animatorIn = function (elem, isInit) {
7
+ // if (!isInit) {
8
+ if (vhxm.components.shared.sidebar.state.isOpen()) {
9
+ $(elem).velocity({
10
+ right: 0
11
+ }, {
12
+ duration: 500,
13
+ easing: [0.19, 1, 0.22, 1],
14
+ complete: function complete() {
15
+ if (vhxm.components.shared.sidebar.state.animate_in_cb) {
16
+ vhxm.components.shared.sidebar.state.onAnimateIn();
17
+ }
18
+ }
19
+ });
20
+ }
21
+ // }
22
+ };
23
+
24
+ self.animatorOut = function (elem, isInit) {
25
+ if (!isInit) {
26
+ elem.onclick = function (ev) {
27
+ ev.preventDefault();
28
+ vhxm.components.shared.sidebar.state.isOpen(false);
29
+
30
+ $('.c-sidebar').velocity({
31
+ right: '-470'
32
+ }, {
33
+ duration: 500,
34
+ easing: [0.19, 1, 0.22, 1],
35
+ complete: function complete() {
36
+ if (vhxm.components.shared.sidebar.state.animate_out_cb) {
37
+ vhxm.components.shared.sidebar.state.onAnimateOut();
38
+ }
39
+ }
40
+ });
41
+ };
42
+ }
43
+ };
44
+ };
45
+
46
+ vhxm.components.shared.sidebar.toggleSidebar = function (state, route) {
47
+ state = state === 'open' ? true : false;
48
+
49
+ vhxm.components.shared.sidebar.state.isOpen(state);
50
+ route ? m.route(route) : m.redraw();
51
+ };
52
+
53
+ vhxm.components.shared.sidebar.setTemplate = function (template) {
54
+ vhxm.components.shared.sidebar.state.template(template);
55
+ m.redraw();
56
+ };
57
+
58
+ vhxm.components.shared.sidebar.setModel = function (model) {
59
+ vhxm.components.shared.sidebar.state.model(model);
60
+ m.redraw();
61
+ };
62
+
63
+ vhxm.components.shared.sidebar.state = {
64
+ isOpen: m.prop(false),
65
+ skipTransition: m.prop(false),
66
+ model: m.prop(null),
67
+ template: m.prop(null),
68
+ onAnimateOut: m.prop(null),
69
+ onAnimateIn: m.prop(null)
70
+ };
71
+
72
+ vhxm.components.shared.sidebar.ui.container = {
73
+ controller: vhxm.components.shared.sidebar.controller,
74
+ view: function view(ctrl) {
75
+ if (!vhxm.components.shared.sidebar.state.model()) {
76
+ return m('.c-sidebar.bg-white.shadow--gray.background-white.loader-slate.loader--cover-hide.loader--large.is-loading', { config: ctrl.animatorIn });
77
+ } else {
78
+ return m('.c-sidebar.bg-gray-1.shadow--gray', { config: ctrl.animatorIn }, [m('a.c-sidebar--close.icon-circle.icon-x-navy.icon--xsmall', { config: ctrl.animatorOut }), vhxm.components.shared.sidebar.state.template()]);
79
+ }
80
+ }
81
+ };
@@ -0,0 +1,16 @@
1
+ .c-sidebar {
2
+ overflow: auto;
3
+ position: fixed;
4
+ width: 462px;
5
+ top: 0;
6
+ z-index: 21474838;
7
+ bottom: 0;
8
+ right: -470px;
9
+ height: 100%; }
10
+
11
+ .c-sidebar--close {
12
+ position: absolute;
13
+ top: 10px;
14
+ right: 15px;
15
+ z-index: 10;
16
+ background-size: 10px !important; }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vhx-quartz
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.8
4
+ version: 0.8.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Scott Robertson, Courtney Burton, Steven Bone, David Gonzalez
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-15 00:00:00.000000000 Z
11
+ date: 2016-07-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -95,10 +95,12 @@ files:
95
95
  - vendor/assets/javascripts/vhx-quartz.checkbox.js
96
96
  - vendor/assets/javascripts/vhx-quartz.filter.js
97
97
  - vendor/assets/javascripts/vhx-quartz.header.js
98
+ - vendor/assets/javascripts/vhx-quartz.load_more.js
98
99
  - vendor/assets/javascripts/vhx-quartz.radio.js
99
100
  - vendor/assets/javascripts/vhx-quartz.scope.js
100
101
  - vendor/assets/javascripts/vhx-quartz.search_input.js
101
102
  - vendor/assets/javascripts/vhx-quartz.select.js
103
+ - vendor/assets/javascripts/vhx-quartz.sidebar.js
102
104
  - vendor/assets/stylesheets/vhx-quartz.autosuggest.css
103
105
  - vendor/assets/stylesheets/vhx-quartz.checkbox.css
104
106
  - vendor/assets/stylesheets/vhx-quartz.css
@@ -264,6 +266,7 @@ files:
264
266
  - vendor/assets/stylesheets/vhx-quartz.radio.css
265
267
  - vendor/assets/stylesheets/vhx-quartz.search_input.css
266
268
  - vendor/assets/stylesheets/vhx-quartz.select.css
269
+ - vendor/assets/stylesheets/vhx-quartz.sidebar.css
267
270
  homepage: http://github.com/vhx/quartz-rails
268
271
  licenses:
269
272
  - MIT
@@ -284,7 +287,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
284
287
  version: '0'
285
288
  requirements: []
286
289
  rubyforge_project:
287
- rubygems_version: 2.4.5
290
+ rubygems_version: 2.6.1
288
291
  signing_key:
289
292
  specification_version: 4
290
293
  summary: VHX Styleguide - Quartz