This repository was archived by the owner on May 29, 2019. It is now read-only.
File tree 5 files changed +49
-11
lines changed
5 files changed +49
-11
lines changed Original file line number Diff line number Diff line change 18
18
I've got an HTML heading, and a select callback. Pretty cool!
19
19
</ tab >
20
20
</ tabset >
21
+
22
+ < hr />
23
+
24
+ < tabset vertical ="true ">
25
+ < tab heading ="Vertical 1 "> Vertical content 1</ tab >
26
+ < tab heading ="Vertical 2 "> Vertical content 2</ tab >
27
+ </ tabset >
21
28
</ div >
Original file line number Diff line number Diff line change 1
1
AngularJS version of the tabs directive.
2
2
3
- Allows a ` select ` callback attribute, ` active ` binding attribute and ` disabled ` binding attribute.
3
+ ### Settings ###
4
4
5
- Allows either ` heading ` text-heading as an attribute, or a ` <tab-heading> ` element inside as the heading.
5
+ #### ` <tabset> ` ####
6
+
7
+ * ` vertical `
8
+ _ (Defaults: false)_ :
9
+ Whether tabs appear vertically stacked.
10
+
11
+ #### ` <tab> ` ####
12
+
13
+ * ` heading ` or ` <tab-heading> `
14
+ :
15
+ Heading text or HTML markup.
16
+
17
+ * ` active ` <i class =" icon-eye-open " ></i >
18
+ _ (Defaults: false)_ :
19
+ Whether tab is currently selected.
20
+
21
+ * ` disabled ` <i class =" icon-eye-open " ></i >
22
+ _ (Defaults: false)_ :
23
+ Whether tab is clickable and can be activated.
24
+
25
+ * ` select() `
26
+ _ (Defaults: null)_ :
27
+ An optional expression called when tab is activated.
Original file line number Diff line number Diff line change @@ -43,7 +43,10 @@ function TabsetCtrl($scope, $element) {
43
43
transclude : true ,
44
44
scope : { } ,
45
45
controller : 'TabsetController' ,
46
- templateUrl : 'template/tabs/tabset.html'
46
+ templateUrl : 'template/tabs/tabset.html' ,
47
+ link : function ( scope , element , attrs ) {
48
+ scope . vertical = angular . isDefined ( attrs . vertical ) ? scope . $eval ( attrs . vertical ) : false ;
49
+ }
47
50
} ;
48
51
} )
49
52
Original file line number Diff line number Diff line change @@ -404,13 +404,6 @@ describe('tabs', function() {
404
404
scope . $apply ( ) ;
405
405
} ) ) ;
406
406
407
- function titles ( ) {
408
- return elm . find ( 'ul.nav-tabs li' ) ;
409
- }
410
- function contents ( ) {
411
- return elm . find ( 'div.tab-content div.tab-pane' ) ;
412
- }
413
-
414
407
function expectTabActive ( activeTab ) {
415
408
var _titles = titles ( ) ;
416
409
angular . forEach ( scope . tabs , function ( tab , i ) {
@@ -454,4 +447,17 @@ describe('tabs', function() {
454
447
} ) ;
455
448
} ) ;
456
449
450
+ describe ( 'vertical' , function ( ) {
451
+ beforeEach ( inject ( function ( $compile , $rootScope ) {
452
+ scope = $rootScope . $new ( ) ;
453
+
454
+ elm = $compile ( '<tabset vertical="true"></tabset>' ) ( scope ) ;
455
+ scope . $apply ( ) ;
456
+ } ) ) ;
457
+
458
+ it ( 'to stack tabs' , function ( ) {
459
+ expect ( elm . find ( 'ul.nav-tabs' ) ) . toHaveClass ( 'nav-stacked' ) ;
460
+ } ) ;
461
+ } ) ;
462
+
457
463
} ) ;
Original file line number Diff line number Diff line change 1
1
2
2
< div class ="tabbable ">
3
- < ul class ="nav nav-tabs " ng-transclude >
3
+ < ul class ="nav nav-tabs " ng-class =" {'nav-stacked': vertical} " ng- transclude>
4
4
</ ul >
5
5
< div class ="tab-content ">
6
6
< div class ="tab-pane "
You can’t perform that action at this time.
0 commit comments