Notebook view and styling

James Peret 8 years ago
parent
commit
1b93695470

+ 1 - 0
app.js

@@ -40,6 +40,7 @@ var createPreferencesWindow = function() {
40 40
       width: 500,
41 41
       height: 300,
42 42
       show: true,
43
+      resizable: false,
43 44
       'title-bar-style': 'hidden',
44 45
       'fullscreen' : false
45 46
     });

BIN
app/content/imgs/db-icon.png


BIN
app/content/imgs/notebook-icon.png


+ 22 - 3
app/preferences-window.html

@@ -20,10 +20,29 @@
20 20
     <header class="toolbar toolbar-header">
21 21
       <h1 class="title">Preferences</h1>
22 22
 
23
-      <div class="toolbar-actions">
24
-        <img src="content/imgs/prefs-icon.png" style="width: 32px; height: 32px;">
25
-      </div>
23
+      <ul class="icon-tabs">
24
+        <li class="active">
25
+          <img src="content/imgs/prefs-icon.png" style="width: 32px; height: 32px;"><br>General
26
+        </li>
27
+        <li>
28
+          <img src="content/imgs/db-icon.png" style="width: 32px; height: 32px;"><br>Databases
29
+        </li>
30
+      </ul>
26 31
     </header>
32
+    <div class="well">
33
+      <p>Default View when opening the app:<br>
34
+      <select class="form-control" style="width: 220px;">
35
+        <option>All Notes</option>
36
+        <option>All Files</option>
37
+        <option>Index note</option>
38
+      </select></p>
39
+      <p>Default Notebook:
40
+      <select class="form-control" style="width: 220px;">
41
+        <option>Notebook 1</option>
42
+        <option>Notebook 2</option>
43
+        <option>Notebook 3</option>
44
+      </select></p>
27 45
 
46
+    </div>
28 47
   </body>
29 48
 </html>

+ 19 - 8
app/scripts/controllers/app-ctrl.js

@@ -21,6 +21,10 @@ angular.module('codexApp.index', [])
21 21
           break;
22 22
         case "Notebooks":
23 23
           $scope.files = FileService.getFolders();
24
+          break;
25
+        case "Notebook":
26
+          $scope.files = FileService.getAllFiles($scope.current_folder);
27
+          break;
24 28
       }
25 29
     }
26 30
 
@@ -76,14 +80,21 @@ angular.module('codexApp.index', [])
76 80
       return false;
77 81
     };
78 82
 
79
-    $scope.openNote = function(note){
80
-      //console.log($location.path());
81
-      console.log("openning note " + note.title + " (" + note.id + ")");
82
-      FileService.setCurrentNote(note)
83
-      $rootScope.$broadcast('main-window:note-view');
84
-      $state.go("note-view");
85
-      //$location.path('/notes/' + 'test1')
86
-      //console.log($location.path());
83
+    $scope.openFile = function(file){
84
+      console.log("openning " + file.type + " link: " + file.path);
85
+      switch (file.type) {
86
+        case "Markdown":
87
+          FileService.setCurrentNote(file)
88
+          $rootScope.$broadcast('main-window:note-view');
89
+          $state.go("note-view");
90
+          break;
91
+        case "Folder":
92
+          $scope.current_folder = file.path;
93
+          PrefsService.setCurrentView("Notebook");
94
+          $scope.setView();
95
+          break;
96
+      }
97
+
87 98
     }
88 99
 
89 100
     $rootScope.$on('file-service:files-loaded', function(){

+ 4 - 3
app/scripts/services/file-service.js

@@ -37,7 +37,7 @@ angular.module('codexApp')
37 37
       case "md":
38 38
         return "Markdown";
39 39
       default:
40
-        return "File";
40
+        return "Folder";
41 41
     }
42 42
   }
43 43
 
@@ -331,8 +331,9 @@ angular.module('codexApp')
331 331
 
332 332
 
333 333
   // RESPONSE
334
-  this.getAllFiles = function() {
335
-    notes = getAllFilesFromFolder();
334
+  this.getAllFiles = function(dir) {
335
+    if (typeof(dir)==='undefined') dir = notes_dir;
336
+    notes = getAllFilesFromFolder(dir);
336 337
     return notes.sort(date_sort_asc);
337 338
   }
338 339
 

+ 1 - 1
app/scripts/services/prefs-service.js

@@ -1,7 +1,7 @@
1 1
 angular.module('codexApp')
2 2
 .service('PrefsService', [ '$rootScope', '$http',  function($rootScope, $http) {
3 3
 
4
-  var views = ["All Notes", "All Files", "Notebooks"];
4
+  var views = ["All Notes", "All Files", "Notebooks", "Notebook"];
5 5
   var current_view = "All Notes"
6 6
 
7 7
   this.getCurrentView = function() {

+ 3 - 2
app/views/index.html

@@ -21,11 +21,12 @@
21 21
 
22 22
 <div class="file-view">
23 23
   <ul>
24
-    <li ng-repeat="file in files track by $index" ng-dblclick="openNote(file)" class="file-view-item">
25
-      <div class="thumbnail">
24
+    <li ng-repeat="file in files track by $index" ng-dblclick="openFile(file)" class="file-view-item">
25
+      <div class="thumbnail" ng-show="file.type != 'Folder'">
26 26
         <img src="{{getImageURL(file.path)}}" ng-hide="isImage(file.type)">
27 27
         <img src="{{file.thumbnail}}" ng-show="isImage(file.type)">
28 28
       </div>
29
+      <img class="notebook-thumbnail" src="content/imgs/notebook-icon.png" ng-show="file.type == 'Folder'">
29 30
       <div>{{file.title}}</div>
30 31
     </li>
31 32
   </ul>

+ 2 - 1
codex/index.md

@@ -12,4 +12,5 @@
12 12
 
13 13
 * [Todo's](dev/codex-app/todos.md)
14 14
 * [Notes](dev/codex-app/notes.md) 
15
-* [Highlight JS](dev/codex-app/highlightjs.md)
15
+* [Highlight JS](dev/codex-app/highlightjs.md)
16
+* [Encryption](dev/codex-app/Encryption.md)

+ 38 - 1
css/codex.css

@@ -107,7 +107,12 @@ code {
107 107
   margin-bottom: 0px;
108 108
 }
109 109
 
110
-
110
+.notebook-thumbnail {
111
+  width: 220px;
112
+  height: 170px;
113
+  margin-bottom: 5px;
114
+  overflow: hidden;
115
+}
111 116
 
112 117
 pre code.hljs {
113 118
     display: block;
@@ -134,3 +139,35 @@ pre code.hljs .hljs-title {
134 139
 code.hljs .hljs-title {
135 140
   margin-right: 6px;
136 141
 }
142
+
143
+.icon-tabs {
144
+    margin: 0px;
145
+    margin-left: -34px;
146
+    margin-top: 0px;
147
+}
148
+
149
+.icon-tabs li {
150
+    float: left;
151
+    list-style: none;
152
+    text-align: center;
153
+    font-size: 12px;
154
+    line-height: 14px;
155
+    padding-bottom: 4px;
156
+    margin-right: 12px;
157
+    padding-left: 3px;
158
+    padding-right: 3px;
159
+    padding-top: 3px;
160
+}
161
+
162
+.icon-tabs li.active {
163
+  background-color: #C3C2C3;
164
+  border-top-left-radius: 5px;
165
+  border-top-right-radius: 5px;
166
+}
167
+
168
+.well {
169
+  background-color: #ECECEC;
170
+  padding: 15px;
171
+  height: 100%;
172
+  padding-top: 2px;
173
+}