Skip to content

Commit

Permalink
ren artifact-editor to editor-artifact
Browse files Browse the repository at this point in the history
  • Loading branch information
bengarrett committed Aug 6, 2024
1 parent 636302f commit d6fea8f
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 41 deletions.
5 changes: 0 additions & 5 deletions assets/js/editor-archive.js

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @file artifact-editor.js
* @file editor-artifact.js
* This script is the entry point for the artifact editor page.
*/
import {
Expand Down
18 changes: 6 additions & 12 deletions handler/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -770,12 +770,11 @@ type Cache struct {

// SRI are the Subresource Integrity hashes for the layout.
type SRI struct {
ArtifactEditor string // Artifact Editor JS verification hash.
Bootstrap5 string // Bootstrap CSS verification hash.
Bootstrap5JS string // Bootstrap JS verification hash.
BootstrapIcons string // Bootstrap Icons SVG verification hash.
EditArtifact string // Artifact Editor JS verification hash.
EditAssets string // Editor Assets JS verification hash.
EditArchive string // Editor Archive JS verification hash.
EditForApproval string // Editor For Approval JS verification hash.
Jsdos6JS string // js-dos v6 verification hash.
DosboxJS string // DOSBox Emscripten verification hash.
Expand All @@ -793,12 +792,7 @@ type SRI struct {
func (s *SRI) Verify(fs embed.FS) error { //nolint:funlen
names := Names()
var err error
name := names[ArtifactEditor]
s.ArtifactEditor, err = helper.Integrity(name, fs)
if err != nil {
return fmt.Errorf("%s: %w", name, err)
}
name = names[Bootstrap5]
name := names[Bootstrap5]
s.Bootstrap5, err = helper.Integrity(name, fs)
if err != nil {
return fmt.Errorf("%s: %w", name, err)
Expand All @@ -818,13 +812,13 @@ func (s *SRI) Verify(fs embed.FS) error { //nolint:funlen
if err != nil {
return fmt.Errorf("%s: %w", name, err)
}
name = names[EditAssets]
s.EditAssets, err = helper.Integrity(name, fs)
name = names[EditArtifact]
s.EditArtifact, err = helper.Integrity(name, fs)
if err != nil {
return fmt.Errorf("%s: %w", name, err)
}
name = names[EditArchive]
s.EditArchive, err = helper.Integrity(name, fs)
name = names[EditAssets]
s.EditAssets, err = helper.Integrity(name, fs)
if err != nil {
return fmt.Errorf("%s: %w", name, err)
}
Expand Down
4 changes: 2 additions & 2 deletions handler/app/app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ func TestFuncMap(t *testing.T) {
t.Parallel()
w := app.Templ{}
x := w.FuncMap()
assert.Contains(t, x, "artifactEditor")
assert.Contains(t, x, "editArtifact")
assert.Contains(t, x, "version")
assert.Contains(t, x, "az")
assert.Contains(t, x, "msdos")
Expand Down Expand Up @@ -305,7 +305,7 @@ func TestNames(t *testing.T) {
t.Parallel()

x := app.Names()
assert.Equal(t, "public/js/artifact-editor.min.js", x[0])
assert.Equal(t, "public/js/editor-artifact.min.js", x[0])
}

func TestFontRefs(t *testing.T) {
Expand Down
8 changes: 3 additions & 5 deletions handler/app/asset.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,13 @@ package app
type Asset int

const (
ArtifactEditor Asset = iota // ArtifactEditor is the path to the minified Artifact Editor JS file.
Bootstrap5 // Bootstrap is the path to the minified Bootstrap 5.3 CSS file.
Bootstrap5 Asset = iota // Bootstrap is the path to the minified Bootstrap 5.3 CSS file.
Bootstrap5JS // BootstrapJS is the path to the minified Bootstrap 5.3 JS file.
BootstrapIcons // BootstrapIcons is the path to the custom Bootstrap Icons SVG sprites file.
DosboxJS // DosboxJS is the js-dos v6 default variant compiled with emscripten.
DosboxWasm // DosboxWasm is the js-dos v6 WASM binary file.
EditArtifact // EditArtifact is the path to the minified Artifact Editor JS file.
EditAssets // EditAssets is the path to the minified Editor assets JS file.
EditArchive // EditArchive is the path to the minified Editor archive JS file.
EditForApproval // EditForApproval is the path to the minified Editor for-approval JS file.
Htmx // Htmx is the path to the minified htmx AJAX JS file.
HtmxRespTargets // Htmx is the path to the minified response targets extension file.
Expand All @@ -35,14 +34,13 @@ type Paths map[Asset]string
// the src attribute in HTML script elements.
func Hrefs() Paths {
return Paths{
ArtifactEditor: "/js/artifact-editor.min.js",
Bootstrap5: "/css/bootstrap.min.css",
Bootstrap5JS: "/js/bootstrap.bundle.min.js",
BootstrapIcons: "/svg/bootstrap-icons.svg",
DosboxJS: "/js/wdosbox.js",
DosboxWasm: "/js/wdosbox.wasm",
EditArtifact: "/js/editor-artifact.min.js",
EditAssets: "/js/editor-assets.min.js",
EditArchive: "/js/editor-archive.min.js",
EditForApproval: "/js/editor-forapproval.min.js",
Htmx: "/js/htmx.min.js",
HtmxRespTargets: "/js/htmx-response-targets.min.js",
Expand Down
14 changes: 4 additions & 10 deletions handler/app/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,9 +231,6 @@ func (t Templ) Funcs() template.FuncMap {
func (t Templ) FuncClosures() template.FuncMap { //nolint:funlen
hrefs := Hrefs()
return template.FuncMap{
"artifactEditor": func() string {
return hrefs[ArtifactEditor]
},
"bootstrap5": func() string {
return hrefs[Bootstrap5]
},
Expand All @@ -251,8 +248,8 @@ func (t Templ) FuncClosures() template.FuncMap { //nolint:funlen
"demozooSanity": func() string {
return strconv.Itoa(demozoo.Sanity)
},
"editArchive": func() string {
return hrefs[EditArchive]
"editArtifact": func() string {
return hrefs[EditArtifact]
},
"editAssets": func() string {
return hrefs[EditAssets]
Expand Down Expand Up @@ -324,9 +321,6 @@ func (t Templ) FuncClosures() template.FuncMap { //nolint:funlen
"screenshot": func(unid, desc string) template.HTML {
return str.Screenshot(unid, desc, t.Environment.AbsPreview)
},
"sri_artifactEditor": func() string {
return t.Subresource.ArtifactEditor
},
"sri_bootstrap5": func() string {
return t.Subresource.Bootstrap5
},
Expand All @@ -336,8 +330,8 @@ func (t Templ) FuncClosures() template.FuncMap { //nolint:funlen
"sri_bootstrapIcons": func() string {
return t.Subresource.BootstrapIcons
},
"sri_editArchive": func() string {
return t.Subresource.EditArchive
"sri_editArtifact": func() string {
return t.Subresource.EditArtifact
},
"sri_editAssets": func() string {
return t.Subresource.EditAssets
Expand Down
Loading

0 comments on commit d6fea8f

Please sign in to comment.