Port the web to bootstrap5

So it is responsive in phones.
This commit is contained in:
Las Zenow 2017-06-08 00:44:35 +00:00
parent 8af2ad3758
commit 6a3da59c75
40 changed files with 1131 additions and 849 deletions

View file

@ -15,7 +15,7 @@ func listHandler(h handler) {
list, err := h.db.GetBookList(listID)
if err != nil {
log.Error("Error loading list ", listID, ": ", err)
h.sess.Notify("Something went wrong!", "Could not load the list", "error")
h.sess.Notify("Something went wrong!", "Could not load the list", "danger")
http.Redirect(h.w, h.r, h.r.Referer(), http.StatusFound)
return
}
@ -52,7 +52,7 @@ func listPostHandler(h handler) {
userLists, err := h.db.GetListsByUser(h.sess.User)
if err != nil {
log.Error("Error loading user (", h.sess.User, ") lists: ", err)
h.sess.Notify("Something went wrong!", "Could not add book to the list", "error")
h.sess.Notify("Something went wrong!", "Could not add book to the list", "danger")
http.Redirect(h.w, h.r, h.r.Referer(), http.StatusFound)
return
}
@ -71,7 +71,7 @@ func listPostHandler(h handler) {
err = h.db.NewBookList(listID, listTitle, h.sess.User, []string{})
if err != nil {
log.Error("Error creating list ", listTitle, " by user ", h.sess.User, ": ", err)
h.sess.Notify("Something went wrong!", "Could not add book to the list", "error")
h.sess.Notify("Something went wrong!", "Could not add book to the list", "danger")
http.Redirect(h.w, h.r, h.r.Referer(), http.StatusFound)
return
}
@ -83,7 +83,7 @@ func listPostHandler(h handler) {
err = h.db.AddBookToList(listID, bookID)
if err != nil {
log.Error("Error adding book ", bookID, " to list ", listTitle, "(", listID, "): ", err)
h.sess.Notify("Something went wrong!", "Could not add book to the list", "error")
h.sess.Notify("Something went wrong!", "Could not add book to the list", "danger")
http.Redirect(h.w, h.r, h.r.Referer(), http.StatusFound)
return
}
@ -96,12 +96,12 @@ func listEditPostHandler(h handler) {
list, err := h.db.GetBookList(listID)
if err != nil || list == nil {
log.Error("Error loading list ", listID, ": ", err)
h.sess.Notify("Something went wrong!", "Could not save the list", "error")
h.sess.Notify("Something went wrong!", "Could not save the list", "danger")
http.Redirect(h.w, h.r, h.r.Referer(), http.StatusFound)
return
}
if h.sess.User != list.User.Username {
h.sess.Notify("You are not the owner of the list!", "You can't edit it", "error")
h.sess.Notify("You are not the owner of the list!", "You can't edit it", "danger")
http.Redirect(h.w, h.r, h.r.Referer(), http.StatusFound)
return
}
@ -111,7 +111,7 @@ func listEditPostHandler(h handler) {
err = h.db.UpdateBookList(listID, title, description)
if err != nil {
log.Error("Error editing list ", list.Title, "(", listID, "): ", err)
h.sess.Notify("Something went wrong!", "Could not edit the list", "error")
h.sess.Notify("Something went wrong!", "Could not edit the list", "danger")
http.Redirect(h.w, h.r, h.r.Referer(), http.StatusFound)
return
}
@ -126,12 +126,12 @@ func listRemoveHandler(h handler) {
list, err := h.db.GetBookList(listID)
if err != nil || list == nil {
log.Error("Error loading list ", listID, ": ", err)
h.sess.Notify("Something went wrong!", "Could not remove books from the list", "error")
h.sess.Notify("Something went wrong!", "Could not remove books from the list", "danger")
http.Redirect(h.w, h.r, h.r.Referer(), http.StatusFound)
return
}
if h.sess.User != list.User.Username {
h.sess.Notify("You are not the owner of the list!", "You can't remove books from it", "error")
h.sess.Notify("You are not the owner of the list!", "You can't remove books from it", "danger")
http.Redirect(h.w, h.r, h.r.Referer(), http.StatusFound)
return
}
@ -139,7 +139,7 @@ func listRemoveHandler(h handler) {
err = h.db.DeleteBookFromList(listID, bookID)
if err != nil {
log.Error("Error remove book ", bookID, " from list ", listID, "): ", err)
h.sess.Notify("Something went wrong!", "Could not remove book", "error")
h.sess.Notify("Something went wrong!", "Could not remove book", "danger")
http.Redirect(h.w, h.r, h.r.Referer(), http.StatusFound)
return
}