First bit of History feature working, general look and feel much improved.

This commit is contained in:
Simon Brooke 2015-01-10 09:46:10 +00:00
parent eb5b82fbca
commit 58389072a2
7 changed files with 43 additions and 44 deletions

View file

@ -51,6 +51,10 @@ body {
display: none; display: none;
} }
#nav-menu {
margin: 0;
}
#nav ul li { #nav ul li {
padding: 0; padding: 0;
margin: 0; margin: 0;
@ -71,18 +75,21 @@ li.nav-item a:active { background: gray; color: white; }
/* Overall container div, holds all content of page. Yes, I know it shouldn't have fixed width */ /* Overall container div, holds all content of page. Yes, I know it shouldn't have fixed width */
#main-container{ #main-container{
clear: both;
/* width:100%; */
} }
/* header for all pages in the Wiki - editable, provided by users. Within main-container */ /* header for all pages in the Wiki - editable, provided by users. Within main-container */
#header { #header {
margin-top: 0;
width:100%; width:100%;
background-color: gray; background-color: gray;
color: white; color: white;
} }
#header h1 {
margin-top: 0;
}
/* left bar for all pages in the Wiki - editable, provided by users. Within main-container */ /* left bar for all pages in the Wiki - editable, provided by users. Within main-container */
#left-bar { #left-bar {
width: 17%; width: 17%;
@ -130,6 +137,13 @@ li.nav-item a:active { background: gray; color: white; }
margin-bottom: 0; margin-bottom: 0;
} }
.minor-controls {
float: right;
padding: 0.1em 2em;
background-color: silver;
font-size: 66%;
}
.wiki { .wiki {
margin: 0; margin: 0;
} }

View file

@ -1,13 +1,6 @@
{% extends "templates/base.html" %} {% extends "templates/base.html" %}
{% block content %} {% block content %}
<div id="header" class="wiki"> <div id="content" class="auth">
<h1>{{title}}</h1>
{{header|safe}}
</div>
<div id="left-bar" class="wiki">
{{left-bar|safe}}
</div>
<div id="content" class="wiki">
<form action="{{servlet-context}}/auth" method="POST"> <form action="{{servlet-context}}/auth" method="POST">
{% if user %} {% if user %}
<p class="widget"> <p class="widget">

View file

@ -29,7 +29,16 @@
</ul> </ul>
</div> </div>
<div id="header" class="wiki">
<h1>{{title}}</h1>
{{header|safe}}
</div>
<div id="left-bar" class="wiki">
{{left-bar|safe}}
</div>
<div id="main-container" class="container"> <div id="main-container" class="container">
{% if message %} {% if message %}
<div id="message"> <div id="message">
<p class="message">{{message}}</p> <p class="message">{{message}}</p>

View file

@ -1,13 +1,6 @@
{% extends "templates/base.html" %} {% extends "templates/base.html" %}
{% block content %} {% block content %}
<div id="header" class="wiki"> <div id="content" class="edit">
<h1>Editing {{title}}</h1>
{{header|safe}}
</div>
<div id="left-bar" class="wiki">
{{left-bar|safe}}
</div>
<div id="content" class="wiki">
<form action="{{servlet-context}}/edit" method="POST"> <form action="{{servlet-context}}/edit" method="POST">
<input type="hidden" name="content" value="{{title}}"/> <input type="hidden" name="content" value="{{title}}"/>
<textarea name="src" id="src" rows="25" cols="80">{{content}}</textarea> <textarea name="src" id="src" rows="25" cols="80">{{content}}</textarea>

View file

@ -1,22 +1,12 @@
{% extends "templates/base.html" %} {% extends "templates/base.html" %}
{% block content %} {% block content %}
<div id="header" class="wiki"> <div id="content" class="history">
<h1>{{title}}</h1>
{{header|safe}}
</div>
<div id="left-bar" class="wiki">
{{left-bar|safe}}
</div>
<div id="content" class="wiki">
<table> <table>
<tr> <tr>
<th>Who</th><th>When</th><th>What</th><th>Which</th> <th>When</th><th>What</th><th>Version</th><th>Changes</th>
</tr> </tr>
{% for entry in history %} {% for entry in history %}
<tr> <tr>
<td>
<a href="mailto:{{entry.email}}">{{entry.author}}</a>
</td>
<td> <td>
{{entry.time}} {{entry.time}}
</td> </td>
@ -24,9 +14,13 @@
{{entry.message}} {{entry.message}}
</td> </td>
<td> <td>
{{entry.id}} <a href="history-version?id={{entry.id}}">Show version</a>
</td>
<td>
<a href="history-changes?id={{entry.id}}">What's changed?</a>
</td> </td>
</tr> </tr>
{% endfor %}
</table> </table>
</div> </div>
{% endblock %} {% endblock %}

View file

@ -1,13 +1,9 @@
{% extends "templates/base.html" %} {% extends "templates/base.html" %}
{% block content %} {% block content %}
<div id="header" class="wiki">
<h1>{{title}}</h1>
{{header|safe}}
</div>
<div id="left-bar" class="wiki">
{{left-bar|safe}}
</div>
<div id="content" class="wiki"> <div id="content" class="wiki">
<div class="minor-controls">
<a href="history?page={{title}}">History</a>
</div>
{{content|safe}} {{content|safe}}
</div> </div>
{% endblock %} {% endblock %}

View file

@ -98,15 +98,14 @@
"Render the history for the markdown page specified in this `request`, if any. If none, error?" "Render the history for the markdown page specified in this `request`, if any. If none, error?"
[request] [request]
(let [params (keywordize-keys (:params request)) (let [params (keywordize-keys (:params request))
content (or (:content params) "Introduction") page (or (:page params) "Introduction")
file-name (str "/content/" content ".md") file-name (str page ".md")
file-path (str (io/resource-path) file-name) repo-path (str (io/resource-path) "/content/")]
exists? (.exists (clojure.java.io/as-file file-path))]
(layout/render "history.html" (layout/render "history.html"
{:title content {:title (str "History of " page)
:left-bar (local-links (util/md->html "/content/_left-bar.md")) :left-bar (local-links (util/md->html "/content/_left-bar.md"))
:header (local-links (util/md->html "/content/_header.md")) :header (local-links (util/md->html "/content/_header.md"))
:history (hist/find-history (io/resource-path) file-name)}))) :history (hist/find-history repo-path file-name)})))
(defn auth-page (defn auth-page
"Render the auth page" "Render the auth page"
@ -141,6 +140,7 @@
(GET "/" request (wiki-page request)) (GET "/" request (wiki-page request))
(GET "/edit" request (route/restricted (edit-page request))) (GET "/edit" request (route/restricted (edit-page request)))
(POST "/edit" request (route/restricted (edit-page request))) (POST "/edit" request (route/restricted (edit-page request)))
(GET "/history" request (history-page request))
(GET "/auth" request (auth-page request)) (GET "/auth" request (auth-page request))
(POST "/auth" request (auth-page request)) (POST "/auth" request (auth-page request))
(GET "/about" [] (about-page))) (GET "/about" [] (about-page)))