From 8f0e18f498d6c07937c92d186bfa6b654a1afa14 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=C5=81ukasz=20Rekucki?= Date: Thu, 20 May 2010 18:19:49 +0200 Subject: [PATCH] Save form now adds "stage finished" info correctly + some translations. --- apps/wiki/constants.py | 29 +++--- apps/wiki/forms.py | 20 ++-- apps/wiki/models.py | 19 +++- apps/wiki/templates/wiki/base.html | 4 +- apps/wiki/templates/wiki/diff_table.html | 5 +- .../wiki/document_create_missing.html | 4 +- .../wiki/templates/wiki/document_details.html | 5 +- .../templates/wiki/document_details_base.html | 17 ++-- .../wiki/document_details_readonly.html | 1 + apps/wiki/templates/wiki/document_list.html | 6 +- apps/wiki/templates/wiki/save_dialog.html | 1 + .../templates/wiki/tabs/gallery_view.html | 19 ++-- .../templates/wiki/tabs/history_view.html | 7 +- .../wiki/tabs/history_view_item.html | 3 +- .../templates/wiki/tabs/source_editor.html | 2 +- .../wiki/tabs/source_editor_item.html | 3 +- .../templates/wiki/tabs/summary_view.html | 15 +-- .../wiki/tabs/summary_view_item.html | 1 + .../templates/wiki/tabs/wysiwyg_editor.html | 5 +- .../wiki/tabs/wysiwyg_editor_item.html | 3 +- apps/wiki/templates/wiki/tag_dialog.html | 5 +- apps/wiki/views.py | 12 ++- redakcja/locale/pl/LC_MESSAGES/django.po | 99 ++++++++++++------- redakcja/settings/common.py | 2 +- redakcja/static/js/wiki/view_history.js | 3 + redakcja/templates/base.html | 11 ++- 26 files changed, 182 insertions(+), 119 deletions(-) diff --git a/apps/wiki/constants.py b/apps/wiki/constants.py index 472bbb60..d96ce8bc 100644 --- a/apps/wiki/constants.py +++ b/apps/wiki/constants.py @@ -1,24 +1,19 @@ # -*- coding: utf-8 -*- from django.utils.translation import ugettext_lazy as _ -DOCUMENT_TAGS = ( - ("source", _(u"Tekst źródłowy")), - ("first_correction", _(u"Po autokorekcie")), - ("tagged", _(u"Tekst otagowany")), - ("second_correction", _(u"Po korekcie")), - ("source_annotations", _(u"Sprawdzone przypisy źródła")), - ("language_updates", _(u"Uwspółcześnienia")), - ("ready_to_publish", _(u"Tekst do publikacji")), -) - -DOCUMENT_TAGS_DICT = dict(DOCUMENT_TAGS) - DOCUMENT_STAGES = ( - ("first_correction", _(u"Autokorekta")), - ("tagged", _(u"Tagowanie")), - ("second_correction", _(u"Korekta")), - ("source_annotations", _(u"Przypisy źródła")), - ("language_updates", _(u"Uwspółcześnienia")), + ("", u"-----"), + ("tagging", _(u"Tagging")), + ("proofreading", _(u"Initial Proofreading")), + ("annotation-proofreading", _(u"Annotation Proofreading")), + ("modernisation", _(u"Modernisation")), + ("themes", _(u"Themes")), + ("editor-proofreading", _(u"Editor's Proofreading")), + ("technical-editor-proofreading", _(u"Technical Editor's Proofreading")), ) +DOCUMENT_TAGS = DOCUMENT_STAGES + \ + (("ready-to-publish", _(u"Ready to publish")),) + +DOCUMENT_TAGS_DICT = dict(DOCUMENT_TAGS) DOCUMENT_STAGES_DICT = dict(DOCUMENT_STAGES) diff --git a/apps/wiki/forms.py b/apps/wiki/forms.py index f6e6f40e..e0c69fdd 100644 --- a/apps/wiki/forms.py +++ b/apps/wiki/forms.py @@ -57,22 +57,28 @@ class DocumentTextSaveForm(forms.Form): parent_revision = forms.IntegerField(widget=forms.HiddenInput) text = forms.CharField(widget=forms.HiddenInput) - author = forms.CharField( + author_name = forms.CharField( required=False, - label=_(u"Autor"), - help_text=_(u"Twoje imie i nazwisko lub email."), + label=_(u"Author"), + help_text=_(u"Your name/"), + ) + + author_email = forms.EmailField( + required=False, + label=_(u"Author's email"), + help_text=_(u"Your email address, so we can show a gravatar :)"), ) comment = forms.CharField( required=True, widget=forms.Textarea, - label=_(u"Twój komentarz"), - help_text=_(u"Opisz w miarę dokładnie swoje zmiany."), + label=_(u"Your comments"), + help_text=_(u"Describe changes you made."), ) stage_completed = forms.ChoiceField( choices=DOCUMENT_STAGES, required=False, - label=_(u"Skończyłem robić"), - help_text=_(u"Jeśli skończyłeś jeden z etapów utworu, wybierz go."), + label=_(u"Completed"), + help_text=_(u"If you completed a life cycle stage, select it."), ) diff --git a/apps/wiki/models.py b/apps/wiki/models.py index f8004813..a4dc7941 100644 --- a/apps/wiki/models.py +++ b/apps/wiki/models.py @@ -7,7 +7,8 @@ import re import os import vstorage from vstorage import DocumentNotFound -from wiki import settings +from wiki import settings, constants +from django.utils.translation import ugettext_lazy as _ from django.http import Http404 @@ -15,6 +16,9 @@ import logging logger = logging.getLogger("fnp.wiki") +STAGE_TAGS_RE = re.compile(r'^#stage-finished: (.*)$', re.MULTILINE) + + class DocumentStorage(object): def __init__(self, path): self.vstorage = vstorage.VersionedStorage(path) @@ -60,7 +64,14 @@ class DocumentStorage(object): return list(self.vstorage.all_pages()) def history(self, title): - return list(self.vstorage.page_history(title)) + def stage_desc(match): + stage = match.group(1) + return _("Finished stage: %s") % constants.DOCUMENT_STAGES_DICT[stage] + + for changeset in self.vstorage.page_history(title): + changeset['description'] = STAGE_TAGS_RE.sub(stage_desc, changeset['description']) + yield changeset + class Document(object): @@ -110,3 +121,7 @@ class Document(object): def getstorage(): return DocumentStorage(settings.REPOSITORY_PATH) + +# +# Django models +# diff --git a/apps/wiki/templates/wiki/base.html b/apps/wiki/templates/wiki/base.html index b6cfe60c..f88fac31 100644 --- a/apps/wiki/templates/wiki/base.html +++ b/apps/wiki/templates/wiki/base.html @@ -1,5 +1,5 @@ {% extends "base.html" %} -{% load compressed %} +{% load compressed i18n %} {% block title %}{{ document_name }} - {{ block.super }}{% endblock %} @@ -12,7 +12,7 @@ {% endblock %} {% block maincontent %} -

Platforma Redakcyjna

+

{% trans "Platforma Redakcyjna" %}

{% block leftcolumn %} {% endblock leftcolumn %} diff --git a/apps/wiki/templates/wiki/diff_table.html b/apps/wiki/templates/wiki/diff_table.html index 91ac55c0..818c38cc 100644 --- a/apps/wiki/templates/wiki/diff_table.html +++ b/apps/wiki/templates/wiki/diff_table.html @@ -1,8 +1,9 @@ +{% load i18n %} - - + + diff --git a/apps/wiki/templates/wiki/document_create_missing.html b/apps/wiki/templates/wiki/document_create_missing.html index 0dcf3780..351e87a2 100644 --- a/apps/wiki/templates/wiki/document_create_missing.html +++ b/apps/wiki/templates/wiki/document_create_missing.html @@ -1,13 +1,13 @@ {% extends "wiki/base.html" %} +{% load i18n %} {% block leftcolumn %} {{ form.as_p }} -

+

{% endblock leftcolumn %} {% block rightcolumn %} - {% endblock rightcolumn %} \ No newline at end of file diff --git a/apps/wiki/templates/wiki/document_details.html b/apps/wiki/templates/wiki/document_details.html index 81d76dd9..67b3c478 100644 --- a/apps/wiki/templates/wiki/document_details.html +++ b/apps/wiki/templates/wiki/document_details.html @@ -1,10 +1,11 @@ {% extends "wiki/document_details_base.html" %} +{% load i18n %} {% block extrabody %} {{ block.super }} - - + {% endblock %} {% block tabs-menu %} diff --git a/apps/wiki/templates/wiki/document_details_base.html b/apps/wiki/templates/wiki/document_details_base.html index 576ee1e5..34106bb1 100644 --- a/apps/wiki/templates/wiki/document_details_base.html +++ b/apps/wiki/templates/wiki/document_details_base.html @@ -1,5 +1,6 @@ {% extends "base.html" %} -{% load toolbar_tags %} +{% load toolbar_tags i18n %} + {% block title %}{{ document.name }} - {{ block.super }}{% endblock %} {% block extrahead %} {% load compressed %} @@ -14,13 +15,6 @@ {% endblock %} {% block maincontent %} -
-
- -

Ładowanie

-
-
- - + @@ -42,7 +42,7 @@ $(function() { {% block rightcolumn %}
-

Twoje ostatnio otwierane dokumenty:

+

{% trans "Your last edited documents" %}

    {% for name, date in last_docs %}
  1. {{ forms.text_save.comment.label }}

    diff --git a/apps/wiki/templates/wiki/tabs/gallery_view.html b/apps/wiki/templates/wiki/tabs/gallery_view.html index ec5f6e4a..f903ccca 100644 --- a/apps/wiki/templates/wiki/tabs/gallery_view.html +++ b/apps/wiki/templates/wiki/tabs/gallery_view.html @@ -1,26 +1,25 @@ -
    +{% load i18n %} +
    \ No newline at end of file diff --git a/apps/wiki/templates/wiki/tabs/history_view.html b/apps/wiki/templates/wiki/tabs/history_view.html index 6d82785b..b55839ce 100644 --- a/apps/wiki/templates/wiki/tabs/history_view.html +++ b/apps/wiki/templates/wiki/tabs/history_view.html @@ -1,9 +1,10 @@ +{% load i18n %}
  2. - Historia + {% trans "History" %}
  3. diff --git a/apps/wiki/templates/wiki/tabs/source_editor.html b/apps/wiki/templates/wiki/tabs/source_editor.html index 10ca3348..72d881c4 100644 --- a/apps/wiki/templates/wiki/tabs/source_editor.html +++ b/apps/wiki/templates/wiki/tabs/source_editor.html @@ -1,4 +1,4 @@ -{% load toolbar_tags %} +{% load toolbar_tags i18n %}
    {% if not document_info.readonly %}{% toolbar %}{% endif %} diff --git a/apps/wiki/templates/wiki/tabs/source_editor_item.html b/apps/wiki/templates/wiki/tabs/source_editor_item.html index 0382982d..89e0fae7 100644 --- a/apps/wiki/templates/wiki/tabs/source_editor_item.html +++ b/apps/wiki/templates/wiki/tabs/source_editor_item.html @@ -1,5 +1,6 @@ +{% load i18n %}
  4. - Kod źródłowy + {% trans "Source code" %}
  5. \ No newline at end of file diff --git a/apps/wiki/templates/wiki/tabs/summary_view.html b/apps/wiki/templates/wiki/tabs/summary_view.html index f6dd3de0..70ea2d93 100644 --- a/apps/wiki/templates/wiki/tabs/summary_view.html +++ b/apps/wiki/templates/wiki/tabs/summary_view.html @@ -1,31 +1,32 @@ +{% load i18n %} \ No newline at end of file diff --git a/apps/wiki/templates/wiki/tabs/summary_view_item.html b/apps/wiki/templates/wiki/tabs/summary_view_item.html index d973d4d1..ce8d5945 100644 --- a/apps/wiki/templates/wiki/tabs/summary_view_item.html +++ b/apps/wiki/templates/wiki/tabs/summary_view_item.html @@ -1,3 +1,4 @@ +{% load i18n %}
  6. {{ document_meta.title }}
  7. diff --git a/apps/wiki/templates/wiki/tabs/wysiwyg_editor.html b/apps/wiki/templates/wiki/tabs/wysiwyg_editor.html index dbf1b6a7..5e3c46f9 100644 --- a/apps/wiki/templates/wiki/tabs/wysiwyg_editor.html +++ b/apps/wiki/templates/wiki/tabs/wysiwyg_editor.html @@ -1,3 +1,4 @@ +{% load i18n %}
Stara wersjaNowa wersja{% trans "Old version" %}{% trans "New version" %}
Filtr: