1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-08-02 12:05:23 +02:00

Closes #95 -- flat and section style document viewing

This commit is contained in:
Harvey Kandola 2017-04-27 12:46:34 +01:00
parent ef6b7f429c
commit 4a2147189a
8 changed files with 52 additions and 9 deletions

View file

@ -16,6 +16,7 @@ import NotifierMixin from '../../mixins/notifier';
export default Ember.Component.extend(TooltipMixin, NotifierMixin, {
documentService: Ember.inject.service('document'),
sectionService: Ember.inject.service('section'),
sessionService: Ember.inject.service('session'),
appMeta: Ember.inject.service(),
userService: Ember.inject.service('user'),
localStorage: Ember.inject.service(),
@ -138,6 +139,14 @@ export default Ember.Component.extend(TooltipMixin, NotifierMixin, {
this.showNotification('Template saved');
this.attrs.onSaveTemplate(name, excerpt);
return true;
},
onLayoutChange(layout) {
let doc = this.get('document');
doc.set('layout', layout);
this.get('documentService').save(doc);
return true;
}
}

View file

@ -25,6 +25,7 @@ export default Model.extend({
userId: attr('string'),
tags: attr('string'),
template: attr('boolean'),
layout: attr('string'),
// client-side property
selected: attr('boolean', { defaultValue: false }),

View file

@ -51,7 +51,7 @@
@include content-container();
@include ease-in();
@extend .transition-all;
overflow-x: scroll;
overflow-x: auto;
&:hover {
.page-title {
@ -329,6 +329,28 @@
}
}
.document-view-unified {
margin: 0 0 50px 0;
@include content-container();
@include ease-in();
@extend .transition-all;
.is-a-page, .is-a-tab {
padding: 0 !important;
box-shadow: none !important;
background-color: transparent !important;
@include border-radius(0px);
}
.tab-min, .tab-max {
padding: 0 !important;
}
.start-section {
height: 50px !important;
}
}
.dropdown-page-toolbar {
width: 300px;
}

View file

@ -1,4 +1,4 @@
<div class="document-view">
<div class="document-view {{if (is-equal document.layout 'doc') 'document-view-unified'}}">
{{#if hasPages}}
{{#each pages key="id" as |page index|}}

View file

@ -43,6 +43,13 @@
{{#dropdown-menu target="sidebar-zone-more-button" position="bottom left" open="click" onOpenCallback=(action 'onMenuOpen') onCloseCallback=(action 'onMenuOpen')}}
<ul class="menu">
{{#if session.authenticated}}
{{#if (is-equal document.layout 'section')}}
<li class="item" {{action 'onLayoutChange' 'doc'}}>Flat view</li>
<li class="divider"></li>
{{else}}
<li class="item" {{action 'onLayoutChange' 'section'}}>Section view</li>
<li class="divider"></li>
{{/if}}
{{#if pinState.isPinned}}
<li class="item" {{action 'onUnpin'}}>Unpin</li>
{{else}}