mirror of
https://github.com/documize/community.git
synced 2025-07-25 08:09:43 +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 (
|
||||
"bytes"
|
||||
"database/sql"
|
||||
"fmt"
|
||||
"io"
|
||||
"mime"
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
"github.com/documize/community/domain/auth"
|
||||
"github.com/documize/community/model/space"
|
||||
|
||||
"github.com/documize/community/core/env"
|
||||
"github.com/documize/community/core/request"
|
||||
"github.com/documize/community/core/response"
|
||||
"github.com/documize/community/core/secrets"
|
||||
"github.com/documize/community/core/uniqueid"
|
||||
"github.com/documize/community/domain"
|
||||
"github.com/documize/community/domain/auth"
|
||||
"github.com/documize/community/domain/organization"
|
||||
"github.com/documize/community/domain/permission"
|
||||
indexer "github.com/documize/community/domain/search"
|
||||
"github.com/documize/community/domain/store"
|
||||
"github.com/documize/community/model/attachment"
|
||||
"github.com/documize/community/model/audit"
|
||||
"github.com/documize/community/model/space"
|
||||
"github.com/documize/community/model/workflow"
|
||||
uuid "github.com/nu7hatch/gouuid"
|
||||
)
|
||||
|
@ -89,7 +87,7 @@ func (h *Handler) Download(w http.ResponseWriter, r *http.Request) {
|
|||
return
|
||||
}
|
||||
|
||||
// Get the space for this attachment
|
||||
// Get the space for this attachment.
|
||||
sp, err := h.Store.Space.Get(ctx, doc.SpaceID)
|
||||
if err == sql.ErrNoRows {
|
||||
response.WriteNotFoundError(w, method, a.DocumentID)
|
||||
|
@ -101,8 +99,7 @@ func (h *Handler) Download(w http.ResponseWriter, r *http.Request) {
|
|||
return
|
||||
}
|
||||
|
||||
// Get the organization for this request
|
||||
// Get the space for this attachment
|
||||
// Get the organization for this request.
|
||||
org, err := h.Store.Organization.GetOrganization(ctx, ctx.OrgID)
|
||||
if err == sql.ErrNoRows {
|
||||
response.WriteNotFoundError(w, method, a.DocumentID)
|
||||
|
@ -181,16 +178,20 @@ func (h *Handler) Download(w http.ResponseWriter, r *http.Request) {
|
|||
typ = "application/octet-stream"
|
||||
}
|
||||
|
||||
dataSize := len(a.Data)
|
||||
|
||||
w.Header().Set("Content-Type", typ)
|
||||
w.Header().Set("Content-Disposition", `Attachment; filename="`+a.Filename+`" ; `+`filename*="`+a.Filename+`"`)
|
||||
w.Header().Set("Content-Length", fmt.Sprintf("%d", len(a.Data)))
|
||||
w.WriteHeader(http.StatusOK)
|
||||
if dataSize != 0 {
|
||||
w.Header().Set("Content-Length", string(dataSize))
|
||||
}
|
||||
|
||||
_, err = w.Write(a.Data)
|
||||
if err != nil {
|
||||
h.Runtime.Log.Error("write attachment", err)
|
||||
return
|
||||
}
|
||||
w.WriteHeader(http.StatusOK)
|
||||
|
||||
h.Store.Audit.Record(ctx, audit.EventTypeAttachmentDownload)
|
||||
}
|
||||
|
|
|
@ -49,6 +49,19 @@
|
|||
</Layout::Grid::Sidebar>
|
||||
|
||||
<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
|
||||
tab=tab
|
||||
roles=roles
|
||||
|
@ -64,19 +77,6 @@
|
|||
|
||||
<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
|
||||
expandState=expandState
|
||||
roles=roles
|
||||
|
|
|
@ -15,8 +15,10 @@ a {
|
|||
text-decoration: none;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
outline: none;
|
||||
|
||||
a:focus, a:hover {
|
||||
outline: none;
|
||||
text-decoration: underline;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -171,7 +171,7 @@
|
|||
|
||||
> .document-heading {
|
||||
.name {
|
||||
margin: 1.5rem 0 0.5rem 0;
|
||||
margin: 0;
|
||||
color: map-get($gray-shades, 900);
|
||||
font-size: 2.2rem;
|
||||
font-weight: 700;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue