Skip to content

Commit fd5e985

Browse files
committed
#99 tags complete
1 parent e5ec69f commit fd5e985

File tree

2 files changed

+59
-0
lines changed

2 files changed

+59
-0
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
2+
openNote.controller("tagController", function( $scope,
3+
$rootScope,
4+
$location,
5+
$routeParams,
6+
storageService,
7+
config,
8+
tagService) {
9+
/**
10+
* Load a note
11+
* @param note - load a note
12+
*/
13+
$scope.loadNote = function(note){
14+
$(".note").fadeTo(config.fadeSpeedShort(),0,function(){
15+
$location.url("/note/"+note._id);
16+
$scope.$apply();
17+
});
18+
};
19+
20+
/**
21+
* Load tags
22+
*/
23+
var loadTags = function(){
24+
tagService.getMap().then(function(map){
25+
var tags = map.tags[$scope.tag];
26+
var db = storageService.database();
27+
tags.forEach(function(tag){
28+
db.get(tag).then(function(note){
29+
$scope.notes.push(note);
30+
$scope.$apply();
31+
});
32+
});
33+
});
34+
};
35+
$scope.notes=[];
36+
$scope.tag = $routeParams.tag;
37+
loadTags();
38+
});
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<div class="tagPartial">
2+
<div id="folderTitleBar">
3+
<ol class="breadcrumb">
4+
<li class="active">
5+
{{tag}}
6+
</li>
7+
</ol>
8+
</div>
9+
10+
<div ng-repeat="note in notes | orderBy: 'title'"
11+
class="startHidden box randomFadeInDirective note"
12+
ng-click="loadNote(note);">
13+
<h4>
14+
{{note.title}}
15+
</h4>
16+
<p class="box_description"></p>
17+
<p class="options">
18+
<span class="right">Note</span>
19+
</p>
20+
</div>
21+
</div>

0 commit comments

Comments
 (0)