Toderp side list

This commit is contained in:
Max Lynch
2013-10-09 15:45:53 -05:00
parent 6834d22a16
commit 57333bb714
11 changed files with 155 additions and 40 deletions

16
dist/ionic-angular.js vendored
View File

@ -188,9 +188,23 @@ angular.module('ionic.ui.list', ['ionic.service'])
replace: true, replace: true,
transclude: true, transclude: true,
scope: {}, scope: {},
template: '<ul class="list-group" ng-transclude></ul>' template: '<ul class="list-group" ng-transclude></ul>',
link: function($scope, $element, $attr) {
var lv = new ionic.views.List({el: $element[0]});
}
} }
}) })
/*
.directive('listItem', function() {
return {
restrict: 'E',
replace: true,
transclude: true,
scope: {}
}
});
*/
; ;
angular.module('ionic.ui.nav', ['ionic.service']) angular.module('ionic.ui.nav', ['ionic.service'])

42
dist/ionic-ios7.css vendored
View File

@ -324,7 +324,8 @@ body {
-webkit-font-smoothing: antialiased; -webkit-font-smoothing: antialiased;
-webkit-text-size-adjust: none; -webkit-text-size-adjust: none;
text-size-adjust: none; text-size-adjust: none;
-webkit-tap-highlight-color: transparent; } -webkit-tap-highlight-color: transparent;
-webkit-user-drag: none; }
.view-full { .view-full {
position: fixed; position: fixed;
@ -935,7 +936,6 @@ address {
position: relative; position: relative;
display: block; display: block;
margin-bottom: -1px; margin-bottom: -1px;
padding: 15px 15px;
background-color: white; background-color: white;
border: 1px solid #dddddd; } border: 1px solid #dddddd; }
.list-item:last-child { .list-item:last-child {
@ -960,6 +960,9 @@ address {
color: #333333; color: #333333;
background-color: white; background-color: white;
border-color: #333333; } border-color: #333333; }
.list-item.list-item-default.active .list-item-content, .list-item.list-item-default:active .list-item-content {
background-color: white;
color: #333333; }
.list-item.list-item-secondary { .list-item.list-item-secondary {
/* /*
color: $color; color: $color;
@ -970,6 +973,9 @@ address {
color: #333333; color: #333333;
background-color: white; background-color: white;
border-color: #333333; } border-color: #333333; }
.list-item.list-item-secondary.active .list-item-content, .list-item.list-item-secondary:active .list-item-content {
background-color: white;
color: #333333; }
.list-item.list-item-primary { .list-item.list-item-primary {
/* /*
color: $color; color: $color;
@ -980,6 +986,9 @@ address {
color: white; color: white;
background-color: #4a87ee; background-color: #4a87ee;
border-color: #333333; } border-color: #333333; }
.list-item.list-item-primary.active .list-item-content, .list-item.list-item-primary:active .list-item-content {
background-color: #4a87ee;
color: white; }
.list-item.list-item-info { .list-item.list-item-info {
/* /*
color: $color; color: $color;
@ -990,6 +999,9 @@ address {
color: white; color: white;
background-color: #43cee6; background-color: #43cee6;
border-color: #333333; } border-color: #333333; }
.list-item.list-item-info.active .list-item-content, .list-item.list-item-info:active .list-item-content {
background-color: #43cee6;
color: white; }
.list-item.list-item-success { .list-item.list-item-success {
/* /*
color: $color; color: $color;
@ -1000,6 +1012,9 @@ address {
color: white; color: white;
background-color: #66cc33; background-color: #66cc33;
border-color: #333333; } border-color: #333333; }
.list-item.list-item-success.active .list-item-content, .list-item.list-item-success:active .list-item-content {
background-color: #66cc33;
color: white; }
.list-item.list-item-warning { .list-item.list-item-warning {
/* /*
color: $color; color: $color;
@ -1010,6 +1025,9 @@ address {
color: white; color: white;
background-color: #f0b840; background-color: #f0b840;
border-color: #333333; } border-color: #333333; }
.list-item.list-item-warning.active .list-item-content, .list-item.list-item-warning:active .list-item-content {
background-color: #f0b840;
color: white; }
.list-item.list-item-danger { .list-item.list-item-danger {
/* /*
color: $color; color: $color;
@ -1020,6 +1038,9 @@ address {
color: white; color: white;
background-color: #ef4e3a; background-color: #ef4e3a;
border-color: #333333; } border-color: #333333; }
.list-item.list-item-danger.active .list-item-content, .list-item.list-item-danger:active .list-item-content {
background-color: #ef4e3a;
color: white; }
.list-item.list-item-dark { .list-item.list-item-dark {
/* /*
color: $color; color: $color;
@ -1030,6 +1051,9 @@ address {
color: white; color: white;
background-color: #444444; background-color: #444444;
border-color: #333333; } border-color: #333333; }
.list-item.list-item-dark.active .list-item-content, .list-item.list-item-dark:active .list-item-content {
background-color: #444444;
color: white; }
a.list-item { a.list-item {
color: #333333; color: #333333;
@ -1038,20 +1062,20 @@ a.list-item {
text-decoration: none; } text-decoration: none; }
.list-item-content { .list-item-content {
position: absolute; position: relative;
left: 0; background-color: #fff;
top: 0;
right: 0;
bottom: 0;
z-index: 1; z-index: 1;
background-color: white; padding: 15px 15px;
-webkit-transition: left 1s ease-in-out, right 1s ease-in-out; } -webkit-transition: left 0.2s ease-in-out; }
.list-item-buttons { .list-item-buttons {
position: absolute; position: absolute;
z-index: 0; z-index: 0;
right: 0; right: 0;
top: 0; } top: 0; }
.list-item-buttons .button {
border-radius: 0;
border: none; }
.list-divider { .list-divider {
padding: 5px 15px; padding: 5px 15px;

42
dist/ionic.css vendored
View File

@ -389,7 +389,8 @@ body {
-webkit-font-smoothing: antialiased; -webkit-font-smoothing: antialiased;
-webkit-text-size-adjust: none; -webkit-text-size-adjust: none;
text-size-adjust: none; text-size-adjust: none;
-webkit-tap-highlight-color: transparent; } -webkit-tap-highlight-color: transparent;
-webkit-user-drag: none; }
.view-full { .view-full {
position: fixed; position: fixed;
@ -1023,7 +1024,6 @@ address {
position: relative; position: relative;
display: block; display: block;
margin-bottom: -1px; margin-bottom: -1px;
padding: 15px 15px;
background-color: white; background-color: white;
border: 1px solid #dddddd; } border: 1px solid #dddddd; }
.list-item:last-child { .list-item:last-child {
@ -1048,6 +1048,9 @@ address {
color: #333333; color: #333333;
background-color: white; background-color: white;
border-color: #333333; } border-color: #333333; }
.list-item.list-item-default.active .list-item-content, .list-item.list-item-default:active .list-item-content {
background-color: white;
color: #333333; }
.list-item.list-item-secondary { .list-item.list-item-secondary {
/* /*
color: $color; color: $color;
@ -1058,6 +1061,9 @@ address {
color: #333333; color: #333333;
background-color: white; background-color: white;
border-color: #333333; } border-color: #333333; }
.list-item.list-item-secondary.active .list-item-content, .list-item.list-item-secondary:active .list-item-content {
background-color: white;
color: #333333; }
.list-item.list-item-primary { .list-item.list-item-primary {
/* /*
color: $color; color: $color;
@ -1068,6 +1074,9 @@ address {
color: white; color: white;
background-color: #4a87ee; background-color: #4a87ee;
border-color: #333333; } border-color: #333333; }
.list-item.list-item-primary.active .list-item-content, .list-item.list-item-primary:active .list-item-content {
background-color: #4a87ee;
color: white; }
.list-item.list-item-info { .list-item.list-item-info {
/* /*
color: $color; color: $color;
@ -1078,6 +1087,9 @@ address {
color: white; color: white;
background-color: #43cee6; background-color: #43cee6;
border-color: #333333; } border-color: #333333; }
.list-item.list-item-info.active .list-item-content, .list-item.list-item-info:active .list-item-content {
background-color: #43cee6;
color: white; }
.list-item.list-item-success { .list-item.list-item-success {
/* /*
color: $color; color: $color;
@ -1088,6 +1100,9 @@ address {
color: white; color: white;
background-color: #66cc33; background-color: #66cc33;
border-color: #333333; } border-color: #333333; }
.list-item.list-item-success.active .list-item-content, .list-item.list-item-success:active .list-item-content {
background-color: #66cc33;
color: white; }
.list-item.list-item-warning { .list-item.list-item-warning {
/* /*
color: $color; color: $color;
@ -1098,6 +1113,9 @@ address {
color: white; color: white;
background-color: #f0b840; background-color: #f0b840;
border-color: #333333; } border-color: #333333; }
.list-item.list-item-warning.active .list-item-content, .list-item.list-item-warning:active .list-item-content {
background-color: #f0b840;
color: white; }
.list-item.list-item-danger { .list-item.list-item-danger {
/* /*
color: $color; color: $color;
@ -1108,6 +1126,9 @@ address {
color: white; color: white;
background-color: #ef4e3a; background-color: #ef4e3a;
border-color: #333333; } border-color: #333333; }
.list-item.list-item-danger.active .list-item-content, .list-item.list-item-danger:active .list-item-content {
background-color: #ef4e3a;
color: white; }
.list-item.list-item-dark { .list-item.list-item-dark {
/* /*
color: $color; color: $color;
@ -1118,6 +1139,9 @@ address {
color: white; color: white;
background-color: #444444; background-color: #444444;
border-color: #333333; } border-color: #333333; }
.list-item.list-item-dark.active .list-item-content, .list-item.list-item-dark:active .list-item-content {
background-color: #444444;
color: white; }
a.list-item { a.list-item {
color: #333333; color: #333333;
@ -1126,20 +1150,20 @@ a.list-item {
text-decoration: none; } text-decoration: none; }
.list-item-content { .list-item-content {
position: absolute; position: relative;
left: 0; background-color: #fff;
top: 0;
right: 0;
bottom: 0;
z-index: 1; z-index: 1;
background-color: white; padding: 15px 15px;
-webkit-transition: left 1s ease-in-out, right 1s ease-in-out; } -webkit-transition: left 0.2s ease-in-out; }
.list-item-buttons { .list-item-buttons {
position: absolute; position: absolute;
z-index: 0; z-index: 0;
right: 0; right: 0;
top: 0; } top: 0; }
.list-item-buttons .button {
border-radius: 0;
border: none; }
.list-divider { .list-divider {
padding: 5px 15px; padding: 5px 15px;

18
dist/ionic.js vendored
View File

@ -1787,10 +1787,14 @@ window.ionic = {
window.ionic.onGesture('swipeleft', function(e) { window.ionic.onGesture('swipeleft', function(e) {
_this._handleSwipeLeft(e); _this._handleSwipeLeft(e);
e.gesture.stopDetect();
return false;
}, this.el); }, this.el);
window.ionic.onGesture('swiperight', function(e) { window.ionic.onGesture('swiperight', function(e) {
_this._handleSwipeRight(e); _this._handleSwipeRight(e);
e.gesture.stopDetect();
return false;
}, this.el); }, this.el);
}; };
@ -1809,13 +1813,16 @@ window.ionic = {
content = item; content = item;
} }
if(!content) {
return;
}
// Grab the buttons // Grab the buttons
buttons = content.parentNode.querySelector('.list-item-buttons'); buttons = content.parentNode.querySelector('.list-item-buttons');
if(buttons) { if(buttons) {
buttonsWidth = buttons.offsetWidth; buttonsWidth = buttons.offsetWidth;
// Slide the content over left by the button width // Slide the content over left by the button width
content.style.right = buttonsWidth + 'px';
content.style.left = -buttonsWidth + 'px'; content.style.left = -buttonsWidth + 'px';
} }
}); });
@ -1824,7 +1831,8 @@ window.ionic = {
window.requestAnimationFrame(function() { window.requestAnimationFrame(function() {
var item = e.target, var item = e.target,
cl = item.classList; cl = item.classList,
content;
if(cl.contains('list-item')) { if(cl.contains('list-item')) {
content = item.querySelector('.list-item-content'); content = item.querySelector('.list-item-content');
@ -1832,7 +1840,11 @@ window.ionic = {
content = item; content = item;
} }
content.style.right = 0; // This item didn't have content
if(!content) {
return;
}
content.style.left = 0; content.style.left = 0;
}); });
}, },

View File

@ -137,9 +137,14 @@
<input type="text" ng-model="newProject.title" placeholder="Create a new list..."> <input type="text" ng-model="newProject.title" placeholder="Create a new list...">
</form> </form>
<list> <list>
<a ng-click="selectProject(project)" class="list-item list-item-primary" ng-class="{active: project.$id == activeProject.project.name()}" ng-repeat="project in projects"> <li class="list-item list-item-primary" ng-class="{active: project.$id == activeProject.project.name()}" ng-repeat="project in projects">
{{project.title}} <div class="list-item-content" ng-click="selectProject(project)">
</a> {{project.title}}
</div>
<div class="list-item-buttons">
<button class="button button-danger" ng-click="deleteProject(project)">Delete</button>
</div>
</li>
</list> </list>
</content> </content>
</menu> </menu>

View File

@ -6,6 +6,20 @@ angular.module('ionic.ui.list', ['ionic.service'])
replace: true, replace: true,
transclude: true, transclude: true,
scope: {}, scope: {},
template: '<ul class="list-group" ng-transclude></ul>' template: '<ul class="list-group" ng-transclude></ul>',
link: function($scope, $element, $attr) {
var lv = new ionic.views.List({el: $element[0]});
}
} }
}) })
/*
.directive('listItem', function() {
return {
restrict: 'E',
replace: true,
transclude: true,
scope: {}
}
});
*/

View File

@ -7,10 +7,14 @@
window.ionic.onGesture('swipeleft', function(e) { window.ionic.onGesture('swipeleft', function(e) {
_this._handleSwipeLeft(e); _this._handleSwipeLeft(e);
e.gesture.stopDetect();
return false;
}, this.el); }, this.el);
window.ionic.onGesture('swiperight', function(e) { window.ionic.onGesture('swiperight', function(e) {
_this._handleSwipeRight(e); _this._handleSwipeRight(e);
e.gesture.stopDetect();
return false;
}, this.el); }, this.el);
}; };
@ -29,13 +33,16 @@
content = item; content = item;
} }
if(!content) {
return;
}
// Grab the buttons // Grab the buttons
buttons = content.parentNode.querySelector('.list-item-buttons'); buttons = content.parentNode.querySelector('.list-item-buttons');
if(buttons) { if(buttons) {
buttonsWidth = buttons.offsetWidth; buttonsWidth = buttons.offsetWidth;
// Slide the content over left by the button width // Slide the content over left by the button width
content.style.right = buttonsWidth + 'px';
content.style.left = -buttonsWidth + 'px'; content.style.left = -buttonsWidth + 'px';
} }
}); });
@ -44,7 +51,8 @@
window.requestAnimationFrame(function() { window.requestAnimationFrame(function() {
var item = e.target, var item = e.target,
cl = item.classList; cl = item.classList,
content;
if(cl.contains('list-item')) { if(cl.contains('list-item')) {
content = item.querySelector('.list-item-content'); content = item.querySelector('.list-item-content');
@ -52,7 +60,11 @@
content = item; content = item;
} }
content.style.right = 0; // This item didn't have content
if(!content) {
return;
}
content.style.left = 0; content.style.left = 0;
}); });
}, },

View File

@ -18,7 +18,6 @@
display: block; display: block;
// Place the border on the list items and negative margin up for better styling // Place the border on the list items and negative margin up for better styling
margin-bottom: -1px; margin-bottom: -1px;
padding: 15px 15px;
background-color: $list-default-background; background-color: $list-default-background;
border: $list-item-border; border: $list-item-border;
@ -90,22 +89,26 @@ a.list-item {
} }
.list-item-content { .list-item-content {
position: absolute; position: relative;
left: 0;
top: 0; background-color: #fff;
right: 0;
bottom: 0;
z-index: 1; z-index: 1;
background-color: white; padding: 15px 15px;
-webkit-transition: left 1s ease-in-out, right 1s ease-in-out; -webkit-transition: left 0.2s ease-in-out;
} }
.list-item-buttons { .list-item-buttons {
position: absolute; position: absolute;
z-index: 0; z-index: 0;
right: 0; right: 0;
top: 0; top: 0;
.button {
border-radius: 0;
border: none;
}
} }

View File

@ -78,10 +78,16 @@
border-color: $borderColor; border-color: $borderColor;
*/ */
&.active, &:active { &.active, &:active {
color: $activeColor; color: $activeColor;
background-color: $activeBgColor; background-color: $activeBgColor;
border-color: $activeBorderColor; border-color: $activeBorderColor;
.list-item-content {
background-color: $activeBgColor;
color: $activeColor;
}
} }
}; };

View File

@ -23,6 +23,7 @@ body {
-webkit-text-size-adjust: none; -webkit-text-size-adjust: none;
text-size-adjust: none; text-size-adjust: none;
-webkit-tap-highlight-color: transparent; -webkit-tap-highlight-color: transparent;
-webkit-user-drag: none;
} }
.view { .view {

View File

@ -19,7 +19,7 @@
<main class="content-wrapper"> <main class="content-wrapper">
<div class="content has-header"> <div class="content has-header">
<ul id="list" class="list"> <ul id="list" class="list">
<a href="#" class="list-item"> <li href="#" class="list-item">
<div class="list-item-content"> <div class="list-item-content">
Sasafras Sasafras
<i class="icon-arrow-right"></i> <i class="icon-arrow-right"></i>
@ -27,7 +27,7 @@
<div class="list-item-buttons"> <div class="list-item-buttons">
<button class="button button-danger">Delete</button> <button class="button button-danger">Delete</button>
</div> </div>
</a> </li>
<a href="#" class="list-item"> <a href="#" class="list-item">
Candy Candy
<i class="icon-arrow-right"></i> <i class="icon-arrow-right"></i>