using home-template both home.html and customHome.html

This commit is contained in:
soralee 2017-01-12 14:33:23 +09:00
parent 028f873a45
commit 473bce4fc6
4 changed files with 34 additions and 141 deletions

View file

@ -29,11 +29,11 @@ limitations under the License.
<li class="filter-names" ng-include="'components/filterNoteNames/filter-note-names.html'"></li>
<div ng-if="!query.q || query.q === ''">
<li ng-repeat="node in home.notes.root.children | orderBy:home.arrayOrderingSrv.noteListOrdering track by $index"
ng-include src="'app/home/home-template.html'" ng-class="notebook_folder_renderer"/>
ng-include src="'app/home/home-template.html'" ng-class="note_folder_renderer"></li>
</div>
<div ng-if="query.q">
<li ng-repeat="node in home.notes.flatList | filter:query.q | orderBy:home.arrayOrderingSrv.noteListOrdering track by $index"
ng-include src="'app/home/home-template.html'" ng-class="notebook_folder_renderer" />
ng-include src="'app/home/home-template.html'" ng-class="note_folder_renderer"></li>
</div>
</ul>
</div>

View file

@ -12,17 +12,19 @@ See the License for the specific language governing permissions and
limitations under the License.
-->
<div ng-class="notebook_folder_renderer">
<div ng-class="note_folder_renderer">
<!-- note -->
<div ng-if="node.children == null"
ng-mouseenter="showNoteButton=true"
<div ng-if="node.children == null && isFilterNote(node)" ng-mouseenter="showNoteButton=true"
ng-mouseleave="showNoteButton=false">
<a style="text-decoration: none;" href="#/notebook/{{node.id}}">
<i id="debug" style="font-size: 10px;" class="icon-doc"></i> {{node.name}}
<i style="font-size: 10px;"
ng-class="query.q && node.isTrash ? 'fa fa-trash-o' : 'icon-doc'"></i> {{getNoteName(node)}}
</a>
<!-- if note is not in trash -->
<a ng-if="!node.isTrash" style="text-decoration: none;">
<i style="margin-left: 10px;"
class="fa fa-pencil notebook-list-btn" ng-show="showNoteButton" ng-click="renameNote(node)"
class="fa fa-pencil notebook-list-btn" ng-show="showNoteButton"
ng-click="node.path ? renameNote(node.id, node.path) : renameNote(node.id, node.name)"
tooltip-placement="bottom" tooltip="Rename note">
</i>
</a>
@ -31,23 +33,19 @@ limitations under the License.
tooltip-placement="bottom" tooltip="Clear output">
</i>
</a>
<a style="text-decoration: none;">
<!-- if note is not in trash -->
<i ng-if="!node.isTrash"
class="fa fa-trash-o notebook-list-btn" ng-show="showNoteButton" ng-click="moveNoteToTrash(node.id)"
<a ng-if="!node.isTrash" style="text-decoration: none;">
<i class="fa fa-trash-o notebook-list-btn" ng-show="showNoteButton" ng-click="moveNoteToTrash(node.id)"
tooltip-placement="bottom" tooltip="Move note to Trash">
</i>
</a>
<a>
<!-- if note is in trash -->
<i ng-if="node.isTrash"
class="fa fa-undo notebook-list-btn" ng-show="showNoteButton" ng-click="restoreNote(node.id)"
<!-- if note is in trash -->
<a ng-if="node.isTrash">
<i class="fa fa-undo notebook-list-btn" ng-show="showNoteButton" ng-click="restoreNote(node.id)"
tooltip-placement="bottom" tooltip="Restore note">
</i>
</a>
<a>
<i ng-if="node.isTrash" style="font-size: 16px;"
class="fa fa-times notebook-list-btn" ng-show="showNoteButton" ng-click="removeNote(node.id)"
<a ng-if="node.isTrash" style="font-size: 16px;">
<i class="fa fa-times notebook-list-btn" ng-show="showNoteButton" ng-click="removeNote(node.id)"
tooltip-placement="bottom" tooltip="Remove note permanently">
</i>
</a>
@ -58,42 +56,38 @@ limitations under the License.
<div ng-mouseenter="showFolderButton=true"
ng-mouseleave="showFolderButton=false">
<a style="text-decoration: none; cursor: pointer;" ng-click="toggleFolderNode(node)">
<i style="font-size: 10px;" ng-class="node.hidden ? 'icon-folder' : 'icon-folder-alt'"></i> {{node.name}}
<i style="font-size: 10px;" ng-class="node.hidden ? 'icon-folder' : 'icon-folder-alt'"></i> {{getNoteName(node)}}
</a>
<a style="text-decoration: none;">
<i ng-if="!node.isTrash" style="margin-left: 10px;"
<a ng-if="!node.isTrash" style="text-decoration: none;">
<i style="margin-left: 10px;"
class="fa fa-pencil notebook-list-btn" ng-show="showFolderButton" ng-click="renameFolder(node)"
tooltip-placement="bottom" tooltip="Rename folder">
</i>
</a>
<!-- if folder is not in trash -->
<a>
<i ng-if="!node.isTrash"
class="fa fa-trash-o notebook-list-btn" ng-show="showFolderButton" ng-click="moveFolderToTrash(node.id)"
<a ng-if="!node.isTrash">
<i class="fa fa-trash-o notebook-list-btn" ng-show="showFolderButton" ng-click="moveFolderToTrash(node.id)"
tooltip-placement="bottom" tooltip="Move folder to Trash">
</i>
</a>
<a>
<!-- if folder is in trash -->
<i ng-if="node.isTrash"
class="fa fa-undo notebook-list-btn" ng-show="showFolderButton" ng-click="restoreFolder(node.id)"
<!-- if folder is in trash -->
<a ng-if="node.isTrash">
<i class="fa fa-undo notebook-list-btn" ng-show="showFolderButton" ng-click="restoreFolder(node.id)"
tooltip-placement="bottom" tooltip="Restore folder">
</i>
</a>
<a>
<i ng-if="node.isTrash" style="font-size: 16px"
class="fa fa-times notebook-list-btn" ng-show="showFolderButton" ng-click="removeFolder(node.id)"
<a ng-if="node.isTrash" style="font-size: 16px">
<i class="fa fa-times notebook-list-btn" ng-show="showFolderButton" ng-click="removeFolder(node.id)"
tooltip-placement="bottom" tooltip="Remove folder permanently">
</i>
</a>
</div>
<div ng-if="!node.hidden">
<ul style="list-style-type: none; padding-left:15px;">
<li ng-repeat="node in node.children" ng-include="'app/home/home-template.html'" ng-class="'notebook_folder_renderer'"></li>
<li ng-repeat="node in node.children" ng-include="'app/home/home-template.html'" ng-class="'note_folder_renderer'"></li>
</ul>
</div>
</div>
<!-- trash folder -->
<div ng-if="node.id === TRASH_FOLDER_ID">
<div ng-mouseenter="showFolderButton=true"
@ -106,8 +100,6 @@ limitations under the License.
class="fa fa-undo notebook-list-btn" ng-show="showFolderButton" ng-click="restoreAll()"
tooltip-placement="bottom" tooltip="Restore all">
</i>
</a>
<a>
<i style="font-size: 16px;"
class="fa fa-times notebook-list-btn" ng-show="showFolderButton" ng-click="emptyTrash()"
tooltip-placement="bottom" tooltip="Empty trash">
@ -116,7 +108,7 @@ limitations under the License.
</div>
<div ng-if="!node.hidden">
<ul style="list-style-type: none; padding-left:15px;">
<li ng-repeat="node in node.children" ng-include="'app/home/home-template.html'" ng-class="'notebook_folder_renderer'" ></li>
<li ng-repeat="node in node.children" ng-include="'app/home/home-template.html'" ng-class="'note_folder_renderer'"></li>
</ul>
</div>
</div>

View file

@ -148,4 +148,8 @@ function HomeCtrl($scope, noteListDataFactory, websocketMsgSrv, $rootScope, arra
}
return false;
};
$scope.getNoteName = function(note) {
return arrayOrderingSrv.getNoteName(note);
};
}

View file

@ -11,109 +11,6 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!-- Template of Home -->
<script type="text/ng-template" id="note_renderer.html">
<!-- note -->
<div ng-if="node.children == null && isFilterNote(node)" ng-mouseenter="showNoteButton=true"
ng-mouseleave="showNoteButton=false">
<a style="text-decoration: none;" href="#/notebook/{{node.id}}">
<i style="font-size: 10px;"
ng-class="query.q && node.isTrash ? 'fa fa-trash-o' : 'icon-doc'"></i> {{noteName(node)}}
</a>
<!-- if note is not in trash -->
<a ng-if="!node.isTrash" style="text-decoration: none;">
<i style="margin-left: 10px;"
class="fa fa-pencil notebook-list-btn" ng-show="showNoteButton"
ng-click="node.path ? renameNote(node.id, node.path) : renameNote(node.id, node.name)"
tooltip-placement="bottom" tooltip="Rename note">
</i>
</a>
<a ng-if="!node.isTrash" style="text-decoration: none;">
<i class="fa fa-eraser notebook-list-btn" ng-show="showNoteButton" ng-click="clearAllParagraphOutput(node.id)"
tooltip-placement="bottom" tooltip="Clear output">
</i>
</a>
<a ng-if="!node.isTrash" style="text-decoration: none;">
<i class="fa fa-trash-o notebook-list-btn" ng-show="showNoteButton" ng-click="moveNoteToTrash(node.id)"
tooltip-placement="bottom" tooltip="Move note to Trash">
</i>
</a>
<!-- if note is in trash -->
<a ng-if="node.isTrash">
<i class="fa fa-undo notebook-list-btn" ng-show="showNoteButton" ng-click="restoreNote(node.id)"
tooltip-placement="bottom" tooltip="Restore note">
</i>
</a>
<a ng-if="node.isTrash" style="font-size: 16px;">
<i class="fa fa-times notebook-list-btn" ng-show="showNoteButton" ng-click="removeNote(node.id)"
tooltip-placement="bottom" tooltip="Remove note permanently">
</i>
</a>
</div>
<!-- folder -->
<div ng-if="node.children != null && node.id !== TRASH_FOLDER_ID">
<div ng-mouseenter="showFolderButton=true"
ng-mouseleave="showFolderButton=false">
<a style="text-decoration: none; cursor: pointer;" ng-click="toggleFolderNode(node)">
<i style="font-size: 10px;" ng-class="node.hidden ? 'icon-folder' : 'icon-folder-alt'"></i> {{noteName(node)}}
</a>
<a ng-if="!node.isTrash" style="text-decoration: none;">
<i style="margin-left: 10px;"
class="fa fa-pencil notebook-list-btn" ng-show="showFolderButton" ng-click="renameFolder(node)"
tooltip-placement="bottom" tooltip="Rename folder">
</i>
</a>
<!-- if folder is not in trash -->
<a ng-if="!node.isTrash">
<i class="fa fa-trash-o notebook-list-btn" ng-show="showFolderButton" ng-click="moveFolderToTrash(node.id)"
tooltip-placement="bottom" tooltip="Move folder to Trash">
</i>
</a>
<!-- if folder is in trash -->
<a ng-if="node.isTrash">
<i class="fa fa-undo notebook-list-btn" ng-show="showFolderButton" ng-click="restoreFolder(node.id)"
tooltip-placement="bottom" tooltip="Restore folder">
</i>
</a>
<a ng-if="node.isTrash" style="font-size: 16px">
<i class="fa fa-times notebook-list-btn" ng-show="showFolderButton" ng-click="removeFolder(node.id)"
tooltip-placement="bottom" tooltip="Remove folder permanently">
</i>
</a>
</div>
<div ng-if="!node.hidden">
<ul style="list-style-type: none; padding-left:15px;">
<li ng-repeat="node in node.children" ng-include="'note_renderer.html'"></li>
</ul>
</div>
</div>
<!-- trash folder -->
<div ng-if="node.id === TRASH_FOLDER_ID">
<div ng-mouseenter="showFolderButton=true"
ng-mouseleave="showFolderButton=false">
<a style="text-decoration: none; cursor: pointer;" ng-click="toggleFolderNode(node)">
<i style="font-size: 14px;" class="fa fa-trash-o"></i> Trash
</a>
<a style="text-decoration: none;">
<i style="margin-left: 10px"
class="fa fa-undo notebook-list-btn" ng-show="showFolderButton" ng-click="restoreAll()"
tooltip-placement="bottom" tooltip="Restore all">
</i>
<i style="font-size: 16px;"
class="fa fa-times notebook-list-btn" ng-show="showFolderButton" ng-click="emptyTrash()"
tooltip-placement="bottom" tooltip="Empty trash">
</i>
</a>
</div>
<div ng-if="!node.hidden">
<ul style="list-style-type: none; padding-left:15px;">
<li ng-repeat="node in node.children" ng-include="'note_renderer.html'"></li>
</ul>
</div>
</div>
</script>
<div ng-controller="HomeCtrl as home" data-ng-init="initHome()">
<div ng-show="home.staticHome" class="box width-full home">
<div class="zeppelin">
@ -149,11 +46,11 @@ limitations under the License.
</li>
<div ng-if="!query.q || query.q === ''">
<li ng-repeat="node in home.notes.root.children | orderBy:home.arrayOrderingSrv.noteListOrdering track by $index"
ng-include="'note_renderer.html'"></li>
ng-include src="'app/home/home-template.html'" ng-class="note_folder_renderer"></li>
</div>
<div ng-if="query.q">
<li ng-repeat="node in home.notes.flatList| filter:query.q | orderBy:home.arrayOrderingSrv.noteListOrdering track by $index"
ng-include="'note_renderer.html'"></li>
ng-include src="'app/home/home-template.html'" ng-class="note_folder_renderer"></li>
</div>
</ul>
</div>