You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by tv...@apache.org on 2013/09/04 15:20:21 UTC
[1/9] git commit: [#4595] ticket:421 Simple UI for date range
filtering
Updated Branches:
refs/heads/master 8b15df901 -> 19070bda3
[#4595] ticket:421 Simple UI for date range filtering
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/01194e08
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/01194e08
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/01194e08
Branch: refs/heads/master
Commit: 01194e08c85a00ccd43f903cc546d331cf837930
Parents: 16f3bec
Author: Igor Bondarenko <je...@gmail.com>
Authored: Mon Sep 2 11:51:00 2013 +0300
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Wed Sep 4 13:19:54 2013 +0000
----------------------------------------------------------------------
Allura/allura/controllers/site_admin.py | 28 +++++++++++---------
.../templates/site_admin_new_projects.html | 11 ++++++--
2 files changed, 25 insertions(+), 14 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/01194e08/Allura/allura/controllers/site_admin.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/site_admin.py b/Allura/allura/controllers/site_admin.py
index 7595d66..be8415b 100644
--- a/Allura/allura/controllers/site_admin.py
+++ b/Allura/allura/controllers/site_admin.py
@@ -181,25 +181,29 @@ class SiteAdminController(object):
@expose('jinja:allura:templates/site_admin_new_projects.html')
@without_trailing_slash
- @validate(dict(page=validators.Int(if_empty=0),
- limit=validators.Int(if_empty=100)))
- def new_projects(self, page=0, limit=100, **kwargs):
- c.page_list = W.page_list
- c.page_size = W.page_size
- limit, pagenum, start = g.handle_paging(limit, page, default=100)
- count = 0
+ def new_projects(self, **kwargs):
+ start_dt = kwargs.pop('start-dt', '')
+ end_dt = kwargs.pop('end-dt', '')
+ try:
+ start_dt = datetime.strptime(start_dt, '%Y/%m/%d %H:%M:%S')
+ except ValueError:
+ start_dt = None
+ try:
+ end_dt = datetime.strptime(end_dt, '%Y/%m/%d %H:%M:%S')
+ except ValueError:
+ end_dt = None
nb = M.Neighborhood.query.get(name='Users')
projects = (M.Project.query.find({
'neighborhood_id': {'$ne': nb._id},
'deleted': False,
}).sort('_id', -1))
- count = projects.count()
- projects = projects.skip(start).limit(limit)
+ #projects = projects.skip(start).limit(limit)
+ start_dt = datetime.now() if not start_dt else start_dt
+ end_dt = start_dt - timedelta(days=15) if not end_dt else end_dt
return {
'projects': projects,
- 'limit': limit,
- 'pagenum': pagenum,
- 'count': count
+ 'window_start': start_dt,
+ 'window_end': end_dt,
}
@expose('jinja:allura:templates/site_admin_reclone_repo.html')
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/01194e08/Allura/allura/templates/site_admin_new_projects.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/site_admin_new_projects.html b/Allura/allura/templates/site_admin_new_projects.html
index 213ab43..a3c0b76 100644
--- a/Allura/allura/templates/site_admin_new_projects.html
+++ b/Allura/allura/templates/site_admin_new_projects.html
@@ -20,7 +20,15 @@
{% extends 'allura:templates/site_admin.html' %}
{% block content %}
- {{ c.page_size.display(limit=limit, count=count, page=pagenum) }}
+ <div class="grid-24">
+ <form method="GET">
+ <div class="grid-13">
+ <label for="start-dt">From: </label><input type="text" name="start-dt" id="start-dt" value="{{ window_start.strftime('%Y/%m/%d %H:%M:%S') }}">
+ <label for="end-dt">To: </label><input type="text" name="end-dt" id="end-dt" value="{{ window_end.strftime('%Y/%m/%d %H:%M:%S') }}">
+ </div>
+ <div class="grid-2"><input type="submit" value="Filter"></div>
+ </form>
+ </div>
<table>
<thead>
<tr>
@@ -51,7 +59,6 @@
</tr>
{% endfor %}
</table>
- {{ c.page_list.display(limit=limit, count=count, page=pagenum) }}
<div id="selected-projects"></div>
{% endblock %}
[8/9] git commit: [#4595] ticket:421 Filter projects by date range
Posted by tv...@apache.org.
[#4595] ticket:421 Filter projects by date range
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/f865ddfd
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/f865ddfd
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/f865ddfd
Branch: refs/heads/master
Commit: f865ddfdc5390753cfb268a67d9835b34a439add
Parents: 01194e0
Author: Igor Bondarenko <je...@gmail.com>
Authored: Mon Sep 2 12:26:09 2013 +0300
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Wed Sep 4 13:19:55 2013 +0000
----------------------------------------------------------------------
Allura/allura/controllers/site_admin.py | 8 +++++---
Allura/allura/tests/functional/test_site_admin.py | 14 ++++++++++++++
2 files changed, 19 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/f865ddfd/Allura/allura/controllers/site_admin.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/site_admin.py b/Allura/allura/controllers/site_admin.py
index be8415b..818016f 100644
--- a/Allura/allura/controllers/site_admin.py
+++ b/Allura/allura/controllers/site_admin.py
@@ -192,14 +192,16 @@ class SiteAdminController(object):
end_dt = datetime.strptime(end_dt, '%Y/%m/%d %H:%M:%S')
except ValueError:
end_dt = None
+ start_dt = datetime.now() if not start_dt else start_dt
+ end_dt = start_dt - timedelta(days=15) if not end_dt else end_dt
+ start = bson.ObjectId.from_datetime(start_dt)
+ end = bson.ObjectId.from_datetime(end_dt)
nb = M.Neighborhood.query.get(name='Users')
projects = (M.Project.query.find({
'neighborhood_id': {'$ne': nb._id},
'deleted': False,
+ '_id': {'$lt': start, '$gt': end},
}).sort('_id', -1))
- #projects = projects.skip(start).limit(limit)
- start_dt = datetime.now() if not start_dt else start_dt
- end_dt = start_dt - timedelta(days=15) if not end_dt else end_dt
return {
'projects': projects,
'window_start': start_dt,
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/f865ddfd/Allura/allura/tests/functional/test_site_admin.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/functional/test_site_admin.py b/Allura/allura/tests/functional/test_site_admin.py
index e339ff7..e0ba8fd 100644
--- a/Allura/allura/tests/functional/test_site_admin.py
+++ b/Allura/allura/tests/functional/test_site_admin.py
@@ -16,6 +16,7 @@
# under the License.
import json
+from datetime import timedelta
from nose.tools import assert_equal
from ming.odm import ThreadLocalORMSession
@@ -78,6 +79,19 @@ class TestSiteAdmin(TestController):
username='root'))
assert_equal(len(r.html.find('table').findAll('tr')), count - 1)
+ def test_new_projects_daterange_filtering(self):
+ r = self.app.get('/nf/admin/new_projects', extra_environ=dict(
+ username='root'))
+ count = len(r.html.find('table').findAll('tr'))
+ assert_equal(count, 7)
+
+ filtr = r.forms[0]
+ filtr['start-dt'] = '2000/01/01 10:10:10'
+ filtr['end-dt'] = '2000/01/01 09:09:09'
+ r = filtr.submit()
+ count = len(r.html.find('table').findAll('tr'))
+ assert_equal(count, 1) # only row with headers - no results
+
def test_reclone_repo_access(self):
r = self.app.get('/nf/admin/reclone_repo', extra_environ=dict(
username='*anonymous'), status=302).follow()
[7/9] git commit: [#4595] ticket:421 Fix occasionally failing tests
Posted by tv...@apache.org.
[#4595] ticket:421 Fix occasionally failing tests
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/ef8c3397
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/ef8c3397
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/ef8c3397
Branch: refs/heads/master
Commit: ef8c33972e8920a1be17a6086bf4f0bff5c42db1
Parents: 91c7a3a
Author: Igor Bondarenko <je...@gmail.com>
Authored: Mon Sep 2 13:22:51 2013 +0300
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Wed Sep 4 13:19:55 2013 +0000
----------------------------------------------------------------------
Allura/allura/controllers/site_admin.py | 6 ++----
Allura/allura/tests/functional/test_site_admin.py | 1 -
2 files changed, 2 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/ef8c3397/Allura/allura/controllers/site_admin.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/site_admin.py b/Allura/allura/controllers/site_admin.py
index b5fa97a..0051a04 100644
--- a/Allura/allura/controllers/site_admin.py
+++ b/Allura/allura/controllers/site_admin.py
@@ -187,13 +187,11 @@ class SiteAdminController(object):
try:
start_dt = datetime.strptime(start_dt, '%Y/%m/%d %H:%M:%S')
except ValueError:
- start_dt = None
+ start_dt = datetime.utcnow() + timedelta(days=1)
try:
end_dt = datetime.strptime(end_dt, '%Y/%m/%d %H:%M:%S')
except ValueError:
- end_dt = None
- start_dt = datetime.utcnow() if not start_dt else start_dt
- end_dt = start_dt - timedelta(days=3) if not end_dt else end_dt
+ end_dt = start_dt - timedelta(days=3) if not end_dt else end_dt
start = bson.ObjectId.from_datetime(start_dt)
end = bson.ObjectId.from_datetime(end_dt)
nb = M.Neighborhood.query.get(name='Users')
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/ef8c3397/Allura/allura/tests/functional/test_site_admin.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/functional/test_site_admin.py b/Allura/allura/tests/functional/test_site_admin.py
index e0ba8fd..0f20247 100644
--- a/Allura/allura/tests/functional/test_site_admin.py
+++ b/Allura/allura/tests/functional/test_site_admin.py
@@ -16,7 +16,6 @@
# under the License.
import json
-from datetime import timedelta
from nose.tools import assert_equal
from ming.odm import ThreadLocalORMSession
[3/9] git commit: [#4595] ticket:421 Show only usernames in admins
column
Posted by tv...@apache.org.
[#4595] ticket:421 Show only usernames in admins column
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/22f7c861
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/22f7c861
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/22f7c861
Branch: refs/heads/master
Commit: 22f7c861f8098d1ad4bd83f3a60c2689dcdbd489
Parents: f59fcc2
Author: Igor Bondarenko <je...@gmail.com>
Authored: Mon Sep 2 10:49:40 2013 +0300
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Wed Sep 4 13:19:54 2013 +0000
----------------------------------------------------------------------
Allura/allura/templates/site_admin_new_projects.html | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/22f7c861/Allura/allura/templates/site_admin_new_projects.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/site_admin_new_projects.html b/Allura/allura/templates/site_admin_new_projects.html
index bd97dc1..213ab43 100644
--- a/Allura/allura/templates/site_admin_new_projects.html
+++ b/Allura/allura/templates/site_admin_new_projects.html
@@ -47,7 +47,7 @@
<td><small>{{ p.short_description }}</small></td>
<td><small>{{ p.summary }}</small></td>
<td><small>{{ p.external_homepage|urlize(22) }}</small></td>
- <td><small>{{ p.admins()|join(' ') }}</small></td>
+ <td>{% for a in p.admins() %}<small><a href="{{ a.url() }}">{{ a.username }}</a></small> {% endfor %}</td>
</tr>
{% endfor %}
</table>
[2/9] git commit: [#4595] ticket:421 Check the checkbox when clicking
on the corresponding row
Posted by tv...@apache.org.
[#4595] ticket:421 Check the checkbox when clicking on the corresponding row
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/16f3bece
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/16f3bece
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/16f3bece
Branch: refs/heads/master
Commit: 16f3beceae726cc4c3b849236be47510aea3c173
Parents: 22f7c86
Author: Igor Bondarenko <je...@gmail.com>
Authored: Mon Sep 2 11:10:55 2013 +0300
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Wed Sep 4 13:19:54 2013 +0000
----------------------------------------------------------------------
Allura/allura/public/nf/js/site_admin_new_projects.js | 6 ++++++
1 file changed, 6 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/16f3bece/Allura/allura/public/nf/js/site_admin_new_projects.js
----------------------------------------------------------------------
diff --git a/Allura/allura/public/nf/js/site_admin_new_projects.js b/Allura/allura/public/nf/js/site_admin_new_projects.js
index 42b6e08..d27322e 100644
--- a/Allura/allura/public/nf/js/site_admin_new_projects.js
+++ b/Allura/allura/public/nf/js/site_admin_new_projects.js
@@ -31,4 +31,10 @@ $(document).ready(function() {
$('#selected-projects').text(shortnames.join(' '));
}
});
+
+ $('tr').click(function(event) {
+ if (event.target.tagName !== 'A' && event.target.type !== 'checkbox') {
+ $(this).find(':checkbox').trigger('click');
+ }
+ });
});
[9/9] git commit: [#4595] ticket:421 Pagination by date range
Posted by tv...@apache.org.
[#4595] ticket:421 Pagination by date range
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/815940cc
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/815940cc
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/815940cc
Branch: refs/heads/master
Commit: 815940cca6165e0ae414bd96d8f3032fee2250d7
Parents: f865ddf
Author: Igor Bondarenko <je...@gmail.com>
Authored: Mon Sep 2 12:43:39 2013 +0300
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Wed Sep 4 13:19:55 2013 +0000
----------------------------------------------------------------------
Allura/allura/controllers/site_admin.py | 12 ++++++++++-
.../templates/site_admin_new_projects.html | 21 ++++++++++++++++++++
2 files changed, 32 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/815940cc/Allura/allura/controllers/site_admin.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/site_admin.py b/Allura/allura/controllers/site_admin.py
index 818016f..eacf105 100644
--- a/Allura/allura/controllers/site_admin.py
+++ b/Allura/allura/controllers/site_admin.py
@@ -193,7 +193,7 @@ class SiteAdminController(object):
except ValueError:
end_dt = None
start_dt = datetime.now() if not start_dt else start_dt
- end_dt = start_dt - timedelta(days=15) if not end_dt else end_dt
+ end_dt = start_dt - timedelta(days=3) if not end_dt else end_dt
start = bson.ObjectId.from_datetime(start_dt)
end = bson.ObjectId.from_datetime(end_dt)
nb = M.Neighborhood.query.get(name='Users')
@@ -202,8 +202,18 @@ class SiteAdminController(object):
'deleted': False,
'_id': {'$lt': start, '$gt': end},
}).sort('_id', -1))
+ step = start_dt - end_dt
+ params = request.params.copy()
+ params['start-dt'] = (start_dt + step).strftime('%Y/%m/%d %H:%M:%S')
+ params['end-dt'] = (end_dt + step).strftime('%Y/%m/%d %H:%M:%S')
+ newer_url = tg.url(params=params).lstrip('/')
+ params['start-dt'] = (start_dt - step).strftime('%Y/%m/%d %H:%M:%S')
+ params['end-dt'] = (end_dt - step).strftime('%Y/%m/%d %H:%M:%S')
+ older_url = tg.url(params=params).lstrip('/')
return {
'projects': projects,
+ 'newer_url': newer_url,
+ 'older_url': older_url,
'window_start': start_dt,
'window_end': end_dt,
}
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/815940cc/Allura/allura/templates/site_admin_new_projects.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/site_admin_new_projects.html b/Allura/allura/templates/site_admin_new_projects.html
index a3c0b76..b49bf1f 100644
--- a/Allura/allura/templates/site_admin_new_projects.html
+++ b/Allura/allura/templates/site_admin_new_projects.html
@@ -19,6 +19,13 @@
{% set page="new_projects" %}
{% extends 'allura:templates/site_admin.html' %}
+{% macro _paging() %}
+<div class="paging">
+ <a class="newer" title="Newer" href="{{ newer_url }}"><</a> …
+ <a class="newer" title="Older" href="{{ older_url }}">></a>
+</div>
+{% endmacro %}
+
{% block content %}
<div class="grid-24">
<form method="GET">
@@ -29,6 +36,7 @@
<div class="grid-2"><input type="submit" value="Filter"></div>
</form>
</div>
+ {{ _paging() }}
<table>
<thead>
<tr>
@@ -59,9 +67,22 @@
</tr>
{% endfor %}
</table>
+ {{ _paging() }}
<div id="selected-projects"></div>
{% endblock %}
+{% block extra_css %}
+<style type="text/css">
+ .paging {
+ float: right;
+ margin: 1em;
+ }
+ .pad table {
+ width: 915px;
+ }
+</style>
+{% endblock %}
+
{% block extra_js %}
<script type="text/javascript" src="{{g.forge_static('js/site_admin_new_projects.js')}}"></script>
{% endblock %}
[6/9] git commit: [#4595] ticket:421 Use utcnow() instead of now()
Posted by tv...@apache.org.
[#4595] ticket:421 Use utcnow() instead of now()
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/91c7a3aa
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/91c7a3aa
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/91c7a3aa
Branch: refs/heads/master
Commit: 91c7a3aa891c0ee60a83d5870131abc03a360385
Parents: 815940c
Author: Igor Bondarenko <je...@gmail.com>
Authored: Mon Sep 2 13:08:32 2013 +0300
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Wed Sep 4 13:19:55 2013 +0000
----------------------------------------------------------------------
Allura/allura/controllers/site_admin.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/91c7a3aa/Allura/allura/controllers/site_admin.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/site_admin.py b/Allura/allura/controllers/site_admin.py
index eacf105..b5fa97a 100644
--- a/Allura/allura/controllers/site_admin.py
+++ b/Allura/allura/controllers/site_admin.py
@@ -192,7 +192,7 @@ class SiteAdminController(object):
end_dt = datetime.strptime(end_dt, '%Y/%m/%d %H:%M:%S')
except ValueError:
end_dt = None
- start_dt = datetime.now() if not start_dt else start_dt
+ start_dt = datetime.utcnow() if not start_dt else start_dt
end_dt = start_dt - timedelta(days=3) if not end_dt else end_dt
start = bson.ObjectId.from_datetime(start_dt)
end = bson.ObjectId.from_datetime(end_dt)
[5/9] git commit: [#4595] ticket:421 Fix page layout for firefox
Posted by tv...@apache.org.
[#4595] ticket:421 Fix page layout for firefox
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/19070bda
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/19070bda
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/19070bda
Branch: refs/heads/master
Commit: 19070bda3732ca3097c3e24636f813259e390e7c
Parents: ef8c339
Author: Igor Bondarenko <je...@gmail.com>
Authored: Tue Sep 3 14:55:41 2013 +0300
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Wed Sep 4 13:19:55 2013 +0000
----------------------------------------------------------------------
Allura/allura/templates/site_admin_new_projects.html | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/19070bda/Allura/allura/templates/site_admin_new_projects.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/site_admin_new_projects.html b/Allura/allura/templates/site_admin_new_projects.html
index b49bf1f..3b9dab5 100644
--- a/Allura/allura/templates/site_admin_new_projects.html
+++ b/Allura/allura/templates/site_admin_new_projects.html
@@ -33,10 +33,11 @@
<label for="start-dt">From: </label><input type="text" name="start-dt" id="start-dt" value="{{ window_start.strftime('%Y/%m/%d %H:%M:%S') }}">
<label for="end-dt">To: </label><input type="text" name="end-dt" id="end-dt" value="{{ window_end.strftime('%Y/%m/%d %H:%M:%S') }}">
</div>
- <div class="grid-2"><input type="submit" value="Filter"></div>
+ <div class="grid-3"><input type="submit" value="Filter"></div>
</form>
</div>
{{ _paging() }}
+ <div style="clear:both;"></div>
<table>
<thead>
<tr>
[4/9] git commit: [#4595] ticket:421 Filter out deleted projects
Posted by tv...@apache.org.
[#4595] ticket:421 Filter out deleted projects
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/f59fcc24
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/f59fcc24
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/f59fcc24
Branch: refs/heads/master
Commit: f59fcc246dedaeae060cf63532507dfdec473840
Parents: 8b15df9
Author: Igor Bondarenko <je...@gmail.com>
Authored: Fri Aug 30 12:17:20 2013 +0300
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Wed Sep 4 13:19:54 2013 +0000
----------------------------------------------------------------------
Allura/allura/controllers/site_admin.py | 6 ++++--
.../templates/site_admin_new_projects.html | 2 --
.../allura/tests/functional/test_site_admin.py | 20 +++++++++++++++++---
3 files changed, 21 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/f59fcc24/Allura/allura/controllers/site_admin.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/site_admin.py b/Allura/allura/controllers/site_admin.py
index 50b0e38..7595d66 100644
--- a/Allura/allura/controllers/site_admin.py
+++ b/Allura/allura/controllers/site_admin.py
@@ -189,8 +189,10 @@ class SiteAdminController(object):
limit, pagenum, start = g.handle_paging(limit, page, default=100)
count = 0
nb = M.Neighborhood.query.get(name='Users')
- projects = (M.Project.query.find({'neighborhood_id': {'$ne': nb._id}})
- .sort('_id', -1))
+ projects = (M.Project.query.find({
+ 'neighborhood_id': {'$ne': nb._id},
+ 'deleted': False,
+ }).sort('_id', -1))
count = projects.count()
projects = projects.skip(start).limit(limit)
return {
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/f59fcc24/Allura/allura/templates/site_admin_new_projects.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/site_admin_new_projects.html b/Allura/allura/templates/site_admin_new_projects.html
index aae9e48..bd97dc1 100644
--- a/Allura/allura/templates/site_admin_new_projects.html
+++ b/Allura/allura/templates/site_admin_new_projects.html
@@ -30,7 +30,6 @@
<th>Name</th>
<th>Short description</th>
<th>Summary</th>
- <th>Deleted?</th>
<th>Homepage</th>
<th>Admins</th>
</tr>
@@ -47,7 +46,6 @@
<td><small><a href="{{ p.url() }}">{{ p.name }}</a></small></td>
<td><small>{{ p.short_description }}</small></td>
<td><small>{{ p.summary }}</small></td>
- <td><small>{{ 'Yes' if p.deleted else 'No' }}</small></td>
<td><small>{{ p.external_homepage|urlize(22) }}</small></td>
<td><small>{{ p.admins()|join(' ') }}</small></td>
</tr>
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/f59fcc24/Allura/allura/tests/functional/test_site_admin.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/functional/test_site_admin.py b/Allura/allura/tests/functional/test_site_admin.py
index dc8f26c..e339ff7 100644
--- a/Allura/allura/tests/functional/test_site_admin.py
+++ b/Allura/allura/tests/functional/test_site_admin.py
@@ -17,6 +17,9 @@
import json
+from nose.tools import assert_equal
+from ming.odm import ThreadLocalORMSession
+
from allura import model as M
from allura.tests import TestController
from allura.lib.decorators import task
@@ -60,9 +63,20 @@ class TestSiteAdmin(TestController):
assert headers[3].contents[0] == 'Name'
assert headers[4].contents[0] == 'Short description'
assert headers[5].contents[0] == 'Summary'
- assert headers[6].contents[0] == 'Deleted?'
- assert headers[7].contents[0] == 'Homepage'
- assert headers[8].contents[0] == 'Admins'
+ assert headers[6].contents[0] == 'Homepage'
+ assert headers[7].contents[0] == 'Admins'
+
+ def test_new_projects_deleted_projects(self):
+ '''Deleted projects should not be visible here'''
+ r = self.app.get('/nf/admin/new_projects', extra_environ=dict(
+ username='root'))
+ count = len(r.html.find('table').findAll('tr'))
+ p = M.Project.query.get(shortname='test')
+ p.deleted = True
+ ThreadLocalORMSession.flush_all()
+ r = self.app.get('/nf/admin/new_projects', extra_environ=dict(
+ username='root'))
+ assert_equal(len(r.html.find('table').findAll('tr')), count - 1)
def test_reclone_repo_access(self):
r = self.app.get('/nf/admin/reclone_repo', extra_environ=dict(