##// END OF EJS Templates
admin: added basic admin page
marcink -
r3563:a4c028c7 new-ui
parent child Browse files
Show More
@@ -0,0 +1,49 b''
1 ## -*- coding: utf-8 -*-
2 <%inherit file="/base/base.mako"/>
3
4 <%def name="title()">
5 ${_('Settings administration')}
6 %if c.rhodecode_name:
7 &middot; ${h.branding(c.rhodecode_name)}
8 %endif
9 </%def>
10
11 <%def name="breadcrumbs_links()">
12 ${h.link_to(_('Admin'),h.route_path('admin_home'))}
13 &raquo;
14 ${_('Settings')}
15 </%def>
16
17 <%def name="menu_bar_nav()">
18 ${self.menu_items(active='admin')}
19 </%def>
20
21 <%def name="side_bar_nav()">
22
23 </%def>
24
25 <%def name="main_content()">
26 Hello Admin
27 </%def>
28
29 <%def name="main()">
30 <div class="box">
31 <div class="title">
32 ${self.breadcrumbs()}
33 </div>
34
35 ##main
36 <div class='sidebar-col-wrapper'>
37 <div class="sidebar">
38 <ul class="nav nav-pills nav-stacked">
39 ${self.side_bar_nav()}
40 </ul>
41 </div>
42
43 <div class="main-content-auto-width">
44 ${self.main_content()}
45 </div>
46 </div>
47 </div>
48
49 </%def> No newline at end of file
@@ -1,64 +1,69 b''
1 # -*- coding: utf-8 -*-
1 # -*- coding: utf-8 -*-
2
2
3 # Copyright (C) 2016-2019 RhodeCode GmbH
3 # Copyright (C) 2016-2019 RhodeCode GmbH
4 #
4 #
5 # This program is free software: you can redistribute it and/or modify
5 # This program is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU Affero General Public License, version 3
6 # it under the terms of the GNU Affero General Public License, version 3
7 # (only), as published by the Free Software Foundation.
7 # (only), as published by the Free Software Foundation.
8 #
8 #
9 # This program is distributed in the hope that it will be useful,
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
12 # GNU General Public License for more details.
13 #
13 #
14 # You should have received a copy of the GNU Affero General Public License
14 # You should have received a copy of the GNU Affero General Public License
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
16 #
16 #
17 # This program is dual-licensed. If you wish to learn more about the
17 # This program is dual-licensed. If you wish to learn more about the
18 # RhodeCode Enterprise Edition, including its added features, Support services,
18 # RhodeCode Enterprise Edition, including its added features, Support services,
19 # and proprietary license terms, please see https://rhodecode.com/licenses/
19 # and proprietary license terms, please see https://rhodecode.com/licenses/
20
20
21 import logging
21 import logging
22
22
23 from pyramid.httpexceptions import HTTPFound
23 from pyramid.httpexceptions import HTTPFound
24 from pyramid.view import view_config
24 from pyramid.view import view_config
25
25
26 from rhodecode.apps._base import BaseAppView
26 from rhodecode.apps._base import BaseAppView
27 from rhodecode.lib import helpers as h
27 from rhodecode.lib import helpers as h
28 from rhodecode.lib.auth import (LoginRequired, HasPermissionAllDecorator)
28 from rhodecode.lib.auth import (LoginRequired, HasPermissionAllDecorator)
29 from rhodecode.model.db import PullRequest
29 from rhodecode.model.db import PullRequest
30
30
31
31
32 log = logging.getLogger(__name__)
32 log = logging.getLogger(__name__)
33
33
34
34
35 class AdminMainView(BaseAppView):
35 class AdminMainView(BaseAppView):
36 def load_default_context(self):
37 c = self._get_local_tmpl_context()
38 return c
36
39
37 @LoginRequired()
40 @LoginRequired()
38 @HasPermissionAllDecorator('hg.admin')
41 @HasPermissionAllDecorator('hg.admin')
39 @view_config(
42 @view_config(
40 route_name='admin_home', request_method='GET')
43 route_name='admin_home', request_method='GET',
44 renderer='rhodecode:templates/admin/main.mako')
41 def admin_main(self):
45 def admin_main(self):
42 # redirect _admin to audit logs...
46 c = self.load_default_context()
43 raise HTTPFound(h.route_path('admin_audit_logs'))
47 c.active = 'admin'
48 return self._get_template_context(c)
44
49
45 @LoginRequired()
50 @LoginRequired()
46 @view_config(route_name='pull_requests_global_0', request_method='GET')
51 @view_config(route_name='pull_requests_global_0', request_method='GET')
47 @view_config(route_name='pull_requests_global_1', request_method='GET')
52 @view_config(route_name='pull_requests_global_1', request_method='GET')
48 @view_config(route_name='pull_requests_global', request_method='GET')
53 @view_config(route_name='pull_requests_global', request_method='GET')
49 def pull_requests(self):
54 def pull_requests(self):
50 """
55 """
51 Global redirect for Pull Requests
56 Global redirect for Pull Requests
52
57
53 :param pull_request_id: id of pull requests in the system
58 :param pull_request_id: id of pull requests in the system
54 """
59 """
55
60
56 pull_request = PullRequest.get_or_404(
61 pull_request = PullRequest.get_or_404(
57 self.request.matchdict['pull_request_id'])
62 self.request.matchdict['pull_request_id'])
58 pull_request_id = pull_request.pull_request_id
63 pull_request_id = pull_request.pull_request_id
59
64
60 repo_name = pull_request.target_repo.repo_name
65 repo_name = pull_request.target_repo.repo_name
61
66
62 raise HTTPFound(
67 raise HTTPFound(
63 h.route_path('pullrequest_show', repo_name=repo_name,
68 h.route_path('pullrequest_show', repo_name=repo_name,
64 pull_request_id=pull_request_id))
69 pull_request_id=pull_request_id))
General Comments 0
You need to be logged in to leave comments. Login now