You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by jo...@apache.org on 2013/06/21 23:34:23 UTC

[11/38] git commit: [#5833] ticket:370 refactored attachments

[#5833]  ticket:370 refactored attachments


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/1288e7be
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/1288e7be
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/1288e7be

Branch: refs/heads/cj/6272
Commit: 1288e7be790e6279a2e10b51358762427f61dbe2
Parents: 7d01904
Author: Yuriy Arhipov <yu...@yandex.ru>
Authored: Mon Jun 10 13:55:52 2013 +0400
Committer: Cory Johns <cj...@slashdotmedia.com>
Committed: Mon Jun 17 14:15:56 2013 +0000

----------------------------------------------------------------------
 .../allura/templates/widgets/post_widget.html   |  2 +-
 Allura/allura/tests/functional/test_discuss.py  |  1 +
 .../forgetracker/templates/tracker/ticket.html  |  4 ---
 .../templates/tracker_widgets/ticket_form.html  |  4 ---
 .../forgetracker/tests/functional/test_root.py  |  3 +-
 .../forgewiki/templates/wiki/page_view.html     | 30 +++++++-------------
 .../forgewiki/tests/functional/test_root.py     |  2 +-
 7 files changed, 15 insertions(+), 31 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/1288e7be/Allura/allura/templates/widgets/post_widget.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/widgets/post_widget.html b/Allura/allura/templates/widgets/post_widget.html
index f9c881a..6c33f62 100644
--- a/Allura/allura/templates/widgets/post_widget.html
+++ b/Allura/allura/templates/widgets/post_widget.html
@@ -69,7 +69,7 @@
           <strong>Attachments</strong>
           <div class="clear"></div>
           {% for att in value.attachments %}
-            <div class="attachment_thumb" style="min-height: 130px;">
+            <div class="attachment_thumb">
                 <form method="POST" action="{{att.url()}}">
                 {% if att.is_image() %}
                     <a href="{{att.url()}}"><img src="{{att.url()}}/thumb" alt="Thumbnail"/></a>

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/1288e7be/Allura/allura/tests/functional/test_discuss.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/functional/test_discuss.py b/Allura/allura/tests/functional/test_discuss.py
index 6ad4f21..0573340 100644
--- a/Allura/allura/tests/functional/test_discuss.py
+++ b/Allura/allura/tests/functional/test_discuss.py
@@ -220,6 +220,7 @@ class TestAttachment(TestController):
                 break
         else:
             assert False, 'attachment link not found'
+        assert '<div class="attachment_thumb" style="min-height: 130px;">' not in r
         r = self.app.get(alink)
         assert r.content_disposition == 'attachment;filename="test.txt"', 'Attachments should force download'
         r = self.app.post(self.post_link + 'attach',

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/1288e7be/ForgeTracker/forgetracker/templates/tracker/ticket.html
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/templates/tracker/ticket.html b/ForgeTracker/forgetracker/templates/tracker/ticket.html
index e6e11f6..f6288bb 100644
--- a/ForgeTracker/forgetracker/templates/tracker/ticket.html
+++ b/ForgeTracker/forgetracker/templates/tracker/ticket.html
@@ -152,10 +152,6 @@
             <a href="{{att.url()}}" class="file_type">
               <img src="{{att.url()}}/thumb" alt="">
             </a>
-          {% else %}
-            <a href="{{att.url()}}" class="file_type">
-              <span>{{att.filename.split('.')[-1] or 'file'}}</span>
-            </a>
           {% endif %}
           <a href="{{att.url()}}">{{att.filename}}</a>
         </div>

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/1288e7be/ForgeTracker/forgetracker/templates/tracker_widgets/ticket_form.html
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/templates/tracker_widgets/ticket_form.html b/ForgeTracker/forgetracker/templates/tracker_widgets/ticket_form.html
index bd36514..d9c5743 100644
--- a/ForgeTracker/forgetracker/templates/tracker_widgets/ticket_form.html
+++ b/ForgeTracker/forgetracker/templates/tracker_widgets/ticket_form.html
@@ -91,10 +91,6 @@
               <a href="{{att.url()}}" class="file_type">
                 <img src="{{att.url()}}/thumb" alt="Thumbnail">
               </a>
-            {% else %}
-              <a href="{{att.url()}}" class="file_type">
-                <span>{{att.filename.split('.')[-1] or 'file'}}</span>
-              </a>
             {% endif %}
             <a href="{{att.url()}}">{{att.filename}}</a>
             <a href="{{att.url()}}" class="btn delete_attachment"><b data-icon="{{g.icons['delete'].char}}" class="ico {{g.icons['delete'].css}}"></b></a>

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/1288e7be/ForgeTracker/forgetracker/tests/functional/test_root.py
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/tests/functional/test_root.py b/ForgeTracker/forgetracker/tests/functional/test_root.py
index 5c2be7a..5b038d1 100644
--- a/ForgeTracker/forgetracker/tests/functional/test_root.py
+++ b/ForgeTracker/forgetracker/tests/functional/test_root.py
@@ -478,6 +478,7 @@ class TestFunctionalController(TrackerTestController):
             'summary':'zzz'
         }, upload_files=[upload]).follow()
         assert_true(file_name in ticket_editor)
+        assert '<span>py</span>' not in ticket_editor
 
     def test_delete_attachment(self):
         file_name = 'test_root.py'
@@ -489,7 +490,7 @@ class TestFunctionalController(TrackerTestController):
         }, upload_files=[upload]).follow()
         assert file_name in ticket_editor, ticket_editor.showbrowser()
         req = self.app.get('/bugs/1/')
-        file_link = req.html.findAll('form')[1].findAll('a')[7]
+        file_link = req.html.findAll('form')[1].findAll('a')[6]
         assert_equal(file_link.string, file_name)
         self.app.post(str(file_link['href']),{
             'delete':'True'

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/1288e7be/ForgeWiki/forgewiki/templates/wiki/page_view.html
----------------------------------------------------------------------
diff --git a/ForgeWiki/forgewiki/templates/wiki/page_view.html b/ForgeWiki/forgewiki/templates/wiki/page_view.html
index 0153b04..9c2de74 100644
--- a/ForgeWiki/forgewiki/templates/wiki/page_view.html
+++ b/ForgeWiki/forgewiki/templates/wiki/page_view.html
@@ -78,27 +78,17 @@
       </a>
     {% endfor %}
   </div>
-  {% if page.attachments %}
-  <div class="grid-18">
-    <strong>Attachments</strong>
-  </div>
-  {% endif %}
-  {% for att in page.attachments %}
-    {% if att.is_image() and not att.is_embedded() %}
-    <div class="attachment_thumb">
-      <a href="{{att.url()}}">
-        <img src="{{att.url()}}/thumb" alt="Thumbnail"/>
-      </a><br/>
-      <a href="{{att.url()}}">{{att.filename}}</a>
-      ({{att.length}} bytes)
-    </div>
-    {% else %}
-    <div>
-      <a href="{{att.url()}}">{{att.filename}}</a>
-      ({{att.length}} bytes)
+   {% if page.attachments %}
+    <div class="grid-18">
+        <strong>Attachments</strong>
+        {% for att in page.attachments %}
+            <div>
+                <a href="{{att.url()}}">{{att.filename}}</a>
+                ({{att.length}} bytes)
+            </div>
+        {% endfor %}
     </div>
-    {% endif %}
-  {% endfor %}
+  {% endif %}
 </div>
 {% endblock %}
 

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/1288e7be/ForgeWiki/forgewiki/tests/functional/test_root.py
----------------------------------------------------------------------
diff --git a/ForgeWiki/forgewiki/tests/functional/test_root.py b/ForgeWiki/forgewiki/tests/functional/test_root.py
index 9e8cf58..0b8ad0d 100644
--- a/ForgeWiki/forgewiki/tests/functional/test_root.py
+++ b/ForgeWiki/forgewiki/tests/functional/test_root.py
@@ -391,7 +391,7 @@ class TestRootController(TestController):
         # Make sure thumbnail is present
         r = self.app.get('/wiki/TEST/')
         img_srcs = [ i['src'] for i in r.html.findAll('img') ]
-        assert ('/p/test/wiki/TEST/attachment/' + filename + '/thumb') in img_srcs, img_srcs
+        assert ('/p/test/wiki/TEST/attachment/' + filename + '/thumb') not in img_srcs, img_srcs
         # Update the page to embed the image, make sure the thumbnail is absent
         self.app.post('/wiki/TEST/update', params=dict(
                 title='TEST',