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,57 @@
1
+ <?xml version="1.0" standalone="no"?>
2
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
3
+ <svg xmlns="http://www.w3.org/2000/svg">
4
+ <metadata></metadata>
5
+ <defs>
6
+ <font id="pushpopglyphsregular" horiz-adv-x="1624" >
7
+ <font-face units-per-em="2048" ascent="1536" descent="-512" />
8
+ <missing-glyph horiz-adv-x="500" />
9
+ <glyph horiz-adv-x="2048" />
10
+ <glyph horiz-adv-x="2048" />
11
+ <glyph unicode="&#xd;" horiz-adv-x="2048" />
12
+ <glyph unicode=" " d="M0 0v1536h1624v-1536h-1624z" />
13
+ <glyph unicode="&#xa0;" d="M0 0v1536h1624v-1536h-1624z" />
14
+ <glyph unicode="&#x2000;" horiz-adv-x="812" />
15
+ <glyph unicode="&#x2001;" />
16
+ <glyph unicode="&#x2002;" horiz-adv-x="812" />
17
+ <glyph unicode="&#x2003;" />
18
+ <glyph unicode="&#x2004;" horiz-adv-x="541" />
19
+ <glyph unicode="&#x2005;" horiz-adv-x="406" />
20
+ <glyph unicode="&#x2006;" horiz-adv-x="270" />
21
+ <glyph unicode="&#x2007;" horiz-adv-x="270" />
22
+ <glyph unicode="&#x2008;" horiz-adv-x="203" />
23
+ <glyph unicode="&#x2009;" horiz-adv-x="324" />
24
+ <glyph unicode="&#x200a;" horiz-adv-x="90" />
25
+ <glyph unicode="&#x202f;" horiz-adv-x="324" />
26
+ <glyph unicode="&#x205f;" horiz-adv-x="406" />
27
+ <glyph unicode="&#xe000;" horiz-adv-x="1024" d="M0 0z" />
28
+ <glyph unicode="&#xf000;" horiz-adv-x="960" d="M0 193l578 575l-578 575l193 193l768 -768l-768 -768z" />
29
+ <glyph unicode="&#xf001;" d="M0 633v366h1624v-366h-1624z" />
30
+ <glyph unicode="&#xf002;" d="M0 612v400h612v612h400v-612h612v-400h-612v-612h-400v612h-612z" />
31
+ <glyph unicode="&#xf003;" horiz-adv-x="1454" d="M59.5 643q-0.5 39 15 70.5t41 53t56.5 26t63.5 -10t59.5 -55.5l215 -299q10 -8 19.5 -9t17.5 1t16 8l567 946q20 41 51 59.5t65 19.5t63.5 -14.5t47 -44t17.5 -68.5t-26 -87l-676 -1133q-20 -31 -49 -49t-63 -21t-67.5 13.5t-64.5 56.5l-348 459q-20 39 -20.5 78z" />
32
+ <glyph unicode="&#xf004;" horiz-adv-x="1931" d="M0 0v1202h602l-186 -184h-250v-852h1288v188l166 166v-520h-1620zM416 436q0 141 36.5 248t96 187.5t136.5 136t157 92.5q186 86 424 102v334l665 -541v-20l-665 -539v332q-125 0 -227.5 -14.5t-185.5 -37t-148.5 -52t-112.5 -62.5q-115 -72 -176 -166z" />
33
+ <glyph unicode="&#xf005;" horiz-adv-x="1703" d="M0 561v768q0 39 18.5 76t47 66.5t66.5 47t77 17.5h852q45 0 84 -17.5t65.5 -47t42 -66.5t15.5 -76v-43h-168q0 16 -7.5 31.5t-18.5 27t-25.5 18.5t-30.5 7h-768q-16 0 -30.5 -7t-27 -18.5t-18.5 -26.5t-6 -32v-684q0 -14 6 -29.5t18.5 -28t26.5 -19.5t31 -7h82v-166h-123 q-39 0 -77 15.5t-66.5 42t-47 65.5t-18.5 86zM416 227v750q0 45 17.5 87t49 72.5t72.5 49t88 18.5h850q41 0 78 -18.5t66.5 -49t48 -72.5t18.5 -87v-750q0 -47 -18.5 -88t-48 -71.5t-66.5 -49t-78 -18.5h-850q-47 0 -88 18.5t-72.5 49t-49 71.5t-17.5 88zM602 268 q0 -23 7 -41t18.5 -31.5t27 -20.5t29.5 -7h770q14 0 28.5 7t27 20.5t19.5 32t7 40.5v668q0 23 -7 38t-19.5 25.5t-27 14.5t-28.5 4h-770q-31 0 -56.5 -18.5t-25.5 -63.5v-668z" />
34
+ <glyph unicode="&#xf006;" horiz-adv-x="1703" d="M0 561v768q0 39 18.5 76t47 66.5t66.5 47t77 17.5h852q45 0 84 -17.5t65.5 -47t42 -66.5t15.5 -76v-43h-168q0 16 -7.5 31.5t-18.5 27t-25.5 18.5t-30.5 7h-768q-16 0 -30.5 -7t-27 -18.5t-18.5 -26.5t-6 -32v-684q0 -14 6 -29.5t18.5 -28t26.5 -19.5t31 -7h82v-166h-123 q-39 0 -77 15.5t-66.5 42t-47 65.5t-18.5 86zM416 227v750q0 45 17.5 87t49 72.5t72.5 49t88 18.5h850q41 0 78 -18.5t66.5 -49t48 -72.5t18.5 -87v-750q0 -47 -18.5 -88t-48 -71.5t-66.5 -49t-78 -18.5h-850q-47 0 -88 18.5t-72.5 49t-49 71.5t-17.5 88z" />
35
+ <glyph unicode="&#xf007;" horiz-adv-x="1536" d="M2 768q0 109 26.5 207t76 184t119 154.5t154.5 119t183 77t207 26.5q102 0 199.5 -26.5t183.5 -77t155.5 -119t121 -154.5t80 -184t28.5 -207q0 -102 -28.5 -199.5t-80 -182.5t-121 -155.5t-155.5 -122t-183.5 -79t-199.5 -27.5q-109 0 -207 27.5t-183 79t-154.5 122 t-119 155.5t-76 182.5t-26.5 199.5zM386 491.5q-1 -14.5 3 -28.5t11.5 -27.5t15.5 -19.5q6 -8 19.5 -15.5t27.5 -11.5t28.5 -3t20.5 9l256 256l256 -256q6 -8 20.5 -9t28.5 3t27.5 11.5t21.5 15.5q6 6 13.5 19.5t11.5 27.5t3 28.5t-7 20.5l-256 256l256 256q6 6 7 20.5 t-3 28.5t-11.5 27.5t-13.5 21.5q-8 6 -21.5 13.5t-27.5 11.5t-28.5 3t-20.5 -7l-256 -256l-256 256q-6 6 -20.5 7t-28.5 -3t-27.5 -11.5t-19.5 -13.5q-8 -8 -15.5 -21.5t-11.5 -27.5t-3 -28.5t9 -20.5l256 -256l-256 -256q-8 -6 -9 -20.5z" />
36
+ <glyph unicode="&#xf008;" horiz-adv-x="1433" d="M2 920q0 135 46 247.5t127 193.5t193.5 127t247.5 46q133 0 245 -46t194 -127t127 -193.5t45 -247.5q0 -115 -38 -221.5t-116 -184.5l359 -358l-154 -154l-358 358q-78 -39 -152 -45t-152 -6q-135 0 -247.5 45t-193.5 127t-127 193.5t-46 245.5zM207 920q0 -76 34.5 -149 t93 -130t131.5 -92t150 -35q76 0 149 35t130 92t92 130t35 149t-35 149.5t-92 132t-130 93t-149 34.5q-78 0 -150.5 -34.5t-131 -93t-93 -132.5t-34.5 -149z" />
37
+ <glyph unicode="&#xf009;" horiz-adv-x="1331" d="M0 666q0 135 53 255.5t144.5 212t212 144.5t256.5 53h51v205l461 -307l-461 -307v204h-51q-96 0 -180.5 -35.5t-147 -98t-98 -146.5t-35.5 -180t35.5 -180.5t98 -147t146.5 -98t181 -35.5q96 0 180 35.5t146.5 98t98 146.5t35.5 181v51h205v-51q0 -135 -53 -256 t-144.5 -212.5t-212 -144.5t-255.5 -53t-256 53t-212.5 144.5t-144.5 212t-53 256.5z" />
38
+ <glyph unicode="&#xf00a;" horiz-adv-x="1171" d="M0 1098v37q0 111 111 110h108v72q0 41 19.5 81t50 70.5t69.5 49t80 18.5h293q41 0 81 -18.5t70.5 -49t50 -70.5t19.5 -81v-72h109q111 0 110 -110v-37h-73v-916q0 -82 -49.5 -132t-133.5 -50h-659q-84 0 -133 50t-49 132v916h-74zM219 219q0 -29 22.5 -51.5t51.5 -22.5 h586q29 0 51 22.5t22 51.5v879h-733v-879zM293 330l37 -37h35q14 0 27.5 5t23.5 13q12 8 22 19v549q0 29 -22.5 51t-50.5 22h-35q-10 -10 -19 -22q-8 -10 -13 -23.5t-5 -27.5v-549zM365 1245h442v72q0 29 -23.5 51.5t-52.5 22.5h-293q-29 0 -51 -22.5t-22 -51.5v-72z M512 330l37 -37h35q14 0 27.5 5t23.5 13q12 8 22 19v549q0 29 -22.5 51t-50.5 22h-35q-10 -10 -19 -22q-8 -10 -13 -23.5t-5 -27.5v-549zM731 330l39 -37h37q12 0 25.5 5t23.5 13q12 8 23 19v549q0 29 -22.5 51t-49.5 22h-37q-12 -10 -20 -22q-8 -10 -13.5 -23.5t-5.5 -27.5 v-549z" />
39
+ <glyph unicode="&#xf00b;" horiz-adv-x="1482" d="M0 848l1483 688l-688 -1536v848h-795z" />
40
+ <glyph unicode="&#xf00c;" horiz-adv-x="0" d="M0 0v1126q96 76 186 119t173 61.5t158 15.5t136 -17q145 -35 269 -127q123 92 268 127q61 14 135 17t157 -15.5t174 -61.5t187 -119v-1126q-115 86 -216 132t-187 61.5t-159 7.5t-130 -29q-135 -51 -229 -172h-52q-80 121 -204 172q-53 20 -121 28.5t-151 -7t-181 -61.5 t-213 -132zM205 307q133 76 246.5 85t195.5 -9q96 -23 172 -76v717q-63 53 -153 76q-39 8 -87.5 12t-105.5 -3t-124.5 -26.5t-143.5 -58.5v-717zM1024 307q76 53 172 76q82 18 194.5 9t247.5 -85v717q-78 39 -144.5 58.5t-123.5 26.5t-105 3t-87 -12q-90 -23 -154 -76v-717z " />
41
+ <glyph unicode="&#xf00d;" horiz-adv-x="1716" d="M0 0h1716v543h-180v-363h-1356v363h-180v-543zM362 1083h361v453h270v-453h363l-498 -540h-43z" />
42
+ <glyph unicode="&#xf00e;" horiz-adv-x="1716" d="M0 362v812q0 68 30.5 133t82 116.5t117 82t132.5 30.5h994q68 0 132 -30.5t115.5 -82t82 -117t30.5 -132.5v-812q0 -68 -30.5 -133t-82 -116.5t-116 -82t-131.5 -30.5h-994q-68 0 -133 30.5t-116.5 82t-82 117t-30.5 132.5z" />
43
+ <glyph unicode="&#xf00f;" horiz-adv-x="2166" d="M0 272v1264h2167v-1264h-361l-180 179h361v903h-1807v-903h361l-181 -179h-360zM360 0l678 858h45l723 -858h-1446z" />
44
+ <glyph unicode="&#xf010;" horiz-adv-x="1280" d="M0 0v1536l1280 -768v-43z" />
45
+ <glyph unicode="&#xf011;" d="M0 0v1536h1624v-1536h-1624z" />
46
+ <glyph unicode="&#xf012;" horiz-adv-x="1003" d="M0 0v1536h354v-1536h-354zM649 0v1536h355v-1536h-355z" />
47
+ <glyph unicode="&#xf013;" horiz-adv-x="2164" d="M0 0v1536h281v-1536h-281zM453 733v35l802 768v-1536zM1362 733v35l803 768v-1536z" />
48
+ <glyph unicode="&#xf014;" horiz-adv-x="2164" d="M0 0v1536l803 -768v-35zM909 0v1536l803 -768v-35zM1884 0v1536h281v-1536h-281z" />
49
+ <glyph unicode="&#xf015;" horiz-adv-x="1710" d="M0 733v35l803 768v-1536zM907 733v35l803 768v-1536z" />
50
+ <glyph unicode="&#xf016;" horiz-adv-x="1710" d="M0 0v1536l803 -768v-35zM907 0v1536l803 -768v-35z" />
51
+ <glyph unicode="&#xf017;" horiz-adv-x="1792" d="M0 213v1110q0 96 58.5 154.5t154.5 58.5h1110q33 0 58.5 -5t25.5 -38l-127 -127h-1024q-33 0 -59.5 -26.5t-26.5 -59.5v-1024q0 -33 26.5 -59.5t59.5 -26.5h1024q33 0 59.5 26.5t26.5 59.5v428l170 170v-641q0 -96 -58.5 -154.5t-154.5 -58.5h-1110q-96 0 -154.5 58.5 t-58.5 154.5zM598 299l129 299l168 -170zM768 641l682 682l172 -172l-684 -682zM1493 1366l86 84q66 66 127 0l43 -43q66 -61 0 -127l-84 -86z" />
52
+ <glyph unicode="&#xf018;" horiz-adv-x="710" d="M0 436h162v129h387v-129h162l-357 -436h-14zM162 629v131h387v-131h-387zM162 825v129h387v-129h-387zM162 1020v129h387v-129h-387zM162 1212v129h387v-129h-387zM162 1407v129h387v-129h-387z" />
53
+ <glyph unicode="&#xf019;" d="M0 0v221h49v-172h162v-49h-211zM0 381v291h49v-291h-49zM0 844v293h49v-293h-49zM0 1296v224h211v-52h-162v-172h-49zM268 1008v288h979v-288h-30q-12 31 -21.5 50t-17 33.5t-10.5 24.5t-3 21q-20 23 -42.5 45t-45.5 37q-8 0 -22.5 5t-29.5 11t-28.5 11t-19.5 5h-82v-848 v-100l20 -31q23 -23 44.5 -25.5t35.5 -2.5h31v-23h-547v23h29q27 0 43 3t39 25l33 31v100v848h-80q-47 0 -87 -18.5t-85 -32.5q-16 -47 -38 -90t-44 -102h-21zM371 0v49h301v-49h-301zM371 1468v52h301v-52h-301zM834 0v49h305v-49h-305zM834 1468v52h305v-52h-305zM1298 0 v49h158v172h62v-221h-220zM1298 1468v52h220v-224h-62v172h-158zM1456 381v291h62v-291h-62zM1456 844v293h62v-293h-62z" />
54
+ <glyph unicode="&#xf01a;" d="M0 766q0 160 60.5 299t164 243.5t242.5 165t299 60.5t299 -60.5t243.5 -165t165 -243.5t60.5 -299t-60.5 -299t-165 -242.5t-243.5 -164t-299 -60.5t-299 60.5t-242.5 164t-164 242.5t-60.5 299z" />
55
+ <glyph unicode="&#xf01b;" d="M0 0v1536h1624v-1536h-1624z" />
56
+ </font>
57
+ </defs></svg>
@@ -0,0 +1,148 @@
1
+ .pp-modal-view-stack {
2
+ background: #333 url('../background.png');
3
+ background-size: 320px 460px;
4
+ position: absolute;
5
+ overflow: hidden;
6
+ padding: 0;
7
+ z-index: 99999;
8
+ visibility: hidden;
9
+ opacity: 0;
10
+ pointer-events: none;
11
+ font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
12
+ font-size: 13px;
13
+ line-height: 1.25em;
14
+ -webkit-border-radius: 6px;
15
+ -moz-border-radius: 6px;
16
+ border-radius: 6px;
17
+ -webkit-box-shadow: 0 4px 20px 2px rgba(0, 0, 0, 0.6);
18
+ -moz-box-shadow: 0 4px 20px 2px rgba(0, 0, 0, 0.6);
19
+ box-shadow: 0 4px 20px 2px rgba(0, 0, 0, 0.6);
20
+ -webkit-backface-visibility: hidden;
21
+ -moz-backface-visibility: hidden;
22
+ -ms-backface-visibility: hidden;
23
+ -o-backface-visibility: hidden;
24
+ backface-visibility: hidden;
25
+ -webkit-text-size-adjust: 100%;
26
+ -moz-text-size-adjust: 100%;
27
+ -ms-text-size-adjust: 100%;
28
+ -o-text-size-adjust: 100%;
29
+ text-size-adjust: 100%;
30
+ -webkit-transform: translate3d(0, 0, 0);
31
+ -moz-transform: translate(0, 0);
32
+ -ms-transform: translate(0, 0);
33
+ -o-transform: translate(0, 0);
34
+ transform: translate(0, 0);
35
+ }
36
+
37
+ @media only screen and (-webkit-min-device-pixel-ratio: 2) {
38
+ .pp-modal-view-stack {
39
+ background: #333 url('../background@2x.png');
40
+ }
41
+ }
42
+
43
+ .pp-modal-view-stack.pp-active {
44
+ pointer-events: auto;
45
+ }
46
+
47
+ .pp-modal-presentation-style-full-screen {
48
+ top: 0;
49
+ right: 0;
50
+ bottom: 0;
51
+ left: 0;
52
+ margin: 0;
53
+ width: auto;
54
+ height: auto;
55
+ }
56
+
57
+ .pp-modal-presentation-style-page-sheet {
58
+ top: 0;
59
+ bottom: 0;
60
+ left: 50%;
61
+ margin: 0 0 0 -384px;
62
+ width: 768px;
63
+ height: auto;
64
+ }
65
+
66
+ .pp-modal-presentation-style-form-sheet {
67
+ top: 64px;
68
+ bottom: auto;
69
+ left: 50%;
70
+ margin: 0 0 0 -270px;
71
+ width: 540px;
72
+ height: 620px;
73
+ }
74
+
75
+ /* On screens smaller than 768px (e.g.: phones) all presentation styles should be full screen. */
76
+ @media (max-width: 768px) {
77
+ .pp-modal-presentation-style-full-screen,
78
+ .pp-modal-presentation-style-page-sheet,
79
+ .pp-modal-presentation-style-form-sheet {
80
+ top: 0;
81
+ right: 0;
82
+ bottom: 0;
83
+ left: 0;
84
+ margin: 0;
85
+ width: auto;
86
+ height: auto;
87
+ }
88
+ }
89
+
90
+ .pp-modal-transition-style-cover-vertical {
91
+ visibility: hidden;
92
+ opacity: 0;
93
+ -webkit-transform: translate3d(0, 100%, 0);
94
+ -moz-transform: translate(0, 100%);
95
+ -ms-transform: translate(0, 100%);
96
+ -o-transform: translate(0, 100%);
97
+ transform: translate(0, 100%);
98
+ -webkit-transition: visibility 0s linear 0.4s, opacity 0.15s ease 0.15s, -webkit-transform 0.3s ease 0s;
99
+ -moz-transition: visibility 0s linear 0.4s, opacity 0.15s ease 0.15s, -moz-transform 0.3s ease 0s;
100
+ -ms-transition: visibility 0s linear 0.4s, opacity 0.15s ease 0.15s, -ms-transform 0.3s ease 0s;
101
+ -o-transition: visibility 0s linear 0.4s, opacity 0.15s ease 0.15s, -o-transform 0.3s ease 0s;
102
+ transition: visibility 0s linear 0.4s, opacity 0.15s ease 0.15s, transform 0.3s ease 0s;
103
+ }
104
+
105
+ .pp-modal-transition-style-cover-vertical.pp-active {
106
+ visibility: visible;
107
+ opacity: 1;
108
+ -webkit-transform: translate3d(0, 0, 0);
109
+ -moz-transform: translate(0, 0);
110
+ -ms-transform: translate(0, 0);
111
+ -o-transform: translate(0, 0);
112
+ transform: translate(0, 0);
113
+ -webkit-transition-delay: 0s;
114
+ -moz-transition-delay: 0s;
115
+ -ms-transition-delay: 0s;
116
+ -o-transition-delay: 0s;
117
+ transition-delay: 0s;
118
+ }
119
+
120
+ .pp-modal-view-stack-backdrop {
121
+ background: #000;
122
+ position: absolute;
123
+ top: 0;
124
+ right: 0;
125
+ bottom: 0;
126
+ left: 0;
127
+ margin: 0;
128
+ width: auto;
129
+ height: auto;
130
+ z-index: 99998;
131
+ visibility: hidden;
132
+ opacity: 0;
133
+ -webkit-transition: visibility 0s linear 0.3s, opacity 0.3s linear 0s;
134
+ -moz-transition: visibility 0s linear 0.3s, opacity 0.3s linear 0s;
135
+ -ms-transition: visibility 0s linear 0.3s, opacity 0.3s linear 0s;
136
+ -o-transition: visibility 0s linear 0.3s, opacity 0.3s linear 0s;
137
+ transition: visibility 0s linear 0.3s, opacity 0.3s linear 0s;
138
+ }
139
+
140
+ .pp-modal-view-stack.pp-active + .pp-modal-view-stack-backdrop {
141
+ visibility: visible;
142
+ opacity: 0.5;
143
+ -webkit-transition-delay: 0s;
144
+ -moz-transition-delay: 0s;
145
+ -ms-transition-delay: 0s;
146
+ -o-transition-delay: 0s;
147
+ transition-delay: 0s;
148
+ }
@@ -0,0 +1,306 @@
1
+ ;'use strict';
2
+
3
+ // The base Pushpop object.
4
+ var Pushpop = window['Pushpop'] || {};
5
+
6
+ /**
7
+ Creates a new ModalViewStack.
8
+ @param {HTMLDivElement} element The DIV element to initialize as a new ModalViewStack.
9
+ @constructor
10
+ @extends Pushpop.ViewStack
11
+ */
12
+ Pushpop.ModalViewStack = function ModalViewStack(element) {
13
+
14
+ // Call the "super" constructor.
15
+ Pushpop.ViewStack.prototype.constructor.apply(this, arguments);
16
+
17
+ var $element = this.$element;
18
+
19
+ // Insert the backdrop element after the modal view stack element.
20
+ var $backdrop = $('<div class="pp-modal-view-stack-backdrop"/>').insertAfter($element);
21
+
22
+ // Initialize the modal view stack's presentation style based on the element's CSS classes.
23
+ var presentationStyles = Pushpop.ModalViewStack.PresentationStyleType, didInitPresentationStyle = false;
24
+ for (var presentationStyle in presentationStyles) {
25
+ if ($element.hasClass('pp-modal-presentation-style-' + presentationStyles[presentationStyle])) {
26
+ this.setPresentationStyle(presentationStyles[presentationStyle]);
27
+ didInitPresentationStyle = true;
28
+ break;
29
+ }
30
+ }
31
+
32
+ // Set the modal view stack's presentation style to the default if one was not specified.
33
+ if (!didInitPresentationStyle) this.setPresentationStyle(this.constructor.prototype._presentationStyle);
34
+
35
+ // Initialize the modal view stack's transition style based on the element's CSS classes.
36
+ var transitionStyles = Pushpop.ModalViewStack.TransitionStyleType, didInitTransitionStyle = false;
37
+ for (var transitionStyle in transitionStyles) {
38
+ if ($element.hasClass('pp-modal-transition-style-' + transitionStyles[transitionStyle])) {
39
+ this.setTransitionStyle(transitionStyles[transitionStyle]);
40
+ didInitTransitionStyle = true;
41
+ break;
42
+ }
43
+ }
44
+
45
+ // Set the modal view stack's transition style to the default if one was not specified.
46
+ if (!didInitTransitionStyle) this.setTransitionStyle(this.constructor.prototype._transitionStyle);
47
+
48
+ // Make the modal view stack visible if it is initialized with the .pp-active CSS class.
49
+ this.setHidden(!$element.hasClass('pp-active'));
50
+ };
51
+
52
+ /**
53
+ Presentation styles available when presenting a Pushpop.ModalViewStack.
54
+ */
55
+ Pushpop.ModalViewStack.PresentationStyleType = {
56
+ FullScreen: 'full-screen', // 100% x 100%
57
+ PageSheet: 'page-sheet', // 768px x 100%
58
+ FormSheet: 'form-sheet' // 540px x 620px
59
+ };
60
+
61
+ /**
62
+ Transition styles available when presenting a Pushpop.ModalViewStack.
63
+ */
64
+ Pushpop.ModalViewStack.TransitionStyleType = {
65
+ CoverVertical: 'cover-vertical'
66
+ };
67
+
68
+ // Create the prototype for the Pushpop.ModalViewStack as a "sub-class" of Pushpop.ViewStack.
69
+ Pushpop.ModalViewStack.prototype = new Pushpop.ViewStack();
70
+ Pushpop.ModalViewStack.prototype.constructor = Pushpop.ModalViewStack;
71
+
72
+ /**
73
+ Pushes the specified view to the view stack using the optionally specified transition. If a
74
+ transition is not specified, the default will be used. A callback may optionally be provided
75
+ to be called after the transition completes. In the case of a Pushpop.ModalViewStack, the
76
+ modal view stack will first be presented if it is currently hidden.
77
+ @description This method overrides the default implementation of Pushpop.ViewStack to present
78
+ the modal view stack if it is hidden. After presenting the modal view stack (if needed), the
79
+ "super" implementation of this method is then executed.
80
+ @param {Pushpop.View} view The view to be pushed to the view stack.
81
+ @param {String|Function} [transitionOrCallback] Either the name of the transition to use when
82
+ pushing the view or a callback function to be executed upon completion of the default transition.
83
+ If this parameter is omitted, the default transition is used.
84
+ @param {Function} [callback] A callback function to be executed upon completion of the specified
85
+ transition.
86
+ */
87
+ Pushpop.ModalViewStack.prototype.push = function(view, transitionOrCallback, callback) {
88
+ if (this.getHidden()) this.present();
89
+
90
+ // Call the "super" method.
91
+ Pushpop.ViewStack.prototype.push.apply(this, arguments);
92
+ };
93
+
94
+ /**
95
+ Pops the current or specified view off the view stack using the optionally specified transition.
96
+ If a view is not specified, the current view will be popped (unless it is the root view). If a
97
+ transition is not specified, the default will be used. A callback may optionally be provided to
98
+ be called after the transition completes. In the case of a Pushpop.ModalViewStack, the modal
99
+ view stack will be dismissed if this method is called when there is only one remaining view on
100
+ the view stack (e.g.: the "root" view) and no view is specified.
101
+ @description This method overrides the default implementation of Pushpop.ViewStack to dismiss
102
+ the modal view stack if there is only one remaining view on the view stack and no view is
103
+ specified. After dismissing the modal view stack (if needed), the "super" implementation of this
104
+ method is then executed.
105
+ @param {Pushpop.View|String} viewOrTransition Either the view to be popped to on the view stack
106
+ or the name of the transition to use when popping the view. If this parameter is omitted or if
107
+ it specifies a transition name, the current view will be assumed to be popped.
108
+ @param {String|Function} [transitionOrCallback] Either the name of the transition to use when
109
+ popping the view or a callback function to be executed upon completion of the default transition.
110
+ If this parameter is omitted, the default transition is used.
111
+ @param {Function} [callback] A callback function to be executed upon completion of the specified
112
+ transition.
113
+ */
114
+ Pushpop.ModalViewStack.prototype.pop = function(viewOrTransition, transitionOrCallback, callback) {
115
+ if (this.views.length <= 1) this.dismiss();
116
+
117
+ // Call the "super" method.
118
+ Pushpop.ViewStack.prototype.pop.apply(this, arguments);
119
+ };
120
+
121
+ Pushpop.ModalViewStack.prototype._hidden = true;
122
+
123
+ /**
124
+ Returns a flag indicating if this modal view stack is hidden.
125
+ @type Boolean
126
+ */
127
+ Pushpop.ModalViewStack.prototype.getHidden = function() { return this._hidden; };
128
+
129
+ /**
130
+ Sets a flag indicating if this modal view stack should be hidden.
131
+ @param {Boolean} hidden A flag indicating if this modal view stack should be hidden.
132
+ */
133
+ Pushpop.ModalViewStack.prototype.setHidden = function(hidden) { if (hidden) this.dismiss(); else this.present(); };
134
+
135
+ /**
136
+ Presents this modal view stack and transitions it to a visible state.
137
+ @param {Pushpop.View} [view] Optional view to set as the active view before presenting.
138
+ */
139
+ Pushpop.ModalViewStack.prototype.present = function(view) {
140
+ if (!this.getHidden()) return;
141
+
142
+ this._hidden = false;
143
+
144
+ var oldActiveView = this.getActiveView();
145
+ if (view && oldActiveView !== view) {
146
+ oldActiveView.$element.removeClass('pp-active');
147
+ view.$element.addClass('pp-active');
148
+
149
+ this.views.length = 0;
150
+ this.views.push(view);
151
+ } else {
152
+ this.views.length = 0;
153
+ this.views.push(oldActiveView);
154
+ }
155
+
156
+ var activeView = this.getActiveView();
157
+ activeView.$trigger($.Event(Pushpop.EventType.WillPresentView, {
158
+ view: activeView,
159
+ action: 'modal-present'
160
+ }));
161
+
162
+ this.$element.addClass('pp-active');
163
+
164
+ activeView.$trigger($.Event(Pushpop.EventType.DidPresentView, {
165
+ view: activeView,
166
+ action: 'modal-present'
167
+ }));
168
+ };
169
+
170
+ /**
171
+ Dismisses this modal view stack and transitions it to a hidden state.
172
+ */
173
+ Pushpop.ModalViewStack.prototype.dismiss = function() {
174
+ if (this.getHidden()) return;
175
+
176
+ this._hidden = true;
177
+
178
+ var activeView = this.getActiveView();
179
+ activeView.$trigger($.Event(Pushpop.EventType.WillDismissView, {
180
+ view: activeView,
181
+ action: 'modal-dismiss'
182
+ }));
183
+
184
+ var self = this;
185
+ window.setTimeout(function() {
186
+ self.$element.removeClass('pp-active');
187
+
188
+ activeView.$trigger($.Event(Pushpop.EventType.DidDismissView, {
189
+ view: activeView,
190
+ action: 'modal-dismiss'
191
+ }));
192
+ }, 50);
193
+ };
194
+
195
+ Pushpop.ModalViewStack.prototype._presentationStyle = Pushpop.ModalViewStack.PresentationStyleType.FormSheet;
196
+
197
+ /**
198
+ Returns the presentation style of this modal view stack.
199
+ @type String
200
+ */
201
+ Pushpop.ModalViewStack.prototype.getPresentationStyle = function() { return this._presentationStyle; };
202
+
203
+ /**
204
+ Sets the presentation style to use when presenting this modal view stack.
205
+ @param {String} presentationStyle The presentation style for this modal view stack.
206
+ */
207
+ Pushpop.ModalViewStack.prototype.setPresentationStyle = function(presentationStyle) {
208
+ this._presentationStyle = presentationStyle;
209
+
210
+ var $element = this.$element, presentationStyles = Pushpop.ModalViewStack.PresentationStyleType;
211
+ for (var p in presentationStyles) $element.removeClass('pp-modal-presentation-style-' + presentationStyles[p]);
212
+ $element.addClass('pp-modal-presentation-style-' + presentationStyle);
213
+ };
214
+
215
+ Pushpop.ModalViewStack.prototype._transitionStyle = Pushpop.ModalViewStack.TransitionStyleType.CoverVertical;
216
+
217
+ /**
218
+ Returns the transition style of this modal view stack.
219
+ @type String
220
+ */
221
+ Pushpop.ModalViewStack.prototype.getTransitionStyle = function() { return this._transitionStyle; };
222
+
223
+ /**
224
+ Sets the transition style to use when presenting this modal view stack.
225
+ @param {String} transitionStyle The transition style for this modal view stack.
226
+ */
227
+ Pushpop.ModalViewStack.prototype.setTransitionStyle = function(transitionStyle) {
228
+ this._transitionStyle = transitionStyle;
229
+
230
+ var $element = this.$element, transitionStyles = Pushpop.ModalViewStack.TransitionStyleType;
231
+ for (var t in transitionStyles) $element.removeClass('pp-modal-transition-style-' + transitionStyles[t]);
232
+ $element.addClass('pp-modal-transition-style-' + transitionStyle);
233
+ };
234
+
235
+ $(function() {
236
+ var $window = $(window['addEventListener'] ? window : document.body);
237
+
238
+ // Handle actions for buttons set up to automatically present/dismiss modals.
239
+ $window.delegate('.pp-button.pp-present-modal, .pp-button.pp-dismiss-modal', Pushpop.Button.EventType.DidTriggerAction, function(evt) {
240
+ var button = evt.button;
241
+ var $element = button.$element;
242
+ var href = $element.attr('href');
243
+ var $viewElement, view, viewStack;
244
+
245
+ if ($element.hasClass('pp-present-modal')) {
246
+ $viewElement = $(href);
247
+ if ($viewElement.length === 0) return;
248
+
249
+ view = $viewElement[0].view || new Pushpop.View($viewElement);
250
+
251
+ viewStack = view.getViewStack();
252
+ if (viewStack) viewStack.present(view);
253
+ }
254
+
255
+ else if ($element.hasClass('pp-dismiss-modal')) {
256
+ if (href === '#') {
257
+ viewStack = button.getViewStack();
258
+ if (viewStack) viewStack.dismiss();
259
+ } else {
260
+ $viewElement = $(href);
261
+ if ($viewElement.length === 0) return;
262
+
263
+ view = $viewElement[0].view || new Pushpop.View($viewElement);
264
+
265
+ viewStack = view.getViewStack();
266
+ if (viewStack) viewStack.dismiss();
267
+ }
268
+ }
269
+ });
270
+
271
+ // Handle clicks for anchor links set up to automatically present/dismiss modals.
272
+ $window.delegate('a.pp-present-modal, a.pp-dismiss-modal', 'click', function(evt) {
273
+ var $element = $(this);
274
+ if ($element.hasClass('pp-button')) return;
275
+
276
+ evt.preventDefault();
277
+
278
+ var href = $element.attr('href');
279
+ var $viewElement, view, viewStack;
280
+
281
+ if ($element.hasClass('pp-present-modal')) {
282
+ $viewElement = $(href);
283
+ if ($viewElement.length === 0) return;
284
+
285
+ view = $viewElement[0].view || new Pushpop.View($viewElement);
286
+
287
+ viewStack = view.getViewStack();
288
+ if (viewStack) viewStack.present(view);
289
+ }
290
+
291
+ else if ($element.hasClass('pp-dismiss-modal')) {
292
+ if (href === '#') {
293
+ viewStack = Pushpop.getViewStackForElement($element);
294
+ if (viewStack) viewStack.dismiss();
295
+ } else {
296
+ $viewElement = $(href);
297
+ if ($viewElement.length === 0) return;
298
+
299
+ view = $viewElement[0].view || new Pushpop.View($viewElement);
300
+
301
+ viewStack = view.getViewStack();
302
+ if (viewStack) viewStack.dismiss();
303
+ }
304
+ }
305
+ });
306
+ });