Skip to content

Commit

Permalink
test(list): update with sidemenu
Browse files Browse the repository at this point in the history
  • Loading branch information
ajoslin committed Mar 26, 2014
1 parent c1dbe04 commit 8ec7c00
Show file tree
Hide file tree
Showing 2 changed files with 114 additions and 101 deletions.
3 changes: 2 additions & 1 deletion js/ext/angular/src/directive/ionicSideMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,8 @@ angular.module('ionic.ui.sideMenu', ['ionic.service.gesture', 'ionic.service.vie
restrict: 'AC',
require: '^ionSideMenus',
link: function($scope, $element, $attr, sideMenuCtrl) {
var side = $scope.$eval($attr.menuToggle) || 'left';
//This is always left because scope.$eval('right') will try to read scope.right
var side = $attr.menuToggle || 'left';
$element.bind('click', function(){
if(side === 'left') {
sideMenuCtrl.toggleLeft();
Expand Down
212 changes: 112 additions & 100 deletions js/ext/angular/test/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,114 +18,126 @@
</head>
<body ng-controller="TestCtrl">
<div id="click-notify">CLICK!</div>
<ion-pane>

<header class="bar bar-header bar-positive">
<div class="buttons">
<button ng-click="toggleDelete()" class="button button-clear">{{ editBtnText }}</button>
</div>
<h1 class="title">List Tests</h1>
<div class="buttons">
<button ng-click="toggleReorder()" class="button button-clear">{{ reorderBtnText }}</button>
</div>
</header>

<ion-content class="has-header">

<ion-list show-delete="isDeletingItems"
show-reorder="isReorderingItems"
on-refresh-holding="refreshHolding()"
on-refresh-opening="refreshOpening(ratio)"
on-refresh="refreshItems()"
on-reorder="onReorder(el, start, end)"
refresh-complete="refreshComplete"
on-delete="deleteListItem(item, index)"
delete-icon="ion-minus-circled"
reorder-icon="ion-navicon"
animation="my-repeat-animation"
can-delete="true"
can-reorder="true"
can-swipe="true"
option-buttons="optionButtons1">

<!-- shows that the item directive does not need attributes and can get values from the list attributes -->
<ion-item item="item" ng-href="#" ng-click="itemClick()" class="item-thumbnail-left" ng-repeat="item in items" ng-class="{ active: item.isActive}">
<img ng-src="{{item.face}}">
<h2>{{item.from}}</h2>
<p>{{item.text}}</p>
</ion-item>

<!-- shows how a divider could be included-->
<div class="item item-divider">
Me Divider, just plain ol' HTML nested in the list directive.
</div>
<ion-side-menus>

<!-- shows it can override the attributes set by the list -->
<ion-item can-delete="false"
can-reorder="false"
can-swipe="false"
item-type="item-icon-left item-icon-right">
<i class="icon ion-stats-bars"></i>
Individual item directive, but can't do much. Overrides list attributes with its own left and right icons.
<i class="icon ion-arrow-graph-up-right"></i>
</ion-item>

<!-- shows that the item directive can receive many attributes and overrides the list attributes -->
<ion-item on-delete="deleteItem(item, index)"
delete-icon="ion-trash-a"
reorder-icon="ion-navicon-round"
can-delete="true"
can-reorder="true"
option-buttons="optionButtons2">
<i class="icon ion-person-stalker"></i>
Individual item directive and overrides list attrs with item attributes
</ion-item>

<!-- shows how a divider could be included-->
<div class="item item-divider">
Below is NOT using the item directive, but just nested HTML
</div>
<ion-side-menu-content>

<!-- shows how very simple lists don't need the item directive at all -->
<div class="item item-thumbnail-left">
<img src="http://pbs.twimg.com/profile_images/2913427048/ed94193baa04ace85aa8a8bf4bf6c5a9.jpeg">
<h2>Nic Cage</h2>
<p>I am not a demon. I am a lizard, a shark, a heat-seeking panther. I want to be Bob Denver on acid playing the accordion.</p>
<ion-header-bar class="bar-positive">
<div class="buttons">
<button ng-click="toggleDelete()" class="button button-clear">{{ editBtnText }}</button>
<button ng-click="toggleLeft()" class="button">Toggle Left Menu</button>
</div>

<a class="item item-icon-left" href="{{ item.url }}" ng-repeat="item in urlItems" ng-class="{ active: item.isActive}">
<i class="icon {{ item.icon }}"></i>
{{ item.text }}
</a>
<input type="text" placeholder="text input">
<div class="item">
<ion-slide-box show-pager="false">
<ion-slide>
<div class="box blue">
<h1>BLUE {{slideBox.slideIndex}}</h1>
</div>
</ion-slide>
<ion-slide>
<div class="box yellow">
<h1>YELLOW {{slideBox.slideIndex}}</h1>
</div>
</ion-slide>
<ion-slide>
<div class="box pink"><h1>PINK {{slideBox.slideIndex}}</h1></div>
</ion-slide>
</ion-slide-box>
<h1 class="title">List Tests</h1>
<div class="buttons">
<button ng-click="toggleReorder()" class="button button-clear">{{ reorderBtnText }}</button>
</div>

</ion-list>

</ion-content>

</ion-pane>
</ion-header-bar>

<ion-content class="has-header">

<ion-list show-delete="isDeletingItems"
show-reorder="isReorderingItems"
on-refresh-holding="refreshHolding()"
on-refresh-opening="refreshOpening(ratio)"
on-refresh="refreshItems()"
on-reorder="onReorder(el, start, end)"
refresh-complete="refreshComplete"
on-delete="deleteListItem(item, index)"
delete-icon="ion-minus-circled"
reorder-icon="ion-navicon"
animation="my-repeat-animation"
can-delete="true"
can-reorder="true"
can-swipe="true"
option-buttons="optionButtons1">

<!-- shows that the item directive does not need attributes and can get values from the list attributes -->
<ion-item item="item" ng-href="#" ng-click="itemClick()" class="item-thumbnail-left" ng-repeat="item in items" ng-class="{ active: item.isActive}">
<img ng-src="{{item.face}}">
<h2>{{item.from}}</h2>
<p>{{item.text}}</p>
</ion-item>

<!-- shows how a divider could be included-->
<div class="item item-divider">
Me Divider, just plain ol' HTML nested in the list directive.
</div>

<!-- shows it can override the attributes set by the list -->
<ion-item can-delete="false"
can-reorder="false"
can-swipe="false"
item-type="item-icon-left item-icon-right">
<i class="icon ion-stats-bars"></i>
Individual item directive, but can't do much. Overrides list attributes with its own left and right icons.
<i class="icon ion-arrow-graph-up-right"></i>
</ion-item>

<!-- shows that the item directive can receive many attributes and overrides the list attributes -->
<ion-item on-delete="deleteItem(item, index)"
delete-icon="ion-trash-a"
reorder-icon="ion-navicon-round"
can-delete="true"
can-reorder="true"
option-buttons="optionButtons2">
<i class="icon ion-person-stalker"></i>
Individual item directive and overrides list attrs with item attributes
</ion-item>

<!-- shows how a divider could be included-->
<div class="item item-divider">
Below is NOT using the item directive, but just nested HTML
</div>

<!-- shows how very simple lists don't need the item directive at all -->
<div class="item item-thumbnail-left">
<img src="http://pbs.twimg.com/profile_images/2913427048/ed94193baa04ace85aa8a8bf4bf6c5a9.jpeg">
<h2>Nic Cage</h2>
<p>I am not a demon. I am a lizard, a shark, a heat-seeking panther. I want to be Bob Denver on acid playing the accordion.</p>
</div>

<a class="item item-icon-left" href="{{ item.url }}" ng-repeat="item in urlItems" ng-class="{ active: item.isActive}">
<i class="icon {{ item.icon }}"></i>
{{ item.text }}
</a>
<input type="text" placeholder="text input">
<div class="item">
<ion-slide-box show-pager="false">
<ion-slide>
<div class="box blue">
<h1>BLUE {{slideBox.slideIndex}}</h1>
</div>
</ion-slide>
<ion-slide>
<div class="box yellow">
<h1>YELLOW {{slideBox.slideIndex}}</h1>
</div>
</ion-slide>
<ion-slide>
<div class="box pink"><h1>PINK {{slideBox.slideIndex}}</h1></div>
</ion-slide>
</ion-slide-box>
</div>

</ion-list>

</ion-content>

</ion-side-menu-content>

<ion-side-menu side="left">
Left menu!
</ion-side-menu>
</ion-side-menus>

<script>
angular.module('navTest', ['ionic'])

.controller('TestCtrl', function($scope, $timeout) {
.controller('TestCtrl', function($scope, $timeout, $ionicSideMenuDelegate) {

$scope.toggleLeft = function() {
$ionicSideMenuDelegate.toggleLeft();
};

// Build Mock Data
$scope.items = [
Expand Down

0 comments on commit 8ec7c00

Please sign in to comment.