diff --git a/resources/templates/error.html b/resources/templates/error.html index f811553..505310c 100644 --- a/resources/templates/error.html +++ b/resources/templates/error.html @@ -2,24 +2,12 @@ {% block big-links %} {% endblock %} {% block content %} -<body> -<div class="container-fluid"> - <div class="row-fluid"> - <div class="col-lg-12"> - <div class="centering text-center"> - <div class="text-center"> - <h1><span class="text-danger">Error: {{status}}</span></h1> - <hr> - {% if title %} - <h2 class="without-margin">{{title}}</h2> - {% endif %} - {% if message %} - <h4 class="text-danger">{{message}}</h4> - {% endif %} - </div> - </div> - </div> - </div> -</div> + {% if status %} + <h2>Error: {{status}}</h2> + {% endif %} + <hr> + {% if error %} + <p>{{error}}</p> + {% endif %} {% endblock %} diff --git a/src/clj/youyesyet/layout.clj b/src/clj/youyesyet/layout.clj index 744fca2..3254100 100644 --- a/src/clj/youyesyet/layout.clj +++ b/src/clj/youyesyet/layout.clj @@ -89,19 +89,19 @@ "renders the HTML `template` located relative to resources/templates in the context of this session and with these parameters." [template & [params]] - (log/debug (str "layout/render: template: '" template "'")) - (content-type - (ok - (parser/render-file - template - (merge params + (log/debug (str "layout/render: template: '" template "'")) + (content-type + (ok + (parser/render-file + template + (merge params {:page template - :csrf-token *anti-forgery-token* - :user *user* - :user-roles (get-user-roles *user*) - :site-title (:site-title env) - :version (System/getProperty "youyesyet.version")}))) - "text/html; charset=utf-8")) + :csrf-token *anti-forgery-token* + :user *user* + :user-roles (get-user-roles *user*) + :site-title (:site-title env) + :version (System/getProperty "youyesyet.version")}))) + "text/html; charset=utf-8")) @@ -113,6 +113,16 @@ returns a response map with the error page as the body and the status specified by the status key" [error-details] + (log/debug "Showing error page: " error-details) {:status (:status error-details) :headers {"Content-Type" "text/html; charset=utf-8"} - :body (render "error.html" {} error-details)}) + :body (parser/render-file + "error.html" + (assoc + error-details + :site-title (:site-title env) + :title + (str "Apologies, we have a problem: " + (:title error-details)) + :error (:message error-details) + :message nil))})