diff --git a/markupwiki/templates/edit_article.html b/markupwiki/templates/edit_article.html deleted file mode 100644 index e85426d..0000000 --- a/markupwiki/templates/edit_article.html +++ /dev/null @@ -1,10 +0,0 @@ -{% if article %} -

Editing Article "{{title}}"

-{% else %} -

Creating Article "{{title}}"

-{% endif %} - -
- {{ form.as_ul }} - -
diff --git a/markupwiki/templates/markupwiki/article.html b/markupwiki/templates/markupwiki/article.html index d53ef29..2f9ee72 100644 --- a/markupwiki/templates/markupwiki/article.html +++ b/markupwiki/templates/markupwiki/article.html @@ -17,9 +17,11 @@ {% if article.editable %} edit article | {% endif %} - view history + {% if article %} + view history + {% endif %} - {% if form %} + {% if article and form %}
{{form.status.label_tag}} {{ form.status }} diff --git a/markupwiki/templates/markupwiki/edit_article.html b/markupwiki/templates/markupwiki/edit_article.html new file mode 100644 index 0000000..24e47a3 --- /dev/null +++ b/markupwiki/templates/markupwiki/edit_article.html @@ -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.as_ul }} + +
+{% endblock %} diff --git a/markupwiki/templates/history.html b/markupwiki/templates/markupwiki/history.html similarity index 72% rename from markupwiki/templates/history.html rename to markupwiki/templates/markupwiki/history.html index f7d3358..c6792cb 100644 --- a/markupwiki/templates/history.html +++ b/markupwiki/templates/markupwiki/history.html @@ -1,11 +1,17 @@ +{% extends "markupwiki/article.html" %} -

History {{article.title}}

+{% block article_title %} +{{article.title}} [History] +{% endblock %} +{% block article_meta %} {% endblock %} + +{% block article_body %} - + @@ -15,13 +21,13 @@ - + @@ -30,3 +36,4 @@ +{% endblock %} diff --git a/markupwiki/views.py b/markupwiki/views.py index 825f01b..2af5757 100644 --- a/markupwiki/views.py +++ b/markupwiki/views.py @@ -75,8 +75,9 @@ def edit_article(request, title): except Article.DoesNotExist: article = None - if article and article.is_locked(): - return render_to_response('locked_article.html', {'article': article}) + if article and article.is_locked() and not user.is_staff: + return render_to_response('locked_article.html', {'article': article}, + context_instance=RequestContext(request)) if request.method == 'GET': # 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 return redirect(article) - return render_to_response('edit_article.html', {'title':title, - 'article':article, - 'form': form}) + return render_to_response('markupwiki/edit_article.html', + {'title':title, 'article':article, 'form': form}, + context_instance=RequestContext(request)) @require_POST @@ -129,8 +130,9 @@ def article_status(request, title): def article_history(request, title): article = get_object_or_404(Article, title=title) versions = article.versions.filter(removed=False) - return render_to_response('history.html', {'article':article, - 'versions':versions}) + return render_to_response('markupwiki/history.html', + {'article':article, 'versions':versions}, + context_instance=RequestContext(request)) @title_check def article_diff(request, title): @@ -143,4 +145,5 @@ def article_diff(request, title): from_body = from_version.body.raw.split('\n') to_body = to_version.body.raw.split('\n') 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))
Version AuthorDateTimestamp Compare From Compare To
{% ifequal version.number 0 %} - Initial Version + Initial {% else %} Revision {{version.number}} {% endifequal %} {{version.author}}{{version.timestamp}}{{version.timestamp|date:"Y-m-d H:i:s"}}