history page
This commit is contained in:
parent
ade62a74c1
commit
6cfe053a19
@ -1,10 +0,0 @@
|
|||||||
{% if article %}
|
|
||||||
<h2>Editing Article "{{title}}"</h2>
|
|
||||||
{% else %}
|
|
||||||
<h2>Creating Article "{{title}}"</h2>
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
<form method="POST" action=".">
|
|
||||||
{{ form.as_ul }}
|
|
||||||
<input type="submit">
|
|
||||||
</form>
|
|
@ -17,9 +17,11 @@
|
|||||||
{% if article.editable %}
|
{% if article.editable %}
|
||||||
<a href="{% url edit_article article.title %}">edit article</a> |
|
<a href="{% url edit_article article.title %}">edit article</a> |
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% if article %}
|
||||||
<a href="{% url article_history article.title %}">view history</a>
|
<a href="{% url article_history article.title %}">view history</a>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{% if form %}
|
{% if article and form %}
|
||||||
<form method="POST" action="{% url update_article_status article.title %}">
|
<form method="POST" action="{% url update_article_status article.title %}">
|
||||||
{{form.status.label_tag}} {{ form.status }}
|
{{form.status.label_tag}} {{ form.status }}
|
||||||
<input type="submit" />
|
<input type="submit" />
|
||||||
|
16
markupwiki/templates/markupwiki/edit_article.html
Normal file
16
markupwiki/templates/markupwiki/edit_article.html
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
{% extends "markupwiki/article.html" %}
|
||||||
|
|
||||||
|
{% block article_title %}
|
||||||
|
{% if article %}
|
||||||
|
Editing "{{title}}"
|
||||||
|
{% else %}
|
||||||
|
Creating New Article "{{title}}"
|
||||||
|
{% endif %}
|
||||||
|
{% endblock article_title %}
|
||||||
|
|
||||||
|
{% block article_body %}
|
||||||
|
<form method="POST" action=".">
|
||||||
|
{{ form.as_ul }}
|
||||||
|
<input type="submit">
|
||||||
|
</form>
|
||||||
|
{% endblock %}
|
@ -1,11 +1,17 @@
|
|||||||
|
{% extends "markupwiki/article.html" %}
|
||||||
|
|
||||||
<h2>History {{article.title}}</h2>
|
{% block article_title %}
|
||||||
|
{{article.title}} [History]
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block article_meta %} {% endblock %}
|
||||||
|
|
||||||
|
{% block article_body %}
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Version</th>
|
<th>Version</th>
|
||||||
<th>Author</th>
|
<th>Author</th>
|
||||||
<th>Date</th>
|
<th>Timestamp</th>
|
||||||
<th>Compare From</th>
|
<th>Compare From</th>
|
||||||
<th>Compare To</th>
|
<th>Compare To</th>
|
||||||
</tr>
|
</tr>
|
||||||
@ -15,13 +21,13 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td><a href="{{version.get_absolute_url}}">
|
<td><a href="{{version.get_absolute_url}}">
|
||||||
{% ifequal version.number 0 %}
|
{% ifequal version.number 0 %}
|
||||||
Initial Version
|
Initial
|
||||||
{% else %}
|
{% else %}
|
||||||
Revision {{version.number}}
|
Revision {{version.number}}
|
||||||
{% endifequal %}
|
{% endifequal %}
|
||||||
</a></td>
|
</a></td>
|
||||||
<td>{{version.author}}</td>
|
<td>{{version.author}}</td>
|
||||||
<td><a href="{{version.get_absolute_url}}">{{version.timestamp}}</a></td>
|
<td><a href="{{version.get_absolute_url}}">{{version.timestamp|date:"Y-m-d H:i:s"}}</a></td>
|
||||||
<td><input type="radio" name="from" value="{{version.number}}"></td>
|
<td><input type="radio" name="from" value="{{version.number}}"></td>
|
||||||
<td><input type="radio" name="to" value="{{version.number}}"></td>
|
<td><input type="radio" name="to" value="{{version.number}}"></td>
|
||||||
</tr>
|
</tr>
|
||||||
@ -30,3 +36,4 @@
|
|||||||
|
|
||||||
<input type="submit">
|
<input type="submit">
|
||||||
</form>
|
</form>
|
||||||
|
{% endblock %}
|
@ -75,8 +75,9 @@ def edit_article(request, title):
|
|||||||
except Article.DoesNotExist:
|
except Article.DoesNotExist:
|
||||||
article = None
|
article = None
|
||||||
|
|
||||||
if article and article.is_locked():
|
if article and article.is_locked() and not user.is_staff:
|
||||||
return render_to_response('locked_article.html', {'article': article})
|
return render_to_response('locked_article.html', {'article': article},
|
||||||
|
context_instance=RequestContext(request))
|
||||||
|
|
||||||
if request.method == 'GET':
|
if request.method == 'GET':
|
||||||
# either get an empty ArticleForm or one based on latest version
|
# either get an empty ArticleForm or one based on latest version
|
||||||
@ -108,9 +109,9 @@ def edit_article(request, title):
|
|||||||
# redirect to view article on save
|
# redirect to view article on save
|
||||||
return redirect(article)
|
return redirect(article)
|
||||||
|
|
||||||
return render_to_response('edit_article.html', {'title':title,
|
return render_to_response('markupwiki/edit_article.html',
|
||||||
'article':article,
|
{'title':title, 'article':article, 'form': form},
|
||||||
'form': form})
|
context_instance=RequestContext(request))
|
||||||
|
|
||||||
|
|
||||||
@require_POST
|
@require_POST
|
||||||
@ -129,8 +130,9 @@ def article_status(request, title):
|
|||||||
def article_history(request, title):
|
def article_history(request, title):
|
||||||
article = get_object_or_404(Article, title=title)
|
article = get_object_or_404(Article, title=title)
|
||||||
versions = article.versions.filter(removed=False)
|
versions = article.versions.filter(removed=False)
|
||||||
return render_to_response('history.html', {'article':article,
|
return render_to_response('markupwiki/history.html',
|
||||||
'versions':versions})
|
{'article':article, 'versions':versions},
|
||||||
|
context_instance=RequestContext(request))
|
||||||
|
|
||||||
@title_check
|
@title_check
|
||||||
def article_diff(request, title):
|
def article_diff(request, title):
|
||||||
@ -143,4 +145,5 @@ def article_diff(request, title):
|
|||||||
from_body = from_version.body.raw.split('\n')
|
from_body = from_version.body.raw.split('\n')
|
||||||
to_body = to_version.body.raw.split('\n')
|
to_body = to_version.body.raw.split('\n')
|
||||||
table = differ.make_table(from_body, to_body)
|
table = differ.make_table(from_body, to_body)
|
||||||
return render_to_response('article_diff.html', {'table':table})
|
return render_to_response('article_diff.html', {'table':table},
|
||||||
|
context_instance=RequestContext(request))
|
||||||
|
Loading…
Reference in New Issue
Block a user