Show More
@@ -1,173 +1,173 b'' | |||||
1 | <%inherit file="/base/base.mako"/> |
|
1 | <%inherit file="/base/base.mako"/> | |
2 |
|
2 | |||
3 | <%def name="main()"> |
|
3 | <%def name="main()"> | |
4 | <div class="box"> |
|
4 | <div class="box"> | |
5 | <!-- box / title --> |
|
5 | <!-- box / title --> | |
6 | <div class="title"> |
|
6 | <div class="title"> | |
7 | <div class="block-left breadcrumbs"> |
|
7 | <div class="block-left breadcrumbs"> | |
8 | <input class="q_filter_box" id="q_filter" size="15" type="text" name="filter" placeholder="${_('quick filter...')}" value=""/> |
|
8 | <input class="q_filter_box" id="q_filter" size="15" type="text" name="filter" placeholder="${_('quick filter...')}" value=""/> | |
9 | ${self.breadcrumbs()} |
|
9 | ${self.breadcrumbs()} | |
10 | <span id="match_container" style="display:none">» <span id="match_count">0</span> ${_('matches')}</span> |
|
10 | <span id="match_container" style="display:none">» <span id="match_count">0</span> ${_('matches')}</span> | |
11 | </div> |
|
11 | </div> | |
12 | %if c.rhodecode_user.username != h.DEFAULT_USER: |
|
12 | %if c.rhodecode_user.username != h.DEFAULT_USER: | |
13 | <div class="block-right"> |
|
13 | <div class="block-right"> | |
14 | <% |
|
14 | <% | |
15 | is_admin = h.HasPermissionAny('hg.admin')('can create repos index page') |
|
15 | is_admin = h.HasPermissionAny('hg.admin')('can create repos index page') | |
16 | create_repo = h.HasPermissionAny('hg.create.repository')('can create repository index page') |
|
16 | create_repo = h.HasPermissionAny('hg.create.repository')('can create repository index page') | |
17 | create_repo_group = h.HasPermissionAny('hg.repogroup.create.true')('can create repository groups index page') |
|
17 | create_repo_group = h.HasPermissionAny('hg.repogroup.create.true')('can create repository groups index page') | |
18 | create_user_group = h.HasPermissionAny('hg.usergroup.create.true')('can create user groups index page') |
|
18 | create_user_group = h.HasPermissionAny('hg.usergroup.create.true')('can create user groups index page') | |
19 |
|
19 | |||
20 | gr_name = c.repo_group.group_name if c.repo_group else None |
|
20 | gr_name = c.repo_group.group_name if c.repo_group else None | |
21 | # create repositories with write permission on group is set to true |
|
21 | # create repositories with write permission on group is set to true | |
22 | create_on_write = h.HasPermissionAny('hg.create.write_on_repogroup.true')() |
|
22 | create_on_write = h.HasPermissionAny('hg.create.write_on_repogroup.true')() | |
23 | group_admin = h.HasRepoGroupPermissionAny('group.admin')(gr_name, 'group admin index page') |
|
23 | group_admin = h.HasRepoGroupPermissionAny('group.admin')(gr_name, 'group admin index page') | |
24 | group_write = h.HasRepoGroupPermissionAny('group.write')(gr_name, 'can write into group index page') |
|
24 | group_write = h.HasRepoGroupPermissionAny('group.write')(gr_name, 'can write into group index page') | |
25 | %> |
|
25 | %> | |
26 |
|
26 | |||
27 | %if not c.repo_group: |
|
27 | %if not c.repo_group: | |
28 | ## no repository group context here |
|
28 | ## no repository group context here | |
29 | %if is_admin or create_repo: |
|
29 | %if is_admin or create_repo: | |
30 | <a href="${h.route_path('repo_new')}" class="btn btn-small btn-success btn-primary">${_('Add Repository')}</a> |
|
30 | <a href="${h.route_path('repo_new')}" class="btn btn-small btn-success btn-primary">${_('Add Repository')}</a> | |
31 | %endif |
|
31 | %endif | |
32 |
|
32 | |||
33 | %if is_admin or create_repo_group: |
|
33 | %if is_admin or create_repo_group: | |
34 | <a href="${h.url('new_repo_group')}" class="btn btn-small btn-default">${_(u'Add Repository Group')}</a> |
|
34 | <a href="${h.url('new_repo_group')}" class="btn btn-small btn-default">${_(u'Add Repository Group')}</a> | |
35 | %endif |
|
35 | %endif | |
36 | %else: |
|
36 | %else: | |
37 | ##we're inside other repository group other terms apply |
|
37 | ##we're inside other repository group other terms apply | |
38 | %if is_admin or group_admin or (group_write and create_on_write): |
|
38 | %if is_admin or group_admin or (group_write and create_on_write): | |
39 | <a href="${h.route_path('repo_new',parent_group=c.repo_group.group_id)}" class="btn btn-small btn-success btn-primary">${_('Add Repository')}</a> |
|
39 | <a href="${h.route_path('repo_new',_query=dict(parent_group=c.repo_group.group_id))}" class="btn btn-small btn-success btn-primary">${_('Add Repository')}</a> | |
40 | %endif |
|
40 | %endif | |
41 | %if is_admin or group_admin: |
|
41 | %if is_admin or group_admin: | |
42 | <a href="${h.url('new_repo_group', parent_group=c.repo_group.group_id)}" class="btn btn-small btn-default">${_(u'Add Repository Group')}</a> |
|
42 | <a href="${h.url('new_repo_group', parent_group=c.repo_group.group_id)}" class="btn btn-small btn-default">${_(u'Add Repository Group')}</a> | |
43 | %endif |
|
43 | %endif | |
44 | %if is_admin or group_admin: |
|
44 | %if is_admin or group_admin: | |
45 | <a href="${h.url('edit_repo_group',group_name=c.repo_group.group_name)}" title="${_('You have admin right to this group, and can edit it')}" class="btn btn-small btn-primary">${_('Edit Repository Group')}</a> |
|
45 | <a href="${h.url('edit_repo_group',group_name=c.repo_group.group_name)}" title="${_('You have admin right to this group, and can edit it')}" class="btn btn-small btn-primary">${_('Edit Repository Group')}</a> | |
46 | %endif |
|
46 | %endif | |
47 | %endif |
|
47 | %endif | |
48 | </div> |
|
48 | </div> | |
49 | %endif |
|
49 | %endif | |
50 | </div> |
|
50 | </div> | |
51 | <!-- end box / title --> |
|
51 | <!-- end box / title --> | |
52 | <div class="table"> |
|
52 | <div class="table"> | |
53 | <div id="groups_list_wrap"> |
|
53 | <div id="groups_list_wrap"> | |
54 | <table id="group_list_table" class="display"></table> |
|
54 | <table id="group_list_table" class="display"></table> | |
55 | </div> |
|
55 | </div> | |
56 | </div> |
|
56 | </div> | |
57 |
|
57 | |||
58 | <div class="table"> |
|
58 | <div class="table"> | |
59 | <div id="repos_list_wrap"> |
|
59 | <div id="repos_list_wrap"> | |
60 | <table id="repo_list_table" class="display"></table> |
|
60 | <table id="repo_list_table" class="display"></table> | |
61 | </div> |
|
61 | </div> | |
62 | </div> |
|
62 | </div> | |
63 | </div> |
|
63 | </div> | |
64 | <script> |
|
64 | <script> | |
65 | $(document).ready(function() { |
|
65 | $(document).ready(function() { | |
66 |
|
66 | |||
67 | var get_datatable_count = function() { |
|
67 | var get_datatable_count = function() { | |
68 | var api = $('#repo_list_table').dataTable().api(); |
|
68 | var api = $('#repo_list_table').dataTable().api(); | |
69 | var pageInfo = api.page.info(); |
|
69 | var pageInfo = api.page.info(); | |
70 | var repos = pageInfo.recordsDisplay; |
|
70 | var repos = pageInfo.recordsDisplay; | |
71 | var reposTotal = pageInfo.recordsTotal; |
|
71 | var reposTotal = pageInfo.recordsTotal; | |
72 |
|
72 | |||
73 | api = $('#group_list_table').dataTable().api(); |
|
73 | api = $('#group_list_table').dataTable().api(); | |
74 | pageInfo = api.page.info(); |
|
74 | pageInfo = api.page.info(); | |
75 | var repoGroups = pageInfo.recordsDisplay; |
|
75 | var repoGroups = pageInfo.recordsDisplay; | |
76 | var repoGroupsTotal = pageInfo.recordsTotal; |
|
76 | var repoGroupsTotal = pageInfo.recordsTotal; | |
77 |
|
77 | |||
78 | if (repoGroups !== repoGroupsTotal) { |
|
78 | if (repoGroups !== repoGroupsTotal) { | |
79 | $('#match_count').text(repos+repoGroups); |
|
79 | $('#match_count').text(repos+repoGroups); | |
80 | } |
|
80 | } | |
81 | if (repos !== reposTotal) { |
|
81 | if (repos !== reposTotal) { | |
82 | $('#match_container').show(); |
|
82 | $('#match_container').show(); | |
83 | } |
|
83 | } | |
84 | if ($('#q_filter').val() === '') { |
|
84 | if ($('#q_filter').val() === '') { | |
85 | $('#match_container').hide(); |
|
85 | $('#match_container').hide(); | |
86 | } |
|
86 | } | |
87 | }; |
|
87 | }; | |
88 |
|
88 | |||
89 | // repo group list |
|
89 | // repo group list | |
90 | $('#group_list_table').DataTable({ |
|
90 | $('#group_list_table').DataTable({ | |
91 | data: ${c.repo_groups_data|n}, |
|
91 | data: ${c.repo_groups_data|n}, | |
92 | dom: 'rtp', |
|
92 | dom: 'rtp', | |
93 | pageLength: ${c.visual.dashboard_items}, |
|
93 | pageLength: ${c.visual.dashboard_items}, | |
94 | order: [[ 0, "asc" ]], |
|
94 | order: [[ 0, "asc" ]], | |
95 | columns: [ |
|
95 | columns: [ | |
96 | { data: {"_": "name", |
|
96 | { data: {"_": "name", | |
97 | "sort": "name_raw"}, title: "${_('Name')}", className: "td-componentname" }, |
|
97 | "sort": "name_raw"}, title: "${_('Name')}", className: "td-componentname" }, | |
98 | { data: 'menu', "bSortable": false, className: "quick_repo_menu" }, |
|
98 | { data: 'menu', "bSortable": false, className: "quick_repo_menu" }, | |
99 | { data: {"_": "desc", |
|
99 | { data: {"_": "desc", | |
100 | "sort": "desc"}, title: "${_('Description')}", className: "td-description" }, |
|
100 | "sort": "desc"}, title: "${_('Description')}", className: "td-description" }, | |
101 | { data: {"_": "last_change", |
|
101 | { data: {"_": "last_change", | |
102 | "sort": "last_change_raw", |
|
102 | "sort": "last_change_raw", | |
103 | "type": Number}, title: "${_('Last Change')}", className: "td-time" }, |
|
103 | "type": Number}, title: "${_('Last Change')}", className: "td-time" }, | |
104 | { data: {"_": "owner", |
|
104 | { data: {"_": "owner", | |
105 | "sort": "owner"}, title: "${_('Owner')}", className: "td-user" } |
|
105 | "sort": "owner"}, title: "${_('Owner')}", className: "td-user" } | |
106 | ], |
|
106 | ], | |
107 | language: { |
|
107 | language: { | |
108 | paginate: DEFAULT_GRID_PAGINATION, |
|
108 | paginate: DEFAULT_GRID_PAGINATION, | |
109 | emptyTable: _gettext("No repository groups available yet.") |
|
109 | emptyTable: _gettext("No repository groups available yet.") | |
110 | }, |
|
110 | }, | |
111 | "drawCallback": function( settings, json ) { |
|
111 | "drawCallback": function( settings, json ) { | |
112 | timeagoActivate(); |
|
112 | timeagoActivate(); | |
113 | quick_repo_menu(); |
|
113 | quick_repo_menu(); | |
114 | } |
|
114 | } | |
115 | }); |
|
115 | }); | |
116 |
|
116 | |||
117 | // repo list |
|
117 | // repo list | |
118 | $('#repo_list_table').DataTable({ |
|
118 | $('#repo_list_table').DataTable({ | |
119 | data: ${c.repos_data|n}, |
|
119 | data: ${c.repos_data|n}, | |
120 | dom: 'rtp', |
|
120 | dom: 'rtp', | |
121 | order: [[ 0, "asc" ]], |
|
121 | order: [[ 0, "asc" ]], | |
122 | pageLength: ${c.visual.dashboard_items}, |
|
122 | pageLength: ${c.visual.dashboard_items}, | |
123 | columns: [ |
|
123 | columns: [ | |
124 | { data: {"_": "name", |
|
124 | { data: {"_": "name", | |
125 | "sort": "name_raw"}, title: "${_('Name')}", className: "truncate-wrap td-componentname" }, |
|
125 | "sort": "name_raw"}, title: "${_('Name')}", className: "truncate-wrap td-componentname" }, | |
126 | { data: 'menu', "bSortable": false, className: "quick_repo_menu" }, |
|
126 | { data: 'menu', "bSortable": false, className: "quick_repo_menu" }, | |
127 | { data: {"_": "desc", |
|
127 | { data: {"_": "desc", | |
128 | "sort": "desc"}, title: "${_('Description')}", className: "td-description" }, |
|
128 | "sort": "desc"}, title: "${_('Description')}", className: "td-description" }, | |
129 | { data: {"_": "last_change", |
|
129 | { data: {"_": "last_change", | |
130 | "sort": "last_change_raw", |
|
130 | "sort": "last_change_raw", | |
131 | "type": Number}, title: "${_('Last Change')}", className: "td-time" }, |
|
131 | "type": Number}, title: "${_('Last Change')}", className: "td-time" }, | |
132 | { data: {"_": "last_changeset", |
|
132 | { data: {"_": "last_changeset", | |
133 | "sort": "last_changeset_raw", |
|
133 | "sort": "last_changeset_raw", | |
134 | "type": Number}, title: "${_('Commit')}", className: "td-hash" }, |
|
134 | "type": Number}, title: "${_('Commit')}", className: "td-hash" }, | |
135 | { data: {"_": "owner", |
|
135 | { data: {"_": "owner", | |
136 | "sort": "owner"}, title: "${_('Owner')}", className: "td-user" }, |
|
136 | "sort": "owner"}, title: "${_('Owner')}", className: "td-user" }, | |
137 | ], |
|
137 | ], | |
138 | language: { |
|
138 | language: { | |
139 | paginate: DEFAULT_GRID_PAGINATION, |
|
139 | paginate: DEFAULT_GRID_PAGINATION, | |
140 | emptyTable: _gettext("No repositories available yet.") |
|
140 | emptyTable: _gettext("No repositories available yet.") | |
141 | }, |
|
141 | }, | |
142 | "drawCallback": function( settings, json ) { |
|
142 | "drawCallback": function( settings, json ) { | |
143 | timeagoActivate(); |
|
143 | timeagoActivate(); | |
144 | quick_repo_menu(); |
|
144 | quick_repo_menu(); | |
145 | } |
|
145 | } | |
146 | }); |
|
146 | }); | |
147 |
|
147 | |||
148 | // update the counter when doing search |
|
148 | // update the counter when doing search | |
149 | $('#repo_list_table, #group_list_table').on( 'search.dt', function (e,settings) { |
|
149 | $('#repo_list_table, #group_list_table').on( 'search.dt', function (e,settings) { | |
150 | get_datatable_count(); |
|
150 | get_datatable_count(); | |
151 | }); |
|
151 | }); | |
152 |
|
152 | |||
153 | // filter, filter both grids |
|
153 | // filter, filter both grids | |
154 | $('#q_filter').on( 'keyup', function () { |
|
154 | $('#q_filter').on( 'keyup', function () { | |
155 | var repo_api = $('#repo_list_table').dataTable().api(); |
|
155 | var repo_api = $('#repo_list_table').dataTable().api(); | |
156 | repo_api |
|
156 | repo_api | |
157 | .columns( 0 ) |
|
157 | .columns( 0 ) | |
158 | .search( this.value ) |
|
158 | .search( this.value ) | |
159 | .draw(); |
|
159 | .draw(); | |
160 |
|
160 | |||
161 | var repo_group_api = $('#group_list_table').dataTable().api(); |
|
161 | var repo_group_api = $('#group_list_table').dataTable().api(); | |
162 | repo_group_api |
|
162 | repo_group_api | |
163 | .columns( 0 ) |
|
163 | .columns( 0 ) | |
164 | .search( this.value ) |
|
164 | .search( this.value ) | |
165 | .draw(); |
|
165 | .draw(); | |
166 | }); |
|
166 | }); | |
167 |
|
167 | |||
168 | // refilter table if page load via back button |
|
168 | // refilter table if page load via back button | |
169 | $("#q_filter").trigger('keyup'); |
|
169 | $("#q_filter").trigger('keyup'); | |
170 |
|
170 | |||
171 | }); |
|
171 | }); | |
172 | </script> |
|
172 | </script> | |
173 | </%def> |
|
173 | </%def> |
General Comments 0
You need to be logged in to leave comments.
Login now