Show More
@@ -1,50 +1,54 | |||||
1 | # -*- coding: utf-8 -*- |
|
1 | # -*- coding: utf-8 -*- | |
2 | """ |
|
2 | """ | |
3 | rhodecode.controllers.tags |
|
3 | rhodecode.controllers.tags | |
4 | ~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
4 | ~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
5 |
|
5 | |||
6 | Tags controller for rhodecode |
|
6 | Tags controller for rhodecode | |
7 |
|
7 | |||
8 | :created_on: Apr 21, 2010 |
|
8 | :created_on: Apr 21, 2010 | |
9 | :author: marcink |
|
9 | :author: marcink | |
10 | :copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com> |
|
10 | :copyright: (C) 2009-2011 Marcin Kuzminski <marcin@python-works.com> | |
11 | :license: GPLv3, see COPYING for more details. |
|
11 | :license: GPLv3, see COPYING for more details. | |
12 | """ |
|
12 | """ | |
13 | # This program is free software; you can redistribute it and/or |
|
13 | # This program is free software; you can redistribute it and/or | |
14 | # modify it under the terms of the GNU General Public License |
|
14 | # modify it under the terms of the GNU General Public License | |
15 | # as published by the Free Software Foundation; version 2 |
|
15 | # as published by the Free Software Foundation; version 2 | |
16 | # of the License or (at your opinion) any later version of the license. |
|
16 | # of the License or (at your opinion) any later version of the license. | |
17 | # |
|
17 | # | |
18 | # This program is distributed in the hope that it will be useful, |
|
18 | # This program is distributed in the hope that it will be useful, | |
19 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
19 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
20 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
20 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
21 | # GNU General Public License for more details. |
|
21 | # GNU General Public License for more details. | |
22 | # |
|
22 | # | |
23 | # You should have received a copy of the GNU General Public License |
|
23 | # You should have received a copy of the GNU General Public License | |
24 | # along with this program; if not, write to the Free Software |
|
24 | # along with this program; if not, write to the Free Software | |
25 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
25 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | |
26 | # MA 02110-1301, USA. |
|
26 | # MA 02110-1301, USA. | |
27 | import logging |
|
27 | import logging | |
28 |
|
28 | |||
29 | from pylons import tmpl_context as c |
|
29 | from pylons import tmpl_context as c | |
30 |
|
30 | |||
31 | from rhodecode.lib.auth import LoginRequired, HasRepoPermissionAnyDecorator |
|
31 | from rhodecode.lib.auth import LoginRequired, HasRepoPermissionAnyDecorator | |
32 | from rhodecode.lib.base import BaseRepoController, render |
|
32 | from rhodecode.lib.base import BaseRepoController, render | |
33 | from rhodecode.lib.utils import OrderedDict |
|
33 | from rhodecode.lib.utils import OrderedDict | |
34 |
|
34 | |||
35 | log = logging.getLogger(__name__) |
|
35 | log = logging.getLogger(__name__) | |
36 |
|
36 | |||
37 | class TagsController(BaseRepoController): |
|
37 | class TagsController(BaseRepoController): | |
38 |
|
38 | |||
39 | @LoginRequired() |
|
39 | @LoginRequired() | |
40 | @HasRepoPermissionAnyDecorator('repository.read', 'repository.write', |
|
40 | @HasRepoPermissionAnyDecorator('repository.read', 'repository.write', | |
41 | 'repository.admin') |
|
41 | 'repository.admin') | |
42 | def __before__(self): |
|
42 | def __before__(self): | |
43 | super(TagsController, self).__before__() |
|
43 | super(TagsController, self).__before__() | |
44 |
|
44 | |||
45 | def index(self): |
|
45 | def index(self): | |
46 | c.repo_tags = OrderedDict() |
|
46 | c.repo_tags = OrderedDict() | |
47 | for name, hash_ in c.rhodecode_repo.tags.items(): |
|
47 | ||
48 |
|
|
48 | tags = [(name, c.rhodecode_repo.get_changeset(hash_)) for \ | |
|
49 | name, hash_ in c.rhodecode_repo.tags.items()] | |||
|
50 | ordered_tags = sorted(tags, key=lambda x:x[1].date, reverse=True) | |||
|
51 | for name, cs_tag in ordered_tags: | |||
|
52 | c.repo_tags[name] = cs_tag | |||
49 |
|
53 | |||
50 | return render('tags/tags.html') |
|
54 | return render('tags/tags.html') |
General Comments 0
You need to be logged in to leave comments.
Login now