From 6dfe1f83f0309a1eb7324c5ede5b695aa1880426 Mon Sep 17 00:00:00 2001 From: srxr <10549030+srxr@users.noreply.github.com> Date: Tue, 30 Mar 2021 03:26:16 +0000 Subject: [PATCH] Improve layouts 1. Validate input url is empty for index and view page 2. Display origin full url in view page 3. Do not show edit and delete button on small screen 4. Add tooltip for view button 5. Pad domain on view page --- server.go | 2 ++ templates/edit.html | 21 +++++++++++++++++-- templates/index.html | 50 +++++++++++++++++++++++++++++++------------- templates/view.html | 13 ++++++++++-- 4 files changed, 67 insertions(+), 19 deletions(-) diff --git a/server.go b/server.go index f920e57..2606c6b 100644 --- a/server.go +++ b/server.go @@ -167,9 +167,11 @@ func (s *Server) ViewHandler() httprouter.Handle { struct { ID string URL string + Ori string }{ ID: u.ID, URL: fullURL.String(), + Ori: u.URL, }, ) } diff --git a/templates/edit.html b/templates/edit.html index 4ae9379..c3adb33 100644 --- a/templates/edit.html +++ b/templates/edit.html @@ -6,8 +6,8 @@
- - + + View @@ -17,3 +17,20 @@
{{end}} +{{define "scripts"}} + + +{{end}} \ No newline at end of file diff --git a/templates/index.html b/templates/index.html index 9446c45..b822c85 100644 --- a/templates/index.html +++ b/templates/index.html @@ -3,31 +3,51 @@
{{ range $URL := .URLList }} -
- - {{ $URL.ID }} - - {{ $URL.URL -}} - - + {{end}}
- - + +
{{end}} +{{define "scripts"}} + + +{{end}} \ No newline at end of file diff --git a/templates/view.html b/templates/view.html index 392e3f8..35a17d5 100644 --- a/templates/view.html +++ b/templates/view.html @@ -2,9 +2,10 @@