From 3f4089a6d3b22969d9b1d477adfb1b60c5642212 Mon Sep 17 00:00:00 2001 From: Ro Date: Thu, 21 May 2020 13:23:21 -0700 Subject: [PATCH] turned off page edit options scroll adjustment, fixed page creation redirect --- brain/data/Book.js | 10 ++++++---- brain/routes/dash/pages.js | 1 + brain/views/page-edit.pug | 2 +- src/com/actions/PageActions.js | 4 ++++ src/com/controllers/PageEditor.js | 4 ++-- src/com/ui/TextEditor.js | 5 ++++- src/styles/main/_colors.styl | 2 +- 7 files changed, 19 insertions(+), 9 deletions(-) diff --git a/brain/data/Book.js b/brain/data/Book.js index 018e860..dafbbe7 100644 --- a/brain/data/Book.js +++ b/brain/data/Book.js @@ -79,6 +79,8 @@ export default class Book { switch (task) { case DataEvent.API_PAGE_CREATE: case DataEvent.API_PAGE_WRITE: + var layout = 'page'; + if (body.layout !== 'page') layout = body.layout; var pageWrite = '---\n' + 'id: ' + @@ -94,7 +96,7 @@ export default class Book { body.feature + '\n' + 'layout: ' + - 'page' + + layout + '\n' + 'tags: ' + body.tags + @@ -139,8 +141,9 @@ export default class Book { response = { type: DataEvent.PAGE_ADDED, message: 'New Page Created', - id: body.page_uuid + id: body.uuid }; + resolve(response); } else { response = { type: DataEvent.PAGE_UPDATED, @@ -210,8 +213,7 @@ export default class Book { } } tags = _.orderBy(tags, ['tag_name'], ['asc']); - settings.saveTags(tags).then(response => { - console.log('RESPONSE', response); + settings.saveTags(tags).then(() => { render .publishTags(pages) .then(response => { diff --git a/brain/routes/dash/pages.js b/brain/routes/dash/pages.js index 9d6074a..1539ed2 100644 --- a/brain/routes/dash/pages.js +++ b/brain/routes/dash/pages.js @@ -122,6 +122,7 @@ router.get('/edit/:id', function (req, res) { welcome: 'Edit Page', page: page.metadata, date: moment(page.metadata.created).format('YYYY MMM DD'), + layout: page.metadata.layout, rawDate: page.metadata.created, content: page.content, feature: page.metadata.feature, diff --git a/brain/views/page-edit.pug b/brain/views/page-edit.pug index 9f33a89..219411e 100644 --- a/brain/views/page-edit.pug +++ b/brain/views/page-edit.pug @@ -1,6 +1,6 @@ extends frame block main-content - #post-edit-index(data-index=id data-uuid=uuid) + #post-edit-index(data-index=id data-uuid=uuid data-layout=layout) #post-edit-index-wrapper //h2 EDIT =post_title diff --git a/src/com/actions/PageActions.js b/src/com/actions/PageActions.js index 4220d5c..840377d 100644 --- a/src/com/actions/PageActions.js +++ b/src/com/actions/PageActions.js @@ -26,6 +26,10 @@ export default class PostActions { 'uuid', document.getElementById('post-edit-index').getAttribute('data-uuid') ); + pageInfo.append( + 'layout', + document.getElementById('post-edit-index').getAttribute('data-layout') + ); pageInfo.append('content', html); pageInfo.append('title', document.getElementById('post_title').value); pageInfo.append( diff --git a/src/com/controllers/PageEditor.js b/src/com/controllers/PageEditor.js index 58eeced..11b36d0 100644 --- a/src/com/controllers/PageEditor.js +++ b/src/com/controllers/PageEditor.js @@ -204,8 +204,8 @@ export default class PostEditor { } var reader = new FileReader(); // Closure to capture the file information. - reader.onload = (function(theFile) { - return function(f) { + reader.onload = (function (theFile) { + return function (f) { // Render thumbnail. var image = document.createElement('img'); image.src = f.target.result; diff --git a/src/com/ui/TextEditor.js b/src/com/ui/TextEditor.js index 645f3cd..7d24abc 100644 --- a/src/com/ui/TextEditor.js +++ b/src/com/ui/TextEditor.js @@ -21,12 +21,15 @@ class TextEditor extends EventEmitter { this.url = ''; this.setInputs(); window.addEventListener('scroll', () => { - var fixLimit = this.fixLimit; + //var fixLimit = this.fixLimit; + /** + * edit scroller needs work if (window.pageYOffset >= fixLimit) { document.getElementById('edit-control').style.position = 'fixed'; } else { document.getElementById('edit-control').style.position = 'relative'; } + */ }); this.refresh(); } diff --git a/src/styles/main/_colors.styl b/src/styles/main/_colors.styl index 89b678c..ff59d1d 100644 --- a/src/styles/main/_colors.styl +++ b/src/styles/main/_colors.styl @@ -11,7 +11,7 @@ $black = #32302f; $eventCool = #32cd32 $eventLame = #F64747 -$editorPrimary = #bebebe; +$editorPrimary = #fde3a7; $editorSecondary = #ffa07a; $editorTertiary = #89c4f4; $editorString = #f6dd74;