pushpop-rails 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (31) hide show
  1. data/README.md +42 -0
  2. data/Rakefile +29 -0
  3. data/lib/generators/pushpop/install/install_generator.rb +17 -0
  4. data/lib/pushpop-rails.rb +4 -0
  5. data/lib/pushpop/rails.rb +8 -0
  6. data/lib/pushpop/rails/engine.rb +7 -0
  7. data/lib/pushpop/rails/version.rb +5 -0
  8. data/vendor/assets/Pushpop/background.png +0 -0
  9. data/vendor/assets/Pushpop/background@2x.png +0 -0
  10. data/vendor/assets/Pushpop/externals/scrollkit/background.png +0 -0
  11. data/vendor/assets/Pushpop/externals/scrollkit/scrollkit.css +202 -0
  12. data/vendor/assets/Pushpop/externals/scrollkit/scrollkit.js +924 -0
  13. data/vendor/assets/Pushpop/font/pushpop-glyphs-webfont.eot +0 -0
  14. data/vendor/assets/Pushpop/font/pushpop-glyphs-webfont.svg +57 -0
  15. data/vendor/assets/Pushpop/font/pushpop-glyphs-webfont.ttf +0 -0
  16. data/vendor/assets/Pushpop/font/pushpop-glyphs-webfont.woff +0 -0
  17. data/vendor/assets/Pushpop/pushpop-modal-view-stack/pushpop-modal-view-stack.css +148 -0
  18. data/vendor/assets/Pushpop/pushpop-modal-view-stack/pushpop-modal-view-stack.js +306 -0
  19. data/vendor/assets/Pushpop/pushpop-popover-view-stack/pushpop-popover-view-stack.css +170 -0
  20. data/vendor/assets/Pushpop/pushpop-popover-view-stack/pushpop-popover-view-stack.js +278 -0
  21. data/vendor/assets/Pushpop/pushpop-split-view/pushpop-split-view.css +38 -0
  22. data/vendor/assets/Pushpop/pushpop-split-view/pushpop-split-view.js +33 -0
  23. data/vendor/assets/Pushpop/pushpop-tab-view/pushpop-tab-view.css +130 -0
  24. data/vendor/assets/Pushpop/pushpop-tab-view/pushpop-tab-view.js +298 -0
  25. data/vendor/assets/Pushpop/pushpop-table-view/pushpop-table-view.css +1273 -0
  26. data/vendor/assets/Pushpop/pushpop-table-view/pushpop-table-view.js +2275 -0
  27. data/vendor/assets/Pushpop/pushpop.css +2243 -0
  28. data/vendor/assets/Pushpop/pushpop.js +1554 -0
  29. data/vendor/assets/javascripts/pushpop_rails.js +7 -0
  30. data/vendor/assets/stylesheets/pushpop_rails.css +9 -0
  31. metadata +92 -0
@@ -0,0 +1,33 @@
1
+ ;'use strict';
2
+
3
+ // The base Pushpop object.
4
+ var Pushpop = window['Pushpop'] || {};
5
+
6
+ /**
7
+ Creates a new SplitView.
8
+ @param {HTMLDivElement} element The DIV element to initialize as a new SplitView.
9
+ @constructor
10
+ @extends Pushpop.View
11
+ */
12
+ Pushpop.SplitView = function SplitView(element) {
13
+
14
+ // Call the "super" constructor.
15
+ Pushpop.View.prototype.constructor.apply(this, arguments);
16
+
17
+ this.$element.addClass('pp-view');
18
+
19
+ // TODO: Implement responsive design and auto-collapse the split view into a
20
+ // single view stack on a mobile phone.
21
+ };
22
+
23
+ // Create the prototype for the Pushpop.SplitView as a "sub-class" of Pushpop.View.
24
+ Pushpop.SplitView.prototype = new Pushpop.View();
25
+ Pushpop.SplitView.prototype.constructor = Pushpop.SplitView;
26
+
27
+ Pushpop.SplitView.prototype.getMasterViewStack = function() {
28
+ return this.$element.children('.pp-split-view-stack-master')[0].viewStack;
29
+ };
30
+
31
+ Pushpop.SplitView.prototype.getDetailViewStack = function() {
32
+ return this.$element.children('.pp-split-view-stack-detail')[0].viewStack;
33
+ };
@@ -0,0 +1,130 @@
1
+ .pp-tab-view > .pp-view-stack {
2
+ bottom: 49px;
3
+ display: none;
4
+ -webkit-perspective: none;
5
+ -moz-perspective: none;
6
+ -ms-perspective: none;
7
+ -o-perspective: none;
8
+ perspective: none;
9
+ }
10
+
11
+ .pp-tab-view > .pp-view-stack.pp-active {
12
+ display: block;
13
+ }
14
+
15
+ .pp-tab-bar {
16
+ background: #000; /* Old browsers */
17
+ background: -moz-linear-gradient(top, #636363 0%, #202020 48%, #000 49%, #000 100%); /* FF3.6+ */
18
+ background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#636363), color-stop(48%,#202020), color-stop(49%,#000), color-stop(100%,#000)); /* Chrome,Safari4+ */
19
+ background: -webkit-linear-gradient(top, #636363 0%,#202020 48%,#000 49%,#000 100%); /* Chrome10+,Safari5.1+ */
20
+ background: -o-linear-gradient(top, #636363 0%,#202020 48%,#000 49%,#000 100%); /* Opera 11.10+ */
21
+ background: -ms-linear-gradient(top, #636363 0%,#202020 48%,#000 49%,#000 100%); /* IE10+ */
22
+ background: linear-gradient(top, #636363 0%,#202020 48%,#000 49%,#000 100%); /* W3C */
23
+ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#636363', endColorstr='#000',GradientType=0 ); /* IE6-9 */
24
+ font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
25
+ font-size: 1em;
26
+ border-top: 1px solid rgba(255, 255, 255, 0.15);
27
+ border-bottom: 1px solid #000;
28
+ position: absolute;
29
+ right: 0;
30
+ bottom: 0;
31
+ left: 0;
32
+ padding: 2px;
33
+ width: auto;
34
+ height: 43px;
35
+ -webkit-box-shadow: inset 0 1px 0 0 rgba(255, 255, 255, 0.3);
36
+ -moz-box-shadow: inset 0 1px 0 0 rgba(255, 255, 255, 0.3);
37
+ box-shadow: inset 0 1px 0 0 rgba(255, 255, 255, 0.3);
38
+ -webkit-user-select: none;
39
+ -moz-user-select: none;
40
+ -ms-user-select: none;
41
+ -o-user-select: none;
42
+ user-select: none;
43
+ -webkit-backface-visibility: hidden;
44
+ -moz-backface-visibility: hidden;
45
+ -ms-backface-visibility: hidden;
46
+ -o-backface-visibility: hidden;
47
+ backface-visibility: hidden;
48
+ -webkit-transform: translate3d(0, 0, 0);
49
+ -moz-transform: translate(0, 0);
50
+ -ms-transform: translate(0, 0);
51
+ -o-transform: translate(0, 0);
52
+ transform: translate(0, 0);
53
+ }
54
+
55
+ .pp-tab-bar-button {
56
+ cursor: pointer;
57
+ display: inline-block;
58
+ height: 44px;
59
+ text-align: center;
60
+ text-decoration: none;
61
+ -webkit-border-radius: 3px;
62
+ -moz-border-radius: 3px;
63
+ border-radius: 3px;
64
+ }
65
+
66
+ .pp-tab-bar-button:hover {
67
+ text-decoration: none;
68
+ }
69
+
70
+ .pp-tab-bar-button:first-child:nth-last-child(1) {
71
+ width: 100%;
72
+ }
73
+
74
+ .pp-tab-bar-button:first-child:nth-last-child(2),
75
+ .pp-tab-bar-button:first-child:nth-last-child(2) ~ .pp-tab-bar-button {
76
+ width: 50%;
77
+ }
78
+
79
+ .pp-tab-bar-button:first-child:nth-last-child(3),
80
+ .pp-tab-bar-button:first-child:nth-last-child(3) ~ .pp-tab-bar-button {
81
+ width: 33.33333%;
82
+ }
83
+
84
+ .pp-tab-bar-button:first-child:nth-last-child(4),
85
+ .pp-tab-bar-button:first-child:nth-last-child(4) ~ .pp-tab-bar-button {
86
+ width: 25%;
87
+ }
88
+
89
+ .pp-tab-bar-button:first-child:nth-last-child(5),
90
+ .pp-tab-bar-button:first-child:nth-last-child(5) ~ .pp-tab-bar-button {
91
+ width: 20%;
92
+ }
93
+
94
+ .pp-tab-bar-button.pp-active {
95
+ background: rgba(255, 255, 255, 0.15);
96
+ }
97
+
98
+ .pp-tab-bar-button-icon {
99
+ color: #888;
100
+ font-size: 26px;
101
+ display: block !important;
102
+ }
103
+
104
+ .pp-tab-bar-button-icon::before {
105
+ background: none;
106
+ background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(161,161,161,1)), color-stop(100%,rgba(95,95,95,1))); /* Chrome,Safari4+ */
107
+ background: -webkit-linear-gradient(top, rgba(161,161,161,1) 0%,rgba(95,95,95,1) 100%); /* Chrome10+,Safari5.1+ */
108
+ color: #808080;
109
+ -webkit-text-fill-color: transparent;
110
+ -webkit-background-clip: text;
111
+ }
112
+
113
+ .pp-active > .pp-tab-bar-button-icon::before {
114
+ background: none;
115
+ background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(209,225,248,1)), color-stop(50%,rgba(126,183,236,1)), color-stop(51%,rgba(39,138,242,1)), color-stop(100%,rgba(59,191,248,1))); /* Chrome,Safari4+ */
116
+ background: -webkit-linear-gradient(top, rgba(209,225,248,1) 0%,rgba(126,183,236,1) 50%,rgba(39,138,242,1) 51%,rgba(59,191,248,1) 100%); /* Chrome10+,Safari5.1+ */
117
+ color: #3bbff8;
118
+ -webkit-text-fill-color: transparent;
119
+ -webkit-background-clip: text;
120
+ }
121
+
122
+ .pp-tab-bar-button-title {
123
+ color: #999;
124
+ font-size: 10px;
125
+ font-weight: bold;
126
+ }
127
+
128
+ .pp-active > .pp-tab-bar-button-title {
129
+ color: #fff;
130
+ }
@@ -0,0 +1,298 @@
1
+ ;'use strict';
2
+
3
+ // The base Pushpop object.
4
+ var Pushpop = window['Pushpop'] || {};
5
+
6
+ /**
7
+ Creates a new TabView.
8
+ @param {HTMLDivElement} element The DIV element to initialize as a new TabView.
9
+ @constructor
10
+ @extends Pushpop.View
11
+ */
12
+ Pushpop.TabView = function TabView(element) {
13
+
14
+ // Call the "super" constructor.
15
+ Pushpop.View.prototype.constructor.apply(this, arguments);
16
+
17
+ var $element = this.$element.addClass('pp-view');
18
+
19
+ // Initialize the tab bar.
20
+ var tabBar = this._tabBar = new Pushpop.TabBar(this);
21
+
22
+ // Initialize the tab view stacks.
23
+ var tabViewStacks = this._tabViewStacks = [], viewStacks = [];
24
+ $element.children('.pp-view-stack').each(function(index, element) {
25
+ viewStacks.push(new Pushpop.ViewStack(element));
26
+ });
27
+
28
+ this.setTabViewStacks(viewStacks);
29
+
30
+ // Set the initial selected index.
31
+ if (tabViewStacks.length > 0) this.setSelectedIndex(0);
32
+ };
33
+
34
+ /**
35
+ Event types for Pushpop.TabView.
36
+ */
37
+ Pushpop.TabView.EventType = {
38
+ DidSelectTabViewStack: 'Pushpop:TabView:DidSelectTabViewStack'
39
+ };
40
+
41
+ // Create the prototype for the Pushpop.TabView as a "sub-class" of Pushpop.View.
42
+ Pushpop.TabView.prototype = new Pushpop.View();
43
+ Pushpop.TabView.prototype.constructor = Pushpop.TabView;
44
+
45
+ Pushpop.TabView.prototype._tabBar = null;
46
+
47
+ /**
48
+
49
+ */
50
+ Pushpop.TabView.prototype.getTabBar = function() { return this._tabBar; };
51
+
52
+ Pushpop.TabView.prototype._tabViewStacks = null; // []
53
+
54
+ /**
55
+
56
+ */
57
+ Pushpop.TabView.prototype.getTabViewStacks = function() { return this._tabViewStacks; };
58
+
59
+ /**
60
+
61
+ */
62
+ Pushpop.TabView.prototype.setTabViewStacks = function(tabViewStacks) {
63
+ var _tabViewStacks = this._tabViewStacks;
64
+ _tabViewStacks.length = 0;
65
+
66
+ var tabBarButtons = [];
67
+
68
+ for (var i = 0, length = tabViewStacks.length, tabViewStack; i < length; i++) {
69
+ _tabViewStacks.push(tabViewStack = tabViewStacks[i]);
70
+ tabBarButtons.push(new Pushpop.TabBarButton(tabViewStack));
71
+ }
72
+
73
+ this.getTabBar().setTabBarButtons(tabBarButtons);
74
+ };
75
+
76
+ Pushpop.TabView.prototype._selectedIndex = -1;
77
+
78
+ /**
79
+
80
+ */
81
+ Pushpop.TabView.prototype.getSelectedIndex = function() { return this._selectedIndex; };
82
+
83
+ /**
84
+
85
+ */
86
+ Pushpop.TabView.prototype.setSelectedIndex = function(selectedIndex) {
87
+ var tabViewStacks = this.getTabViewStacks();
88
+ if (selectedIndex === this._selectedIndex || selectedIndex < 0 || selectedIndex >= tabViewStacks.length) return;
89
+
90
+ var previousSelectedTabViewStack = this._selectedTabViewStack;
91
+ var selectedTabViewStack = this._selectedTabViewStack = tabViewStacks[this._selectedIndex = selectedIndex];
92
+
93
+ if (previousSelectedTabViewStack) previousSelectedTabViewStack.$element.removeClass('pp-active');
94
+ selectedTabViewStack.$element.addClass('pp-active');
95
+
96
+ var activeViewInSelectedTab = selectedTabViewStack.getActiveView();
97
+ if (activeViewInSelectedTab) activeViewInSelectedTab.forceReflow();
98
+
99
+ var activeScrollViewInSelectedTab = (activeViewInSelectedTab) ? activeViewInSelectedTab.getScrollView() : null;
100
+ if (activeScrollViewInSelectedTab) activeScrollViewInSelectedTab.recalculateDimensions();
101
+
102
+ this.$element.trigger($.Event(Pushpop.TabView.EventType.DidSelectTabViewStack, {
103
+ previousSelectedTabViewStack: previousSelectedTabViewStack,
104
+ selectedTabViewStack: selectedTabViewStack
105
+ }));
106
+ };
107
+
108
+ Pushpop.TabView.prototype._selectedTabViewStack = null;
109
+
110
+ /**
111
+
112
+ */
113
+ Pushpop.TabView.prototype.getSelectedTabViewStack = function() { return this._selectedTabViewStack; };
114
+
115
+ /**
116
+
117
+ */
118
+ Pushpop.TabView.prototype.setSelectedTabViewStack = function(selectedTabViewStack) {
119
+ var tabViewStacks = this.getTabViewStacks();
120
+ var previousSelectedTabViewStack = this._selectedTabViewStack;
121
+ if (!selectedTabViewStack || selectedTabViewStack === previousSelectedTabViewStack) return;
122
+
123
+ for (var i = 0, length = tabViewStacks.length; i < length; i++) {
124
+ if (selectedTabViewStack === tabViewStacks[i]) {
125
+ this._selectedTabViewStack = selectedTabViewStack;
126
+ this._selectedIndex = i;
127
+ break;
128
+ }
129
+ }
130
+
131
+ if (previousSelectedTabViewStack) previousSelectedTabViewStack.$element.removeClass('pp-active');
132
+ selectedTabViewStack.$element.addClass('pp-active');
133
+
134
+ var activeViewInSelectedTab = selectedTabViewStack.getActiveView();
135
+ if (activeViewInSelectedTab) activeViewInSelectedTab.forceReflow();
136
+
137
+ var activeScrollViewInSelectedTab = (activeViewInSelectedTab) ? activeViewInSelectedTab.getScrollView() : null;
138
+ if (activeScrollViewInSelectedTab) activeScrollViewInSelectedTab.recalculateDimensions();
139
+
140
+ this.$element.trigger($.Event(Pushpop.TabView.EventType.DidSelectTabViewStack, {
141
+ previousSelectedTabViewStack: previousSelectedTabViewStack,
142
+ selectedTabViewStack: selectedTabViewStack
143
+ }));
144
+ };
145
+
146
+ /**
147
+ Creates a new TabBar.
148
+ @param {Pushpop.TabView} tabView The tab view to initialize this tab bar for.
149
+ @constructor
150
+ */
151
+ Pushpop.TabBar = function TabBar(tabView) {
152
+ var $element = this.$element = $('<div class="pp-tab-bar"/>');
153
+ var element = this.element = $element[0];
154
+
155
+ var self = element.tabBar = this;
156
+
157
+ this.tabView = tabView;
158
+
159
+ var tabBarButtons = this._tabBarButtons = [];
160
+
161
+ tabView.$element.append($element).bind(Pushpop.TabView.EventType.DidSelectTabViewStack, function(evt) {
162
+ var previousSelectedTabViewStack = evt.previousSelectedTabViewStack;
163
+ var selectedTabViewStack = evt.selectedTabViewStack;
164
+ var previousSelectedTabBarButton, selectedTabBarButton;
165
+
166
+ for (var i = 0, length = tabBarButtons.length, tabBarButton, tabBarButtonViewStack; i < length; i++) {
167
+ tabBarButton = tabBarButtons[i];
168
+ tabBarButtonViewStack = tabBarButton.getTabViewStack();
169
+
170
+ if (previousSelectedTabViewStack && tabBarButtonViewStack === previousSelectedTabViewStack) previousSelectedTabBarButton = tabBarButton;
171
+ if (selectedTabViewStack && tabBarButtonViewStack === selectedTabViewStack) selectedTabBarButton = tabBarButton;
172
+
173
+ if ((previousSelectedTabBarButton || !previousSelectedTabViewStack) && (selectedTabBarButton || !selectedTabViewStack)) break;
174
+ }
175
+
176
+ if (previousSelectedTabBarButton) previousSelectedTabBarButton.$element.removeClass('pp-active');
177
+ if (selectedTabBarButton) selectedTabBarButton.$element.addClass('pp-active');
178
+ });
179
+
180
+ $element.delegate('.pp-tab-bar-button', !!('ontouchstart' in window) ? 'touchstart' : 'mousedown', function(evt) {
181
+ var tabBarButton = this.tabBarButton;
182
+ tabView.setSelectedTabViewStack(tabBarButton.getTabViewStack());
183
+ });
184
+ };
185
+
186
+ Pushpop.TabBar.prototype = {
187
+ constructor: Pushpop.TabBar,
188
+
189
+ element: null,
190
+ $element: null,
191
+
192
+ tabView: null,
193
+
194
+ _tabBarButtons: null, // []
195
+
196
+ /**
197
+
198
+ */
199
+ getTabBarButtons: function() { return this._tabBarButtons; },
200
+
201
+ /**
202
+
203
+ */
204
+ setTabBarButtons: function(tabBarButtons) {
205
+ var _tabBarButtons = this._tabBarButtons;
206
+ _tabBarButtons.length = 0;
207
+
208
+ var $element = this.$element;
209
+ $element.html('');
210
+
211
+ for (var i = 0, length = tabBarButtons.length, tabBarButton; i < length; i++) {
212
+ _tabBarButtons.push(tabBarButton = tabBarButtons[i]);
213
+ tabBarButton.setTabBar(this);
214
+ $element.append(tabBarButton.$element);
215
+ }
216
+ }
217
+ };
218
+
219
+ /**
220
+ Creates a new TabBarButton.
221
+ @param {Pushpop.ViewStack} tabViewStack The view stack containing the tab bar button to initialize.
222
+ @constructor
223
+ */
224
+ Pushpop.TabBarButton = function TabBarButton(tabViewStack) {
225
+ var $element = this.$element = tabViewStack.$element.children('.pp-tab-bar-button').first();
226
+ var element = this.element = $element[0];
227
+
228
+ var self = element.tabBarButton = this;
229
+
230
+ this._tabViewStack = tabViewStack;
231
+
232
+ var $iconElement = this.$iconElement = $element.children('.pp-tab-bar-button-icon').first();
233
+ var icon = this._icon = ''; // TODO: Implement this.
234
+
235
+ var $titleElement = this.$titleElement = $element.children('.pp-tab-bar-button-title').first();
236
+ var title = this._title = $titleElement.html();
237
+ };
238
+
239
+ Pushpop.TabBarButton.prototype = {
240
+ constructor: Pushpop.TabBarButton,
241
+
242
+ element: null,
243
+ $element: null,
244
+ $iconElement: null,
245
+ $titleElement: null,
246
+
247
+ _tabViewStack: null, // []
248
+
249
+ /**
250
+
251
+ */
252
+ getTabViewStack: function() { return this._tabViewStack; },
253
+
254
+ /**
255
+
256
+ */
257
+ setTabViewStack: function(tabViewStack) {
258
+ this._tabViewStack = tabViewStack;
259
+ },
260
+
261
+ _tabBar: null,
262
+
263
+ /**
264
+
265
+ */
266
+ getTabBar: function() { return this._tabBar; },
267
+
268
+ /**
269
+
270
+ */
271
+ setTabBar: function(tabBar) { this._tabBar = tabBar; },
272
+
273
+ _icon: '',
274
+
275
+ /**
276
+
277
+ */
278
+ getIcon: function() { return this._icon; },
279
+
280
+ /**
281
+
282
+ */
283
+ setIcon: function(icon) {
284
+ this._icon = icon;
285
+ },
286
+
287
+ _title: '',
288
+
289
+ /**
290
+
291
+ */
292
+ getTitle: function() { return this._title; },
293
+
294
+ /**
295
+
296
+ */
297
+ setTitle: function(title) { this.$titleElement.html(this._title = title); }
298
+ };