forked from airbnb/backpack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
1019 lines (919 loc) · 38.5 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE HTML>
<html lang="en-us">
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>Backpack.js User Guide</title>
<link rel="stylesheet" href="./lib/css/Backpack.css" type="text/css" media="screen">
<link rel="stylesheet" href="./assets/css/docs.css" type="text/css" media="screen">
<link rel="stylesheet" href="./assets/css/prettify.css" type="text/css" media="screen">
<!-- Satisfy the IE Gods -->
<!--[if gte IE 9]>
<style type="text/css"> .gradient { filter: none; } </style>
<![endif]-->
<!-- TypeKit -->
<script type="text/javascript" src="http://use.typekit.com/khy0ojp.js"></script>
<script type="text/javascript">try{Typekit.load();}catch(e){}</script>
</head>
<body class='backpack tk-proxima-nova-alt'>
<aside id='sidebar'>
<a href='#' class='logo'><img src='./assets/img/backpack-icon.png' height='70' /></a>
</aside>
<section id='guideContainer'>
<section id='guide'>
<section id='header'>
<h1 class='big-h1 w310'>Backpack.js</h1>
<h2 class='big-h2 w310'>Grab your backpack and enjoy the Views</h2>
<h3 class='big-h3 w310'>Backpack.js is a lightweight Backbone extension for composing and structuring UI components</h3>
<!-- <div class='github-social w310'>
<iframe src="http://ghbtns.com/github-btn.html?user=airbnb&repo=backpack.js&type=watch&count=true"
allowtransparency="true" frameborder="0" scrolling="0"
width="90px" height="30px"></iframe>
<iframe src="http://ghbtns.com/github-btn.html?user=airbnb&repo=backpack.js&type=fork&count=true"
allowtransparency="true" frameborder="0" scrolling="0"
width="90px" height="30px"></iframe>
<iframe src="http://ghbtns.com/github-btn.html?user=airbnb&repo=backpack.js&type=follow"
allowtransparency="true" frameborder="0" scrolling="0"
width="111px" height="30px"></iframe>
<iframe allowtransparency="true" frameborder="0" scrolling="no"
src="//platform.twitter.com/widgets/tweet_button.html?url=https://git.io/backpackjs&counturl=https://airbnb.github.com/backpack.js&text=Check out Backpack.js, lightweight Backbone extension for UI components&via=airbnb"
style="width:90px; height:20px;"></iframe>
<a href="https://twitter.com/backpackjs" class="twitter-follow-button"
data-show-count="false">Follow @backpackjs</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
</div> -->
</section>
<section class='bottom-60 clearfix'>
<a href='https://github.com/airbnb/backpack.js/zipball/master'
class='download button round tk-proxima-nova-alt-ext-cond
orange'>
Download Backpack.js
</a>
<a href='https://github.com/airbnb/backpack.js'
class='fork button round tk-proxima-nova-alt-ext-cond
'>
Fork on Github
</a>
</section>
<section class='bottom-60'>
<a id='Introduction'>
<h3 class='title-h3'>Introduction</h3>
</a>
<p>
Backpack.js is a lightweight Backbone extension for composing and
structuring UI components, and was built by a couple
of <a href='http://www.airbnb.com/jobs'>Airbnb Engineers</a>.
</p>
<p>
Backpack's focus is to be a helper for storing and structuring
decoupled, extensible UI components. Think of it as a roll-your-own
YUI or jQuery UI, with components built with Backbone.Views. It's a
micro-library that you build on as you go.
</p>
<p>
Your Backpack will come with some common UI components that you can
easily extend. As you build out your app, you'll start throwing
more components in your backpack. Then you just pull out the components
you need when you need them.
</p>
<p>
This initial release is the result of our work abstracting
components that we built for the Airbnb mobile site.
We would like to open this initial release to the
community to hear your thoughts and welcome
contributions and ideas for its future.
</p>
</section>
<section class='bottom-60'>
<a id='Overview'>
<h3 class='title-h3'>Overview</h3>
</a>
<!--
=======================================
Backpack
=======================================
-->
<section class='component description clearfix'>
<a id='BP'>
<h4 class='title-h4'>Backpack</h4>
</a>
<p>
Backpack is the global namespace everything gets attached too.
Backpack also comes equiped with a ham radio. It extends Backbone.Events,
so you have a global dispatcher/observer at your disposal.
</p>
</section>
<!--
=======================================
Backpack.Component
=======================================
-->
<section class='component description clearfix'>
<a id='Component'>
<h4 class='title-h4'>Backpack.Component</h4>
</a>
<p>
Component is the base View which all Backpack.js components
extend. It provides convenient helper methods for manipulating
the component and it’s content, many of which follow a syntax
similar to jQuery in that methods can be chained, or
alternatively can be passed in upon initialization of the
component.
</p>
<p>
Component provides the following convenience methods to
all components:
</p>
<ul>
<li><pre>render</pre></li>
<li><pre>show</pre></li>
<li><pre>hide</pre></li>
<li><pre>close</pre></li>
<li><pre>remove</pre></li>
<li><pre>before</pre></li>
<li><pre>after</pre></li>
<li><pre>append</pre></li>
<li><pre>prepend</pre></li>
<li><pre>content</pre></li>
<li><pre>setContent</pre></li>
<li><pre>parent</pre></li>
<li><pre>addClass</pre></li>
<li><pre>removeClass</pre></li>
<li><pre>css</pre></li>
<li><pre>name</pre></li>
<li><pre>slug</pre></li>
</ul>
<!-- <table>
<thead class='chrome'>
<td>Method</td>
<td>Options</td>
<td>Defaults</td>
<td>Description</td>
</thead>
<tr>
<td><pre>render</pre></td>
<td>true | false</td>
<td>true</td>
<td></td>
</tr>
<tr>
<td><pre>show</pre></td>
<td>true | false</td>
<td>true</td>
<td></td>
</tr>
<tr>
<td><pre>hide</pre></td>
<td>true | false</td>
<td>false</td>
<td></td>
</tr>
<tr>
<td><pre>close</pre></td>
<td>true | false</td>
<td>false</td>
<td></td>
</tr>
<tr>
<td><pre>remove</pre></td>
<td>true | false</td>
<td>false</td>
<td></td>
</tr>
<tr>
<td><pre>before</pre></td>
<td>string | View</td>
<td><em>noop</em></td>
<td><strong>@returns</strong> <em>this</em></td>
</tr>
<tr>
<td><pre>after</pre></td>
<td>string | View</td>
<td><em>noop</em></td>
<td><strong>@returns</strong> <em>this</em></td>
</tr>
<tr>
<td><pre>append</pre></td>
<td>string | View</td>
<td><em>noop</em></td>
<td><strong>@returns</strong> <em>this</em></td>
</tr>
<tr>
<td><pre>prepend</pre></td>
<td>string | View</td>
<td><em>noop</em></td>
<td><strong>@returns</strong> <em>this</em></td>
</tr>
<tr>
<td><pre>content</pre></td>
<td>string | View</td>
<td><em>noop</em></td>
<td><strong>@returns</strong> <em>this</em></td>
</tr>
<tr>
<td><pre>setContent</pre></td>
<td>string | View</td>
<td><em>noop</em></td>
<td></td>
</tr>
<tr>
<td><pre>parent</pre></td>
<td>selector</td>
<td><em>'body'</em></td>
<td><strong>@returns</strong> <em>this</em></td>
</tr>
<tr>
<td><pre>addClass</pre></td>
<td>string</td>
<td><em>noop</em></td>
<td><strong>@returns</strong> <em>this</em></td>
</tr>
<tr>
<td><pre>removeClass</pre></td>
<td>string</td>
<td><em>noop</em></td>
<td><strong>@returns</strong> <em>this</em></td>
</tr>
<tr>
<td><pre>name</pre></td>
<td>string</td>
<td><em>noop</em></td>
<td><strong>@returns</strong> <em>this</em></td>
</tr>
<tr>
<td><pre>slug</pre></td>
<td>string | html | View</td>
<td><em>noop</em></td>
<td>Replaces spaces with dashes<br/> <strong>@returns</strong> {string}</td>
</tr>
</table> -->
</section>
<!--
=======================================
Backpack.Tabs
=======================================
-->
<section class='tabs description clearfix'>
<a id='Tabs'>
<h4 class='title-h4'>Backpack.Tabs</h4>
</a>
<p>
Tabs are a grouping of TabItems, responsible for automatically
displaying the content associated with any given tab. Clicking
on a TabItem automatically displays the content, and can also
be extended to execute any number of given arbitrary functions.
</p>
<div class='code tab-code'></div>
<div class='tab hide'>
<pre class="prettyprint linenums">
var tabs = new Backpack.Tabs({
add: [{
content: 'Tab 1',
tabContent: 'Some tab 1 content'
},{
content: 'Tab 2',
tabContent: 'Some tab 2 content'
}]
});</pre>
</div>
<div class='tab2 hide'>
<pre class="prettyprint linenums">
var tabs = new Backpack.Tabs({});
tabs.add({
content: 'Tab 1',
tabContent: 'Some tab 1 content'
});
tabs.add({
content: 'Tab 2',
tabContent: 'Some tab 2 content'
});
tabs.add({
content: 'Tab 3',
tabContent: 'Some tab 3 content'
},{
content: 'Tab 4',
tabContent: 'Some tab 4 content'
});</pre>
</div>
</section>
<!--
=======================================
Backpack.Menu
=======================================
-->
<section class='menu description clearfix'>
<a id='Menu'>
<h4 class='title-h4'>Backpack.Menu</h4>
</a>
<p>
Menu is a means of displaying many MenuItem objects. A MenuItem
can consist of text, or any amount of arbitrary HTML (images,
for example). When clicked, a MenuItem is capable of redirecting
a user to a simple URL or executing any arbitrary function.
</p>
<div class='code menu-code'></div>
<div class='simple hide'>
<pre class="prettyprint linenums">
var menu = new Backpack.Menu({
parent: this,
add: [{
content: 'Menu Item 1',
events: '#Menu'
},{
content: 'Airbnb',
events: 'http://airbnb.com'
},{
content: 'Menu Item 2',
events: function() {
return console.log('test');
}
},{
content: 'Menu Item 3',
events: {
'click':
function() {
console.log('click');
},
'mouseenter':
function() {
console.log('mouseenter');
}
}
}]
});</pre>
<button class='round tk-proxima-nova-alt-ext-cond orange'
onclick="javascript:eval(new Backpack.Modal({
content: new Backpack.Menu({
parent: this,
add: [{
content: 'Menu Item 1',
events: '#Menu'
},{
content: 'Airbnb',
events: 'http://airbnb.com',
css: {
'float': 'right'
}
},{
content: 'Menu Item 2',
events: function() {
return console.log('test');
}
},{
content: 'Menu Item 3',
events: {
'mouseenter': function() {
console.log('mouseenter');
},'click': function() {
console.log('click');
}
}
}]
}),
color: 'rgba(0,0,0,0.7)',
lockOverlay: false,
closable: true,
css: {
'background-color': '#eee',
'border': 'none',
'box-shadow': 'none',
'width': '960px',
'padding': '20px 40px 40px'
},
title: 'Simple Menu'
}))">Run</button>
</div>
<div class='press hide'>
<pre class="prettyprint linenums">
var menu = new Backpack.Menu({
parent: this,
addClass: 'press',
add: [{
content: 'Menu Item 1',
events: '#Menu'
},{
content: 'Airbnb',
events: 'http://airbnb.com'
},{
content: 'Menu Item 2',
events: function() {
return console.log('test');
}
},{
content: 'Menu Item 3',
events: {
'click':
function() {
console.log('click');
},
'mouseenter':
function() {
console.log('mouseenter');
}
}
}]
});</pre>
<button class='round tk-proxima-nova-alt-ext-cond orange'
onclick="javascript:eval(new Backpack.Modal({
content: new Backpack.Menu({
parent: this,
addClass: 'press',
add:
[
{
content: 'Menu Item 1',
events: '#Menu'
},
{
content: 'Menu Item 2',
events: function() {
return console.log('test');
}
},
{
content: 'Menu Item 3',
events: {
'mouseenter': function() {
console.log('mouseenter');},
'click': function() {
console.log('click');}
}
},
]
}),
color: 'rgba(0,0,0,0.7)',
lockOverlay: false,
closable: true,
css: {
'background-color': '#eee',
'border': 'none',
'box-shadow': 'none',
'width': '960px',
'padding': '20px 40px 40px'
},
title: 'Menu with Press Class'
}))">Run</button>
</div>
<div class='list hide'>
<pre class="prettyprint linenums">
var menu = new Backpack.Menu({
parent: this,
addClass: 'backpack-list',
add: [{
content: 'Menu Item 1',
events: '#Menu'
},{
content: 'Airbnb',
events: 'http://airbnb.com'
},{
content: 'Menu Item 2',
events: function() {
return console.log('test');
}
},{
content: 'Menu Item 3',
events: {
'click':
function() {
console.log('click');
},
'mouseenter':
function() {
console.log('mouseenter');
}
}
}]
});</pre>
<button class='round tk-proxima-nova-alt-ext-cond orange'
onclick="javascript:eval(new Backpack.Modal({
content: new Backpack.Menu({
parent: this,
addClass: 'backpack-list',
add:
[
{
content: 'Menu Item 1',
// events can be something like this on click
events: '#Menu'
},
{
content: 'Menu Item 2',
// events can also be a function on click
events: function() {
return console.log('test');
}
},
{
content: 'Menu Item 3',
// or events can be a normal
// events hash
events: {
'mouseenter': function() {
console.log('mouseenter');},
'click': function() {
console.log('click');}
}
},
]
}),
color: 'rgba(0,0,0,0.7)',
lockOverlay: false,
closable: true,
title: 'List Style Menu'
}))">Run</button>
</div>
</section>
<!--
=======================================
Backpack.Modal
=======================================
-->
<section class='modal description clearfix'>
<a id='Modal'>
<h4 class='title-h4'>Backpack.Modal</h4>
</a>
<p>
Depending on the properties a Modal object is initialized with,
they can be easily configured to provide two different
experiences - Popups are notifications presented in the center
of a user’s screen, and Lightboxes are notifications presented
in a similar manner, with the exception that the background
content becomes dim, drawing attention to the middle Modal.
</p>
<div class='code modal-code'></div>
<div class='popup hide'>
<pre class="prettyprint linenums">
var popup = new Backpack.Modal({
content: 'This is a simple popup modal.',
addClass: 'padding-20',
title: 'Simple Popup Modal'
});</pre>
<button class='round tk-proxima-nova-alt-ext-cond orange'
onclick="javascript:eval(new Backpack.Modal({
content: 'This is a simple popup modal.<br/><br/>It just pops up and gets in the way.',
addClass: 'padding-20',
title: 'Simple Popup Modal'
}))">Run</button>
</div>
<div class='lightbox hide'>
<pre class="prettyprint linenums">
var lightbox = new Backpack.Modal({
content: 'This Modal is a bit fancier.',
addClass: 'padding-20',
color: 'rgba(0,0,0,0.7)',
closable: true,
lockOverlay: true,
title: 'Lightbox Modal'
});</pre>
<button class='round tk-proxima-nova-alt-ext-cond orange'
onclick="javascript:eval(new Backpack.Modal({
content: 'This Modal is a bit fancier.<br/><br/>It has a classy overlay in the background. This says, hey look at me, I am a Modal.<br/><br/>Sometimes that is just want you need.',
color: 'rgba(0,0,0,0.7)',
lockOverlay: true,
closable: true,
addClass: 'padding-20',
title: 'Lightbox Modal'
}))">Run</button>
</div>
</section>
<!--
=======================================
Backpack.Layout
=======================================
-->
<section class='layout description clearfix'>
<a id='Layout'>
<h4 class='title-h4'>Backpack.Layout</h4>
</a>
<p>
Layout is a simple grid helper for component placement.
Set the number of columns and gutter size and Layout
will figure out the sizing of everything. No need to
worry about class names or calculating widths.
</p>
<div class='code layout-code'></div>
<div class='basic hide'>
<pre class='prettyprint linenums'>
var testComponent = new Backpack.Component({
name: 'test component',
css: {
'background-color': 'lightgrey',
'padding': '20px'
}
});
var basic = new Backpack.Layout({
add: [{
content: testComponent
},{
content: testComponent
},{
content: testComponent
}]
});</pre>
<button class='round tk-proxima-nova-alt-ext-cond orange'
onclick="javascript:eval(new Backpack.Modal({
content: new Backpack.Layout({
parent: $(this).parent(),
add: [{
content: new Backpack.Component({
name: 'test component',
css: {
'background-color': 'lightgrey',
'padding': '20px'
}
})
},{
content: new Backpack.Component({
css: {
'background-color': 'lightgrey',
'padding': '20px'
}
})
},{
content: new Backpack.Component({
css: {
'background-color': 'lightgrey',
'padding': '20px'
}
})
}]
}),
color: 'rgba(0,0,0,0.7)',
lockOverlay: false,
closable: true,
addClass: 'padding-20',
title: '3-columns'
}))">Run</button>
</div>
</section>
<section class='bottom-60'>
<a id='Make'>
<h3 class='title-h3'>Swipe.js Example Component</h3>
</a>
<p>
It's easy to create components from existing libraries. Here's
an example of how to create a Backpack component out of the Swipe.js library.
</p>
<div class='swipe-code'></div>
<div class='gallery hide'>
<pre class='prettyprint linenums'>
window.mySwipe = new Backpack.Swipe({
parent: '.swipe-gallery',
content: ["<img src='assets/img/swipe/1.jpg'>",
"<img src='assets/img/swipe/2.jpg'>",
"<img src='assets/img/swipe/3.jpg'>",
"<img src='assets/img/swipe/4.jpg'>",
"<img src='assets/img/swipe/5.jpg'>"],
speed: 400,
continuous: true,
disableScroll: false,
callback: function(index, elem) {},
transitionEnd: function(index, elem) {}
});</pre>
</div>
<div class='swipe hide'>
<pre class='prettyprint linenums'>
class Backpack.Swipe extends Backpack.Component
id: 'slider'
config:
'type': 'swipe'
'renderType': 'append'
'startSlide': 0
'speed': 300
'auto': 4000
'continuous': true
'disableScroll': false
'callback': ->
'transitionEnd': ->
initialize: ->
super()
# being lazy and attaching it to window for now
window.s = new window.Swipe(@el, @options)
content: (slides) =>
for content in arguments
@$el.append(content)
@</pre>
</div>
<div class='swipe-gallery'></div>
<div style='text-align:center;padding-top:20px;'>
<button class='round tk-proxima-nova-alt-ext-cond' onclick='s.prev()'>prev</button>
<button class='round tk-proxima-nova-alt-ext-cond orange' onclick='s.next()'>next</button>
</div>
</section>
<section class='bottom-60'>
<a id='Contribute'>
<h3 class='title-h3'>Hack on Backpack</h3>
</a>
<p>
Backpack.js is still in it's early-days. We’re open-sourcing our
progress thus far with the hope to continue to build Backpack.js
with the help of the Backbone community.
</p>
<div class='code'>
<br/>
<a id='Started'>
<p>Getting Started</p>
</a>
<pre class='prettyprint linenums'>
git clone [email protected]:airbnb/backpack.js.git
cd backpack.js && npm install</pre>
<br/><br/>
<a id='Cake'>
<p>Cake Build Tools</p>
</a>
<pre class='prettyprint'>
cake compile # Compile CoffeeScript source files
cake build # Creates /lib_path/Backpack-bundle.js &
# /lib_path/Backpack-bundle.min.js &
# /lib_path/js/*.js
cake test # Opens Jasmine SpecRunner. Watches
# BackpackSpec-Bundle.js for changes
cake docs # Generate annotated source code
# with Docco
cake watch # Recompile CoffeeScript source files when
# modified to Backpack-bundle.js
cake watch:js # Recompile CoffeeScript source files when
# modified to individual .js files</pre>
<br/><br/>
<a id='Test'>
<p>Testing</p>
</a>
<div>
Backpack.js tests are written using <a href=''>jasmine</a> with <a href=''>sinon.js</a> and <a href=''>jasmine-sinon</a>.
</div>
<br/>
<div>
You can run the test suite with <pre class='inline'>cake test</pre>.
</div>
</div>
</section>
<footer>
<p>
Backpack.js was born at <a href='http://airbnb.com/jobs'>Airbnb HQ
</a> in sunny San Francisco, CA
</p>
<p>
With A Lovely Backpack Logo Design by
<a href='http://www.dannyprew.com/'>Danny Prew</a>
</p>
<p>
Here's Backpack's
<a href='https://github.com/airbnb/backpack.js/blob/master/LICENSE'>
Apache 2.0 License</a>
</p>
<br/>
<br/>
<a href='http://nerds.airbnb.com'>
<img src='http://a1.muscache.com/s/1318028912/images/logos/106x40.png' />
</a>
</footer>
</section>
</section>
<script src="./assets/js/prettify.js" type="text/javascript"></script>
<script src="./vendor/jquery.js" type="text/javascript"></script>
<script src="./vendor/underscore.js" type="text/javascript"></script>
<script src="./vendor/backbone.js" type="text/javascript"></script>
<script src="./vendor/swipe.js" type="text/javascript"></script>
<script src="./lib/Backpack-bundle.js" type="text/javascript"></script>
<script>
$(function() {
prettyPrint(); // thanks Google
var menu = new Backpack.Menu({
parent: '#sidebar',
addClass: 'backpack-list',
add: [{
content: 'Introduction',
events: '#Introduction'
},{
content: 'Overview',
events: '#Overview',
addClass: 'sidebar-overview'
},{
content: 'Swipe.js Example Component',
events: '#Make'
},{
content: 'Hack on Backpack',
events: '#Contribute',
addClass: 'sidebar-contribute'
},{
content: 'Github',
events: 'http://github.com/airbnb/backpack.js'
},{
content: "<img height='25' src='http://a1.muscache.com/s/1318028912/images/logos/106x40.png' />",
events: "http://nerds.airbnb.com",
addClass: 'sidebar-logo'
}]
}),
modalTabs = new Backpack.Tabs({
parent: '.modal-code',
addClass: 'round-top chrome',
add: [{
content: 'Popup',
tabContent: $('.popup').html()
},{
content: 'Lightbox',
tabContent: $('.lightbox').html()
}]
}),
menuTabs = new Backpack.Tabs({
parent: '.menu-code',
addClass: 'round-top chrome',
add: [{
content: 'Simple',
tabContent: $('.simple').html()
},{
content: 'Press',
tabContent: $('.press').html()
},{
content: 'List',
tabContent: $('.list').html()
}]
}),
tabTabs = new Backpack.Tabs({
parent: '.tab-code',
addClass: 'round-top chrome',
show: true,
add: [{
content: 'Tab 1',
tabContent: $('.tab').html()
},{
content: 'Tab 2',
tabContent: $('.tab2').html()
}]
}),
layoutTabs = new Backpack.Tabs({
parent: '.layout-code',
addClass: 'round-top chrome',
show: true,
add: [{
content: 'Basic',
tabContent: $('.basic').html()
}]
}),
swipeTabs = new Backpack.Tabs({
parent: '.swipe-code',
addClass: 'round-top chrome',
add: [{
content: 'Example',
tabContent: $('.gallery').html()
},{
content: 'Swipe Component',
tabContent: $('.swipe').html()
}]
}),
components = new Backpack.Menu({
parent: '.sidebar-overview',
addClass: 'backpack-list',
add: [{
content: '- Backpack',
events: '#BP'
},{
content: '- Backpack.Component',
events: '#Component'
},{
content: '- Backpack.Tabs',
events: '#Tabs'
},{
content: '- Backpack.Menu',
events: '#Menu'
},{
content: '- Backpack.Modal',
events: '#Modal'
}
,{
content: '- Backpack.Layout',
events: '#Layout'
}
]
}),
contribute = new Backpack.Menu({
parent: '.sidebar-contribute',
addClass: 'backpack-list',
add: [{
content: '- Getting Started',
events: '#Started'
},{
content: '- Cake Build Tools',
events: '#Cake'
},{
content: '- Jasmine Tests',
events: '#Test'
}]
});