mirror of
https://github.com/documize/community.git
synced 2025-08-10 07:55:25 +02:00
Gemini section show auth message issues
This commit is contained in:
parent
f5d9fa49a3
commit
3762d6aafa
1 changed files with 8 additions and 2 deletions
|
@ -26,6 +26,7 @@ import (
|
||||||
|
|
||||||
// the HTML that is rendered by this section.
|
// the HTML that is rendered by this section.
|
||||||
const renderTemplate = `
|
const renderTemplate = `
|
||||||
|
{{if .Authenticated}}
|
||||||
<p class="margin-left-20">The Gemini workspace <a href="{{.Config.URL}}/workspace/{{.Config.WorkspaceID}}/items">{{.Config.WorkspaceName}}</a> contains {{.Config.ItemCount}} items.</p>
|
<p class="margin-left-20">The Gemini workspace <a href="{{.Config.URL}}/workspace/{{.Config.WorkspaceID}}/items">{{.Config.WorkspaceName}}</a> contains {{.Config.ItemCount}} items.</p>
|
||||||
<table class="basic-table gemini-table">
|
<table class="basic-table gemini-table">
|
||||||
<thead>
|
<thead>
|
||||||
|
@ -49,6 +50,9 @@ const renderTemplate = `
|
||||||
{{end}}
|
{{end}}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
{{else}}
|
||||||
|
<p>Authenticate with Gemini to see items.</p>
|
||||||
|
{{end}}
|
||||||
`
|
`
|
||||||
|
|
||||||
type gemini struct {
|
type gemini struct {
|
||||||
|
@ -83,6 +87,7 @@ func (*gemini) Render(config, data string) string {
|
||||||
|
|
||||||
payload.Items = items
|
payload.Items = items
|
||||||
payload.Config = c
|
payload.Config = c
|
||||||
|
payload.Authenticated = c.UserID > 0
|
||||||
|
|
||||||
t := template.New("items")
|
t := template.New("items")
|
||||||
t, _ = t.Parse(renderTemplate)
|
t, _ = t.Parse(renderTemplate)
|
||||||
|
@ -182,8 +187,9 @@ func (*gemini) Refresh(config, data string) (newData string) {
|
||||||
|
|
||||||
// Gemini helpers
|
// Gemini helpers
|
||||||
type geminiRender struct {
|
type geminiRender struct {
|
||||||
Config geminiConfig
|
Config geminiConfig
|
||||||
Items []geminiItem
|
Items []geminiItem
|
||||||
|
Authenticated bool
|
||||||
}
|
}
|
||||||
|
|
||||||
type geminiItem struct {
|
type geminiItem struct {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue