         [:a {:href link} "Back"]
     ])
 
+(defn render-optional-message
+    [message-type message]
+    (if message
+        [:div {:class "container-fluid"}
+            [:div {:class (str "alert alert-" message-type)}
+                message
+            ]]))
+
 (defn render-front-page
     "Render front page of this application."
     [url-prefix title]


(defn render-chapter-list
    "Render chapter list for selected product."
    [url-prefix title product-id product-name chapter-list]
    (page/xhtml
        (render-html-header url-prefix title)
        [:body
            [:div {:class "container"}
                (render-navigation-bar-section url-prefix title)
                (render-breadcrumb url-prefix "select-product" (str "Product: " product-name))
                [:div {:class "container-fluid"}
                [:h2 (str "Chapters for product " product-name)]
                [:table {:style "border-collapse: separate; border-spacing: 10px;"}
                    (for [chapter chapter-list]
                        [:tr
                            [:td (:name chapter)]
                            [:td [:a {:href (str "chapter?product-id=" product-id "&chapter-id=" (:id chapter) "&action=rename-chapter")} "rename"]]
                            [:td [:a {:href (str "chapter?product-id=" product-id "&chapter-id=" (:id chapter) "&action=grouplist")} "group list"]]])
                ]]
                (render-back-link (str url-prefix "select-product"))
                (render-html-footer)
            ] ; </div class="container">

            [:div {:class "container"}
                (render-navigation-bar-section url-prefix title)
                (render-breadcrumb url-prefix "select-product" "Product list")
                (render-optional-message message-type message)
                [:div {:class "container-fluid"}
                    [:h3 "Edit product"]
                    (form/form-to [:get "edit-product"]
