Toderp working , list item styles for active state

This commit is contained in:
Max Lynch
2013-10-07 00:22:11 -05:00
parent f609320a80
commit 03f615af39
6 changed files with 214 additions and 21 deletions

93
dist/ionic-ios7.css vendored
View File

@ -1,4 +1,3 @@
@charset "UTF-8";
/** /**
* Adapted from normalize.css and some reset.css. We don't care even one * Adapted from normalize.css and some reset.css. We don't care even one
* bit about old IE, so we don't need any hacks for that in here. * bit about old IE, so we don't need any hacks for that in here.
@ -182,7 +181,7 @@ sub {
fieldset { fieldset {
margin: 0 2px; margin: 0 2px;
padding: 0.35em 0.625em 0.75em; padding: 0.35em 0.625em 0.75em;
border: 1px solid silver; } border: 1px solid #c0c0c0; }
/** /**
* 1. Correct `color` not being inherited in IE 8/9. * 1. Correct `color` not being inherited in IE 8/9.
@ -1547,6 +1546,86 @@ address {
z-index: 2; } z-index: 2; }
.list-item.active .list-item-heading, .list-item.active:hover .list-item-heading, .list-item.active:focus .list-item-heading { .list-item.active .list-item-heading, .list-item.active:hover .list-item-heading, .list-item.active:focus .list-item-heading {
color: inherit; } color: inherit; }
.list-item.list-item-default {
/*
color: $color;
background-color: $bgColor;
border-color: $borderColor;
*/ }
.list-item.list-item-default.active, .list-item.list-item-default:active {
color: #333333;
background-color: white;
border-color: #333333; }
.list-item.list-item-secondary {
/*
color: $color;
background-color: $bgColor;
border-color: $borderColor;
*/ }
.list-item.list-item-secondary.active, .list-item.list-item-secondary:active {
color: #333333;
background-color: white;
border-color: #333333; }
.list-item.list-item-primary {
/*
color: $color;
background-color: $bgColor;
border-color: $borderColor;
*/ }
.list-item.list-item-primary.active, .list-item.list-item-primary:active {
color: white;
background-color: #4a87ee;
border-color: #333333; }
.list-item.list-item-info {
/*
color: $color;
background-color: $bgColor;
border-color: $borderColor;
*/ }
.list-item.list-item-info.active, .list-item.list-item-info:active {
color: white;
background-color: #43cee6;
border-color: #333333; }
.list-item.list-item-success {
/*
color: $color;
background-color: $bgColor;
border-color: $borderColor;
*/ }
.list-item.list-item-success.active, .list-item.list-item-success:active {
color: white;
background-color: #66cc33;
border-color: #333333; }
.list-item.list-item-warning {
/*
color: $color;
background-color: $bgColor;
border-color: $borderColor;
*/ }
.list-item.list-item-warning.active, .list-item.list-item-warning:active {
color: white;
background-color: #f0b840;
border-color: #333333; }
.list-item.list-item-danger {
/*
color: $color;
background-color: $bgColor;
border-color: $borderColor;
*/ }
.list-item.list-item-danger.active, .list-item.list-item-danger:active {
color: white;
background-color: #ef4e3a;
border-color: #333333; }
.list-item.list-item-dark {
/*
color: $color;
background-color: $bgColor;
border-color: $borderColor;
*/ }
.list-item.list-item-dark.active, .list-item.list-item-dark:active {
color: white;
background-color: #444444;
border-color: #333333; }
a.list-item { a.list-item {
color: #333333; color: #333333;
@ -1768,7 +1847,7 @@ select:focus,
input[type="file"]:focus, input[type="file"]:focus,
input[type="radio"]:focus, input[type="radio"]:focus,
input[type="checkbox"]:focus { input[type="checkbox"]:focus {
outline: thin dotted #333333; outline: thin dotted #333;
outline: 5px auto -webkit-focus-ring-color; outline: 5px auto -webkit-focus-ring-color;
outline-offset: -2px; } outline-offset: -2px; }
@ -1855,7 +1934,7 @@ input[type="checkbox"][readonly] {
right: 20px; right: 20px;
transition: 0.2s ease; transition: 0.2s ease;
transition-property: left, right; transition-property: left, right;
transition-delay: 0s, 0.05s; } transition-delay: 0s, .05s; }
.toggle :checked + .track { .toggle :checked + .track {
/* When the toggle is "on" */ /* When the toggle is "on" */
@ -1870,7 +1949,7 @@ input[type="checkbox"][readonly] {
right: 0; right: 0;
left: 20px; left: 20px;
-webkit-transform: none; -webkit-transform: none;
transition-delay: 0.05s, 0s; } transition-delay: .05s, 0s; }
/* hide a radio button's icon by default */ /* hide a radio button's icon by default */
.radio-item [class^="icon-"], .radio-item [class^="icon-"],
@ -2095,7 +2174,7 @@ input[type="checkbox"][readonly] {
border: none; border: none;
background: none; } background: none; }
.button.button-icon:active, .button.button-icon.active { .button.button-icon:active, .button.button-icon.active {
text-shadow: 0px 0px 10px white; text-shadow: 0px 0px 10px #fff;
box-shadow: none; box-shadow: none;
background: none; } background: none; }
@ -2278,7 +2357,7 @@ a.button {
width: 100%; width: 100%;
background-color: white; background-color: white;
border-radius: 2px; border-radius: 2px;
border: 1px solid #dddddd; } border: 1px solid #ddd; }
.card-header { .card-header {
padding: 10px; padding: 10px;

89
dist/ionic.css vendored
View File

@ -1,4 +1,3 @@
@charset "UTF-8";
@font-face { @font-face {
font-family: 'ionicon-test'; font-family: 'ionicon-test';
src: url("fonts/ionicon-test.eot"); src: url("fonts/ionicon-test.eot");
@ -247,7 +246,7 @@ sub {
fieldset { fieldset {
margin: 0 2px; margin: 0 2px;
padding: 0.35em 0.625em 0.75em; padding: 0.35em 0.625em 0.75em;
border: 1px solid silver; } border: 1px solid #c0c0c0; }
/** /**
* 1. Correct `color` not being inherited in IE 8/9. * 1. Correct `color` not being inherited in IE 8/9.
@ -1635,6 +1634,86 @@ address {
z-index: 2; } z-index: 2; }
.list-item.active .list-item-heading, .list-item.active:hover .list-item-heading, .list-item.active:focus .list-item-heading { .list-item.active .list-item-heading, .list-item.active:hover .list-item-heading, .list-item.active:focus .list-item-heading {
color: inherit; } color: inherit; }
.list-item.list-item-default {
/*
color: $color;
background-color: $bgColor;
border-color: $borderColor;
*/ }
.list-item.list-item-default.active, .list-item.list-item-default:active {
color: #333333;
background-color: white;
border-color: #333333; }
.list-item.list-item-secondary {
/*
color: $color;
background-color: $bgColor;
border-color: $borderColor;
*/ }
.list-item.list-item-secondary.active, .list-item.list-item-secondary:active {
color: #333333;
background-color: white;
border-color: #333333; }
.list-item.list-item-primary {
/*
color: $color;
background-color: $bgColor;
border-color: $borderColor;
*/ }
.list-item.list-item-primary.active, .list-item.list-item-primary:active {
color: white;
background-color: #4a87ee;
border-color: #333333; }
.list-item.list-item-info {
/*
color: $color;
background-color: $bgColor;
border-color: $borderColor;
*/ }
.list-item.list-item-info.active, .list-item.list-item-info:active {
color: white;
background-color: #43cee6;
border-color: #333333; }
.list-item.list-item-success {
/*
color: $color;
background-color: $bgColor;
border-color: $borderColor;
*/ }
.list-item.list-item-success.active, .list-item.list-item-success:active {
color: white;
background-color: #66cc33;
border-color: #333333; }
.list-item.list-item-warning {
/*
color: $color;
background-color: $bgColor;
border-color: $borderColor;
*/ }
.list-item.list-item-warning.active, .list-item.list-item-warning:active {
color: white;
background-color: #f0b840;
border-color: #333333; }
.list-item.list-item-danger {
/*
color: $color;
background-color: $bgColor;
border-color: $borderColor;
*/ }
.list-item.list-item-danger.active, .list-item.list-item-danger:active {
color: white;
background-color: #ef4e3a;
border-color: #333333; }
.list-item.list-item-dark {
/*
color: $color;
background-color: $bgColor;
border-color: $borderColor;
*/ }
.list-item.list-item-dark.active, .list-item.list-item-dark:active {
color: white;
background-color: #444444;
border-color: #333333; }
a.list-item { a.list-item {
color: #333333; color: #333333;
@ -1856,7 +1935,7 @@ select:focus,
input[type="file"]:focus, input[type="file"]:focus,
input[type="radio"]:focus, input[type="radio"]:focus,
input[type="checkbox"]:focus { input[type="checkbox"]:focus {
outline: thin dotted #333333; outline: thin dotted #333;
outline: 5px auto -webkit-focus-ring-color; outline: 5px auto -webkit-focus-ring-color;
outline-offset: -2px; } outline-offset: -2px; }
@ -2177,7 +2256,7 @@ input[type="checkbox"][readonly] {
border: none; border: none;
background: none; } background: none; }
.button.button-icon:active, .button.button-icon.active { .button.button-icon:active, .button.button-icon.active {
text-shadow: 0px 0px 10px white; text-shadow: 0px 0px 10px #fff;
box-shadow: none; box-shadow: none;
background: none; } background: none; }
@ -2360,7 +2439,7 @@ a.button {
width: 100%; width: 100%;
background-color: white; background-color: white;
border-radius: 2px; border-radius: 2px;
border: 1px solid #dddddd; } border: 1px solid #ddd; }
.card-header { .card-header {
padding: 10px; padding: 10px;

View File

@ -136,7 +136,7 @@
<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="setActiveProject(project)" class="list-item" ng-repeat="project in projects"> <a ng-click="setActiveProject(project)" class="list-item list-item-primary" ng-class="{active: project.isActive}" ng-repeat="project in projects">
{{project.title}} {{project.title}}
</a> </a>
</list> </list>

View File

@ -91,12 +91,16 @@ angular.module('ionic.todo.controllers', ['ionic.todo'])
if(!$scope.activeProject.tasks) { if(!$scope.activeProject.tasks) {
$scope.activeProject.tasks = []; $scope.activeProject.tasks = [];
} }
$scope.activeProject.tasks.push({ $scope.activeProject.tasks.add({
title: task.title, title: task.title,
user_id: $scope.user.id, user_id: $scope.user.id,
isCompleted: false isCompleted: false
}); });
// Set the priorty for this project to the new date, so it will
// sort higher
$scope.activeProject.project.setPriority(+new Date);
$scope.newTask = {}; $scope.newTask = {};
}; };
@ -104,12 +108,17 @@ angular.module('ionic.todo.controllers', ['ionic.todo'])
* Set the current project * Set the current project
*/ */
$scope.setActiveProject = function(project) { $scope.setActiveProject = function(project) {
// Grab the ref. It's the object on new project, and the $ref
// object on exist (for example, from the ng-repeat)
var ref = project;
if(project.$ref) { if(project.$ref) {
$scope.activeProject = angularFire(project.$ref, $scope, 'activeProject'); ref = project.$ref;
} else {
$scope.activeProject = angularFire(project, $scope, 'activeProject');
} }
//$scope.lastProject = project; $scope.activeProject = {
project: ref,
title: project.title,
tasks: angularFireCollection(ref.child('tasks'))
};
} }
/** /**
@ -119,7 +128,8 @@ angular.module('ionic.todo.controllers', ['ionic.todo'])
var p = { var p = {
title: newProject.title, title: newProject.title,
user_id: $scope.user.id, user_id: $scope.user.id,
tasks: [] tasks: [],
isActive: true
}; };
console.log("Adding project:", p); console.log("Adding project:", p);
@ -128,7 +138,9 @@ angular.module('ionic.todo.controllers', ['ionic.todo'])
// Reset the form // Reset the form
$scope.newProject = {}; $scope.newProject = {};
$scope.setActiveProject($scope.projects.add(p)); var np = $scope.projects.add(p);
np.setPriority(+new Date);
$scope.setActiveProject(np);
}; };
$scope.projects = angularFireCollection(new Firebase(FIREBASE_URL + '/project_list'), function(snapshot) { $scope.projects = angularFireCollection(new Firebase(FIREBASE_URL + '/project_list'), function(snapshot) {

View File

@ -52,7 +52,7 @@
&.active, &.active,
&.active:hover, &.active:hover,
&.active:focus { &.active:focus {
z-index: 2; // Place active items above their siblings for proper border styling z-index: 2;
//color: $list-group-active-color; //color: $list-group-active-color;
//background-color: $list-group-active-bg; //background-color: $list-group-active-bg;
//border-color: $list-group-active-border; //border-color: $list-group-active-border;
@ -66,6 +66,14 @@
} }
} }
&.list-item-default { @include list-item-style-active($brand-default, $gray-dark, $gray-dark); }
&.list-item-secondary { @include list-item-style-active($brand-default, $gray-dark, $gray-dark); }
&.list-item-primary { @include list-item-style-active($brand-primary, $gray-dark, $white); }
&.list-item-info { @include list-item-style-active($brand-info, $gray-dark, $white); }
&.list-item-success { @include list-item-style-active($brand-success, $gray-dark, $white); }
&.list-item-warning { @include list-item-style-active($brand-warning, $gray-dark, $white); }
&.list-item-danger { @include list-item-style-active($brand-danger, $gray-dark, $white); }
&.list-item-dark { @include list-item-style-active($brand-dark, $gray-dark, $white); }
} }
// Linked list items // Linked list items

View File

@ -70,6 +70,21 @@
} }
} }
//$bgColor, $borderColor, $color,
@mixin list-item-style-active($activeBgColor, $activeBorderColor, $activeColor) {
/*
color: $color;
background-color: $bgColor;
border-color: $borderColor;
*/
&.active, &:active {
color: $activeColor;
background-color: $activeBgColor;
border-color: $activeBorderColor;
}
};
@mixin bar-style($bgColor, $borderColor, $color) { @mixin bar-style($bgColor, $borderColor, $color) {
background-color: $bgColor; background-color: $bgColor;
border-color: $borderColor; border-color: $borderColor;