Files
@ 9dd726706178
Branch filter:
Location: kallithea/rhodecode/controllers/home.py - annotation
9dd726706178
5.1 KiB
text/x-python
Complete copyright notices for web interface; change footer to link to them.
The original copyright notice found in the footer was not accurate as it
included only one of the many copyright holders in this project. This change
creates an "about" page, which currently contains just the copyright and
license information. It links to repository for additional potential copyright
holders not listed on the about page.
Unlisted contributors are mentioned in template comments.
Html links for Kallithea is fixed and we link to Conservancy.
Display of version information in the footer is improved.
The original copyright notice found in the footer was not accurate as it
included only one of the many copyright holders in this project. This change
creates an "about" page, which currently contains just the copyright and
license information. It links to repository for additional potential copyright
holders not listed on the about page.
Unlisted contributors are mentioned in template comments.
Html links for Kallithea is fixed and we link to Conservancy.
Display of version information in the footer is improved.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 | fd2ea6ceadc8 a671db5bdd58 a671db5bdd58 a671db5bdd58 a671db5bdd58 6832ef664673 ffd07396d315 ffd07396d315 ffd07396d315 ffd07396d315 6832ef664673 ffd07396d315 a671db5bdd58 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 fd2ea6ceadc8 fd2ea6ceadc8 fd2ea6ceadc8 ffd07396d315 62e493c7f436 87e9718ab4a2 0226b6d6b2b5 fd2ea6ceadc8 62e493c7f436 62e493c7f436 ffd45b185016 f37d7514e7ab ffd45b185016 ffd07396d315 ffd45b185016 0226b6d6b2b5 0226b6d6b2b5 f63cc1cbce27 ffd07396d315 ffd07396d315 50e41777675d ffd07396d315 ffd07396d315 ffd07396d315 ffd07396d315 ffd07396d315 9dd726706178 9dd726706178 9dd726706178 b950b884ab87 ffd07396d315 ffd45b185016 5242b1619603 62e493c7f436 1e5bb8ed77d6 1e5bb8ed77d6 1e5bb8ed77d6 1e5bb8ed77d6 62e493c7f436 1e5bb8ed77d6 1e5bb8ed77d6 1e5bb8ed77d6 1e5bb8ed77d6 62e493c7f436 ffd07396d315 f63cc1cbce27 b950b884ab87 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 9c0f5d558789 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 f63cc1cbce27 6248c6fb1fcf 0069657aaf42 b950b884ab87 ffd45b185016 ffd45b185016 0069657aaf42 0069657aaf42 ffd45b185016 deb51ab04891 deb51ab04891 deb51ab04891 deb51ab04891 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 ffd45b185016 | # -*- coding: utf-8 -*-
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
rhodecode.controllers.home
~~~~~~~~~~~~~~~~~~~~~~~~~~
Home controller for Rhodecode
:created_on: Feb 18, 2010
:author: marcink
:copyright: (c) 2013 RhodeCode GmbH.
:license: GPLv3, see LICENSE for more details.
"""
import logging
from pylons import tmpl_context as c, request
from pylons.i18n.translation import _
from webob.exc import HTTPBadRequest
from sqlalchemy.sql.expression import func
import rhodecode
from rhodecode.lib import helpers as h
from rhodecode.lib.utils import jsonify, conditional_cache
from rhodecode.lib.compat import json
from rhodecode.lib.auth import LoginRequired, HasRepoPermissionAnyDecorator
from rhodecode.lib.base import BaseController, render
from rhodecode.model.db import Repository, RepoGroup
from rhodecode.model.repo import RepoModel
log = logging.getLogger(__name__)
class HomeController(BaseController):
def __before__(self):
super(HomeController, self).__before__()
def about(self):
return render('/about.html')
@LoginRequired()
def index(self):
c.groups = self.scm_model.get_repo_groups()
c.group = None
c.repos_list = Repository.query()\
.filter(Repository.group_id == None)\
.order_by(func.lower(Repository.repo_name))\
.all()
repos_data = RepoModel().get_repos_as_dict(repos_list=c.repos_list,
admin=False)
#json used to render the grid
c.data = json.dumps(repos_data)
return render('/index.html')
@LoginRequired()
@jsonify
def repo_switcher_data(self):
#wrapper for conditional cache
def _c():
log.debug('generating switcher repo/groups list')
all_repos = Repository.query().order_by(Repository.repo_name).all()
repo_iter = self.scm_model.get_repos(all_repos, simple=True)
all_groups = RepoGroup.query().order_by(RepoGroup.group_name).all()
repo_groups_iter = self.scm_model.get_repo_groups(all_groups)
res = [{
'text': _('Groups'),
'children': [
{'id': obj.group_name, 'text': obj.group_name,
'type': 'group', 'obj': {}} for obj in repo_groups_iter]
}, {
'text': _('Repositories'),
'children': [
{'id': obj['name'], 'text': obj['name'],
'type': 'repo', 'obj': obj['dbrepo']} for obj in repo_iter]
}]
data = {
'more': False,
'results': res
}
return data
if request.is_xhr:
condition = False
compute = conditional_cache('short_term', 'cache_desc',
condition=condition, func=_c)
return compute()
else:
raise HTTPBadRequest()
@LoginRequired()
@HasRepoPermissionAnyDecorator('repository.read', 'repository.write',
'repository.admin')
def branch_tag_switcher(self, repo_name):
if request.is_xhr:
c.rhodecode_db_repo = Repository.get_by_repo_name(repo_name)
if c.rhodecode_db_repo:
c.rhodecode_repo = c.rhodecode_db_repo.scm_instance
return render('/switch_to_list.html')
raise HTTPBadRequest()
@LoginRequired()
@HasRepoPermissionAnyDecorator('repository.read', 'repository.write',
'repository.admin')
@jsonify
def repo_refs_data(self, repo_name):
repo = Repository.get_by_repo_name(repo_name).scm_instance
res = []
_branches = repo.branches.items()
if _branches:
res.append({
'text': _('Branch'),
'children': [{'id': rev, 'text': name, 'type': 'branch'} for name, rev in _branches]
})
_tags = repo.tags.items()
if _tags:
res.append({
'text': _('Tag'),
'children': [{'id': rev, 'text': name, 'type': 'tag'} for name, rev in _tags]
})
_bookmarks = repo.bookmarks.items()
if _bookmarks:
res.append({
'text': _('Bookmark'),
'children': [{'id': rev, 'text': name, 'type': 'book'} for name, rev in _bookmarks]
})
data = {
'more': False,
'results': res
}
return data
|