1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-07-21 14:19:43 +02:00

Move attachments into meta zone

This commit is contained in:
McMatts 2018-05-30 11:27:29 +01:00
parent c5561491a2
commit c7cc36b307
12 changed files with 77 additions and 80 deletions

View file

@ -15,6 +15,7 @@ import { inject as service } from '@ember/service';
import Component from '@ember/component'; import Component from '@ember/component';
export default Component.extend({ export default Component.extend({
classNames: ['row d-print-none'],
documentService: service('document'), documentService: service('document'),
appMeta: service(), appMeta: service(),
hasAttachments: notEmpty('files'), hasAttachments: notEmpty('files'),
@ -82,7 +83,6 @@ export default Component.extend({
getAttachments() { getAttachments() {
this.get('documentService').getAttachments(this.get('document.id')).then((files) => { this.get('documentService').getAttachments(this.get('document.id')).then((files) => {
this.set('files', files); this.set('files', files);
this.get('onReady')(files.length);
}); });
}, },

View file

@ -20,9 +20,7 @@ export default Controller.extend(Tooltips, Notifier, {
templateService: service('template'), templateService: service('template'),
sectionService: service('section'), sectionService: service('section'),
linkService: service('link'), linkService: service('link'),
// currentPageId: '',
tab: 'content', tab: 'content',
tabCount: 0, // how many items inside the tab?
queryParams: ['currentPageId'], queryParams: ['currentPageId'],
actions: { actions: {
@ -246,9 +244,5 @@ export default Controller.extend(Tooltips, Notifier, {
}); });
}); });
}, },
onReady(count) {
this.set('tabCount', count);
}
} }
}); });

View file

@ -27,6 +27,15 @@
onSaveDocument=(action 'onSaveDocument') onSaveDocument=(action 'onSaveDocument')
refresh=(action 'refresh')}} refresh=(action 'refresh')}}
<div class="text-center non-printable document-tabnav">
<ul class="tabnav-control">
<li class="tab {{if (eq tab 'content') 'selected'}}" {{action 'onTabChange' 'content'}}>Content</li>
{{#if session.authenticated}}
<li class="tab {{if (eq tab 'revision') 'selected'}}" {{action 'onTabChange' 'revision'}}>Revisions</li>
{{/if}}
</ul>
</div>
{{document/document-heading {{document/document-heading
document=document document=document
permissions=permissions permissions=permissions
@ -42,19 +51,6 @@
versions=versions versions=versions
onSaveDocument=(action 'onSaveDocument')}} onSaveDocument=(action 'onSaveDocument')}}
<div class="text-center non-printable document-tabnav">
<ul class="tabnav-control">
<li class="tab {{if (eq tab 'content') 'selected'}}" {{action 'onTabChange' 'content'}}>Content</li>
<li class="tab {{if (eq tab 'attachment') 'selected'}}" {{action 'onTabChange' 'attachment'}}>
Attachments
({{tabCount}})
</li>
{{#if session.authenticated}}
<li class="tab {{if (eq tab 'revision') 'selected'}}" {{action 'onTabChange' 'revision'}}>Revisions</li>
{{/if}}
</ul>
</div>
{{#if (eq tab 'content')}} {{#if (eq tab 'content')}}
{{document/view-content {{document/view-content
document=document links=links pages=pages blocks=blocks currentPageId=currentPageId document=document links=links pages=pages blocks=blocks currentPageId=currentPageId
@ -64,9 +60,6 @@
onCopyPage=(action 'onCopyPage') onMovePage=(action 'onMovePage') onDeletePage=(action 'onPageDeleted') onCopyPage=(action 'onCopyPage') onMovePage=(action 'onMovePage') onDeletePage=(action 'onPageDeleted')
refresh=(action 'refresh')}} refresh=(action 'refresh')}}
{{/if}} {{/if}}
{{#if (eq tab 'attachment')}}
{{document/view-attachment document=document permissions=permissions onReady=(action 'onReady')}}
{{/if}}
{{#if (eq tab 'revision')}} {{#if (eq tab 'revision')}}
{{document/view-revision document=document folder=folder pages=pages permissions=permissions onRollback=(action 'onRollback')}} {{document/view-revision document=document folder=folder pages=pages permissions=permissions onRollback=(action 'onRollback')}}
{{/if}} {{/if}}

View file

@ -76,7 +76,7 @@ footer {
.layout-content { .layout-content {
flex: 0 1 1000px; flex: 0 1 1000px;
margin: 0; margin: 0;
padding: 0 2rem 0 3rem; padding: 0 0 0 3rem;
} }
} }

View file

@ -1,5 +1,6 @@
.document-tabnav { .document-tabnav {
margin: 50px 0 100px 0; margin: 20px 0 0 0;
padding: 0;
} }
.document-structure { .document-structure {

View file

@ -1,6 +1,4 @@
.view-attachment { .view-attachment {
margin: 0 0 50px 0;
> .upload-document-files { > .upload-document-files {
margin: 10px 0 0 0; margin: 10px 0 0 0;
@include ease-in(); @include ease-in();
@ -11,40 +9,32 @@
} }
> .list { > .list {
margin: 20px 0 0 0; margin: 0;
padding: 7px 0; padding: 0;
> .item { > .item {
color: $color-off-black; color: $color-off-black;
margin: 0; margin: 0;
padding: 10px 0; padding: 0;
font-size: 1rem; font-size: 1rem;
list-style-type: none; list-style-type: none;
> .icon { > a {
display: inline-block;
font-size: 1rem;
vertical-align: text-top;
margin-right: 10px; margin-right: 10px;
} }
> a { > .delete {
@extend .text-truncate; display: inline-block;
width: 80%; visibility: hidden;
color: $color-gray;
&:hover {
color: $color-link;
}
> .file {
@extend .text-truncate;
display: inline-block;
font-size: 0.9rem;
width: 80%;
vertical-align: text-top;
}
} }
> .delete { &:hover {
text-align: right; > .delete {
visibility: visible;
}
} }
} }
} }

View file

@ -14,7 +14,7 @@
} }
> .buttons { > .buttons {
margin: 30px 0 0 0; margin: 20px 0 0 0;
} }
> .ack { > .ack {

View file

@ -75,6 +75,9 @@
</div> </div>
{{/if}} {{/if}}
{{/if}} {{/if}}
{{document/view-attachment document=document permissions=permissions}}
</div> </div>
</div> </div>

View file

@ -1,15 +1,15 @@
<div class="view-attachment mt-5"> <div class="col-12 col-sm-3 heading">Attachments</div>
<div class="col-12 col-sm-9 view-attachment">
{{#if hasAttachments}} {{#if hasAttachments}}
<ul class="list"> <ul class="list">
{{#each files key="id" as |a index|}} {{#each files key="id" as |a index|}}
<li class="item"> <li class="item">
<img class="icon" src="/assets/img/attachments/{{document/file-icon a.extension}}" />
<a href="{{appMeta.endpoint}}/public/attachments/{{appMeta.orgId}}/{{a.id}}"> <a href="{{appMeta.endpoint}}/public/attachments/{{appMeta.orgId}}/{{a.id}}">
<span class="file">{{ a.filename }}</span> {{a.filename}}
</a> </a>
{{#if canEdit}} {{#if canEdit}}
<div class="delete"> <div class="delete">
<div class="button-icon-danger align-middle action" {{action 'onShowDialog' a.id a.filename}}> <div class="button-icon-danger button-icon-small align-middle" {{action 'onShowDialog' a.id a.filename}}>
<i class="material-icons">delete</i> <i class="material-icons">delete</i>
</div> </div>
</div> </div>
@ -22,7 +22,7 @@
{{/if}} {{/if}}
{{#if canEdit}} {{#if canEdit}}
<div class="upload-document-files"> <div class="upload-document-files">
<div id="upload-document-files" class="btn btn-secondary">Upload</div> <div id="upload-document-files" class="btn btn-outline-secondary">Upload</div>
</div> </div>
{{/if}} {{/if}}
</div> </div>

View file

@ -1,11 +1,13 @@
{{#if hasPages}} {{#each pages key="id" as |item index|}} {{#if canEdit}} {{#if hasPages}}
<div class="start-section" data-index={{index}} data-before-id={{item.page.id}} id="add-section-button-{{item.page.id}}" {{#each pages key="id" as |item index|}}
{{action 'onShowSectionWizard' item.page}}> {{#if canEdit}}
<div class="start-button"> <div class="start-section" data-index={{index}} data-before-id={{item.page.id}} id="add-section-button-{{item.page.id}}"
<div class="cta">+ SECTION</div> {{action 'onShowSectionWizard' item.page}}>
</div> <div class="start-button">
</div> <div class="cta">+ SECTION</div>
{{else}} </div>
</div>
{{else}}
<div class="section-divider" /> {{/if}} {{document/document-page document=document folder=folder page=item.page meta=item.meta pending=item.pending permissions=permissions <div class="section-divider" /> {{/if}} {{document/document-page document=document folder=folder page=item.page meta=item.meta pending=item.pending permissions=permissions
toEdit=toEdit roles=roles blocks=blocks onSavePage=(action 'onSavePage') onSavePageAsBlock=(action 'onSavePageAsBlock') onCopyPage=(action toEdit=toEdit roles=roles blocks=blocks onSavePage=(action 'onSavePage') onSavePageAsBlock=(action 'onSavePageAsBlock') onCopyPage=(action
'onCopyPage') onMovePage=(action 'onMovePage') onDeletePage=(action 'onDeletePage') refresh=(action refresh)}} {{/each}} 'onCopyPage') onMovePage=(action 'onMovePage') onDeletePage=(action 'onDeletePage') refresh=(action refresh)}} {{/each}}
@ -15,29 +17,37 @@ toEdit=toEdit roles=roles blocks=blocks onSavePage=(action 'onSavePage') onSaveP
<div class="cta">+ SECTION</div> <div class="cta">+ SECTION</div>
</div> </div>
</div> </div>
{{/if}} {{#if showLikes}} {{/if}}
<div class=" d-flex justify-content-center"> {{#if showLikes}}
<div class="vote-box"> <div class=" d-flex justify-content-center">
{{#unless voteThanks}} <div class="vote-box">
<div class="prompt"> {{#unless voteThanks}}
{{folder.likes}} <div class="prompt">
{{folder.likes}}
</div>
<div class="buttons">
<button type="button" class="btn btn-outline-success font-weight-bold" {{action 'onVote' 1}}>Yes, thanks!</button>&nbsp;&nbsp;
<button type="button" class="btn btn-outline-secondary font-weight-bold" {{action 'onVote' 2}}>Not really</button>
</div>
{{else}}
<div class="ack">Thanks for the feedback!</div>
{{/unless}}
</div> </div>
<div class="buttons">
<button type="button" class="btn btn-outline-success font-weight-bold" {{action 'onVote' 1}}>Yes, thanks!</button>&nbsp;&nbsp;
<button type="button" class="btn btn-outline-secondary font-weight-bold" {{action 'onVote' 2}}>Not really</button>
</div>
{{else}}
<div class="ack">Thanks for the feedback!</div>
{{/unless}}
</div> </div>
</div>
{{/if}} {{/if}} {{#unless hasPages}} {{#if canEdit}} {{/if}}
{{/if}}
{{#unless hasPages}}
{{#if canEdit}}
<div class="start-section" data-index="-1" data-before-id="0" id="add-section-button-0" {{action 'onShowSectionWizard'}}> <div class="start-section" data-index="-1" data-before-id="0" id="add-section-button-0" {{action 'onShowSectionWizard'}}>
<div class="start-button"> <div class="start-button">
<div class="cta">+ SECTION</div> <div class="cta">+ SECTION</div>
</div> </div>
</div> </div>
{{/if}} {{/unless}} {{#if canEdit}} {{/if}} {{/unless}}
{{#if canEdit}}
<div id="wizard-placeholder" class="hide margin-top-50" /> <div id="wizard-placeholder" class="hide margin-top-50" />
<div id="new-section-wizard" class="new-section-wizard"> <div id="new-section-wizard" class="new-section-wizard">
<div class="container box"> <div class="container box">

View file

@ -2,7 +2,7 @@
<div class="col d-flex justify-content-start"> <div class="col d-flex justify-content-start">
<div class="footer"> <div class="footer">
{{#if showWait}} {{#if showWait}}
<div class="progress progress-wait"> <div class="progress progress-wait animated fadeIn">
<img src="/assets/img/busy-gray.gif" /> <img src="/assets/img/busy-gray.gif" />
</div> </div>
{{/if}} {{/if}}

View file

@ -68,6 +68,12 @@ func Numberize(pages []Page) {
} }
pages[i].Numbering = numbering pages[i].Numbering = numbering
// Troubleshooting help
if len(numbering) == 0 {
fmt.Printf("No number allocated to page %s ('%s')",
pages[i].RefID, pages[i].Title)
}
// update state // update state
prevPageLevel = p.Level prevPageLevel = p.Level
} }