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';
export default Component.extend({
classNames: ['row d-print-none'],
documentService: service('document'),
appMeta: service(),
hasAttachments: notEmpty('files'),
@ -82,7 +83,6 @@ export default Component.extend({
getAttachments() {
this.get('documentService').getAttachments(this.get('document.id')).then((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'),
sectionService: service('section'),
linkService: service('link'),
// currentPageId: '',
tab: 'content',
tabCount: 0, // how many items inside the tab?
queryParams: ['currentPageId'],
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')
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
permissions=permissions
@ -42,19 +51,6 @@
versions=versions
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')}}
{{document/view-content
document=document links=links pages=pages blocks=blocks currentPageId=currentPageId
@ -64,9 +60,6 @@
onCopyPage=(action 'onCopyPage') onMovePage=(action 'onMovePage') onDeletePage=(action 'onPageDeleted')
refresh=(action 'refresh')}}
{{/if}}
{{#if (eq tab 'attachment')}}
{{document/view-attachment document=document permissions=permissions onReady=(action 'onReady')}}
{{/if}}
{{#if (eq tab 'revision')}}
{{document/view-revision document=document folder=folder pages=pages permissions=permissions onRollback=(action 'onRollback')}}
{{/if}}

View file

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

View file

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

View file

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

View file

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

View file

@ -75,6 +75,9 @@
</div>
{{/if}}
{{/if}}
{{document/view-attachment document=document permissions=permissions}}
</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}}
<ul class="list">
{{#each files key="id" as |a index|}}
<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}}">
<span class="file">{{ a.filename }}</span>
{{a.filename}}
</a>
{{#if canEdit}}
<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>
</div>
</div>
@ -22,7 +22,7 @@
{{/if}}
{{#if canEdit}}
<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>
{{/if}}
</div>

View file

@ -1,11 +1,13 @@
{{#if hasPages}} {{#each pages key="id" as |item index|}} {{#if canEdit}}
<div class="start-section" data-index={{index}} data-before-id={{item.page.id}} id="add-section-button-{{item.page.id}}"
{{action 'onShowSectionWizard' item.page}}>
<div class="start-button">
<div class="cta">+ SECTION</div>
</div>
</div>
{{else}}
{{#if hasPages}}
{{#each pages key="id" as |item index|}}
{{#if canEdit}}
<div class="start-section" data-index={{index}} data-before-id={{item.page.id}} id="add-section-button-{{item.page.id}}"
{{action 'onShowSectionWizard' item.page}}>
<div class="start-button">
<div class="cta">+ SECTION</div>
</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
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}}
@ -15,29 +17,37 @@ toEdit=toEdit roles=roles blocks=blocks onSavePage=(action 'onSavePage') onSaveP
<div class="cta">+ SECTION</div>
</div>
</div>
{{/if}} {{#if showLikes}}
<div class=" d-flex justify-content-center">
<div class="vote-box">
{{#unless voteThanks}}
<div class="prompt">
{{folder.likes}}
{{/if}}
{{#if showLikes}}
<div class=" d-flex justify-content-center">
<div class="vote-box">
{{#unless voteThanks}}
<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 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>
{{/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-button">
<div class="cta">+ SECTION</div>
</div>
</div>
{{/if}} {{/unless}} {{#if canEdit}}
{{/if}} {{/unless}}
{{#if canEdit}}
<div id="wizard-placeholder" class="hide margin-top-50" />
<div id="new-section-wizard" class="new-section-wizard">
<div class="container box">

View file

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

View file

@ -68,6 +68,12 @@ func Numberize(pages []Page) {
}
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
prevPageLevel = p.Level
}