incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From john...@apache.org
Subject [2/2] git commit: [#5339] ticket:239 added a hidden field to the attach form
Date Mon, 07 Jan 2013 19:06:44 GMT
Updated Branches:
  refs/heads/master f25280d8e -> 0ee690787


[#5339] ticket:239 added a hidden field to the attach form


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

Branch: refs/heads/master
Commit: 56b081727e1b3b89512a67ea77abb4500bcface1
Parents: f25280d
Author: Yuriy Arhipov <yuriyarhipovua@yandex.ru>
Authored: Thu Dec 20 02:29:36 2012 +0400
Committer: Cory Johns <johnsca@geek.net>
Committed: Mon Jan 7 19:04:41 2013 +0000

----------------------------------------------------------------------
 Allura/allura/nf/allura/css/site_style.css         |    7 +++-
 Allura/allura/templates/widgets/post_widget.html   |   30 ++++++++------
 .../forgetracker/tests/functional/test_root.py     |   23 +++++++++++
 3 files changed, 46 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/56b08172/Allura/allura/nf/allura/css/site_style.css
----------------------------------------------------------------------
diff --git a/Allura/allura/nf/allura/css/site_style.css b/Allura/allura/nf/allura/css/site_style.css
index 82c2727..4c0643b 100644
--- a/Allura/allura/nf/allura/css/site_style.css
+++ b/Allura/allura/nf/allura/css/site_style.css
@@ -2183,11 +2183,16 @@ div.attachment_thumb {
   position: relative;
   padding: 10px;
 }
-div.attachment_thumb .delete_attachment {
+div.attachment_thumb .delete_attachment .pic {
   position: absolute;
   top: 0;
   left: 100px;
 }
+div.attachment_thumb .file {
+    position: absolute;
+    top: 0;
+    right: -40px;
+}
 div.attachment_thumb .file_type {
   border: 1px solid #ccc;
   display: block;

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/56b08172/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 051e813..8bb31d1 100644
--- a/Allura/allura/templates/widgets/post_widget.html
+++ b/Allura/allura/templates/widgets/post_widget.html
@@ -52,19 +52,23 @@
           <div class="clear"></div>
           {% for att in value.attachments %}
             <div class="attachment_thumb" style="min-height: 130px;">
-              {% if att.is_image() %}
-                <a href="{{att.url()}}"><img src="{{att.url()}}/thumb" alt="Thumbnail"/></a>
-                <br/>
-                <a href="{{att.url()}}">{{att.filename}}</a>
-              {% else %}
-                <a href="{{att.url()}}">{{att.filename}}</a>
-              {% endif %}
-              {% if c.user._id and value.author_id==c.user._id %}
-              <br>
-              <form method="POST" action="{{att.url()}}">
-                <input class="submit delete_attachment" type="submit" name="delete" value="X"/>
-              </form>
-              {% endif %}
+                <form method="POST" action="{{att.url()}}">
+                {% if att.is_image() %}
+                    <a href="{{att.url()}}"><img src="{{att.url()}}/thumb" alt="Thumbnail"/></a>
+                    <br/>
+                    <a href="{{att.url()}}">{{att.filename}}</a>
+                    {% if c.user._id and value.author_id==c.user._id %}
+                        <br>
+                        <input class="submit delete_attachment pic" type="submit" value="X"/>
+                    {% endif %}
+                {% else %}
+                    <a href="{{att.url()}}">{{att.filename}}</a>
+                    {% if c.user._id and value.author_id==c.user._id %}
+                    <input class="submit delete_attachment file" type="submit" value="X"/>
+                    {% endif %}
+                {% endif %}
+                <input type="hidden" name="delete" value="True">
+                </form>
             </div>
           {% endfor %}
         </div>

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/56b08172/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 e254e8b..549964c 100644
--- a/ForgeTracker/forgetracker/tests/functional/test_root.py
+++ b/ForgeTracker/forgetracker/tests/functional/test_root.py
@@ -366,6 +366,29 @@ class TestFunctionalController(TrackerTestController):
         deleted_form = self.app.get('/bugs/1/')
         assert file_name not in deleted_form
 
+    def test_delete_attachment_from_comments(self):
+        ticket_view = self.new_ticket(summary='test ticket').follow()
+        for f in ticket_view.html.findAll('form'):
+            if f.get('action', '').endswith('/post'):
+                break
+        params = dict()
+        inputs = f.findAll('input')
+        for field in inputs:
+            if field.has_key('name'):
+                params[field['name']] = field.has_key('value') and field['value'] or ''
+        params[f.find('textarea')['name']] = 'test comment'
+        self.app.post(f['action'].encode('utf-8'), params=params,
+                          headers={'Referer': '/bugs/1/'.encode("utf-8")})
+        r = self.app.get('/bugs/1/', dict(page=1))
+        post_link = str(r.html.find('div',{'class':'edit_post_form reply'}).find('form')['action'])
+        self.app.post(post_link + 'attach',
+                          upload_files=[('file_info', 'test.txt', 'HiThere!')])
+        r = self.app.get('/bugs/1/', dict(page=1))
+        assert '<input class="submit delete_attachment file" type="submit" value="X"/>'
in r
+        form = r.forms[5].submit()
+        r = self.app.get('/bugs/1/', dict(page=1))
+        assert '<input class="submit delete_attachment" type="submit" value="X"/>'
not in r
+
     def test_new_text_attachment_content(self):
         file_name = 'test_root.py'
         file_data = file(__file__).read()


Mime
View raw message