Commits

ben...@localhost.metavers.net  committed 8c9c633

final interface for diff

  • Participants
  • Parent commits 3b6f1b2

Comments (0)

Files changed (3)

File friendpaste/paste/views.py

     if not res:
         raise NotFound
     snippet = res[0].value
+    snippet['_id'] = res[0].id
     rev = request.values.get('rev', None)
     diff_to = ""
     diff_from = ""
         '\n'.join(unified_diff (diff_from.splitlines(), diff_to.splitlines(), 3))
 
     theme = _get_theme(request)
-    return render_response('paste/diff.html', unidiff=unidiff, theme=theme, url=request.url)
+    return render_response('paste/diff.html', unidiff=unidiff, theme=theme,
+            snippet=snippet, rev=rev, old_rev=old_rev)
     
 
 

File static/css/base.css

 #actions li.first { border: 0; }
 
 #info { background: #f7f7f0; border: 1px solid #899834; padding: 0.5em 0.3em 0.5em 0.3em; font-size:0.9em; font-weight: bold; }
+#info table { width: auto; padding: 0; margin: 10px 0;}
+#info th { background: #f7f7f0; padding: 0; }
 #dl { text-align: center; color: #303030; padding-top: 10px; font-size: 0.9em;}
 #dl a { color: #666; }
 
+
+
 .linenos { border-right: 1px solid #899834; color: #666; font-weight: bold;}
 .lineos pre { border-bottom: 1px solid #899834; }
 

File templates/paste/diff.html

 
 {% block content %}
 <div id="snippet">
-    <div id="actions">
-            
-        <form id="factions" action="{{ url }}" method="post">
+    <h2><a href="/{{ snippet['_id'] }}">{{ snippet['_id'] }}</a> changes</h2>
+    <div id="info">
+        {{ snippet['updated']|datetimeformat }} 
+        <table>
+            <tr><th>Changeset</th><td><a href="/{{ snippet['_id'] }}?rev={{ rev }}">{{ rev }}</a></td></tr>
+            <tr><th>Parent</th><td><a href="/{{ snippet['_id'] }}?rev={{ old_rev }}">{{ old_rev }}</a></td></tr>
+        </table>
+    </div>
+    <div id="actions">            
+        <form id="factions" action="/{{ snippet['_id'] }}/changeset?rev={{ rev }}" method="post">
                 <ul>
                     <li class="first">
                         <select name="theme" id="change-theme">