mirror of
https://github.com/documize/community.git
synced 2025-07-20 05:39:42 +02:00
start new document in sidebar
This commit is contained in:
parent
33d9f4bb5a
commit
71b2e30fbc
9 changed files with 206 additions and 112 deletions
|
@ -26,6 +26,8 @@ export default Ember.Component.extend(TooltipMixin, NotifierMixin, {
|
||||||
hasPrivateFolders: false,
|
hasPrivateFolders: false,
|
||||||
newFolder: "",
|
newFolder: "",
|
||||||
showScrollTool: false,
|
showScrollTool: false,
|
||||||
|
showingDocument: false,
|
||||||
|
showingList: true,
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
this._super(...arguments);
|
this._super(...arguments);
|
||||||
|
@ -35,9 +37,14 @@ export default Ember.Component.extend(TooltipMixin, NotifierMixin, {
|
||||||
let emptyTemplate = {
|
let emptyTemplate = {
|
||||||
id: "0",
|
id: "0",
|
||||||
title: "Empty document",
|
title: "Empty document",
|
||||||
selected: true
|
description: "An empty canvas for your masterpiece",
|
||||||
|
img: "template-blank",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
saved.forEach(function(t) {
|
||||||
|
t.img = "template-saved";
|
||||||
|
});
|
||||||
|
|
||||||
saved.unshiftObject(emptyTemplate);
|
saved.unshiftObject(emptyTemplate);
|
||||||
_this.set('savedTemplates', saved);
|
_this.set('savedTemplates', saved);
|
||||||
});
|
});
|
||||||
|
@ -134,6 +141,16 @@ export default Ember.Component.extend(TooltipMixin, NotifierMixin, {
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
showDocument() {
|
||||||
|
this.set('showingDocument', true);
|
||||||
|
this.set('showingList', false);
|
||||||
|
},
|
||||||
|
|
||||||
|
showList() {
|
||||||
|
this.set('showingDocument', false);
|
||||||
|
this.set('showingList', true);
|
||||||
|
},
|
||||||
|
|
||||||
onEditTemplate(template) {
|
onEditTemplate(template) {
|
||||||
this.navigateToDocument(template);
|
this.navigateToDocument(template);
|
||||||
},
|
},
|
||||||
|
|
|
@ -14,18 +14,27 @@ import NotifierMixin from '../../mixins/notifier';
|
||||||
|
|
||||||
export default Ember.Component.extend(NotifierMixin, {
|
export default Ember.Component.extend(NotifierMixin, {
|
||||||
localStorage: Ember.inject.service(),
|
localStorage: Ember.inject.service(),
|
||||||
tagName: 'span',
|
|
||||||
selectedTemplate: {
|
|
||||||
id: "0"
|
|
||||||
},
|
|
||||||
canEditTemplate: "",
|
canEditTemplate: "",
|
||||||
|
|
||||||
didReceiveAttrs() {
|
actions: {
|
||||||
this.send('setTemplate', this.get('savedTemplates')[0]);
|
editTemplate(template) {
|
||||||
|
this.audit.record('edited-saved-template');
|
||||||
|
this.attrs.onEditTemplate(template);
|
||||||
|
|
||||||
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
actions: {
|
startDocument(template) {
|
||||||
setTemplate(chosen) {
|
this.audit.record('used-saved-template');
|
||||||
|
this.attrs.onDocumentTemplate(template.id, template.title, "private");
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
/*
|
||||||
|
setTemplate(chosen) {
|
||||||
if (is.undefined(chosen)) {
|
if (is.undefined(chosen)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -38,22 +47,7 @@ export default Ember.Component.extend(NotifierMixin, {
|
||||||
templates.forEach(template => {
|
templates.forEach(template => {
|
||||||
Ember.set(template, 'selected', template.id === chosen.id);
|
Ember.set(template, 'selected', template.id === chosen.id);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
editTemplate() {
|
|
||||||
let template = this.get('selectedTemplate');
|
|
||||||
this.audit.record('edited-saved-template');
|
|
||||||
this.attrs.onEditTemplate(template);
|
|
||||||
|
|
||||||
return true;
|
*/
|
||||||
},
|
|
||||||
|
|
||||||
startDocument() {
|
|
||||||
let template = this.get('selectedTemplate');
|
|
||||||
this.audit.record('used-saved-template');
|
|
||||||
this.attrs.onDocumentTemplate(template.id, template.title, "private");
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
.folders-list {
|
.space-tools {
|
||||||
margin-top: 30px;
|
|
||||||
|
|
||||||
.doc-tool {
|
.doc-tool {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 150px;
|
top: 150px;
|
||||||
|
@ -31,9 +29,11 @@
|
||||||
-o-animation: fadein 1s; /* Opera < 12.1 */
|
-o-animation: fadein 1s; /* Opera < 12.1 */
|
||||||
animation: fadein 1s;
|
animation: fadein 1s;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.folders-list {
|
||||||
> .section {
|
> .section {
|
||||||
margin: 0 0 40px 0;
|
margin: 30px 0 10px 0;
|
||||||
|
|
||||||
> .heading {
|
> .heading {
|
||||||
font-size: 0.9rem;
|
font-size: 0.9rem;
|
||||||
|
@ -195,3 +195,67 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.templates-list {
|
||||||
|
margin: 0;
|
||||||
|
|
||||||
|
> .list {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
|
||||||
|
> .item {
|
||||||
|
list-style: none;
|
||||||
|
cursor: pointer;
|
||||||
|
padding: 10px 5px;
|
||||||
|
margin: 5px 0;
|
||||||
|
@include ease-in();
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
@include ease-in();
|
||||||
|
|
||||||
|
> .details {
|
||||||
|
> .title {
|
||||||
|
color: $color-primary;
|
||||||
|
}
|
||||||
|
|
||||||
|
> .desc {
|
||||||
|
color: $color-primary;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.icon {
|
||||||
|
text-align: center;
|
||||||
|
display: inline-block;
|
||||||
|
width: 50px;
|
||||||
|
|
||||||
|
> .img {
|
||||||
|
float: left;
|
||||||
|
text-align: center;
|
||||||
|
display: inline-block;
|
||||||
|
height: 40px;
|
||||||
|
width: 40px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
> .details {
|
||||||
|
vertical-align: top;
|
||||||
|
display: inline-block;
|
||||||
|
width: 80%;
|
||||||
|
|
||||||
|
> .title {
|
||||||
|
font-size: 1rem;
|
||||||
|
font-weight: bold;
|
||||||
|
color: $color-off-black;
|
||||||
|
letter-spacing: 0.5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
> .desc {
|
||||||
|
color: $color-gray;
|
||||||
|
font-size: 0.9rem;
|
||||||
|
margin-top: 5px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1,4 +1,35 @@
|
||||||
{{#if session.isEditor}}
|
<div class="space-tools">
|
||||||
|
{{#if showingDocument}}
|
||||||
|
<div {{action 'showList'}} id="cancel-tool" class="round-button round-button-mono button-white doc-tool">
|
||||||
|
<i class="material-icons color-gray">close</i>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{folder/start-document
|
||||||
|
savedTemplates=savedTemplates
|
||||||
|
folder=folder
|
||||||
|
onEditTemplate=(action 'onEditTemplate')
|
||||||
|
onDocumentTemplate=(action 'onDocumentTemplate')}}
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
{{#if showScrollTool}}
|
||||||
|
<div {{action 'scrollTop'}} id="scroll-space-tool" class="round-button round-button-mono button-white scroll-space-tool" data-tooltip="Back to top" data-tooltip-position="top center">
|
||||||
|
<i class="material-icons color-gray">vertical_align_top</i>
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
{{#if showingList}}
|
||||||
|
{{#if folderService.canEditCurrentFolder}}
|
||||||
|
<div {{action 'showDocument'}} class="round-button button-green doc-tool" data-tooltip="Document" data-tooltip-position="top center">
|
||||||
|
<i class="material-icons">add</i>
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
||||||
|
{{/if}}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="folders-list">
|
||||||
|
{{#if showingList}}
|
||||||
|
|
||||||
|
{{#if session.isEditor}}
|
||||||
<div id="add-space-button" class="regular-button button-white">
|
<div id="add-space-button" class="regular-button button-white">
|
||||||
<i class="material-icons">add</i>
|
<i class="material-icons">add</i>
|
||||||
<div class="name">Space</div>
|
<div class="name">Space</div>
|
||||||
|
@ -12,24 +43,6 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{{/dropdown-dialog}}
|
{{/dropdown-dialog}}
|
||||||
{{/if}}
|
|
||||||
|
|
||||||
<div class="folders-list">
|
|
||||||
{{#if folderService.canEditCurrentFolder}}
|
|
||||||
<div id="start-document-button" class="round-button button-green doc-tool" data-tooltip="Document" data-tooltip-position="top center">
|
|
||||||
<i class="material-icons">add</i>
|
|
||||||
</div>
|
|
||||||
{{folder/start-document
|
|
||||||
savedTemplates=savedTemplates
|
|
||||||
folder=folder
|
|
||||||
onEditTemplate=(action 'onEditTemplate')
|
|
||||||
onDocumentTemplate=(action 'onDocumentTemplate')}}
|
|
||||||
{{/if}}
|
|
||||||
|
|
||||||
{{#if showScrollTool}}
|
|
||||||
<div {{action 'scrollTop'}} id="scroll-space-tool" class="round-button round-button-mono button-white scroll-space-tool" data-tooltip="Back to top" data-tooltip-position="top center">
|
|
||||||
<i class="material-icons color-gray">vertical_align_top</i>
|
|
||||||
</div>
|
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
<div class="section">
|
<div class="section">
|
||||||
|
@ -75,8 +88,11 @@
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="copyright hidden-xs hidden-sm">
|
<div class="copyright hidden-xs hidden-sm">
|
||||||
<a href="https://documize.com?ref=app-footer" target="_blank">Copyright © 2016 Documize Inc.</a>
|
<a href="https://documize.com?ref=app-footer" target="_blank">Copyright © 2016 Documize Inc.</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,14 +1,17 @@
|
||||||
{{#dropdown-dialog target="start-document-button" position="bottom left" button="Start" color="flat-green" onAction=(action 'startDocument') button2=canEditTemplate color2="flat-blue" onAction2=(action 'editTemplate')}}
|
<div class="templates-list">
|
||||||
<ul class="start-document-options" style="min-width:185px;">
|
<ul class="list">
|
||||||
{{#each savedTemplates key="id" as |template|}}
|
{{#each savedTemplates key="id"as |template|}}
|
||||||
<li class="option {{if template.selected "selected"}}" {{action 'setTemplate' template}}>
|
<li class="item" {{action 'startDocument' template}}>
|
||||||
{{#if template.selected}}
|
<div class="icon">
|
||||||
<i class="material-icons">radio_button_checked</i>
|
<img class="img" src="/assets/img/{{template.img}}.png" srcset="/assets/img/{{template.img}}@2x.png" />
|
||||||
{{else}}
|
</div>
|
||||||
<i class="material-icons">radio_button_unchecked</i>
|
<div class="details">
|
||||||
{{/if}}
|
<div class='title'>
|
||||||
{{ template.title }}
|
{{template.title}}
|
||||||
|
</div>
|
||||||
|
<div class='desc'>{{template.description}}</div>
|
||||||
|
</div>
|
||||||
</li>
|
</li>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
</ul>
|
</ul>
|
||||||
{{/dropdown-dialog}}
|
</div>
|
||||||
|
|
BIN
app/public/assets/img/template-blank.png
Normal file
BIN
app/public/assets/img/template-blank.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
BIN
app/public/assets/img/template-blank@2x.png
Normal file
BIN
app/public/assets/img/template-blank@2x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.4 KiB |
BIN
app/public/assets/img/template-saved.png
Normal file
BIN
app/public/assets/img/template-saved.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
BIN
app/public/assets/img/template-saved@2x.png
Normal file
BIN
app/public/assets/img/template-saved@2x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.4 KiB |
Loading…
Add table
Add a link
Reference in a new issue