mirror of
https://github.com/ordinary-dev/phoenix
synced 2024-09-20 03:40:29 +05:00
Keep settings page position after editing (#6)
This commit is contained in:
parent
77ddb3747b
commit
113d5860ff
|
@ -9,7 +9,7 @@
|
||||||
<a href="/">Main page</a>
|
<a href="/">Main page</a>
|
||||||
|
|
||||||
{{range .groups}}
|
{{range .groups}}
|
||||||
<h2>Group "{{.Name}}"</h2>
|
<h2 id="group-{{.ID}}">Group "{{.Name}}"</h2>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<form method="POST" action="/api/groups/{{.ID}}/put" class="innerForm">
|
<form method="POST" action="/api/groups/{{.ID}}/put" class="innerForm">
|
||||||
<input
|
<input
|
||||||
|
@ -36,43 +36,43 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{range .Links}}
|
{{range .Links}}
|
||||||
<div class="row">
|
<div class="row" id="link-{{.ID}}">
|
||||||
<form method="POST" action="/api/links/{{.ID}}/put" class="innerForm">
|
<form method="POST" action="/api/links/{{.ID}}/put" class="innerForm">
|
||||||
<!-- method: put -->
|
<!-- method: put -->
|
||||||
<input
|
<input
|
||||||
class="small-row"
|
class="small-row"
|
||||||
value="{{ if .Icon }}{{ .Icon }}{{ end }}"
|
value="{{ if .Icon }}{{ .Icon }}{{ end }}"
|
||||||
name="icon"
|
name="icon"
|
||||||
placeholder="Icon"
|
placeholder="Icon"
|
||||||
/>
|
/>
|
||||||
<input
|
<input
|
||||||
class="small-row"
|
class="small-row"
|
||||||
value="{{.Name}}"
|
value="{{.Name}}"
|
||||||
name="linkName"
|
name="linkName"
|
||||||
placeholder="Name"
|
placeholder="Name"
|
||||||
required
|
required
|
||||||
/>
|
/>
|
||||||
<input
|
<input
|
||||||
value="{{.Href}}"
|
value="{{.Href}}"
|
||||||
name="href"
|
name="href"
|
||||||
placeholder="Href"
|
placeholder="Href"
|
||||||
required
|
required
|
||||||
/>
|
/>
|
||||||
<button
|
<button
|
||||||
type="submit"
|
type="submit"
|
||||||
aria-label="Save the link"
|
aria-label="Save the link"
|
||||||
>
|
>
|
||||||
<img src="/assets/svg/floppy-disk-solid.svg" width="16px" height="16px" />
|
<img src="/assets/svg/floppy-disk-solid.svg" width="16px" height="16px" />
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
<form method="POST" action="/api/links/{{.ID}}/delete">
|
<form method="POST" action="/api/links/{{.ID}}/delete">
|
||||||
<button
|
<button
|
||||||
type="submit"
|
type="submit"
|
||||||
aria-label="Delete the link"
|
aria-label="Delete the link"
|
||||||
>
|
>
|
||||||
<img src="/assets/svg/trash-solid.svg" width="16px" height="16px" />
|
<img src="/assets/svg/trash-solid.svg" width="16px" height="16px" />
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package views
|
package views
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"github.com/ordinary-dev/phoenix/database"
|
"github.com/ordinary-dev/phoenix/database"
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
|
@ -20,7 +21,7 @@ func CreateGroup(db *gorm.DB) gin.HandlerFunc {
|
||||||
}
|
}
|
||||||
|
|
||||||
// This page is called from the settings, return the user back.
|
// This page is called from the settings, return the user back.
|
||||||
ctx.Redirect(http.StatusFound, "/settings")
|
ctx.Redirect(http.StatusFound, fmt.Sprintf("/settings#group-%v", group.ID))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,7 +46,7 @@ func UpdateGroup(db *gorm.DB) gin.HandlerFunc {
|
||||||
}
|
}
|
||||||
|
|
||||||
// This page is called from the settings, return the user back.
|
// This page is called from the settings, return the user back.
|
||||||
ctx.Redirect(http.StatusFound, "/settings")
|
ctx.Redirect(http.StatusFound, fmt.Sprintf("/settings#group-%v", group.ID))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package views
|
package views
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"github.com/ordinary-dev/phoenix/database"
|
"github.com/ordinary-dev/phoenix/database"
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
|
@ -33,7 +34,7 @@ func CreateLink(db *gorm.DB) gin.HandlerFunc {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Redirect to settings.
|
// Redirect to settings.
|
||||||
ctx.Redirect(http.StatusFound, "/settings")
|
ctx.Redirect(http.StatusFound, fmt.Sprintf("/settings#link-%v", link.ID))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,7 +66,7 @@ func UpdateLink(db *gorm.DB) gin.HandlerFunc {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Redirect to settings.
|
// Redirect to settings.
|
||||||
ctx.Redirect(http.StatusFound, "/settings")
|
ctx.Redirect(http.StatusFound, fmt.Sprintf("/settings#link-%v", link.ID))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue