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