mirror of
https://github.com/documize/community.git
synced 2025-07-29 01:59:41 +02:00
Move doc headings above doc meta
This commit is contained in:
parent
f7a738ad84
commit
14820df165
4 changed files with 26 additions and 23 deletions
|
@ -14,27 +14,25 @@ package attachment
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"database/sql"
|
"database/sql"
|
||||||
"fmt"
|
|
||||||
"io"
|
"io"
|
||||||
"mime"
|
"mime"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/documize/community/domain/auth"
|
|
||||||
"github.com/documize/community/model/space"
|
|
||||||
|
|
||||||
"github.com/documize/community/core/env"
|
"github.com/documize/community/core/env"
|
||||||
"github.com/documize/community/core/request"
|
"github.com/documize/community/core/request"
|
||||||
"github.com/documize/community/core/response"
|
"github.com/documize/community/core/response"
|
||||||
"github.com/documize/community/core/secrets"
|
"github.com/documize/community/core/secrets"
|
||||||
"github.com/documize/community/core/uniqueid"
|
"github.com/documize/community/core/uniqueid"
|
||||||
"github.com/documize/community/domain"
|
"github.com/documize/community/domain"
|
||||||
|
"github.com/documize/community/domain/auth"
|
||||||
"github.com/documize/community/domain/organization"
|
"github.com/documize/community/domain/organization"
|
||||||
"github.com/documize/community/domain/permission"
|
"github.com/documize/community/domain/permission"
|
||||||
indexer "github.com/documize/community/domain/search"
|
indexer "github.com/documize/community/domain/search"
|
||||||
"github.com/documize/community/domain/store"
|
"github.com/documize/community/domain/store"
|
||||||
"github.com/documize/community/model/attachment"
|
"github.com/documize/community/model/attachment"
|
||||||
"github.com/documize/community/model/audit"
|
"github.com/documize/community/model/audit"
|
||||||
|
"github.com/documize/community/model/space"
|
||||||
"github.com/documize/community/model/workflow"
|
"github.com/documize/community/model/workflow"
|
||||||
uuid "github.com/nu7hatch/gouuid"
|
uuid "github.com/nu7hatch/gouuid"
|
||||||
)
|
)
|
||||||
|
@ -89,7 +87,7 @@ func (h *Handler) Download(w http.ResponseWriter, r *http.Request) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the space for this attachment
|
// Get the space for this attachment.
|
||||||
sp, err := h.Store.Space.Get(ctx, doc.SpaceID)
|
sp, err := h.Store.Space.Get(ctx, doc.SpaceID)
|
||||||
if err == sql.ErrNoRows {
|
if err == sql.ErrNoRows {
|
||||||
response.WriteNotFoundError(w, method, a.DocumentID)
|
response.WriteNotFoundError(w, method, a.DocumentID)
|
||||||
|
@ -101,8 +99,7 @@ func (h *Handler) Download(w http.ResponseWriter, r *http.Request) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the organization for this request
|
// Get the organization for this request.
|
||||||
// Get the space for this attachment
|
|
||||||
org, err := h.Store.Organization.GetOrganization(ctx, ctx.OrgID)
|
org, err := h.Store.Organization.GetOrganization(ctx, ctx.OrgID)
|
||||||
if err == sql.ErrNoRows {
|
if err == sql.ErrNoRows {
|
||||||
response.WriteNotFoundError(w, method, a.DocumentID)
|
response.WriteNotFoundError(w, method, a.DocumentID)
|
||||||
|
@ -181,16 +178,20 @@ func (h *Handler) Download(w http.ResponseWriter, r *http.Request) {
|
||||||
typ = "application/octet-stream"
|
typ = "application/octet-stream"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dataSize := len(a.Data)
|
||||||
|
|
||||||
w.Header().Set("Content-Type", typ)
|
w.Header().Set("Content-Type", typ)
|
||||||
w.Header().Set("Content-Disposition", `Attachment; filename="`+a.Filename+`" ; `+`filename*="`+a.Filename+`"`)
|
w.Header().Set("Content-Disposition", `Attachment; filename="`+a.Filename+`" ; `+`filename*="`+a.Filename+`"`)
|
||||||
w.Header().Set("Content-Length", fmt.Sprintf("%d", len(a.Data)))
|
if dataSize != 0 {
|
||||||
w.WriteHeader(http.StatusOK)
|
w.Header().Set("Content-Length", string(dataSize))
|
||||||
|
}
|
||||||
|
|
||||||
_, err = w.Write(a.Data)
|
_, err = w.Write(a.Data)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
h.Runtime.Log.Error("write attachment", err)
|
h.Runtime.Log.Error("write attachment", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
w.WriteHeader(http.StatusOK)
|
||||||
|
|
||||||
h.Store.Audit.Record(ctx, audit.EventTypeAttachmentDownload)
|
h.Store.Audit.Record(ctx, audit.EventTypeAttachmentDownload)
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,6 +49,19 @@
|
||||||
</Layout::Grid::Sidebar>
|
</Layout::Grid::Sidebar>
|
||||||
|
|
||||||
<Layout::Grid::Content>
|
<Layout::Grid::Content>
|
||||||
|
<div class="document-meta">
|
||||||
|
<div class="document-heading">
|
||||||
|
<h1 class="name">{{document.name}}</h1>
|
||||||
|
<h2 class="desc">{{document.excerpt}}</h2>
|
||||||
|
<div class="dates">
|
||||||
|
{{formatted-date document.created}}
|
||||||
|
{{#if (not-eq document.created document.revised)}}
|
||||||
|
— revised {{formatted-date document.revised}}
|
||||||
|
{{/if}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
{{document/document-meta
|
{{document/document-meta
|
||||||
tab=tab
|
tab=tab
|
||||||
roles=roles
|
roles=roles
|
||||||
|
@ -64,19 +77,6 @@
|
||||||
|
|
||||||
<Ui::UiSpacer @size="300" />
|
<Ui::UiSpacer @size="300" />
|
||||||
|
|
||||||
<div class="document-meta">
|
|
||||||
<div class="document-heading">
|
|
||||||
<h1 class="name">{{document.name}}</h1>
|
|
||||||
<h2 class="desc">{{document.excerpt}}</h2>
|
|
||||||
<div class="dates">
|
|
||||||
{{formatted-date document.created}}
|
|
||||||
{{#if (not-eq document.created document.revised)}}
|
|
||||||
— revised {{formatted-date document.revised}}
|
|
||||||
{{/if}}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{{document/view-content
|
{{document/view-content
|
||||||
expandState=expandState
|
expandState=expandState
|
||||||
roles=roles
|
roles=roles
|
||||||
|
|
|
@ -15,8 +15,10 @@ a {
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
-webkit-font-smoothing: antialiased;
|
-webkit-font-smoothing: antialiased;
|
||||||
-moz-osx-font-smoothing: grayscale;
|
-moz-osx-font-smoothing: grayscale;
|
||||||
|
outline: none;
|
||||||
|
|
||||||
a:focus, a:hover {
|
a:focus, a:hover {
|
||||||
|
outline: none;
|
||||||
text-decoration: underline;
|
text-decoration: underline;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -171,7 +171,7 @@
|
||||||
|
|
||||||
> .document-heading {
|
> .document-heading {
|
||||||
.name {
|
.name {
|
||||||
margin: 1.5rem 0 0.5rem 0;
|
margin: 0;
|
||||||
color: map-get($gray-shades, 900);
|
color: map-get($gray-shades, 900);
|
||||||
font-size: 2.2rem;
|
font-size: 2.2rem;
|
||||||
font-weight: 700;
|
font-weight: 700;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue