aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--frontend/utility.go13
-rw-r--r--modules/lists/lists.go7
-rw-r--r--views/includes/navbar.html1
-rw-r--r--views/includes/notification.html23
4 files changed, 43 insertions, 1 deletions
diff --git a/frontend/utility.go b/frontend/utility.go
index 6dbef6a..4138963 100644
--- a/frontend/utility.go
+++ b/frontend/utility.go
@@ -7,6 +7,19 @@ type PaginationRange struct {
7 After []int 7 After []int
8} 8}
9 9
10type Notification struct {
11 Type string `json:"type"`
12 Message string `json:"message"`
13}
14
15func NewErrorNotification(message string) Notification {
16 return Notification{"error", message}
17}
18
19func NewNotification(message string) Notification {
20 return Notification{"info", message}
21}
22
10// PaginationFromPage gibt die Seiten vor und nach der gegebenen Seite zurück. pageRange gibt an, wie viele Seiten vor und nach der aktuellen Page angezeigt werden soll. 23// PaginationFromPage gibt die Seiten vor und nach der gegebenen Seite zurück. pageRange gibt an, wie viele Seiten vor und nach der aktuellen Page angezeigt werden soll.
11func PaginationFromPage(pageRange, currentPage, maxPage int) PaginationRange { 24func PaginationFromPage(pageRange, currentPage, maxPage int) PaginationRange {
12 var before []int 25 var before []int
diff --git a/modules/lists/lists.go b/modules/lists/lists.go
index 39cc4d0..a6d0284 100644
--- a/modules/lists/lists.go
+++ b/modules/lists/lists.go
@@ -464,7 +464,12 @@ func (m *Module) updateListSettings(w http.ResponseWriter, r *http.Request, p ht
464 list.Name = name 464 list.Name = name
465 list.Description = description 465 list.Description = description
466 466
467 m.viewListSettings(w, r, p) 467 data := m.g.Renderer.DefaultData()
468 data["user"] = user
469 data["list"] = list
470 data["notification"] = frontend.NewNotification("Aenderungen gespeichert")
471
472 m.g.Renderer.RenderPage("list_settings", w, data)
468 el.EditList(user, eventlogging.EditListData{ 473 el.EditList(user, eventlogging.EditListData{
469 ListID: id, 474 ListID: id,
470 OldName: oldName, 475 OldName: oldName,
diff --git a/views/includes/navbar.html b/views/includes/navbar.html
index 23514f8..13fd22d 100644
--- a/views/includes/navbar.html
+++ b/views/includes/navbar.html
@@ -14,4 +14,5 @@
14 </ul> 14 </ul>
15 </div> 15 </div>
16</nav> 16</nav>
17{{ if .notification }}{{ template "notification" .notification }}{{ end }}
17{{ end }} 18{{ end }}
diff --git a/views/includes/notification.html b/views/includes/notification.html
new file mode 100644
index 0000000..d8323b7
--- /dev/null
+++ b/views/includes/notification.html
@@ -0,0 +1,23 @@
1{{ define "notification" }}
2<style scoped>
3#notification {
4 transition: opacity .5s;
5 opacity: 1.0;
6 padding: 8px;
7}
8
9#notification div {
10 padding: 8px;
11 border-radius: 4px;
12}
13</style>
14<div class="row" id="notification">
15 <div class="col s12 center-align white-text {{ if eq .Type "error" }}red darken-2 {{ else }}green lighten-2{{ end }}">
16 {{ .Message }}
17 </div>
18</div>
19<script>'use strict';
20 const el = document.getElementById('notification');
21 setTimeout(() => el.style.opacity = 0.0, 3000);
22</script>
23{{ end }}