Skip to content

Commit

Permalink
Added .editorconfig
Browse files Browse the repository at this point in the history
  • Loading branch information
applejag committed Oct 20, 2023
1 parent aa57b2f commit cabe09b
Show file tree
Hide file tree
Showing 15 changed files with 452 additions and 439 deletions.
13 changes: 13 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
root = true

[*]
indent_size = 2
indent_style = space
charset = utf-8
insert_final_newline = true
trim_trailing_whitespace = true
end_of_line = lf

[{*.{go,templ},go.mod,go.sum,Makefile}]
indent_style = tab
indent_size = 4
2 changes: 1 addition & 1 deletion .github/workflows/govulncheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

name: govulncheck

on:
on:
push:
branches:
- main
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/reuse.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

name: REUSE Compliance Check

on:
on:
push:
branches:
- main
Expand Down
18 changes: 9 additions & 9 deletions templates/components/alerts.templ
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@
package components

templ AlertDanger(title string) {
<div class="alert alert-danger">
<p><strong>Error:</strong> {title}</p>
{ children... }
</div>
<div class="alert alert-danger">
<p><strong>Error:</strong> {title}</p>
{ children... }
</div>
}

templ AlertDangerErr(title string, err error) {
<div class="alert alert-danger">
<p><strong>Error:</strong> {title}</p>
{ children... }
<pre><samp style="white-space: normal; word-break: break-word;">{ err.Error() }</samp></pre>
</div>
<div class="alert alert-danger">
<p><strong>Error:</strong> {title}</p>
{ children... }
<pre><samp style="white-space: normal; word-break: break-word;">{ err.Error() }</samp></pre>
</div>
}
10 changes: 5 additions & 5 deletions templates/components/breadcrumbs.templ
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
package components

templ Breadcrumbs() {
<aside>
<ul class="breadcrumb border border-3">
{ children... }
</ul>
</aside>
<aside>
<ul class="breadcrumb border border-3">
{ children... }
</ul>
</aside>
}
16 changes: 8 additions & 8 deletions templates/components/codeblock.templ
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@

package components
import (
"gopkg.in/yaml.v3"
"gopkg.in/yaml.v3"
)

templ CodeBlock(value any) {
if b, err := yaml.Marshal(value); err != nil {
@AlertDangerErr("Failed to serialize YAML:", err)
} else {
<pre><code class="language-yaml">
{ string(b) }
</code></pre>
}
if b, err := yaml.Marshal(value); err != nil {
@AlertDangerErr("Failed to serialize YAML:", err)
} else {
<pre><code class="language-yaml">
{ string(b) }
</code></pre>
}
}
58 changes: 29 additions & 29 deletions templates/components/link.templ
Original file line number Diff line number Diff line change
Expand Up @@ -18,66 +18,66 @@
package components

import (
"net/url"
"fmt"
"net/url"
"fmt"
)

func formatLinkURL(format string, args ...string) string {
var encoded []any
for _, arg := range args {
encoded = append(encoded, url.PathEscape(arg))
}
return fmt.Sprintf(format, encoded...)
var encoded []any
for _, arg := range args {
encoded = append(encoded, url.PathEscape(arg))
}
return fmt.Sprintf(format, encoded...)
}

templ Buttonf(label, format string, args ...string) {
@Button(label, formatLinkURL(format, args...))
@Button(label, formatLinkURL(format, args...))
}

templ Button(label, url string) {
@ButtonCustom(url) {
{ label }
}
@ButtonCustom(url) {
{ label }
}
}

templ ButtonCustomf(format string, args ...string) {
@ButtonCustom(formatLinkURL(format, args...)) {
{ children... }
}
@ButtonCustom(formatLinkURL(format, args...)) {
{ children... }
}
}

templ ButtonCustom(url string) {
<a href={ templ.URL(url) } class="paper-btn">{ children... }</a>
<a href={ templ.URL(url) } class="paper-btn">{ children... }</a>
}

templ ExternalLink(label, url string) {
@ExternalLinkCustom(url) {
{ label }
}
@ExternalLinkCustom(url) {
{ label }
}
}

templ ExternalLinkCustom(url string) {
<a href={ templ.URL(url) } target="_blank">{ children... }</a>
<a href={ templ.URL(url) } target="_blank">{ children... }</a>
}

templ Linkf(label, format string, args ...string) {
@LinkCustomf(formatLinkURL(format, args...)) {
{ label }
}
@LinkCustomf(formatLinkURL(format, args...)) {
{ label }
}
}

templ Link(label, url string) {
@LinkCustom(url) {
{ label }
}
@LinkCustom(url) {
{ label }
}
}

templ LinkCustomf(format string, args ...string) {
@LinkCustom(formatLinkURL(format, args...)) {
{ children... }
}
@LinkCustom(formatLinkURL(format, args...)) {
{ children... }
}
}

templ LinkCustom(url string) {
<a href={ templ.URL(url) }>{ children... }</a>
<a href={ templ.URL(url) }>{ children... }</a>
}
10 changes: 5 additions & 5 deletions templates/pages/config.templ
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@
package pages

import (
"github.com/RiskIdent/jelease/pkg/config"
"github.com/RiskIdent/jelease/pkg/config"
"github.com/RiskIdent/jelease/templates/components"
)

templ Config(config *config.Config) {
@Layout("Config") {
<h2>Config</h2>
@components.CodeBlock(config.Censored())
}
@Layout("Config") {
<h2>Config</h2>
@components.CodeBlock(config.Censored())
}
}
34 changes: 17 additions & 17 deletions templates/pages/errors.templ
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,24 @@ package pages
import "github.com/RiskIdent/jelease/templates/components"

templ Error404(message string) {
@Layout("Page not found") {
<h2>Page not found</h2>
if message != "" {
@components.AlertDanger(message)
}
<p><a href="/">Click here</a> to return to the start page.</p>
}
@Layout("Page not found") {
<h2>Page not found</h2>
if message != "" {
@components.AlertDanger(message)
}
<p><a href="/">Click here</a> to return to the start page.</p>
}
}

templ Error405() {
@Layout("Method not allowed") {
<h2>Method not allowed</h2>
<p>
Quite the interesting error you got there.
If you were navigated here by this website, then this is a bug,
and please report it here:
<a href="https://github.com/RiskIdent/jelease/issues/new" target="_blank">https://github.com/RiskIdent/jelease/issues/new</a>
</p>
<p><a href="/">Click here</a> to return to the start page.</p>
}
@Layout("Method not allowed") {
<h2>Method not allowed</h2>
<p>
Quite the interesting error you got there.
If you were navigated here by this website, then this is a bug,
and please report it here:
<a href="https://github.com/RiskIdent/jelease/issues/new" target="_blank">https://github.com/RiskIdent/jelease/issues/new</a>
</p>
<p><a href="/">Click here</a> to return to the start page.</p>
}
}
10 changes: 5 additions & 5 deletions templates/pages/index.templ
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
package pages

templ Index() {
@Layout("Jelease") {
<div class="row flex-center">
<img src="/images/jelease-gopher-card-512.jpg" alt="Jelease logo" class="border-6" />
</div>
}
@Layout("Jelease") {
<div class="row flex-center">
<img src="/images/jelease-gopher-card-512.jpg" alt="Jelease logo" class="border-6" />
</div>
}
}
Loading

0 comments on commit cabe09b

Please sign in to comment.