From 0173086939e00fa8f3a0654e2d6995706b26e1e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Borna=20Rajkovi=C4=87?= Date: Mon, 1 Jan 2024 17:58:47 +0100 Subject: [PATCH] Removed unused methods --- assets/global.css | 6 +- assets/style.css | 317 -------------------- main.go | 19 -- templates/countries.gohtml | 63 ---- templates/dialogs/check-is-a-holiday.gohtml | 23 -- templates/search.gohtml | 76 ----- 6 files changed, 4 insertions(+), 500 deletions(-) delete mode 100644 assets/style.css delete mode 100644 templates/dialogs/check-is-a-holiday.gohtml delete mode 100644 templates/search.gohtml diff --git a/assets/global.css b/assets/global.css index 88933be..27e133d 100644 --- a/assets/global.css +++ b/assets/global.css @@ -111,6 +111,7 @@ h3 { color: #999; } .form-field input, .form-field textarea { + box-sizing: border-box; width: 100%; border: none; border-bottom: 1px solid #bbb; @@ -390,5 +391,6 @@ dialog::backdrop { } dialog { width: 400px; - max-width: 100vh; -} \ No newline at end of file + max-width: 80vw; + box-sizing: border-box; +} diff --git a/assets/style.css b/assets/style.css deleted file mode 100644 index 567de95..0000000 --- a/assets/style.css +++ /dev/null @@ -1,317 +0,0 @@ -/* cleanup */ - -:root { - --primary: #9222dd; - --primary-darker: #6400a2; - --primary-contrast: #eee; -} - -* { - box-sizing: border-box; - font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; - padding: 0; - margin: 0; -} - -header { - padding: 1rem 2rem; - width: 100%; - background: var(--primary); - color: var(--primary-contrast); -} -header h1 { - font-size: 1.25em; -} -header a { - color: var(--primary-contrast); - text-decoration: none; -} -button { - all: unset; - padding: 0.25em 0.5em; - color: var(--primary-contrast); - background: var(--primary); - border: solid 1px var(--primary-darker); - border-radius: 0.25em; - font-size: 0.875em; - - --text: var(--primary-contrast); -} -select { - all: unset; - color: #111; - padding: 0.25em 0.5em; - background: #dddddd; - border: solid 1px #cccccc; - border-radius: 0.25em; - font-size: 0.875em; -} - -nav { - padding: 1rem 2rem; - width: 100%; - background: #f7f7f7; -} -nav a, nav button { - display: inline-block; - text-decoration: none; - color: #333; - font-size: 1rem; - border: none; - background: none; - padding: 0.5rem 1rem; - transition: ease-out 0.2s; - border-radius: 0; -} -nav a:hover, nav button:hover { - background: #e0e0e0; - color: #000; - transition: ease-out 0.2s; -} -nav a.selected, nav button.selected { - background: #216897; - color: white; -} - -table { - border-radius: 0.5em; -} - -table:not(.clean) { - width: 100%; -} - -table th, table td { - text-align: left; -} -table { - border-spacing: 0; - /*border-collapse: collapse;*/ -} -table thead * { - background: #666; - color: #fff; -} -table th, table td { - padding: 0.4rem 0.4rem; -} - -table:not(.clean) tbody tr:nth-child(2n+1) { - background: #fcfcfc; -} - -table:not(.clean) tbody tr:nth-child(2n) { - background: #f2f2f2; -} - -button { - padding: 0.25rem 1rem; -} - -.card { - padding: 1em; - background: #fff; - border-radius: 0.2rem; - border: 1px solid #bbb; -} -.card .card-title { - margin-bottom: 0.5em; -} -.card p { - margin-bottom: 0.5em; -} - -form section { - width: fit-content; -} - -/* styling */ -form section:not(.radio-group) label+:not(select) { - display: flex; -} - -form section { - padding-bottom: 0.75rem; -} - -form section > input { - width: 200px; - padding: 0.2em 0.5em; - border-radius: 0.25em; - border: 1px solid #aaa; -} - -form section > textarea { - width: 200px; - padding: 0.2em 0.5em; - border: 1px solid #aaa; - border-radius: 0.25em; -} - -form section select { - display: block; - width: 200px; - border: none; - font-size: 0.9rem; - padding: 0.2em 0.5em; - background: #ddd; -} - -form section label.checkbox { - display: block; - overflow: hidden; - width: 200px; -} -form section input[type=checkbox] { - vertical-align: middle; - float: right; -} - - -section.radio-group input { - display: none; -} - -section.radio-group div label { - display: inline-block; - padding: 0.25rem 0.75rem; - background: #ddd; -} - -section.radio-group div label { - min-width: 64px; - text-align: center; - font-size: 0.9rem; -} - -section.radio-group div label:first-of-type { - border-top-left-radius: 0.25rem; - border-bottom-left-radius: 0.25rem; -} - -section.radio-group div label:last-of-type { - border-top-right-radius: 0.25rem; - border-bottom-right-radius: 0.25rem; -} - -section.radio-group div input:checked+label { - background: #555; - color: white; -} - -img.icon, button.icon svg { - height: 1.2em; - width: 1.2em; -} -button.icon, a.icon { - display: flex; - align-content: baseline; - gap: 0.3em; -} - -button.icon svg, button.icon svg * { - fill: var(--text, var(--primary-contrast)); - color: var(--text, var(--primary-contrast)); - stroke: var(--text, var(--primary-contrast)); -} - -main { - display: flex; - flex-wrap: wrap; - max-width: 1280px; - margin: auto; -} - -.container { - max-width: 1280px; - margin: auto; -} - -section#search { - margin: 1em; - width: fit-content; -} - -.index-page { - margin: 1em auto; - align-content: center; - gap: 1em; -} -.index-page section { - flex-grow: 1; -} -.index-page section article { - margin: auto; - width: 300px; - max-width: 90vw; -} - -section#results { - margin: 1em; - flex-grow: 1; -} - -button.clean { - display: inline-block; - padding: 0.4rem; - border: none; - background: none; - text-decoration: none; - color: #000; - cursor: pointer; -} - -section#results a, section#results button { - display: inline-block; - padding: 0.4rem; - border: none; - background: none; - text-decoration: none; - color: #000; - cursor: pointer; -} - -dialog { - position: fixed; - left: 50%; - top: 80px; - transform: translate(-50%, 0); - max-height: calc(100vh - 160px); - overflow-y: scroll; -} -section.actions { - padding: 0; -} -article.single-holiday { - padding-bottom: 0.5em; - margin-bottom: 1em; - border-bottom: 2px solid #a0a0a0; -} - -.optional-selector { - border: 1px solid #666; - border-radius: 0.5em; -} - -.optional-selector .header { - padding: 1em; - background: #666; - margin-bottom: 0.5em; - color: white; - border-top-left-radius: 0.5em; - border-top-right-radius: 0.5em; -} -.optional-selector > *:not(.header) { - margin: 0 1em; -} -.hide { - display: none; -} -.source-code { - padding: 1em; -} -.source-code, .source-code * { - background: #777; - color: #fff; - font-family: 'Courier New', Courier, monospace; -} \ No newline at end of file diff --git a/main.go b/main.go index 28f5637..c41728b 100644 --- a/main.go +++ b/main.go @@ -82,22 +82,6 @@ func main() { years, _ := yearService.Find() c.HTML(http.StatusOK, "documentation.gohtml", gin.H{"Years": years, "Countries": countries}) }) - g.GET("/search", func(c *gin.Context) { - request := holiday.Search{} - if err := c.ShouldBindQuery(&request); err != nil { - c.AbortWithError(http.StatusBadRequest, err) - return - } - search := holiday.Search{Country: request.Country, Date: request.Date} - holidays, _ := holidayService.Find(search, holiday.Paging{PageSize: 100}) - countries, _ := countryService.Find() - c.HTML(http.StatusOK, "search.gohtml", gin.H{"Countries": countries, "Search": search, "Holidays": mapHolidays(holidays).Holidays}) - }) - g.GET("/dialogs/check-is-a-holiday", func(c *gin.Context) { - countries, _ := countryService.Find() - c.HTML(http.StatusOK, "check-is-a-holiday.gohtml", gin.H{"Countries": countries}) - }) - log.Fatal(http.ListenAndServe(":5281", g)) } @@ -122,7 +106,6 @@ func loadTemplates(g *gin.Engine) { g.LoadHTMLFiles( "templates/index.gohtml", "templates/results.gohtml", - "templates/search.gohtml", "templates/documentation.gohtml", "templates/admin_dashboard.gohtml", @@ -131,7 +114,6 @@ func loadTemplates(g *gin.Engine) { "templates/dialogs/add-holiday.gohtml", "templates/dialogs/edit-holiday.gohtml", "templates/dialogs/delete-holiday.gohtml", - "templates/dialogs/check-is-a-holiday.gohtml", "templates/dialogs/add-country.gohtml", "templates/dialogs/edit-country.gohtml", @@ -145,7 +127,6 @@ func IncludeHTML(path string) template.HTML { log.Println("includeHTML - error reading file: %v", err) return "" } - return template.HTML(string(b)) } diff --git a/templates/countries.gohtml b/templates/countries.gohtml index 98e5ee3..96a75a3 100644 --- a/templates/countries.gohtml +++ b/templates/countries.gohtml @@ -1,66 +1,3 @@ - - diff --git a/templates/dialogs/check-is-a-holiday.gohtml b/templates/dialogs/check-is-a-holiday.gohtml deleted file mode 100644 index 5e1c96d..0000000 --- a/templates/dialogs/check-is-a-holiday.gohtml +++ /dev/null @@ -1,23 +0,0 @@ - -
-

Is it a holiday?

- -
-
-
- - -
-
- - -
-
- -
-
-
\ No newline at end of file diff --git a/templates/search.gohtml b/templates/search.gohtml deleted file mode 100644 index 1080ee3..0000000 --- a/templates/search.gohtml +++ /dev/null @@ -1,76 +0,0 @@ - - - - - - Holiday-api | Admin dashboard - - - - -
-
-
-

Holiday-api | {{.Search.Date.Format "2006-01-02"}}

-
-
- -
- -
-

Results

- {{range $entry := .Holidays}} -
- - - - - - - - - - - - - - - - - - - -
Name: {{$entry.Name}}
Description: {{$entry.Description}}
Is state holiday:
Is religious holiday:
-
- {{end}} -
-
- - \ No newline at end of file