Clean versions list/comparison/view and add original version.
authorgibus
Mon, 21 Jan 2013 14:12:10 +0100
changeset 486 c9a646707d86
parent 485 af74b898d551
child 487 b2105d3dff5b
Clean versions list/comparison/view and add original version.
src/cm/locale/bg/LC_MESSAGES/django.mo
src/cm/locale/bg/LC_MESSAGES/django.po
src/cm/locale/en/LC_MESSAGES/django.po
src/cm/locale/es/LC_MESSAGES/django.po
src/cm/locale/fr/LC_MESSAGES/django.mo
src/cm/locale/fr/LC_MESSAGES/django.po
src/cm/locale/it/LC_MESSAGES/django.mo
src/cm/locale/it/LC_MESSAGES/django.po
src/cm/locale/no/LC_MESSAGES/django.mo
src/cm/locale/no/LC_MESSAGES/django.po
src/cm/locale/pt_BR/LC_MESSAGES/django.mo
src/cm/locale/pt_BR/LC_MESSAGES/django.po
src/cm/templates/site/text_history.html
src/cm/templates/site/text_history_compare.html
src/cm/templates/site/text_history_version.html
src/cm/views/texts.py
Binary file src/cm/locale/bg/LC_MESSAGES/django.mo has changed
--- a/src/cm/locale/bg/LC_MESSAGES/django.po	Mon Jan 21 09:41:46 2013 +0100
+++ b/src/cm/locale/bg/LC_MESSAGES/django.po	Mon Jan 21 14:12:10 2013 +0100
@@ -1181,6 +1181,13 @@
 msgid "Most recent version"
 msgstr "Най—нова версия"
 
+#: templates/site/text_history.html:63
+#: templates/site/text_history_compare.html:30
+#: templates/site/text_history_version.html:31
+#, fuzzy
+msgid "Original version"
+msgstr "Оригинална версия"
+
 #: templates/site/text_history.html:67
 msgid "Compare selected versions"
 msgstr "Сравнете избраните версий"
--- a/src/cm/locale/en/LC_MESSAGES/django.po	Mon Jan 21 09:41:46 2013 +0100
+++ b/src/cm/locale/en/LC_MESSAGES/django.po	Mon Jan 21 14:12:10 2013 +0100
@@ -1144,6 +1144,12 @@
 msgid "Most recent version"
 msgstr ""
 
+#: templates/site/text_history.html:63
+#: templates/site/text_history_compare.html:30
+#: templates/site/text_history_version.html:31
+msgid "Original version"
+msgstr ""
+
 #: templates/site/text_history.html:67
 msgid "Compare selected versions"
 msgstr ""
--- a/src/cm/locale/es/LC_MESSAGES/django.po	Mon Jan 21 09:41:46 2013 +0100
+++ b/src/cm/locale/es/LC_MESSAGES/django.po	Mon Jan 21 14:12:10 2013 +0100
@@ -1252,6 +1252,13 @@
 msgid "Most recent version"
 msgstr "Versión más reciente"
 
+#: templates/site/text_history.html:63
+#: templates/site/text_history_compare.html:30
+#: templates/site/text_history_version.html:31
+#, fuzzy
+msgid "Last version"
+msgstr "Versión original"
+
 #: templates/site/text_history.html:67
 msgid "Compare selected versions"
 msgstr "Comparar las versiones seleccionada"
Binary file src/cm/locale/fr/LC_MESSAGES/django.mo has changed
--- a/src/cm/locale/fr/LC_MESSAGES/django.po	Mon Jan 21 09:41:46 2013 +0100
+++ b/src/cm/locale/fr/LC_MESSAGES/django.po	Mon Jan 21 14:12:10 2013 +0100
@@ -1262,6 +1262,12 @@
 msgid "Most recent version"
 msgstr "Version la plus récente"
 
+#: templates/site/text_history.html:63
+#: templates/site/text_history_compare.html:30
+#: templates/site/text_history_version.html:31
+msgid "Original version"
+msgstr "Version originale"
+
 #: templates/site/text_history.html:67
 msgid "Compare selected versions"
 msgstr "Comparer les versions selectionnées"
Binary file src/cm/locale/it/LC_MESSAGES/django.mo has changed
--- a/src/cm/locale/it/LC_MESSAGES/django.po	Mon Jan 21 09:41:46 2013 +0100
+++ b/src/cm/locale/it/LC_MESSAGES/django.po	Mon Jan 21 14:12:10 2013 +0100
@@ -1323,6 +1323,13 @@
 msgid "Most recent version"
 msgstr "Versioni più recenti"
 
+#: templates/site/text_history.html:63
+#: templates/site/text_history_compare.html:30
+#: templates/site/text_history_version.html:31
+#, fuzzy
+msgid "Last version"
+msgstr "Versione originale"
+
 #: templates/site/text_history.html:67
 msgid "Compare selected versions"
 msgstr "Compara le versioni selezionate"
Binary file src/cm/locale/no/LC_MESSAGES/django.mo has changed
--- a/src/cm/locale/no/LC_MESSAGES/django.po	Mon Jan 21 09:41:46 2013 +0100
+++ b/src/cm/locale/no/LC_MESSAGES/django.po	Mon Jan 21 14:12:10 2013 +0100
@@ -1166,6 +1166,13 @@
 msgid "Most recent version"
 msgstr "Nyeste versjon"
 
+#: templates/site/text_history.html:63
+#: templates/site/text_history_compare.html:30
+#: templates/site/text_history_version.html:31
+#, fuzzy
+msgid "Last version"
+msgstr "Original versjon"
+
 #: templates/site/text_history.html:67
 msgid "Compare selected versions"
 msgstr "Sammenlikn valgte versjoner"
Binary file src/cm/locale/pt_BR/LC_MESSAGES/django.mo has changed
--- a/src/cm/locale/pt_BR/LC_MESSAGES/django.po	Mon Jan 21 09:41:46 2013 +0100
+++ b/src/cm/locale/pt_BR/LC_MESSAGES/django.po	Mon Jan 21 14:12:10 2013 +0100
@@ -1161,18 +1161,28 @@
 msgstr "Versões"
 
 #: templates/site/text_history.html:59
+#, fuzzy
 msgid "Compare last two versions"
-msgstr ""
+msgstr "Comparar duas últimas versões"
 
 #: templates/site/text_history.html:61
 #: templates/site/text_history_compare.html:37
 #: templates/site/text_history_version.html:38
+#, fuzzy
 msgid "Most recent version"
-msgstr ""
+msgstr "Versão mais recente"
+
+#: templates/site/text_history.html:63
+#: templates/site/text_history_compare.html:30
+#: templates/site/text_history_version.html:31
+#, fuzzy
+msgid "Last version"
+msgstr "Versão original"
 
 #: templates/site/text_history.html:67
+#, fuzzy
 msgid "Compare selected versions"
-msgstr ""
+msgstr "Compare as versões seleccionadas"
 
 #: templates/site/text_history.html:77
 #, fuzzy
@@ -1189,8 +1199,9 @@
 msgstr "Autor"
 
 #: templates/site/text_history.html:82
+#, fuzzy
 msgid "Created"
-msgstr ""
+msgstr "Criado"
 
 #: templates/site/text_history.html:83 templates/site/text_list.html:141
 #, fuzzy
@@ -1203,8 +1214,9 @@
 
 #: templates/site/text_history.html:106
 #: templates/site/text_history_version.html:32
+#, fuzzy
 msgid "Compare with previous version"
-msgstr ""
+msgstr "Comparar com versão anterior"
 
 #: templates/site/text_history.html:108
 #, fuzzy
--- a/src/cm/templates/site/text_history.html	Mon Jan 21 09:41:46 2013 +0100
+++ b/src/cm/templates/site/text_history.html	Mon Jan 21 14:12:10 2013 +0100
@@ -59,6 +59,8 @@
     <li><a href="{% url text-history-compare text.key last_last_version.key last_version.key %}">{% blocktrans %}Compare last two versions{% endblocktrans %}</a></li>
     <li> / </li>
     <li><a href="{% url text-history-version text.key text.last_text_version.key %}">{% blocktrans %}Most recent version{% endblocktrans %}</a></li>
+    <li> / </li>
+    <li><a href="{% url text-history-version text.key first_version.key %}">{% blocktrans %}Original version{% endblocktrans %}</a></li>
     {% endif %}
 </ul>
 
--- a/src/cm/templates/site/text_history_compare.html	Mon Jan 21 09:41:46 2013 +0100
+++ b/src/cm/templates/site/text_history_compare.html	Mon Jan 21 14:12:10 2013 +0100
@@ -27,14 +27,16 @@
 <ul class="sub_list">
     <li><a href="{% url text-history text.key %}">{% blocktrans %}Version list{% endblocktrans %}</a></li>
     <li> / </li>
+    <li>&nbsp;<a href="{% url text-history-version text.key first_version.key %}" alt="{% blocktrans %}Original version{% endblocktrans %}" title="{% blocktrans %}Original version{% endblocktrans %}">&laquo;&laquo;{{ first_version.get_version_number }}</a></li>
+    {% ifnotequal v1.key first_version.key %}
     {% if v1.get_previous_version %}<li>&nbsp;<a href="{% url text-history-compare text.key v1.get_previous_version.key v1.key %}"><img style="vertical-align: text-bottom;" title="{% blocktrans %}Previous modification{% endblocktrans %}" alt="{% blocktrans %}Previous modification{% endblocktrans %}" src="{{ CM_MEDIA_PREFIX }}img/plus-minus-left.gif"></img></a></li>{% endif %}    
-    <li>&nbsp;<a href="{% url text-history-version text.key v1.key %}" alt="{% blocktrans with v1.get_version_number as version_number %}Version {{ version_number }}{% endblocktrans %}">&laquo;{{ v1.get_version_number }}</a></li>
+    <li>&nbsp;<a href="{% url text-history-version text.key v1.key %}" alt="{% blocktrans with v1.get_version_number as version_number %}Version {{ version_number }}{% endblocktrans %}" title="{% blocktrans with v1.get_version_number as version_number %}Version {{ version_number }}{% endblocktrans %}">&laquo;{{ v1.get_version_number }}</a></li>
+    {% endifnotequal %}
     <li class="active_sub">&nbsp;{% blocktrans with v1.get_version_number as version_1_number and v2.get_version_number as version_2_number %}Comparison between version #{{ version_1_number }} and #{{ version_2_number }}{% endblocktrans %}</li>
-    {% ifnotequal v2.key text.last_text_version.key %}<li>&nbsp;<a href="{% url text-history-version text.key v2.key %}" alt="{% blocktrans with v2.get_version_number as version_number %}Version {{ version_number }}{% endblocktrans %}">{{ v2.get_version_number }}&raquo;</a></li>
+    {% ifnotequal v2.key text.last_text_version.key %}<li>&nbsp;<a href="{% url text-history-version text.key v2.key %}" alt="{% blocktrans with v2.get_version_number as version_number %}Version {{ version_number }}{% endblocktrans %}" title="{% blocktrans with v2.get_version_number as version_number %}Version {{ version_number }}{% endblocktrans %}">{{ v2.get_version_number }}&raquo;</a></li>
     {% if v1.get_next_version %}<li>&nbsp;<a href="{% url text-history-compare text.key v2.key v2.get_next_version.key %}"><img style="vertical-align: text-bottom;" title="{% blocktrans %}Next modification{% endblocktrans %}" alt="{% blocktrans %}Next modification{% endblocktrans %}" src="{{ CM_MEDIA_PREFIX }}img/plus-minus-right.gif"></img></a></li>{% endif %}    
-    
     {% endifnotequal %}
-    <li>&nbsp;<a href="{% url text-history-version text.key text.last_text_version.key %}" alt="{% blocktrans %}Most recent version{% endblocktrans %}">{{ text.last_text_version.get_version_number }}&raquo;&raquo;</a></li>
+    <li>&nbsp;<a href="{% url text-history-version text.key text.last_text_version.key %}" alt="{% blocktrans %}Most recent version{% endblocktrans %}" title="{% blocktrans %}Most recent version{% endblocktrans %}">{{ text.last_text_version.get_version_number }}&raquo;&raquo;</a></li>
 </ul>
 
 <div style="clear:both;"></div>
--- a/src/cm/templates/site/text_history_version.html	Mon Jan 21 09:41:46 2013 +0100
+++ b/src/cm/templates/site/text_history_version.html	Mon Jan 21 14:12:10 2013 +0100
@@ -28,13 +28,18 @@
     <li><a href="{% url text-history text.key %}">{% blocktrans %}Version list{% endblocktrans %}</a></li>
     <li>&nbsp;/</li>
     {% if text_version.get_previous_version %}
+    <li>&nbsp;<a href="{% url text-history-version text.key first_version.key %}" title="{% blocktrans %}Original version{% endblocktrans %}">&laquo;&laquo;{{ first_version.get_version_number }}</a></li>    
+    <li>&nbsp;<a href="{% url text-history-compare text.key text_version.get_previous_version.key text_version.key %}"><img style="vertical-align: text-bottom;" title="{% blocktrans %}Compare with previous version{% endblocktrans %}" alt="title="{% blocktrans %}Compare with previous version{% endblocktrans %}"  src="{{ CM_MEDIA_PREFIX }}img/plus-minus-left.gif"></img></a></li>
+    {% ifnotequal text_version.get_previous_version.key first_version.key %}
     <li>&nbsp;<a href="{% url text-history-version text.key text_version.get_previous_version.key %}" title="{% blocktrans %}Previous version{% endblocktrans %}" >&laquo;{{ text_version.get_previous_version.get_version_number }}</a></li>
-    <li>&nbsp;<a href="{% url text-history-compare text.key text_version.get_previous_version.key text_version.key %}"><img style="vertical-align: text-bottom;" title="{% blocktrans %}Compare with previous version{% endblocktrans %}" alt="title="{% blocktrans %}Compare with previous version{% endblocktrans %}"  src="{{ CM_MEDIA_PREFIX }}img/plus-minus-left.gif"></img></a></li>
+    {% endifnotequal %}
     {% endif %}
     <li class="active_sub">{% blocktrans with text_version.get_version_number as version_number %}Version {{ version_number }}{% endblocktrans %}</li>
     {% if text_version.get_next_version %}
+    {% ifnotequal text_version.get_next_version.key text.last_text_version.key %}
+    <li>&nbsp;<a href="{% url text-history-version text.key text_version.get_next_version.key %}" title="{% blocktrans %}Next version{% endblocktrans %}" >{{ text_version.get_next_version.get_version_number }}&raquo;</a></li>
+    {% endifnotequal %}
     <li>&nbsp;<a href="{% url text-history-compare text.key text_version.key text_version.get_next_version.key %}"><img style="vertical-align: text-bottom;" title="{% blocktrans %}Compare with next version{% endblocktrans %}" alt="{% blocktrans %}Compare with next version{% endblocktrans %}" src="{{ CM_MEDIA_PREFIX }}img/plus-minus-right.gif"></img></a></li>
-    <li>&nbsp;<a href="{% url text-history-version text.key text_version.get_next_version.key %}" title="{% blocktrans %}Next version{% endblocktrans %}" >{{ text_version.get_next_version.get_version_number }}&raquo;</a></li>
     <li>&nbsp;<a href="{% url text-history-version text.key text.last_text_version.key %}" title="{% blocktrans %}Most recent version{% endblocktrans %}">{{ text.last_text_version.get_version_number }}&raquo;&raquo;</a></li>    
     {% endif %}
 </ul>
--- a/src/cm/views/texts.py	Mon Jan 21 09:41:46 2013 +0100
+++ b/src/cm/views/texts.py	Mon Jan 21 14:12:10 2013 +0100
@@ -443,9 +443,12 @@
 def text_history_version(request, key, version_key):
     text = get_text_by_keys_or_404(key)
     text_version = get_textversion_by_keys_or_404(version_key, key=key)
+    text_versions = text.get_versions()
+    first_version = text_versions[len(text_versions) - 1]
     template_dict = {'text' : text,
                      'text_version' : text_version,
                      'embed_code' : embed_html(key, 'id="text_view_frame" name="text_view_frame"', version_key),
+                     'first_version':first_version,
                       }
     return render_to_response('site/text_history_version.html',
                               template_dict,
@@ -470,12 +473,15 @@
         dif = diff_match_patch2()
         content = dif.diff_prettyHtml_one_way(dif.diff_main(v1.get_content(), v2.get_content()), mode='ins_del')
 
+    text_versions = text.get_versions()
+    first_version = text_versions[len(text_versions) - 1]
     template_dict = {
                      'text' : text,
                      'v1': v1,
                      'v2': v2,
                      'content' : content.strip(),
                      'empty' : '<table class="diff"><tbody></tbody></table>'==content,
+                     'first_version':first_version,
                      }
     return render_to_response('site/text_history_compare.html',
                               template_dict,
@@ -495,7 +501,8 @@
     paginate_by = get_int(request.GET,'paginate',TEXT_PAGINATION)
 
     last_last_version = text_versions[1] if len(text_versions)>1 else None 
-    context = {'text':text, 'last_version':text.last_text_version, 'last_last_version':last_last_version}
+    first_version = text_versions[len(text_versions) - 1]
+    context = {'text':text, 'last_version':text.last_text_version, 'last_last_version':last_last_version, 'first_version':first_version}
     return object_list(request, text_versions,
                        template_name = 'site/text_history.html',
                        paginate_by = paginate_by,