active_frontend 15.0.3 → 15.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f96ce44f987d58f4e41dece727c0fe8eaf5a4857
4
- data.tar.gz: 6c76cd3139bdd77ecf3564d626bbc6504701b3fa
3
+ metadata.gz: 748cb998fb711985e57ab9a9a2922c866c8a0cf8
4
+ data.tar.gz: 2c7699b0a10ade9ac7cf728bc7c5c399df3a28a3
5
5
  SHA512:
6
- metadata.gz: 4d11dcfb7be68b476552978d935f35a7ce0cf653adea9493eecba9af95ec120ee1c59a1955a8d6a863044dd5a423dc3a7b5b19fdb104b2fb5be772dc089d8300
7
- data.tar.gz: 64e4569fab29d605da61ae2e74d791ce11244698e087696c048f31307167c177b189a35c13cbfb0892aa393e04d346d0d991ee3444851929345f5adc89ab927e
6
+ metadata.gz: a35a7b297e2840b7fc5bdbc9c089ec5a6f3c1d89e5f1f883fe9b9dc3d9dd84471d4840a1a9e6fe9ec2b61e5d5b97c52951862d495721f545148b5a1be133841c
7
+ data.tar.gz: 6f8f234ce680578c1257aa2dc4b9f07473bf49fc2f57217d85249af66db865e953765f3066cd4829da8498b163ec3e053fbeea09f4cefb7fc68a2ce8900f85a2
data/.rubocop.yml CHANGED
@@ -4,6 +4,8 @@ AllCops:
4
4
  TargetRubyVersion: 2.4
5
5
  Exclude:
6
6
  - 'spec/**/**/*'
7
+ Gemspec/OrderedDependencies:
8
+ Enabled: false
7
9
  Layout/EmptyLinesAroundClassBody:
8
10
  Enabled: false
9
11
  Layout/EmptyLinesAroundModuleBody:
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ActiveFrontend
4
- VERSION ||= '15.0.3'
4
+ VERSION ||= '15.0.4'
5
5
  end
@@ -48,4 +48,5 @@
48
48
  //= require extensions/_map
49
49
  //= require extensions/_push
50
50
  //= require extensions/_wysiwyg
51
+ //= require extensions/_xpull
51
52
  //
@@ -60,6 +60,7 @@
60
60
  @import 'components/calendar';
61
61
  @import 'components/map';
62
62
  @import 'components/wysiwyg';
63
+ @import 'components/xpull';
63
64
  @import 'components/cohort';
64
65
  @import 'components/chart';
65
66
  @import 'blocks/common';
@@ -48,4 +48,5 @@
48
48
  //= require extensions/_map
49
49
  //= require extensions/_push
50
50
  //= require extensions/_wysiwyg
51
+ //= require extensions/_xpull
51
52
  //
@@ -0,0 +1,201 @@
1
+ ;(function ($, window, document) {
2
+ var pluginName = 'xpull';
3
+ var defaults = {
4
+ paused: false,
5
+ pullThreshold: 50,
6
+ maxPullThreshold: 50,
7
+ spinnerTimeout: 0,
8
+ scrollingDom: null,
9
+ onPullStartCallback: function () {},
10
+ onPullEndCallback: function () {},
11
+ onPullRefreshCallback: function () {
12
+ window.location.reload();
13
+ }
14
+ };
15
+
16
+ function Plugin (element, options) {
17
+ this.element = element;
18
+ this.options = $.extend({}, defaults, options);
19
+ this._defaults = defaults;
20
+ this._name = pluginName;
21
+ this.init();
22
+ }
23
+
24
+ Plugin.prototype = {
25
+ init: function() {
26
+ var that = this;
27
+ var ofstop = 0;
28
+ var fingerOffset = 0;
29
+ var top = 0;
30
+ var hasc = false;
31
+ var elm = {};
32
+
33
+ that.$element = $(that.element);
34
+ that.elm = elm = that.$element.children(':not(.xpull)');
35
+ that.indicator = that.$element.find('.xpull:eq(0)');
36
+ that.indicator.css({ display: 'block' });
37
+ that.spinner = that.indicator.find('.xpull-spinner:eq(0)');
38
+ that.startBlock = that.indicator.find('.xpull-content:eq(0)');
39
+ that.indicatorHeight = that.indicator.outerHeight();
40
+
41
+ that.changeStyle(-that.indicatorHeight, true);
42
+ that.$element.css({
43
+ '-webkit-overflow-scrolling': 'touch',
44
+ 'overflow-scrolling': 'touch'
45
+ });
46
+
47
+ ofstop = that.$element.offset().top;
48
+
49
+ that.elast = true;
50
+ that.startBlock.css('visibility', 'hidden');
51
+ that.indicatorHidden = true;
52
+
53
+ elm.unbind('touchstart.' + pluginName);
54
+ elm.on('touchstart.' + pluginName, function (ev) {
55
+ if (that.options.paused) return false;
56
+
57
+ that.options.onPullStartCallback.call(this);
58
+ fingerOffset = ev.originalEvent.touches[0].pageY - ofstop;
59
+ });
60
+
61
+ elm.unbind('touchmove.' + pluginName);
62
+ elm.on('touchmove.' + pluginName, function (ev) {
63
+ if (that.options.paused) return false;
64
+
65
+ if (elm.position().top < 0 ||
66
+ (that.options.scrollingDom || that.$element).scrollTop() > 0 ||
67
+ document.body.scrollTop > 0) return true;
68
+
69
+ if (that.indicatorHidden) {
70
+ that.startBlock.css('visibility', 'visible');
71
+ that.indicatorHidden = false;
72
+ }
73
+
74
+ top = (ev.originalEvent.touches[0].pageY - ofstop - fingerOffset);
75
+
76
+ if (top > 1) {
77
+ if (that.elast) {
78
+ $(document.body).on('touchmove.' + pluginName, function (e) {
79
+ e.preventDefault();
80
+ });
81
+
82
+ that.elast = false;
83
+ }
84
+
85
+ if (top <= (parseInt(that.options.pullThreshold) + that.options.maxPullThreshold)) {
86
+ that.changeStyle((top - that.indicatorHeight), false);
87
+ }
88
+
89
+ if (top > that.options.pullThreshold && !hasc) {
90
+ that.indicator.addClass('xpull-pulled');
91
+ } else if (top <= that.options.pullThreshold && hasc) {
92
+ that.indicator.removeClass('xpull-pulled');
93
+ }
94
+ } else {
95
+ $(document.body).unbind('touchmove.' + pluginName);
96
+ that.elast = true;
97
+ }
98
+
99
+ hasc = that.indicator.hasClass('xpull-pulled');
100
+ });
101
+
102
+ elm.unbind('touchend.' + pluginName);
103
+ elm.on('touchend.' + pluginName, function () {
104
+ if (that.options.paused) return false;
105
+
106
+ that.options.onPullEndCallback.call(this);
107
+
108
+ if (top > 0) {
109
+ if (top > that.options.pullThreshold) {
110
+ that.startBlock.hide();
111
+ that.spinner.show();
112
+
113
+ setTimeout(function () {
114
+ that.options.onPullRefreshCallback.call(this);
115
+ }, 300);
116
+
117
+ that.options.paused = true;
118
+
119
+ that.changeStyle(0, true);
120
+
121
+ if (that.options.spinnerTimeout) {
122
+ setTimeout(function () {
123
+ that.reset();
124
+ }, that.options.spinnerTimeout);
125
+ }
126
+ } else {
127
+ that.changeStyle(-that.indicatorHeight, true);
128
+ }
129
+
130
+ top = 0;
131
+ }
132
+
133
+ if (!that.indicatorHidden) {
134
+ that.startBlock.css('visibility', 'hidden');
135
+ that.indicatorHidden = true;
136
+ }
137
+
138
+ setTimeout(function() {
139
+ elm.css({ 'transition': '' });
140
+ that.indicator.css({ 'transition': '' });
141
+ $(document.body).unbind('touchmove.' + pluginName);
142
+ that.elast = true;
143
+ }, 300);
144
+ });
145
+ },
146
+ changeStyle: function (top, transition) {
147
+ var changeCss = {
148
+ transform: 'translate3d(0px, ' + top + 'px, 0px)',
149
+ transition: 'transform 0.3s ease-in-out'
150
+ };
151
+
152
+ if (!transition) {
153
+ changeCss.transition = '';
154
+ }
155
+
156
+ this.indicator.css(changeCss);
157
+ this.elm.css(changeCss);
158
+ },
159
+ reset: function() {
160
+ var that = this;
161
+
162
+ that.changeStyle(-that.indicatorHeight, true);
163
+
164
+ setTimeout(function() {
165
+ that.startBlock.show();
166
+ that.spinner.hide();
167
+ that.options.paused = false;
168
+ that.indicator.removeClass('xpull-pulled');
169
+
170
+ that.changeStyle(-that.indicatorHeight, false);
171
+ $(document.body).unbind('touchmove.' + pluginName);
172
+ that.elast = true;
173
+ }, 300);
174
+ },
175
+ destroy: function () {
176
+ var that = this;
177
+ var elm = that.elm;
178
+
179
+ that.changeStyle(0);
180
+ that.indicator.css({ display: 'none' });
181
+
182
+ elm.off('touchstart.' + pluginName);
183
+ elm.off('touchmove.' + pluginName);
184
+ elm.off('touchend.' + pluginName);
185
+ $(document.body).off('touchmove.' + pluginName);
186
+
187
+ that.$element.removeData('plugin_' + pluginName);
188
+ }
189
+ };
190
+
191
+ $.fn[pluginName] = function(options) {
192
+ return this.each(function() {
193
+ var pName = 'plugin_' + pluginName;
194
+
195
+ if (!$.data(this, pName)) {
196
+ $.data(this, pName, new Plugin(this, options));
197
+ }
198
+ });
199
+ };
200
+
201
+ })(jQuery, window, document);
@@ -60,6 +60,7 @@
60
60
  @import 'components/calendar';
61
61
  @import 'components/map';
62
62
  @import 'components/wysiwyg';
63
+ @import 'components/xpull';
63
64
  @import 'components/cohort';
64
65
  @import 'components/chart';
65
66
  @import 'blocks/common';
@@ -130,8 +130,8 @@
130
130
  }
131
131
  @media only screen and (max-width: 767px) {
132
132
  .header {
133
- height: 50px;
134
- padding: 10px 0;
133
+ height: 54px;
134
+ padding: 12px 0;
135
135
  }
136
136
  .header-brand {
137
137
  font-size: 26px;
@@ -61,10 +61,10 @@
61
61
  .layout-body,
62
62
  .layout-sidebar {
63
63
  &.with-sticky-header {
64
- height: calc(100% - 50px);
65
- margin-top: 50px;
64
+ height: calc(100% - 54px);
65
+ margin-top: 54px;
66
66
 
67
- &.with-sticky-navbar { height: calc(100% - 100px); }
67
+ &.with-sticky-navbar { height: calc(100% - 108px); }
68
68
  }
69
69
  }
70
70
  .layout-sidebar {
@@ -13,7 +13,7 @@
13
13
  border-top: 1px solid color(dark-haze);
14
14
  box-sizing: border-box;
15
15
  display: table;
16
- height: 50px;
16
+ height: 54px;
17
17
  line-height: 1;
18
18
  table-layout: fixed;
19
19
  width: 100%;
@@ -0,0 +1,49 @@
1
+ // Table of Contents
2
+ // ==================================================
3
+ // Xpull
4
+
5
+ // Xpull
6
+ // ==================================================
7
+ .xpull {
8
+ color: color(gray);
9
+ display: none;
10
+ font-size: text-size(s);
11
+ height: 40px;
12
+ margin: 0 auto;
13
+ position: relative;
14
+ text-align: center;
15
+ transform: translate3d(0, 0, 0) rotate(0deg);
16
+ }
17
+ .xpull-pulled {
18
+ .xpull-arrow {
19
+ top: 5px;
20
+ transform: rotate(180deg);
21
+ }
22
+ }
23
+ .xpull-arrow {
24
+ @include transition(transform 0.3s ease-in-out);
25
+ background: color(gray);
26
+ border-top-left-radius: border-radius(b);
27
+ border-top-right-radius: border-radius(b);
28
+ height: 10px;
29
+ margin: 5px auto;
30
+ position: relative;
31
+ width: 4px;
32
+
33
+ &::after {
34
+ border-top: 6px solid color(gray);
35
+ border-left: 5px solid transparent;
36
+ border-right: 5px solid transparent;
37
+ content: '';
38
+ height: 0;
39
+ left: -3px;
40
+ position: absolute;
41
+ top: 100%;
42
+ width: 0;
43
+ }
44
+ }
45
+ .xpull-spinner {
46
+ display: none;
47
+ font-size: text-size(xl);
48
+ padding: 20px;
49
+ }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_frontend
3
3
  version: !ruby/object:Gem::Version
4
- version: 15.0.3
4
+ version: 15.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Juan Gomez
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-10-17 00:00:00.000000000 Z
11
+ date: 2017-10-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -498,6 +498,7 @@ files:
498
498
  - vendor/assets/javascripts/extensions/_map.js
499
499
  - vendor/assets/javascripts/extensions/_push.js
500
500
  - vendor/assets/javascripts/extensions/_wysiwyg.js
501
+ - vendor/assets/javascripts/extensions/_xpull.js
501
502
  - vendor/assets/stylesheets/.DS_Store
502
503
  - vendor/assets/stylesheets/.keep
503
504
  - vendor/assets/stylesheets/_utility.scss
@@ -557,6 +558,7 @@ files:
557
558
  - vendor/assets/stylesheets/components/_transition.scss
558
559
  - vendor/assets/stylesheets/components/_typeahead.scss
559
560
  - vendor/assets/stylesheets/components/_wysiwyg.scss
561
+ - vendor/assets/stylesheets/components/_xpull.scss
560
562
  homepage: https://github.com/drexed/active_frontend
561
563
  licenses:
562
564
  - MIT