changeset 2772:239e3b34c6b4

fix parentid adding to metadata, use it for +mychanges, display it on +meta
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Tue, 02 Sep 2014 20:32:52 +0200
parents 5762664a2887
children c227de3a4096
files MoinMoin/items/__init__.py MoinMoin/templates/mychanges.html MoinMoin/templates/utils.html
diffstat 3 files changed, 8 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/items/__init__.py	Tue Sep 02 19:58:40 2014 +0200
+++ b/MoinMoin/items/__init__.py	Tue Sep 02 20:32:52 2014 +0200
@@ -429,7 +429,7 @@
     def prepare_meta_for_modify(self, meta):
         """
         transform the meta dict of the current revision into a meta dict
-        that can be used for savind next revision (after "modify").
+        that can be used for saving next revision (after "modify").
         """
         meta = dict(meta)
         revid = meta.pop(REVID, None)
@@ -534,7 +534,11 @@
                       suitable as arguments of the same names to pass to
                       item.modify
             """
-            meta = self['meta_form'].value.copy()
+            # Since the metadata form for tickets is an incomplete one, we load the
+            # original meta and update it with those from the metadata editor
+            # e.g. we get PARENTID in here
+            meta = item.meta_filter(item.prepare_meta_for_modify(item.meta))
+            meta.update(self['meta_form'].value)
             meta.update(item.meta_text_to_dict(self['extra_meta_text'].value))
             data, contenttype_guessed = self['content_form']._dump(item.content)
             comment = self['comment'].value
--- a/MoinMoin/templates/mychanges.html	Tue Sep 02 19:58:40 2014 +0200
+++ b/MoinMoin/templates/mychanges.html	Tue Sep 02 20:32:52 2014 +0200
@@ -42,7 +42,7 @@
                             <td>
                                 <div class="moin-hist-rev">
                                     <form action="{{ url_for('frontend.diff', item_name=doc.fqname) }}" method="GET">
-                                        <input type="hidden" name="rev1" value="{{ doc.revid }}" />
+                                        <input type="hidden" name="rev1" value="{{ doc.parentid }}" />
                                         <input type="hidden" name="rev2" value="{{ doc.revid }}" />
                                         <input type="submit" class="btn btn-sm btn-primary" value="Diff" />
                                     </form>
--- a/MoinMoin/templates/utils.html	Tue Sep 02 19:58:40 2014 +0200
+++ b/MoinMoin/templates/utils.html	Tue Sep 02 20:32:52 2014 +0200
@@ -164,6 +164,7 @@
             {% endif %}
         </li>
         <li class="list-group-item">Namespace: '{{ meta['namespace'] }}'</li>
+        <li class="list-group-item">Parent Revision ID: {{ meta['parentid'] }}</li>
         <li class="list-group-item">Revision ID: {{ meta['revid'] }}</li>
         <li class="list-group-item">SHA1: {{ meta['sha1'] }}</li>
         <li class="list-group-item">Size: {{ meta['size']|filesizeformat }}</li>