]> git.openstreetmap.org Git - osqa.git/commitdiff
OSQA-375
authorqw3rty <qw3rty@0cfe37f9-358a-4d5e-be75-b63607b5c754>
Wed, 30 Jun 2010 22:54:52 +0000 (22:54 +0000)
committerqw3rty <qw3rty@0cfe37f9-358a-4d5e-be75-b63607b5c754>
Wed, 30 Jun 2010 22:54:52 +0000 (22:54 +0000)
1) listing the most recent first

2) collapsing the bodies of the revisions except for the first two by default

3) The triangle icon changes

4) added a link to the revisions page on the more menu of the questions page.

git-svn-id: http://svn.osqa.net/svnroot/osqa/trunk@479 0cfe37f9-358a-4d5e-be75-b63607b5c754

forum/skins/default/media/style/default.css
forum/skins/default/media/style/style.css
forum/skins/default/templates/revisions.html
forum/templatetags/node_tags.py
forum/views/readers.py

index 27da1dab631a30ddc3b0985ae95854b0f3a3b99a..c8b41f2c3548562b220da4034b8a5825cf4332b7 100644 (file)
@@ -1192,7 +1192,7 @@ form .errorlist li{
 }
 
 .revision .summary span{
-    background-color:yellow;
+    /**background-color:yellow;/**/
     display:inline;
 }
 .revision h1{
@@ -1708,7 +1708,7 @@ a.comment-user:hover {
 }
 
 .revision-summary{
-    background-color:#FFFE9B;
+    /**background-color:#FFFE9B;/**/
     padding:2px;
 }
 .question-title-link a{
index a2a9fa865cf2b9b40c770484d98d588c90aeb20a..e0605d6e77adb546a5601e38fb7fb2dd4ca0168e 100644 (file)
@@ -887,7 +887,7 @@ span.form-error {
 }
 
 .revision .summary span {
-    background-color: yellow;
+    /**background-color: yellow;/**/
     display: inline;
     padding-left: 3px;
     padding-right: 3px;
index eb24116039752d8dcea663980a01617743acd88b..234b764447c88716456de64ba78b97e35eeed472 100644 (file)
@@ -6,28 +6,31 @@
 {% load humanize %}
 {% block title %}{% spaceless %}{% trans "Revision history" %}{% endspaceless %}{% endblock %}
 {% block forejs %}
-        <script type="text/javascript">
-        //todo - take this out into .js file 
-        $().ready(function(){
-            $("#nav_questions").attr('className',"on");
-            $('div.revision div[id^=rev-header-]').bind('click', function(){
-                var revId = this.id.substr(11);
-                toggleRev(revId); 
-            
-            });
-            lanai.highlightSyntax();
+    <script type="text/javascript">
+
+        $(document).ready(function() {
+            rev_bodies = $('div.rev-body');
+            if(rev_bodies.length > 0)toggleRev(rev_bodies.length);
+            if(rev_bodies.length > 1)toggleRev(rev_bodies.length-1);
+
+            for(var index = 0; index < rev_bodies.length; index++) {
+                rev_bodies.get(index);
+            }
         });
-        
-        function toggleRev(id) {
-            var arrow = $("#rev-arrow-" + id);
-            var visible = arrow.attr("src").indexOf("hide") > -1;
 
-            var path = $.i18n._('/') + "media/images/expander-arrow-" + 
-                        (visible ? "show" : "hide") + ".gif";
-            arrow.attr("src", path);
-            $("#rev-body-" + id).slideToggle("fast");
+        function toggleRev(id) {
+            var rev_body = $('div#rev-body-' + id).get(0);
+            var rev_arrow = $('img#rev-arrow-' + id).get(0);
+            if (rev_body.style.display == "none") {
+                rev_body.style.display = "";
+                rev_arrow.src="{% media  "/media/images/expander-arrow-hide.gif" %}"
+            } else {
+                rev_body.style.display = "none";
+                rev_arrow.src="{% media  "/media/images/expander-arrow-show.gif" %}"
+            }
         }
-        </script>
+        
+    </script>
 {% endblock %}
         
 {% block content %}
           <div class="header-controls">
             <table width="100%">
                 <tr>
-                    <td width="20" style="vertical-align:middle"><img id="rev-arrow-{{ revision.revision }}" 
-                                                                src="{% media  "/media/images/expander-arrow-show.gif" %}"
-                                                                alt="{% trans "click to hide/show revision" %}"/>
+                    <td width="20" style="vertical-align:middle"><img id="rev-arrow-{{ revision.inst.revision }}"
+                                                                      class="rev-arrow"
+                                                                      onclick="toggleRev({{ revision.inst.revision }})"
+                                                                      src="{% media  "/media/images/expander-arrow-show.gif" %}"
+                                                                      alt="{% trans "click to hide/show revision" %}"/>
                     </td>
                     <td width="30px" style="vertical-align:middle"><span class="revision-number" title="{% trans "revision" %} {{ revision.inst.revision }}">{{ revision.inst.revision }}</span></td>
                     <td width="200px" style="vertical-align:middle">
-                        <div class="summary"><span>{{ revision.summary }}</span></div>
+                        <div class="summary"><span>{{ revision.inst.summary }}</span></div>
                     </td>
                     <td align="right">
                         <div class="revision-mark" >
@@ -60,7 +65,7 @@
             </table>
           </div>
         </div>
-        <div id="rev-body-{{ revision.inst.revision }}" class="diff body">
+        <div id="rev-body-{{ revision.inst.revision }}" class="diff body rev-body" style="display:none">
             {{ revision.diff|safe }}
         </div>
       </div>
index c45272ee1915f0e5970c86eb49c2c58834d88e70..a840a2c27bafcfc06970c0254edd15014dce3b15 100644 (file)
@@ -96,6 +96,12 @@ def post_controls(post, user):
                 controls.append(post_control(_('delete'), reverse('delete_post', kwargs={'id': post.id}),\r
                         command=True, confirm=True))\r
 \r
+        if user.can_delete_post(post):\r
+            menu.append(post_control(_('see revisions'),\r
+                        reverse('revisions',\r
+                        kwargs={'id': post.id}),\r
+                        command=False, confirm=False))\r
+\r
         if settings.WIKI_ON:\r
             if (not post.nis.wiki) and user.can_wikify(post):\r
                 menu.append(post_control(_('mark as community wiki'), reverse('wikify', kwargs={'id': post.id}),\r
index 134fff24fb5e09e21991efbb95f51ddb730c641b..07f6a3f2de3f5c44940939dbe4a11af1610c3637 100644 (file)
@@ -340,11 +340,10 @@ REVISION_TEMPLATE = template.loader.get_template('node/revision.html')
 def revisions(request, id):
     post = get_object_or_404(Node, id=id).leaf
     revisions = list(post.revisions.order_by('revised_at'))
-
     rev_ctx = []
 
     for i, revision in enumerate(revisions):
-        rev_ctx.append(dict(inst=revision, html=REVISION_TEMPLATE.render(template.Context({
+        rev_ctx.append(dict(inst=revision, html=template.loader.get_template('node/revision.html').render(template.Context({
         'title': revision.title,
         'html': revision.html,
         'tags': revision.tagname_list(),
@@ -360,6 +359,8 @@ def revisions(request, id):
         else:
             rev_ctx[i]['summary'] = revision.summary
 
+    rev_ctx.reverse()
+
     return render_to_response('revisions.html', {
     'post': post,
     'revisions': rev_ctx,