forked from ionic-team/ionic-framework
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ddda809
commit c1215aa
Showing
13 changed files
with
1,028 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
--- | ||
name: popover | ||
component: $ionicPopover | ||
--- | ||
|
||
<ion-header-bar class="bar-positive" title="Popover" ng-controller="HeaderCtrl"> | ||
<div class="buttons"> | ||
<button class="button button-icon ion-android-more" ng-click="openPopover($event)" id="icon-btn"></button> | ||
</div> | ||
<h1 class="title">Popover</h1> | ||
<div class="buttons"> | ||
<button class="button" ng-click="openPopover2($event)" id="mid-btn">Popover 2</button> | ||
<button class="button" ng-click="openPopover($event)" id="right-btn">Popover</button> | ||
</div> | ||
</ion-header-bar> | ||
|
||
<ion-content class="padding has-header" ng-controller="PlatformCtrl"> | ||
<p> | ||
<button class="button" ng-click="setPlatform('ios')" id="ios">iOS</button> | ||
<button class="button" ng-click="setPlatform('android')" id="android">Android</button> | ||
<button class="button" ng-click="setPlatform('base')" id="base">Base</button> | ||
</p> | ||
</ion-content> | ||
|
||
<script id="popover.html" type="text/ng-template"> | ||
<ion-popover-view> | ||
<ion-header-bar> | ||
<h1 class="title">Popover Header</h1> | ||
</ion-header-bar> | ||
<ion-content> | ||
<div class="list"> | ||
<label class="item item-input"> | ||
<span class="input-label">First Name</span> | ||
<input type="text" placeholder=""> | ||
</label> | ||
<label class="item item-input"> | ||
<span class="input-label">Last Name</span> | ||
<input type="text" placeholder=""> | ||
</label> | ||
<label class="item item-input"> | ||
<span class="input-label">Email</span> | ||
<input type="text" placeholder=""> | ||
</label> | ||
<button class="button button-block button-positive">Submit</button> | ||
</div> | ||
</ion-content> | ||
</ion-popover-view> | ||
</script> | ||
|
||
|
||
<script id="popover2.html" type="text/ng-template"> | ||
<ion-popover-view> | ||
<ion-content> | ||
<div class="list"> | ||
<div class="item"> | ||
Item 1 | ||
</div> | ||
<div class="item"> | ||
Item 2 | ||
</div> | ||
<div class="item"> | ||
Item 3 | ||
</div> | ||
<div class="item"> | ||
Item 4 | ||
</div> | ||
<div class="item"> | ||
Item 5 | ||
</div> | ||
<div class="item"> | ||
Item 6 | ||
</div> | ||
</div> | ||
</ion-content> | ||
</ion-popover-view> | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
--- | ||
name: popover | ||
component: $ionicPopover | ||
--- | ||
|
||
angular.module('popover', ['ionic']) | ||
|
||
.controller('HeaderCtrl', function($scope, $ionicPopover) { | ||
|
||
$scope.openPopover = function($event) { | ||
$scope.popover.show($event); | ||
}; | ||
$ionicPopover.fromTemplateUrl('popover.html', function(popover) { | ||
$scope.popover = popover; | ||
}); | ||
|
||
$scope.openPopover2 = function($event) { | ||
$scope.popover2.show($event); | ||
}; | ||
$ionicPopover.fromTemplateUrl('popover2.html', function(popover) { | ||
$scope.popover2 = popover; | ||
}); | ||
}) | ||
|
||
.controller('PlatformCtrl', function($scope, $ionicPopover) { | ||
|
||
$scope.setPlatform = function(p) { | ||
document.body.classList.remove('platform-ios'); | ||
document.body.classList.remove('platform-android'); | ||
document.body.classList.add('platform-' + p); | ||
}; | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
--- | ||
name: popover | ||
component: $ionicPopover | ||
--- | ||
|
||
it('should open left side ios popover', function(){ | ||
element(by.css('#ios')).click(); | ||
element(by.css('#icon-btn')).click(); | ||
}); | ||
|
||
it('should close ios popover when clicking backdrop', function(){ | ||
element(by.css('.popover-backdrop.active')).click(); | ||
}); | ||
|
||
it('should open middle ios popover', function(){ | ||
element(by.css('#mid-btn')).click(); | ||
}); | ||
|
||
it('should open right ios popover', function(){ | ||
element(by.css('.popover-backdrop.active')).click(); | ||
element(by.css('#right-btn')).click(); | ||
}); | ||
|
||
it('should open left side android popover', function(){ | ||
element(by.css('.popover-backdrop.active')).click(); | ||
element(by.css('#android')).click(); | ||
element(by.css('#icon-btn')).click(); | ||
}); | ||
|
||
it('should close android popover when clicking backdrop', function(){ | ||
element(by.css('.popover-backdrop.active')).click(); | ||
}); | ||
|
||
it('should open middle android popover', function(){ | ||
element(by.css('#mid-btn')).click(); | ||
}); | ||
|
||
it('should open right android popover', function(){ | ||
element(by.css('.popover-backdrop.active')).click(); | ||
element(by.css('#right-btn')).click(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/* | ||
* We don't document the ionPopover directive, we instead document | ||
* the $ionicPopover service | ||
*/ | ||
IonicModule | ||
.directive('ionPopover', [function() { | ||
return { | ||
restrict: 'E', | ||
transclude: true, | ||
replace: true, | ||
controller: [function(){}], | ||
template: '<div class="popover-backdrop">' + | ||
'<div class="popover-wrapper" ng-transclude></div>' + | ||
'</div>' | ||
}; | ||
}]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
IonicModule | ||
.directive('ionPopoverView', function() { | ||
return { | ||
restrict: 'E', | ||
compile: function(element) { | ||
element.append( angular.element('<div class="popover-arrow"></div>') ); | ||
element.addClass('popover'); | ||
} | ||
}; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.