fix sort and serch

Change-Id: I9bab7c78c8264b4c59fbd6b73d18d796ab29028f
This commit is contained in:
prabhjyotsingh 2017-11-22 18:39:18 +05:30
parent b4cbba891d
commit 00ec295dce
No known key found for this signature in database
GPG key ID: B8B72E48316C663D
5 changed files with 8 additions and 7 deletions

View file

@ -40,12 +40,12 @@ limitations under the License.
<i style="font-size: 15px;" class="icon-notebook"></i> Create new note</a></h5>
<ul id="notebook-names">
<li class="filter-names" ng-include="'components/note-name-filter/note-name-filter.html'"></li>
<li ng-repeat="note in home.notes.list | filter:query.q | orderBy:node:false:home.arrayOrderingSrv.noteComparator track by $index">
<li ng-repeat="note in home.notes.list | filter:query.q track by $index">
<i style="font-size: 10px;" class="icon-doc"></i>
<a style="text-decoration: none;" href="#/notebook/{{note.id}}">{{noteName(note)}}</a>
</li>
<div ng-if="!query.q || query.q === ''" infinite-scroll="loadMoreNotes()">
<li ng-repeat="node in home.notes.root.children | limitTo:home.numberOfNotesDisplayed | orderBy:node:false:home.arrayOrderingSrv.noteComparator track by $index"
<li ng-repeat="node in home.notes.root.children | limitTo:home.numberOfNotesDisplayed track by $index"
ng-include src="'app/home/notebook-template.html'" ng-class="note_folder_renderer"></li>
</div>
<div ng-if="query.q" infinite-scroll="loadMoreNotes()">

View file

@ -28,7 +28,7 @@ limitations under the License.
<ul id="notebook-names">
<li class="filter-names" ng-include="'components/note-name-filter/note-name-filter.html'"></li>
<div ng-if="!query.q || query.q === ''" infinite-scroll="loadMoreNotes()">
<li ng-repeat="node in home.notes.root.children | limitTo:home.numberOfNotesDisplayed | orderBy:node:false:home.arrayOrderingSrv.noteComparator track by $index"
<li ng-repeat="node in home.notes.root.children | limitTo:home.numberOfNotesDisplayed track by $index"
ng-include src="'app/home/notebook-template.html'" ng-class="note_folder_renderer"></li>
</div>
<div ng-if="query.q" infinite-scroll="loadMoreNotes()">

View file

@ -35,8 +35,8 @@ function ArrayOrderingService(TRASH_FOLDER_ID) {
}
this.noteComparator = function (v1, v2) {
let note1 = v1.value
let note2 = v2.value
let note1 = v1.value || v1
let note2 = v2.value || v2
if (note1.id === TRASH_FOLDER_ID) {
return 1

View file

@ -47,7 +47,7 @@ limitations under the License.
<div id="notebook-list" class="scrollbar-container" ng-if="isDrawNavbarNoteList">
<li class="filter-names" ng-include="'components/note-name-filter/note-name-filter.html'"></li>
<div ng-if="!query.q || query.q === ''" infinite-scroll="loadMoreNotes()">
<li ng-repeat="node in navbar.notes.root.children | limitTo:navbar.numberOfNotesDisplayed | orderBy:node:false:navbar.arrayOrderingSrv.noteComparator track by node.id"
<li ng-repeat="node in navbar.notes.root.children | limitTo:navbar.numberOfNotesDisplayed track by node.id"
ng-class="{'active' : navbar.isActive(node.id)}" ng-include="'components/navbar/navbar-note-list-elem.html'">
</li>
</div>

View file

@ -14,7 +14,7 @@
angular.module('zeppelinWebApp').factory('noteListFactory', NoteListFactory)
function NoteListFactory(TRASH_FOLDER_ID) {
function NoteListFactory(arrayOrderingSrv, TRASH_FOLDER_ID) {
'ngInject'
const notes = {
@ -42,6 +42,7 @@ function NoteListFactory(TRASH_FOLDER_ID) {
return root
}, notes.root)
notes.root.children.sort(arrayOrderingSrv.noteComparator)
}
}