-
Notifications
You must be signed in to change notification settings - Fork 3
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
a5e87d4
commit 6e12668
Showing
15 changed files
with
173 additions
and
25 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
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
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
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,8 @@ | ||
//- | ||
//- Copyright (C) 2015 by Looker Data Services, Inc. | ||
//- All rights reserved. | ||
//- | ||
.checkbox(ng-class="{checked: todo.isDone}" ng-click="doneChanged()") | ||
|
||
input(ng-model="todo.text" ng-change="textChanged()") |
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,37 @@ | ||
/* | ||
* Copyright (C) 2015 by Looker Data Services, Inc. | ||
* All rights reserved. | ||
*/ | ||
|
||
todo { | ||
display: flex; | ||
|
||
.checkbox { | ||
flex: 0 0 auto; | ||
height: 2rem; | ||
width: 2rem; | ||
margin-right: 0.5rem; | ||
|
||
border: 1px solid $color-gray-medium; | ||
|
||
&.checked { | ||
text-align: center; | ||
|
||
&:before { | ||
content: "✓"; | ||
font-size: 2rem; | ||
line-height: 2rem; | ||
} | ||
} | ||
} | ||
|
||
input { | ||
flex: 1 1 100%; | ||
|
||
border: 0; | ||
|
||
font-family: $font-family-text; | ||
font-size: 1.25rem; | ||
padding: 0 0.5rem; | ||
} | ||
} |
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 @@ | ||
# | ||
# Copyright (C) 2015 by Looker Data Services, Inc. | ||
# All rights reserved. | ||
# | ||
|
||
m = angular.module 'directives.todo' | ||
|
||
############################################################################################################ | ||
|
||
m.controller 'TodoController', ( | ||
$scope | ||
DatafluxEvent | ||
TodoModelActions | ||
TodoModelStore | ||
)-> | ||
|
||
$scope.todo = TodoModelStore.get($scope.modelId)?.toHash() or {} | ||
|
||
# Listener Methods ############################################################################### | ||
|
||
TodoModelStore.$listen (event, id)-> | ||
todo = TodoModelStore.get($scope.modelId) | ||
return unless todo? | ||
|
||
todo.mergeInto $scope.todo | ||
|
||
# Scope Functions ################################################################################ | ||
|
||
$scope.doneChanged = -> | ||
todo = TodoModelStore.get($scope.modelId) | ||
return unless todo? | ||
|
||
todo.isDone = ! todo.isDone | ||
TodoModelActions.update(todo) | ||
|
||
$scope.textChanged = -> | ||
todo = TodoModelStore.get($scope.modelId) | ||
return unless todo? | ||
|
||
todo.text = $scope.todo.text | ||
TodoModelActions.update(todo) |
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 @@ | ||
# | ||
# Copyright (C) 2015 by Looker Data Services, Inc. | ||
# All rights reserved. | ||
# | ||
|
||
m = angular.module 'directives.todo' | ||
|
||
############################################################################################################ | ||
|
||
m.directive 'todo', ( | ||
)-> | ||
controller: 'TodoController' | ||
restrict: 'E' | ||
scope: | ||
modelId: '@' | ||
template: templates['directives/todo'] |
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,12 @@ | ||
# | ||
# Copyright (C) 2015 by Looker Data Services, Inc. | ||
# All rights reserved. | ||
# | ||
|
||
m = module.exports = angular.module 'directives.todo', [ | ||
'dataflux' | ||
'stores' | ||
] | ||
|
||
require './todo_controller' | ||
require './todo_directive' |
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 |
---|---|---|
|
@@ -4,4 +4,4 @@ | |
//- | ||
div(ng-repeat="todo in todos track by todo.id") | ||
todo(id="todo.id") | ||
todo(model-id="{{todo.id}}") |
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,13 @@ | ||
/* | ||
* Copyright (C) 2015 by Looker Data Services, Inc. | ||
* All rights reserved. | ||
*/ | ||
|
||
todo-list { | ||
border: 1px solid $color-gray-light; | ||
|
||
display: flex; | ||
flex-direction: column; | ||
|
||
padding: 1rem; | ||
} |
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
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
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,22 @@ | ||
/* | ||
* Copyright (C) 2015 by Looker Data Services, Inc. | ||
* All rights reserved. | ||
*/ | ||
|
||
body { | ||
display: flex; | ||
|
||
.content { | ||
flex: 1 1 100%; | ||
margin: 3rem; | ||
|
||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
|
||
todo-list { | ||
max-width: 500px; | ||
width: 66%; | ||
} | ||
} | ||
} |
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
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