Show More
@@ -0,0 +1,75 b'' | |||||
|
1 | ## -*- coding: utf-8 -*- | |||
|
2 | ||||
|
3 | <div class="panel panel-default"> | |||
|
4 | <div class="panel-heading"> | |||
|
5 | <h3 class="panel-title">${_('User Group Membership')}</h3> | |||
|
6 | </div> | |||
|
7 | ||||
|
8 | <div class="panel-body"> | |||
|
9 | <div class="groups_management"> | |||
|
10 | <div id="repos_list_wrap"> | |||
|
11 | <table id="user_group_list_table" class="display"></table> | |||
|
12 | </div> | |||
|
13 | </div> | |||
|
14 | </div> | |||
|
15 | </div> | |||
|
16 | ||||
|
17 | ||||
|
18 | <script> | |||
|
19 | var api; | |||
|
20 | $(document).ready(function() { | |||
|
21 | ||||
|
22 | var get_datatable_count = function(){ | |||
|
23 | $('#user_group_count').text(api.page.info().recordsDisplay); | |||
|
24 | }; | |||
|
25 | ||||
|
26 | $('#user_group_list_table').on('click', 'a.editor_remove', function (e) { | |||
|
27 | e.preventDefault(); | |||
|
28 | var row = api.row($(this).closest('tr')); | |||
|
29 | row.remove().draw(); | |||
|
30 | } ); | |||
|
31 | ||||
|
32 | $('#user_group_list_table').DataTable({ | |||
|
33 | data: ${c.user_groups|n}, | |||
|
34 | dom: 'rtp', | |||
|
35 | pageLength: ${c.visual.admin_grid_items}, | |||
|
36 | order: [[ 0, "asc" ]], | |||
|
37 | columns: [ | |||
|
38 | { data: {"_": "group_name", | |||
|
39 | "sort": "group_name"}, title: "${_('Name')}", className: "td-componentname," , | |||
|
40 | render: function (data,type,full,meta) | |||
|
41 | {return '<div><i class="icon-group" title="User group">'+data+'</i></div>'}}, | |||
|
42 | ||||
|
43 | { data: {"_": "group_description", | |||
|
44 | "sort": "group_description"}, title: "${_('Description')}", className: "td-description" }, | |||
|
45 | { data: {"_": "users_group_id"}, className: "td-user", | |||
|
46 | render: function (data,type,full,meta) | |||
|
47 | {return '<input type="hidden" name="users_group_id" value="'+data+'">'}}, | |||
|
48 | { data: {"_": "active", | |||
|
49 | "sort": "active"}, title: "${_('Active')}", className: "td-active"}, | |||
|
50 | { data: {"_": "owner_data"}, title: "${_('Owner')}", className: "td-user", | |||
|
51 | render: function (data,type,full,meta) | |||
|
52 | {return '<div class="rc-user tooltip">'+ | |||
|
53 | '<img class="gravatar" src="'+ data.owner_icon +'" height="16" width="16">'+ | |||
|
54 | data.owner +'</div>' | |||
|
55 | } | |||
|
56 | } | |||
|
57 | ], | |||
|
58 | language: { | |||
|
59 | paginate: DEFAULT_GRID_PAGINATION, | |||
|
60 | emptyTable: _gettext("No user groups available yet.") | |||
|
61 | }, | |||
|
62 | "initComplete": function( settings, json ) { | |||
|
63 | var data_grid = $('#user_group_list_table').dataTable(); | |||
|
64 | api = data_grid.api(); | |||
|
65 | get_datatable_count(); | |||
|
66 | } | |||
|
67 | }); | |||
|
68 | ||||
|
69 | // update the counter when doing search | |||
|
70 | $('#user_group_list_table').on( 'search.dt', function (e,settings) { | |||
|
71 | get_datatable_count(); | |||
|
72 | }); | |||
|
73 | ||||
|
74 | }); | |||
|
75 | </script> No newline at end of file |
@@ -70,6 +70,11 b' def includeme(config):' | |||||
70 | name='my_account_ssh_keys_delete', |
|
70 | name='my_account_ssh_keys_delete', | |
71 | pattern=ADMIN_PREFIX + '/my_account/ssh_keys/delete') |
|
71 | pattern=ADMIN_PREFIX + '/my_account/ssh_keys/delete') | |
72 |
|
72 | |||
|
73 | # my account user group membership | |||
|
74 | config.add_route( | |||
|
75 | name='my_account_user_group_membership', | |||
|
76 | pattern=ADMIN_PREFIX + '/my_account/user_group_membership') | |||
|
77 | ||||
73 | # my account emails |
|
78 | # my account emails | |
74 | config.add_route( |
|
79 | config.add_route( | |
75 | name='my_account_emails', |
|
80 | name='my_account_emails', |
@@ -48,6 +48,7 b' from rhodecode.model.pull_request import' | |||||
48 | from rhodecode.model.scm import RepoList |
|
48 | from rhodecode.model.scm import RepoList | |
49 | from rhodecode.model.user import UserModel |
|
49 | from rhodecode.model.user import UserModel | |
50 | from rhodecode.model.repo import RepoModel |
|
50 | from rhodecode.model.repo import RepoModel | |
|
51 | from rhodecode.model.user_group import UserGroupModel | |||
51 | from rhodecode.model.validation_schema.schemas import user_schema |
|
52 | from rhodecode.model.validation_schema.schemas import user_schema | |
52 |
|
53 | |||
53 | log = logging.getLogger(__name__) |
|
54 | log = logging.getLogger(__name__) | |
@@ -583,3 +584,16 b' class MyAccountView(BaseAppView, DataGri' | |||||
583 | data = self._get_pull_requests_list(statuses=statuses) |
|
584 | data = self._get_pull_requests_list(statuses=statuses) | |
584 | return data |
|
585 | return data | |
585 |
|
586 | |||
|
587 | @LoginRequired() | |||
|
588 | @NotAnonymous() | |||
|
589 | @view_config( | |||
|
590 | route_name='my_account_user_group_membership', | |||
|
591 | request_method='GET', | |||
|
592 | renderer='rhodecode:templates/admin/my_account/my_account.mako') | |||
|
593 | def my_account_user_group_membership(self): | |||
|
594 | c = self.load_default_context() | |||
|
595 | c.active = 'user_group_membership' | |||
|
596 | groups = [UserGroupModel.get_user_groups_as_dict(group.users_group) | |||
|
597 | for group in self._rhodecode_db_user.group_member] | |||
|
598 | c.user_groups = json.dumps(groups) | |||
|
599 | return self._get_template_context(c) |
@@ -30,6 +30,8 b'' | |||||
30 | <li class="${'active' if c.active=='password' else ''}"><a href="${h.route_path('my_account_password')}">${_('Password')}</a></li> |
|
30 | <li class="${'active' if c.active=='password' else ''}"><a href="${h.route_path('my_account_password')}">${_('Password')}</a></li> | |
31 | <li class="${'active' if c.active=='auth_tokens' else ''}"><a href="${h.route_path('my_account_auth_tokens')}">${_('Auth Tokens')}</a></li> |
|
31 | <li class="${'active' if c.active=='auth_tokens' else ''}"><a href="${h.route_path('my_account_auth_tokens')}">${_('Auth Tokens')}</a></li> | |
32 | <li class="${'active' if c.active in ['ssh_keys', 'ssh_keys_generate'] else ''}"><a href="${h.route_path('my_account_ssh_keys')}">${_('SSH Keys')}</a></li> |
|
32 | <li class="${'active' if c.active in ['ssh_keys', 'ssh_keys_generate'] else ''}"><a href="${h.route_path('my_account_ssh_keys')}">${_('SSH Keys')}</a></li> | |
|
33 | <li class="${'active' if c.active=='user_group_membership' else ''}"><a href="${h.route_path('my_account_user_group_membership')}">${_('User Group Membership')}</a></li> | |||
|
34 | ||||
33 | ## TODO: Find a better integration of oauth views into navigation. |
|
35 | ## TODO: Find a better integration of oauth views into navigation. | |
34 | <% my_account_oauth_url = h.route_path_or_none('my_account_oauth') %> |
|
36 | <% my_account_oauth_url = h.route_path_or_none('my_account_oauth') %> | |
35 | % if my_account_oauth_url: |
|
37 | % if my_account_oauth_url: |
General Comments 0
You need to be logged in to leave comments.
Login now