From 5283b489dc1339a1cfb5ad7a3d89fd7849ad7e1f Mon Sep 17 00:00:00 2001 From: zadam Date: Sun, 21 Jul 2019 10:17:08 +0200 Subject: [PATCH] sidebar skeleton --- src/public/javascripts/desktop.js | 1 + src/public/javascripts/services/sidebar.js | 25 ++++++++ .../javascripts/services/tab_context.js | 2 + src/public/stylesheets/style.css | 38 ++++++++++++ src/views/desktop.ejs | 4 +- src/views/sidebar.ejs | 49 +++++++++++++++ src/views/tabs.ejs | 62 ++++++++++--------- src/views/title.ejs | 2 + 8 files changed, 152 insertions(+), 31 deletions(-) create mode 100644 src/public/javascripts/services/sidebar.js create mode 100644 src/views/sidebar.ejs diff --git a/src/public/javascripts/desktop.js b/src/public/javascripts/desktop.js index 73b389ef8..831079666 100644 --- a/src/public/javascripts/desktop.js +++ b/src/public/javascripts/desktop.js @@ -42,6 +42,7 @@ import noteAutocompleteService from './services/note_autocomplete.js'; import macInit from './services/mac_init.js'; import cssLoader from './services/css_loader.js'; import dateNoteService from './services/date_notes.js'; +import sidebarService from './services/sidebar.js'; window.glob.isDesktop = utils.isDesktop; window.glob.isMobile = utils.isMobile; diff --git a/src/public/javascripts/services/sidebar.js b/src/public/javascripts/services/sidebar.js new file mode 100644 index 000000000..030934f85 --- /dev/null +++ b/src/public/javascripts/services/sidebar.js @@ -0,0 +1,25 @@ +class Sidebar { + /** + * @param {TabContext} ctx + */ + constructor(ctx) { + this.ctx = ctx; + this.$sidebar = ctx.$tabContent.find(".note-detail-sidebar"); + this.$showSideBarButton = this.ctx.$tabContent.find(".show-sidebar-button"); + this.$showSideBarButton.hide(); + + this.$hideSidebarButton = this.$sidebar.find(".hide-sidebar-button"); + + this.$hideSidebarButton.click(() => { + this.$sidebar.hide(); + this.$showSideBarButton.show(); + }); + + this.$showSideBarButton.click(() => { + this.$sidebar.show(); + this.$showSideBarButton.hide(); + }) + } +} + +export default Sidebar; \ No newline at end of file diff --git a/src/public/javascripts/services/tab_context.js b/src/public/javascripts/services/tab_context.js index d2d35e758..a12cf5908 100644 --- a/src/public/javascripts/services/tab_context.js +++ b/src/public/javascripts/services/tab_context.js @@ -18,6 +18,7 @@ import noteDetailRelationMap from "./note_detail_relation_map.js"; import noteDetailProtectedSession from "./note_detail_protected_session.js"; import protectedSessionService from "./protected_session.js"; import linkService from "./link.js"; +import Sidebar from "./sidebar.js"; const $tabContentsContainer = $("#note-tab-container"); @@ -59,6 +60,7 @@ class TabContext { this.noteChangeDisabled = false; this.isNoteChanged = false; this.attributes = new Attributes(this); + this.sidebar = new Sidebar(this); if (utils.isDesktop()) { this.noteType = new NoteTypeContext(this); diff --git a/src/public/stylesheets/style.css b/src/public/stylesheets/style.css index d1639dbbd..fe2a1757b 100644 --- a/src/public/stylesheets/style.css +++ b/src/public/stylesheets/style.css @@ -103,11 +103,49 @@ ul.fancytree-container { } .note-tab-content { + display: flex; + flex-direction: row; + height: 100%; + width: 100%; +} + +.note-detail-content { display: flex; flex-direction: column; height: 100%; } +.note-detail-sidebar { + min-width: 300px; + overflow: auto; + padding-top: 12px; + padding-left: 7px; +} + +.note-detail-sidebar .card { + border: 0; +} + +.note-detail-sidebar .card-header { + background: inherit; + padding: 0; + border: 0; +} + +.note-detail-sidebar .card-header button { + +} + +.note-detail-sidebar .card-header h5 { + font-size: 1rem; +} + +.note-detail-sidebar .card-body { + max-width: 300px; + padding: 8px; + border: 0; +} + .note-detail-component-wrapper { flex-grow: 100; position: relative; diff --git a/src/views/desktop.ejs b/src/views/desktop.ejs index 1dedf66fc..da2232a45 100644 --- a/src/views/desktop.ejs +++ b/src/views/desktop.ejs @@ -6,7 +6,7 @@ -