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;
}
#nav-menu {
margin: 0;
}
#nav ul li {
padding: 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 */
#main-container{
clear: both;
/* width:100%; */
}
/* header for all pages in the Wiki - editable, provided by users. Within main-container */
#header {
margin-top: 0;
width:100%;
background-color: gray;
color: white;
}
#header h1 {
margin-top: 0;
}
/* left bar for all pages in the Wiki - editable, provided by users. Within main-container */
#left-bar {
width: 17%;
@ -130,6 +137,13 @@ li.nav-item a:active { background: gray; color: white; }
margin-bottom: 0;
}
.minor-controls {
float: right;
padding: 0.1em 2em;
background-color: silver;
font-size: 66%;
}
.wiki {
margin: 0;
}

View file

@ -1,13 +1,6 @@
{% extends "templates/base.html" %}
{% 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="auth">
<form action="{{servlet-context}}/auth" method="POST">
{% if user %}
<p class="widget">

View file

@ -29,7 +29,16 @@
</ul>
</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">
{% if message %}
<div id="message">
<p class="message">{{message}}</p>

View file

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

View file

@ -1,22 +1,12 @@
{% extends "templates/base.html" %}
{% 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="history">
<table>
<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>
{% for entry in history %}
<tr>
<td>
<a href="mailto:{{entry.email}}">{{entry.author}}</a>
</td>
<td>
{{entry.time}}
</td>
@ -24,9 +14,13 @@
{{entry.message}}
</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>
</tr>
{% endfor %}
</table>
</div>
{% endblock %}

View file

@ -1,13 +1,9 @@
{% extends "templates/base.html" %}
{% 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 class="minor-controls">
<a href="history?page={{title}}">History</a>
</div>
{{content|safe}}
</div>
{% endblock %}

View file

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