marionette-modal 1.0.0.8
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 +7 -0
- data/.gitignore +36 -0
- data/Gemfile +4 -0
- data/Gruntfile.coffee +111 -0
- data/LICENSE +22 -0
- data/README.md +42 -0
- data/Rakefile +1 -0
- data/dist/backbone.marionette.modals-min.js +1 -0
- data/dist/backbone.marionette.modals.js +104 -0
- data/dist/backbone.modal-min.js +1 -0
- data/dist/backbone.modal.js +382 -0
- data/dist/marionette.modal-bundled-min.js +1 -0
- data/dist/marionette.modal-bundled.js +858 -0
- data/dist/marionette.modal-min.js +1 -0
- data/dist/marionette.modal.css +24 -0
- data/dist/marionette.modal.js +370 -0
- data/dist/marionette.modal.theme.css +324 -0
- data/examples/1_single_view.html +71 -0
- data/examples/2_tab_based.html +104 -0
- data/examples/3_stacked_modal_with_marionette.html +105 -0
- data/examples/4_wizard.html +132 -0
- data/examples/css/style.css +45 -0
- data/examples/img/tab-icons.png +0 -0
- data/examples/style.css +35 -0
- data/examples/vendor/backbone.js +1591 -0
- data/examples/vendor/backbone.marionette.modals.js +104 -0
- data/examples/vendor/backbone.modal.css +24 -0
- data/examples/vendor/backbone.modal.js +382 -0
- data/examples/vendor/backbone.modal.theme.css +324 -0
- data/examples/vendor/jquery-1.9.1.js +9597 -0
- data/examples/vendor/marionette.js +2466 -0
- data/examples/vendor/marionette.modal.css +24 -0
- data/examples/vendor/marionette.modal.js +370 -0
- data/examples/vendor/marionette.modal.theme.css +324 -0
- data/examples/vendor/underscore.js +1314 -0
- data/lib/marionette-modal/version.rb +3 -0
- data/lib/marionette-modal.rb +22 -0
- data/marionette-modal.gemspec +23 -0
- data/package.json +19 -0
- data/src/backbone.marionette.modals.coffee +67 -0
- data/src/backbone.modal.coffee +253 -0
- data/src/marionette.modal.coffee +248 -0
- data/src/marionette.modal.sass +26 -0
- data/src/marionette.modal.theme.sass +486 -0
- data/src/style.sass +48 -0
- data/test/spec/backbone.marionette.modals.spec.js +120 -0
- data/test/spec/backbone.modal.spec.js +224 -0
- data/test/spec.html +41 -0
- data/test/src/backbone.marionette.modals.spec.coffee +56 -0
- data/test/src/backbone.modal.spec.coffee +139 -0
- metadata +128 -0
@@ -0,0 +1,324 @@
|
|
1
|
+
.bbm-wrapper {
|
2
|
+
background: rgba(0, 0, 0, 0.75);
|
3
|
+
-webkit-transition: background-color 0.3s; }
|
4
|
+
|
5
|
+
.bbm-modal {
|
6
|
+
background: white;
|
7
|
+
box-shadow: 0 0px 6px rgba(0, 0, 0, 0.6), 0 1px 2px rgba(0, 0, 0, 0.9); }
|
8
|
+
|
9
|
+
/* BLOCKS */
|
10
|
+
.bbm-modal__topbar,
|
11
|
+
.bbm-modal__bottombar {
|
12
|
+
padding: 0 30px; }
|
13
|
+
|
14
|
+
.bbm-modal__topbar {
|
15
|
+
border-bottom: 1px solid rgba(0, 0, 0, 0.1);
|
16
|
+
margin-bottom: 30px; }
|
17
|
+
.bbm-modal__topbar > ul {
|
18
|
+
list-style: none;
|
19
|
+
text-align: center;
|
20
|
+
padding: 0;
|
21
|
+
margin: 0; }
|
22
|
+
|
23
|
+
.bbm-modal__tab {
|
24
|
+
display: inline-block;
|
25
|
+
padding: 15px 10px; }
|
26
|
+
.bbm-modal__tab a {
|
27
|
+
font-size: 16px;
|
28
|
+
font-weight: bold;
|
29
|
+
color: #999999; }
|
30
|
+
.bbm-modal__tab a:hover, .bbm-modal__tab a.active {
|
31
|
+
color: #222222; }
|
32
|
+
|
33
|
+
.bbm-modal__title {
|
34
|
+
padding: 20px 0 19px;
|
35
|
+
margin: 0;
|
36
|
+
font-weight: normal;
|
37
|
+
font-size: 22px;
|
38
|
+
line-height: 1em;
|
39
|
+
color: #312d3a; }
|
40
|
+
|
41
|
+
.bbm-modal__section {
|
42
|
+
padding: 0 30px;
|
43
|
+
margin-top: 0px;
|
44
|
+
font-size: 16px;
|
45
|
+
line-height: 26px;
|
46
|
+
color: #575656; }
|
47
|
+
.bbm-modal__section p {
|
48
|
+
font-size: 16px;
|
49
|
+
line-height: 26px;
|
50
|
+
color: #575656; }
|
51
|
+
.bbm-modal__section p:last-child {
|
52
|
+
padding: 0;
|
53
|
+
margin-bottom: 0; }
|
54
|
+
.bbm-modal__section a {
|
55
|
+
color: #ff643c; }
|
56
|
+
.bbm-modal__section h3 {
|
57
|
+
margin: 0;
|
58
|
+
font-size: 20px;
|
59
|
+
line-height: 1em; }
|
60
|
+
|
61
|
+
.bbm-modal__bottombar {
|
62
|
+
border-top: 1px solid rgba(0, 0, 0, 0.1);
|
63
|
+
padding: 18px;
|
64
|
+
text-align: right;
|
65
|
+
margin-top: 30px; }
|
66
|
+
|
67
|
+
/* MODULES */
|
68
|
+
.bbm-group {
|
69
|
+
content: "";
|
70
|
+
display: table;
|
71
|
+
clear: both; }
|
72
|
+
|
73
|
+
.bbm-button {
|
74
|
+
display: inline-block;
|
75
|
+
color: rgba(49, 45, 58, 0.8);
|
76
|
+
text-decoration: none;
|
77
|
+
font-size: 14px;
|
78
|
+
font-weight: 500;
|
79
|
+
position: relative;
|
80
|
+
line-height: 1em;
|
81
|
+
padding: 10px 14px;
|
82
|
+
border-radius: 3px;
|
83
|
+
background: #fcfcfc;
|
84
|
+
background-image: -o-linear-gradient(rgba(70, 30, 170, 0) 0%, rgba(65, 61, 75, 0.15) 100%);
|
85
|
+
background-image: -moz-linear-gradient(rgba(70, 30, 170, 0) 0%, rgba(65, 61, 75, 0.15) 100%);
|
86
|
+
background-image: -webkit-linear-gradient(rgba(70, 30, 170, 0) 0%, rgba(65, 61, 75, 0.15) 100%);
|
87
|
+
background-image: -ms-linear-gradient(rgba(70, 30, 170, 0) 0%, rgba(65, 61, 75, 0.15) 100%);
|
88
|
+
background-image: linear-gradient(rgba(70, 30, 170, 0) 0%, rgba(65, 61, 75, 0.15) 100%);
|
89
|
+
-moz-box-shadow: 0px 1px 1px 0px rgba(0, 0, 0, 0.1), inset 0px 0px 0px 1px rgba(0, 0, 0, 0.2);
|
90
|
+
-webkit-box-shadow: 0px 1px 1px 0px rgba(0, 0, 0, 0.1), inset 0px 0px 0px 1px rgba(0, 0, 0, 0.2);
|
91
|
+
box-shadow: 0px 1px 1px 0px rgba(0, 0, 0, 0.1), inset 0px 0px 0px 1px rgba(0, 0, 0, 0.2); }
|
92
|
+
.bbm-button.inactive {
|
93
|
+
opacity: 0.5;
|
94
|
+
pointer-events: none; }
|
95
|
+
.bbm-button:active {
|
96
|
+
background-image: -o-linear-gradient(rgba(70, 30, 170, 0) 0%, rgba(65, 61, 75, 0.25) 100%);
|
97
|
+
background-image: -moz-linear-gradient(rgba(70, 30, 170, 0) 0%, rgba(65, 61, 75, 0.25) 100%);
|
98
|
+
background-image: -webkit-linear-gradient(rgba(70, 30, 170, 0) 0%, rgba(65, 61, 75, 0.25) 100%);
|
99
|
+
background-image: -ms-linear-gradient(rgba(70, 30, 170, 0) 0%, rgba(65, 61, 75, 0.25) 100%);
|
100
|
+
background-image: linear-gradient(rgba(70, 30, 170, 0) 0%, rgba(65, 61, 75, 0.25) 100%);
|
101
|
+
-moz-box-shadow: inset 0px 1px 2px 0px rgba(0, 0, 0, 0.5), inset 0px 0px 0px 1px rgba(0, 0, 0, 0.2);
|
102
|
+
-webkit-box-shadow: inset 0px 1px 2px 0px rgba(0, 0, 0, 0.5), inset 0px 0px 0px 1px rgba(0, 0, 0, 0.2);
|
103
|
+
box-shadow: inset 0px 1px 2px 0px rgba(0, 0, 0, 0.5), inset 0px 0px 0px 1px rgba(0, 0, 0, 0.2); }
|
104
|
+
|
105
|
+
/* ANIMATIONS */
|
106
|
+
/* Open modal */
|
107
|
+
@-webkit-keyframes bbm-open {
|
108
|
+
0% {
|
109
|
+
-webkit-transform: matrix(0.99126, 0, 0, 0.99126, 0, 43.8813);
|
110
|
+
opacity: 0.1259; }
|
111
|
+
|
112
|
+
4% {
|
113
|
+
-webkit-transform: matrix(0.99295, 0, 0, 0.99295, 0, 45.06809);
|
114
|
+
opacity: 0.29544; }
|
115
|
+
|
116
|
+
8% {
|
117
|
+
-webkit-transform: matrix(0.99467, 0, 0, 0.99467, 0, 46.26922);
|
118
|
+
opacity: 0.46703; }
|
119
|
+
|
120
|
+
12% {
|
121
|
+
-webkit-transform: matrix(0.99619, 0, 0, 0.99619, 0, 47.33355);
|
122
|
+
opacity: 0.61908; }
|
123
|
+
|
124
|
+
16% {
|
125
|
+
-webkit-transform: matrix(0.99743, 0, 0, 0.99743, 0, 48.19991);
|
126
|
+
opacity: 0.74284; }
|
127
|
+
|
128
|
+
20% {
|
129
|
+
-webkit-transform: matrix(0.99837, 0, 0, 0.99837, 0, 48.86067);
|
130
|
+
opacity: 0.83724; }
|
131
|
+
|
132
|
+
24% {
|
133
|
+
-webkit-transform: matrix(0.99905, 0, 0, 0.99905, 0, 49.33658);
|
134
|
+
opacity: 0.90523; }
|
135
|
+
|
136
|
+
28% {
|
137
|
+
-webkit-transform: matrix(0.99952, 0, 0, 0.99952, 0, 49.66049);
|
138
|
+
opacity: 0.9515; }
|
139
|
+
|
140
|
+
32% {
|
141
|
+
-webkit-transform: matrix(0.99981, 0, 0, 0.99981, 0, 49.8675);
|
142
|
+
opacity: 0.98107; }
|
143
|
+
|
144
|
+
36% {
|
145
|
+
-webkit-transform: matrix(0.99999, 0, 0, 0.99999, 0, 49.98966);
|
146
|
+
opacity: 0.99852; }
|
147
|
+
|
148
|
+
40% {
|
149
|
+
-webkit-transform: matrix(1.00008, 0, 0, 1.00008, 0, 50.05361);
|
150
|
+
opacity: 1.00766; }
|
151
|
+
|
152
|
+
44% {
|
153
|
+
-webkit-transform: matrix(1.00011, 0, 0, 1.00011, 0, 50.08);
|
154
|
+
opacity: 1.01143; }
|
155
|
+
|
156
|
+
48% {
|
157
|
+
-webkit-transform: matrix(1.00012, 0, 0, 1.00012, 0, 50.08394);
|
158
|
+
opacity: 1.01199; }
|
159
|
+
|
160
|
+
52% {
|
161
|
+
-webkit-transform: matrix(1.00011, 0, 0, 1.00011, 0, 50.07589);
|
162
|
+
opacity: 1.01084; }
|
163
|
+
|
164
|
+
56% {
|
165
|
+
-webkit-transform: matrix(1.00009, 0, 0, 1.00009, 0, 50.06265);
|
166
|
+
opacity: 1.00895; }
|
167
|
+
|
168
|
+
60% {
|
169
|
+
-webkit-transform: matrix(1.00007, 0, 0, 1.00007, 0, 50.04833);
|
170
|
+
opacity: 1.0069; }
|
171
|
+
|
172
|
+
64% {
|
173
|
+
-webkit-transform: matrix(1.00005, 0, 0, 1.00005, 0, 50.03518);
|
174
|
+
opacity: 1.00503; }
|
175
|
+
|
176
|
+
68% {
|
177
|
+
-webkit-transform: matrix(1.00004, 0, 0, 1.00004, 0, 50.02421);
|
178
|
+
opacity: 1.00346; }
|
179
|
+
|
180
|
+
72% {
|
181
|
+
-webkit-transform: matrix(1.00002, 0, 0, 1.00002, 0, 50.01567);
|
182
|
+
opacity: 1.00224; }
|
183
|
+
|
184
|
+
76% {
|
185
|
+
-webkit-transform: matrix(1.00001, 0, 0, 1.00001, 0, 50.00941);
|
186
|
+
opacity: 1.00134; }
|
187
|
+
|
188
|
+
80% {
|
189
|
+
-webkit-transform: matrix(1.00001, 0, 0, 1.00001, 0, 50.00506);
|
190
|
+
opacity: 1.00072; }
|
191
|
+
|
192
|
+
84% {
|
193
|
+
-webkit-transform: matrix(1, 0, 0, 1, 0, 50.00223);
|
194
|
+
opacity: 1.00032; }
|
195
|
+
|
196
|
+
88% {
|
197
|
+
-webkit-transform: matrix(1, 0, 0, 1, 0, 50.0005);
|
198
|
+
opacity: 1.00007; }
|
199
|
+
|
200
|
+
92% {
|
201
|
+
-webkit-transform: matrix(1, 0, 0, 1, 0, 49.99956);
|
202
|
+
opacity: 0.99994; }
|
203
|
+
|
204
|
+
96% {
|
205
|
+
-webkit-transform: matrix(1, 0, 0, 1, 0, 49.99913);
|
206
|
+
opacity: 0.99988; }
|
207
|
+
|
208
|
+
100% {
|
209
|
+
-webkit-transform: matrix(1, 0, 0, 1, 0, 50);
|
210
|
+
opacity: 1; } }
|
211
|
+
|
212
|
+
.bbm-modal--open {
|
213
|
+
-webkit-animation-duration: 0.3s;
|
214
|
+
-webkit-animation-name: bbm-open;
|
215
|
+
-webkit-animation-timing-function: linear;
|
216
|
+
-webkit-animation-fill-mode: both;
|
217
|
+
-webkit-transform-origin: 50% 50%;
|
218
|
+
-webkit-backface-visibility: hidden; }
|
219
|
+
|
220
|
+
/* Open a stacked modal */
|
221
|
+
@-webkit-keyframes bbm-stacked {
|
222
|
+
0% {
|
223
|
+
-webkit-transform: matrix(0.99874, 0, 0, 0.99874, 0, 49.1187);
|
224
|
+
opacity: 0.93705; }
|
225
|
+
|
226
|
+
4% {
|
227
|
+
-webkit-transform: matrix(0.99705, 0, 0, 0.99705, 0, 47.93192);
|
228
|
+
opacity: 0.85228; }
|
229
|
+
|
230
|
+
8% {
|
231
|
+
-webkit-transform: matrix(0.99533, 0, 0, 0.99533, 0, 46.73078);
|
232
|
+
opacity: 0.76648; }
|
233
|
+
|
234
|
+
12% {
|
235
|
+
-webkit-transform: matrix(0.99381, 0, 0, 0.99381, 0, 45.66645);
|
236
|
+
opacity: 0.69046; }
|
237
|
+
|
238
|
+
16% {
|
239
|
+
-webkit-transform: matrix(0.99257, 0, 0, 0.99257, 0, 44.80009);
|
240
|
+
opacity: 0.62858; }
|
241
|
+
|
242
|
+
20% {
|
243
|
+
-webkit-transform: matrix(0.99163, 0, 0, 0.99163, 0, 44.13933);
|
244
|
+
opacity: 0.58138; }
|
245
|
+
|
246
|
+
24% {
|
247
|
+
-webkit-transform: matrix(0.99095, 0, 0, 0.99095, 0, 43.66342);
|
248
|
+
opacity: 0.54739; }
|
249
|
+
|
250
|
+
28% {
|
251
|
+
-webkit-transform: matrix(0.99049, 0, 0, 0.99049, 0, 43.33951);
|
252
|
+
opacity: 0.52425; }
|
253
|
+
|
254
|
+
32% {
|
255
|
+
-webkit-transform: matrix(0.99019, 0, 0, 0.99019, 0, 43.1325);
|
256
|
+
opacity: 0.50946; }
|
257
|
+
|
258
|
+
36% {
|
259
|
+
-webkit-transform: matrix(0.99002, 0, 0, 0.99002, 0, 43.01034);
|
260
|
+
opacity: 0.50074; }
|
261
|
+
|
262
|
+
40% {
|
263
|
+
-webkit-transform: matrix(0.98992, 0, 0, 0.98992, 0, 42.94639);
|
264
|
+
opacity: 0.49617; }
|
265
|
+
|
266
|
+
44% {
|
267
|
+
-webkit-transform: matrix(0.98989, 0, 0, 0.98989, 0, 42.92001);
|
268
|
+
opacity: 0.49429; }
|
269
|
+
|
270
|
+
48% {
|
271
|
+
-webkit-transform: matrix(0.98988, 0, 0, 0.98988, 0, 42.91606);
|
272
|
+
opacity: 0.494; }
|
273
|
+
|
274
|
+
52% {
|
275
|
+
-webkit-transform: matrix(0.98989, 0, 0, 0.98989, 0, 42.92411);
|
276
|
+
opacity: 0.49458; }
|
277
|
+
|
278
|
+
56% {
|
279
|
+
-webkit-transform: matrix(0.98991, 0, 0, 0.98991, 0, 42.93736);
|
280
|
+
opacity: 0.49553; }
|
281
|
+
|
282
|
+
60% {
|
283
|
+
-webkit-transform: matrix(0.98993, 0, 0, 0.98993, 0, 42.95167);
|
284
|
+
opacity: 0.49655; }
|
285
|
+
|
286
|
+
64% {
|
287
|
+
-webkit-transform: matrix(0.98995, 0, 0, 0.98995, 0, 42.96482);
|
288
|
+
opacity: 0.49749; }
|
289
|
+
|
290
|
+
68% {
|
291
|
+
-webkit-transform: matrix(0.98997, 0, 0, 0.98997, 0, 42.97579);
|
292
|
+
opacity: 0.49827; }
|
293
|
+
|
294
|
+
72% {
|
295
|
+
-webkit-transform: matrix(0.98998, 0, 0, 0.98998, 0, 42.98433);
|
296
|
+
opacity: 0.49888; }
|
297
|
+
|
298
|
+
76% {
|
299
|
+
-webkit-transform: matrix(0.98999, 0, 0, 0.98999, 0, 42.99059);
|
300
|
+
opacity: 0.49933; }
|
301
|
+
|
302
|
+
80% {
|
303
|
+
-webkit-transform: matrix(0.98999, 0, 0, 0.98999, 0, 42.99494);
|
304
|
+
opacity: 0.49964; }
|
305
|
+
|
306
|
+
84% {
|
307
|
+
-webkit-transform: matrix(0.99, 0, 0, 0.99, 0, 42.99777);
|
308
|
+
opacity: 0.49984; }
|
309
|
+
|
310
|
+
88% {
|
311
|
+
-webkit-transform: matrix(0.99, 0, 0, 0.99, 0, 42.9995);
|
312
|
+
opacity: 0.49996; }
|
313
|
+
|
314
|
+
92% {
|
315
|
+
-webkit-transform: matrix(0.99, 0, 0, 0.99, 0, 43.00044);
|
316
|
+
opacity: 0.50003; }
|
317
|
+
|
318
|
+
96% {
|
319
|
+
-webkit-transform: matrix(0.99, 0, 0, 0.99, 0, 43.00088);
|
320
|
+
opacity: 0.50006; }
|
321
|
+
|
322
|
+
100% {
|
323
|
+
-webkit-transform: matrix(0.99, 0, 0, 0.99, 0, 43);
|
324
|
+
opacity: 0.5; } }
|
@@ -0,0 +1,71 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
|
2
|
+
<html xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
|
3
|
+
|
4
|
+
|
5
|
+
<head>
|
6
|
+
<meta content="text/html;charset=UTF-8" http-equiv="Content-Type"/>
|
7
|
+
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"/>
|
8
|
+
|
9
|
+
<title>Single view modal</title>
|
10
|
+
|
11
|
+
<script type="text/javascript" src="vendor/jquery-1.9.1.js"></script>
|
12
|
+
<script type="text/javascript" src="vendor/underscore.js"></script>
|
13
|
+
<script type="text/javascript" src="vendor/backbone.js"></script>
|
14
|
+
|
15
|
+
<!-- Adding Backbone.Modal extension here -->
|
16
|
+
<link type="text/css" rel="stylesheet" href="vendor/backbone.modal.css">
|
17
|
+
<link type="text/css" rel="stylesheet" href="vendor/backbone.modal.theme.css">
|
18
|
+
<script type="text/javascript" src="vendor/backbone.modal.js"></script>
|
19
|
+
|
20
|
+
<!-- Custom style -->
|
21
|
+
<link type="text/css" rel="stylesheet" href="css/style.css">
|
22
|
+
</head>
|
23
|
+
|
24
|
+
|
25
|
+
<body>
|
26
|
+
<a href="#" class="open">Open modal</a>
|
27
|
+
|
28
|
+
<div class="app"></div>
|
29
|
+
|
30
|
+
<script type="text/template" id="modal-template">
|
31
|
+
<div class="bbm-modal__topbar">
|
32
|
+
<h3 class="bbm-modal__title">Backbone.Modal</h3>
|
33
|
+
</div>
|
34
|
+
<div class="bbm-modal__section">
|
35
|
+
<p>With Backbone.Modal you can create a modals in a few lines of code.</p>
|
36
|
+
<p>Some features are:</p>
|
37
|
+
<ul>
|
38
|
+
<li>Really flexible and easy to set up.</li>
|
39
|
+
<li>Default behaviors like ESC or clicking outside a modal.</li>
|
40
|
+
<li>Some awesome animations that make them feel robust.</li>
|
41
|
+
<li>Responsive and usable on mobile devices.</li>
|
42
|
+
</ul>
|
43
|
+
</div>
|
44
|
+
<div class="bbm-modal__bottombar">
|
45
|
+
<a href="#" class="bbm-button">Close</a>
|
46
|
+
</div>
|
47
|
+
</script>
|
48
|
+
|
49
|
+
<script>
|
50
|
+
jQuery(function($) {
|
51
|
+
|
52
|
+
// Create a modal view class
|
53
|
+
var Modal = Backbone.Modal.extend({
|
54
|
+
template: _.template($('#modal-template').html()),
|
55
|
+
cancelEl: '.bbm-button'
|
56
|
+
});
|
57
|
+
|
58
|
+
|
59
|
+
$('.open').on('click', function(){
|
60
|
+
|
61
|
+
// Render an instance of your modal
|
62
|
+
var modalView = new Modal();
|
63
|
+
$('.app').html(modalView.render().el);
|
64
|
+
|
65
|
+
});
|
66
|
+
|
67
|
+
$('.open').click()
|
68
|
+
});
|
69
|
+
</script>
|
70
|
+
</body>
|
71
|
+
</html>
|
@@ -0,0 +1,104 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
|
2
|
+
<html xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
|
3
|
+
|
4
|
+
|
5
|
+
<head>
|
6
|
+
<meta content="text/html;charset=UTF-8" http-equiv="Content-Type"/>
|
7
|
+
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"/>
|
8
|
+
|
9
|
+
<title>Tab based modal</title>
|
10
|
+
|
11
|
+
<script type="text/javascript" src="vendor/jquery-1.9.1.js"></script>
|
12
|
+
<script type="text/javascript" src="vendor/underscore.js"></script>
|
13
|
+
<script type="text/javascript" src="vendor/backbone.js"></script>
|
14
|
+
|
15
|
+
<!-- Adding Backbone.Modal extension here -->
|
16
|
+
<link type="text/css" rel="stylesheet" href="vendor/backbone.modal.css">
|
17
|
+
<link type="text/css" rel="stylesheet" href="vendor/backbone.modal.theme.css">
|
18
|
+
<script type="text/javascript" src="vendor/backbone.modal.js"></script>
|
19
|
+
|
20
|
+
<!-- Custom style -->
|
21
|
+
<link type="text/css" rel="stylesheet" href="css/style.css">
|
22
|
+
|
23
|
+
|
24
|
+
</head>
|
25
|
+
|
26
|
+
<body>
|
27
|
+
<a href="#" class="open">Open modal</a>
|
28
|
+
|
29
|
+
<div class="app"></div>
|
30
|
+
|
31
|
+
<!-- The modal structure, with an container element that will contain all tabs -->
|
32
|
+
<script type="text/template" id="modal-template">
|
33
|
+
<div class="bbm-modal__topbar">
|
34
|
+
<ul>
|
35
|
+
<li class="bbm-modal__tab"><a href="#" id="tab1" class="active">General</a></li>
|
36
|
+
<li class="bbm-modal__tab"><a href="#" id="tab2">Account</a></li>
|
37
|
+
</ul>
|
38
|
+
</div>
|
39
|
+
|
40
|
+
<div class="my-container"></div>
|
41
|
+
<div class="bbm-modal__bottombar">
|
42
|
+
<a href="#" class="bbm-button">Done</a>
|
43
|
+
</div>
|
44
|
+
</script>
|
45
|
+
|
46
|
+
<!-- Tab 1 -->
|
47
|
+
<script type="text/template" id="modal-view1-template">
|
48
|
+
<div class="bbm-modal__section">
|
49
|
+
<h3>Tab based example</h3>
|
50
|
+
<p>It's also really easy to create a modal, with seperate views that you can control using tabs.</p>
|
51
|
+
<p>We're also using a default style, but you can overwrite anything you want.</p>
|
52
|
+
</div>
|
53
|
+
</script>
|
54
|
+
|
55
|
+
<!-- Tab 2 -->
|
56
|
+
<script type="text/template" id="modal-view2-template">
|
57
|
+
<div class="bbm-modal__section">
|
58
|
+
Your account details
|
59
|
+
</div>
|
60
|
+
</script>
|
61
|
+
|
62
|
+
<script>
|
63
|
+
jQuery(function($) {
|
64
|
+
|
65
|
+
// Create a modal view class
|
66
|
+
var Modal = Backbone.Modal.extend({
|
67
|
+
template: _.template($('#modal-template').html()),
|
68
|
+
|
69
|
+
viewContainer: '.my-container',
|
70
|
+
submitEl: '.bbm-button',
|
71
|
+
|
72
|
+
views: {
|
73
|
+
'click #tab1': {
|
74
|
+
name: 'tab1',
|
75
|
+
view: _.template($('#modal-view1-template').html()),
|
76
|
+
onActive: 'setActive'
|
77
|
+
},
|
78
|
+
'click #tab2': {
|
79
|
+
name: 'tab2',
|
80
|
+
view: _.template($('#modal-view2-template').html()),
|
81
|
+
onActive: 'setActive'
|
82
|
+
}
|
83
|
+
},
|
84
|
+
|
85
|
+
setActive: function(options) {
|
86
|
+
this.$('.bbm-modal__tab a').removeClass('active');
|
87
|
+
this.$('#'+options.name).addClass('active');
|
88
|
+
}
|
89
|
+
});
|
90
|
+
|
91
|
+
$('.open').on('click', function(){
|
92
|
+
|
93
|
+
// Render an instance of your modal
|
94
|
+
var modalView = new Modal();
|
95
|
+
$('.app').html(modalView.render().el);
|
96
|
+
|
97
|
+
});
|
98
|
+
|
99
|
+
$('.open').click()
|
100
|
+
|
101
|
+
});
|
102
|
+
</script>
|
103
|
+
</body>
|
104
|
+
</html>
|
@@ -0,0 +1,105 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
|
2
|
+
<html xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
|
3
|
+
<head>
|
4
|
+
<meta content="text/html;charset=UTF-8" http-equiv="Content-Type"/>
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"/>
|
6
|
+
<title>Stacked modal with Marionette</title>
|
7
|
+
|
8
|
+
<script type="text/javascript" src="vendor/jquery-1.9.1.js"></script>
|
9
|
+
<script type="text/javascript" src="vendor/underscore.js"></script>
|
10
|
+
<script type="text/javascript" src="vendor/backbone.js"></script>
|
11
|
+
<script type="text/javascript" src="vendor/marionette.js"></script>
|
12
|
+
|
13
|
+
<!-- Adding Backbone.Modal extension here -->
|
14
|
+
<link type="text/css" rel="stylesheet" href="vendor/backbone.modal.css">
|
15
|
+
<link type="text/css" rel="stylesheet" href="vendor/backbone.modal.theme.css">
|
16
|
+
|
17
|
+
<script type="text/javascript" src="vendor/backbone.modal.js"></script>
|
18
|
+
<script type="text/javascript" src="vendor/backbone.marionette.modals.js"></script>
|
19
|
+
|
20
|
+
<!-- Custom style -->
|
21
|
+
<link type="text/css" rel="stylesheet" href="css/style.css">
|
22
|
+
|
23
|
+
</head>
|
24
|
+
<body>
|
25
|
+
<a href="#" class="open-1">Open modal</a>
|
26
|
+
|
27
|
+
<div class="app"></div>
|
28
|
+
|
29
|
+
<!-- Region container -->
|
30
|
+
<script type="text/template" id="modals-template">
|
31
|
+
<div class="modals-container"></div>
|
32
|
+
</script>
|
33
|
+
|
34
|
+
<!-- Modal templates -->
|
35
|
+
<script type="text/template" id="modal-template1">
|
36
|
+
<div class="bbm-modal__topbar">
|
37
|
+
<h3 class="bbm-modal__title">Stacked modals with Backbone.Marionette</h3>
|
38
|
+
</div>
|
39
|
+
<div class="bbm-modal__section">
|
40
|
+
<p>Go ahead and open the <a href="#" class="open-2">second modal</a>.</p>
|
41
|
+
</div>
|
42
|
+
<div class="bbm-modal__bottombar">
|
43
|
+
<a href="#" class="bbm-button">Done</a>
|
44
|
+
</div>
|
45
|
+
</script>
|
46
|
+
|
47
|
+
<script type="text/template" id="modal-template2">
|
48
|
+
<div class="bbm-modal__topbar">
|
49
|
+
<h3 class="bbm-modal__title">The stacked modal</h3>
|
50
|
+
</div>
|
51
|
+
<div class="bbm-modal__section">
|
52
|
+
<p>By using Backbone.Marionette, your code stays simple and clean. So now we can create stacked modals, without doing any complex work.</p>
|
53
|
+
</div>
|
54
|
+
<div class="bbm-modal__bottombar">
|
55
|
+
<a href="#" class="bbm-button">Done</a>
|
56
|
+
</div>
|
57
|
+
</script>
|
58
|
+
|
59
|
+
<script>
|
60
|
+
jQuery(function($) {
|
61
|
+
|
62
|
+
// Create a layout class
|
63
|
+
var Layout = Backbone.Marionette.Layout.extend({
|
64
|
+
template: _.template($('#modals-template').html()),
|
65
|
+
regions: {
|
66
|
+
modals: {
|
67
|
+
selector: '.modals-container',
|
68
|
+
regionType: Backbone.Marionette.Modals
|
69
|
+
}
|
70
|
+
}
|
71
|
+
});
|
72
|
+
|
73
|
+
// Create a modal view class
|
74
|
+
var Modal1 = Backbone.Modal.extend({
|
75
|
+
template: _.template($('#modal-template1').html()),
|
76
|
+
submitEl: '.bbm-button',
|
77
|
+
events: {
|
78
|
+
'click .open-2': 'openModal'
|
79
|
+
},
|
80
|
+
openModal: function(e) {
|
81
|
+
e.preventDefault();
|
82
|
+
myLayout.modals.show(new Modal2());
|
83
|
+
}
|
84
|
+
});
|
85
|
+
|
86
|
+
var Modal2 = Backbone.Modal.extend({
|
87
|
+
template: _.template($('#modal-template2').html()),
|
88
|
+
submitEl: '.bbm-button'
|
89
|
+
});
|
90
|
+
|
91
|
+
// Render the layout
|
92
|
+
var myLayout = new Layout();
|
93
|
+
$('body').append(myLayout.render().el);
|
94
|
+
|
95
|
+
// Render modals on click
|
96
|
+
$('body').on('click', '.open-1', function(){
|
97
|
+
myLayout.modals.show(new Modal1());
|
98
|
+
});
|
99
|
+
|
100
|
+
$('.open-1').click()
|
101
|
+
|
102
|
+
});
|
103
|
+
</script>
|
104
|
+
</body>
|
105
|
+
</html>
|