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

Make content linker compat with new attachment API

Moved fom /attachments to /attachment API endpoint name.
This commit is contained in:
Harvey Kandola 2018-12-21 17:38:55 +00:00
parent 60f8cb7b5b
commit 92cb03a1db
7 changed files with 32 additions and 19 deletions

View file

@ -97,7 +97,6 @@ func (h *Handler) GetLinkCandidates(w http.ResponseWriter, r *http.Request) {
if len(files) == 0 { if len(files) == 0 {
files = []attachment.Attachment{} files = []attachment.Attachment{}
} }
if err != nil && err != sql.ErrNoRows { if err != nil && err != sql.ErrNoRows {
response.WriteServerError(w, method, err) response.WriteServerError(w, method, err)
h.Runtime.Log.Error(method, err) h.Runtime.Log.Error(method, err)

View file

@ -13,7 +13,7 @@ import Service, { inject as service } from '@ember/service';
import Notifier from '../mixins/notifier'; import Notifier from '../mixins/notifier';
export default Service.extend(Notifier, { export default Service.extend(Notifier, {
sessionService: service('session'), session: service('session'),
ajax: service(), ajax: service(),
appMeta: service(), appMeta: service(),
store: service(), store: service(),
@ -66,7 +66,13 @@ export default Service.extend(Notifier, {
result = `<a data-documize='true' data-link-space-id='${link.spaceId}' data-link-id='${link.id}' data-link-target-document-id='${link.documentId}' data-link-target-id='${link.targetId}' data-link-type='${link.linkType}' href='${href}'>${link.title}</a>`; result = `<a data-documize='true' data-link-space-id='${link.spaceId}' data-link-id='${link.id}' data-link-target-document-id='${link.documentId}' data-link-target-id='${link.targetId}' data-link-type='${link.linkType}' href='${href}'>${link.title}</a>`;
} }
if (link.linkType === "file") { if (link.linkType === "file") {
href = `${endpoint}/public/attachments/${orgId}/${link.targetId}`; // For authenticated users we send server auth token.
let qry = '';
if (this.get('session.authenticated')) {
qry = '?token=' + this.get('session.authToken');
}
href = `${endpoint}/public/attachment/${orgId}/${link.targetId}${qry}`;
result = `<a data-documize='true' data-link-space-id='${link.spaceId}' data-link-id='${link.id}' data-link-target-document-id='${link.documentId}' data-link-target-id='${link.targetId}' data-link-type='${link.linkType}' href='${href}'>${link.title}</a>`; result = `<a data-documize='true' data-link-space-id='${link.spaceId}' data-link-id='${link.id}' data-link-target-document-id='${link.documentId}' data-link-target-id='${link.targetId}' data-link-type='${link.linkType}' href='${href}'>${link.title}</a>`;
} }
if (link.linkType === "network") { if (link.linkType === "network") {
@ -130,6 +136,7 @@ export default Service.extend(Notifier, {
// handle attachment links // handle attachment links
if (link.linkType === "file") { if (link.linkType === "file") {
link.url = link.url.replace('attachments/', 'attachment/');
window.location.href = link.url; window.location.href = link.url;
return; return;
} }

View file

@ -31,6 +31,7 @@ $modal-header-border-color: $color-white;
$modal-footer-border-color: $color-white; $modal-footer-border-color: $color-white;
.modal-header { .modal-header {
// background-color: map-get($gray-shades, 800);
background-color: $theme-500; background-color: $theme-500;
color: map-get($gray-shades, 100); color: map-get($gray-shades, 100);
font-size: 1.2rem; font-size: 1.2rem;

View file

@ -21,11 +21,6 @@ a {
} }
} }
a.broken-link {
color: map-get($red-shades, 600);
text-decoration: line-through;
}
.no-outline { .no-outline {
outline: none !important; outline: none !important;
border: none !important; border: none !important;

View file

@ -13,8 +13,8 @@
white-space: nowrap; white-space: nowrap;
padding: 0.375rem 0.75rem; padding: 0.375rem 0.75rem;
margin: 10px; margin: 10px;
background-color: map-get($yellow-shades, 300); background-color: map-get($gray-shades, 100);
border: 1px solid map-get($yellow-shades, 400); border: 1px solid map-get($gray-shades, 200);
@extend .no-select; @extend .no-select;
@include border-radius(2px); @include border-radius(2px);
@include button-shadow-light(); @include button-shadow-light();
@ -37,13 +37,14 @@
display: inline-block; display: inline-block;
font-size: 1.1rem; font-size: 1.1rem;
font-weight: 500; font-weight: 500;
color: map-get($yellow-shades, 900); color: map-get($gray-shades, 800);
letter-spacing: 0.5px; letter-spacing: 0.5px;
margin-top: 6px; margin-top: 6px;
} }
&:hover { &:hover {
background-color: map-get($yellow-shades, 400); background-color: map-get($yellow-shades, 200);
border: 1px solid map-get($yellow-shades, 300);
} }
} }
@ -53,8 +54,8 @@
white-space: nowrap; white-space: nowrap;
padding: 0.375rem 0.75rem; padding: 0.375rem 0.75rem;
margin: 10px; margin: 10px;
background-color: map-get($yellow-shades, 200); background-color: map-get($gray-shades, 100);
border: 1px solid map-get($yellow-shades, 300); border: 1px solid map-get($gray-shades, 200);
@extend .no-select; @extend .no-select;
@include border-radius(2px); @include border-radius(2px);
@include button-shadow-light(); @include button-shadow-light();
@ -62,20 +63,21 @@
> .name { > .name {
font-size: 1.1rem; font-size: 1.1rem;
font-weight: 500; font-weight: 500;
color: map-get($yellow-shades, 800); color: map-get($green-shades, 800);
letter-spacing: 0.5px; letter-spacing: 0.5px;
@extend .text-truncate; @extend .text-truncate;
} }
> .desc { > .desc {
color: map-get($yellow-shades, 700); color: map-get($gray-shades, 800);
font-size: 0.9rem; font-size: 0.9rem;
font-weight: 300; font-weight: 300;
@extend .text-truncate; @extend .text-truncate;
} }
&:hover { &:hover {
background-color: map-get($yellow-shades, 300); background-color: map-get($yellow-shades, 200);
border: 1px solid map-get($yellow-shades, 300);
} }
} }
} }

View file

@ -35,3 +35,8 @@
.block-editor { .block-editor {
margin-top: 3rem; margin-top: 3rem;
} }
a.broken-link {
color: map-get($red-shades, 600);
text-decoration: line-through;
}

View file

@ -4,8 +4,12 @@
<div class="modal-header">Insert Link</div> <div class="modal-header">Insert Link</div>
<div class="modal-body"> <div class="modal-body">
<ul class="tabnav-control text-center"> <ul class="tabnav-control text-center">
<li class="tab {{if tab1Selected "selected"}}" {{action "onTabSelect" 1}}>Section</li> {{#if hasSections}}
<li class="tab {{if tab2Selected "selected"}}" {{action "onTabSelect" 2}}>Attachment</li> <li class="tab {{if tab1Selected "selected"}}" {{action "onTabSelect" 1}}>Section</li>
{{/if}}
{{#if hasAttachments}}
<li class="tab {{if tab2Selected "selected"}}" {{action "onTabSelect" 2}}>Attachment</li>
{{/if}}
<li class="tab {{if tab3Selected "selected"}}" {{action "onTabSelect" 3}}>Search</li> <li class="tab {{if tab3Selected "selected"}}" {{action "onTabSelect" 3}}>Search</li>
<li class="tab {{if tab4Selected "selected"}}" {{action "onTabSelect" 4}}>Network</li> <li class="tab {{if tab4Selected "selected"}}" {{action "onTabSelect" 4}}>Network</li>
</ul> </ul>