Skip to content
This repository has been archived by the owner on May 29, 2019. It is now read-only.

Commit

Permalink
tabs orientation wip
Browse files Browse the repository at this point in the history
  • Loading branch information
pkozlowski-opensource committed Feb 2, 2013
1 parent 4629071 commit aaa8d81
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 9 deletions.
24 changes: 18 additions & 6 deletions src/tabs/docs/demo.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,22 @@
<div ng-controller="TabsDemoCtrl">
<h3>Basic tabs</h3>
<tabs>
<pane heading="Static title">Static content</pane>
<pane ng-repeat="pane in panes" heading="{{pane.title}}" active="pane.active">{{pane.content}}</pane>
<pane heading="Static title" style="padding-bottom: 9px; border-bottom: 1px solid #ddd;">
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin lacinia, ante sit amet pharetra vulputate, augue velit dignissim libero, in blandit neque sapien at sapien. Sed lacinia tellus quis risus consectetur egestas. In hac habitasse platea dictumst.
</pane>
<pane ng-repeat="pane in panes" heading="{{pane.title}}" active="pane.active" style="padding-bottom: 9px; border-bottom: 1px solid #ddd;">{{pane.content}}</pane>
</tabs>
<p>
<button class="btn btn-mini" ng-click="panes[0].active = true">Select second tab</button>
<button class="btn btn-mini" ng-click="panes[1].active = true">Select third tab</button>
</p>
<h3>Different tab placements</h3>
<h4>Left</h4>
<tabs placement="left">
<pane ng-repeat="pane in panes" heading="{{pane.title}}">{{pane.content}}</pane>
</tabs>
<h4>Right</h4>
<tabs placement="right">
<pane ng-repeat="pane in panes" heading="{{pane.title}}">{{pane.content}}</pane>
</tabs>
<div class="row-fluid">
<button class="btn" ng-click="panes[0].active = true">Select second tab</button>
<button class="btn" ng-click="panes[1].active = true">Select third tab</button>
</div>
</div>
8 changes: 7 additions & 1 deletion src/tabs/docs/readme.md
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
AngularJS version of the tabs directive.
AngularJS version of the tabs directive.

Individual tabs can be created statically, from markup, or generated from model using the `ng-repeat directive`.

Tabs selection can be driven by mouse `click` event or in response to model changes (see the `active` attribute).

It is also possible to change placement of tabs using the `placement` attribute.
4 changes: 3 additions & 1 deletion src/tabs/tabs.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ angular.module('ui.bootstrap.tabs', [])
return {
restrict: 'EA',
transclude: true,
scope: {},
scope: {
placement: '@'
},
controller: 'TabsController',
templateUrl: 'template/tabs/tabs.html',
replace: true
Expand Down
2 changes: 1 addition & 1 deletion template/tabs/tabs.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div class="tabbable">
<div class="tabbable" ng-class='placement && "tabs-" + placement'>
<ul class="nav nav-tabs">
<li ng-repeat="pane in panes" ng-class="{active:pane.selected}">
<a href="" ng-click="select(pane)">{{pane.heading}}</a>
Expand Down

3 comments on commit aaa8d81

@jhiemer
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Pawel,
this looks like a quite good solution to the problem discussed. I would vote for it. :-)

@pkozlowski-opensource
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool :-)

There are only 2 problems:

  • demo sucks .... sorry...
  • supporting tabs at the bottom would require using ng-switch and would make a template somehow more complex (not to mention new scope created...). But we could start without the bottom option.

@jhiemer
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi there,

  • first one should be fixable. :-)
  • second one is fine, without bottom. Seems rather attractive to me anyway regarding UI principles.

Please sign in to comment.