From caa0e61762511c32e45caf0df4e9dca4d4670849 Mon Sep 17 00:00:00 2001 From: jan Date: Wed, 12 Oct 2016 16:58:08 +0200 Subject: globale Notification eingefuegt. Wir brauchen noch irgendienen weg, das zB bei redirects zu verwenden 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 { After []int } +type Notification struct { + Type string `json:"type"` + Message string `json:"message"` +} + +func NewErrorNotification(message string) Notification { + return Notification{"error", message} +} + +func NewNotification(message string) Notification { + return Notification{"info", message} +} + // 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. func PaginationFromPage(pageRange, currentPage, maxPage int) PaginationRange { 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 list.Name = name list.Description = description - m.viewListSettings(w, r, p) + data := m.g.Renderer.DefaultData() + data["user"] = user + data["list"] = list + data["notification"] = frontend.NewNotification("Aenderungen gespeichert") + + m.g.Renderer.RenderPage("list_settings", w, data) el.EditList(user, eventlogging.EditListData{ ListID: id, 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 @@ +{{ if .notification }}{{ template "notification" .notification }}{{ end }} {{ 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 @@ +{{ define "notification" }} + +
+
+ {{ .Message }} +
+
+ +{{ end }} -- cgit v0.10.1