##// END OF EJS Templates
ui: fix buttons on advanced page
marcink -
r4127:fe33631d default
parent child Browse files
Show More
@@ -1,291 +1,289 b''
1 1 <%namespace name="base" file="/base/base.mako"/>
2 2
3 3 <%
4 4 elems = [
5 5 (_('Repository ID'), c.rhodecode_db_repo.repo_id, '', ''),
6 6 (_('Owner'), lambda:base.gravatar_with_user(c.rhodecode_db_repo.user.email, tooltip=True), '', ''),
7 7 (_('Created on'), h.format_date(c.rhodecode_db_repo.created_on), '', ''),
8 8 (_('Updated on'), h.format_date(c.rhodecode_db_repo.updated_on), '', ''),
9 9 (_('Cached Commit id'), lambda: h.link_to(c.rhodecode_db_repo.changeset_cache.get('short_id'), h.route_path('repo_commit',repo_name=c.repo_name,commit_id=c.rhodecode_db_repo.changeset_cache.get('raw_id'))), '', ''),
10 10 (_('Cached Commit date'), c.rhodecode_db_repo.changeset_cache.get('date'), '', ''),
11 11 (_('Attached scoped tokens'), len(c.rhodecode_db_repo.scoped_tokens), '', [x.user for x in c.rhodecode_db_repo.scoped_tokens]),
12 12 (_('Pull requests source'), len(c.rhodecode_db_repo.pull_requests_source), '', ['pr_id:{}, repo:{}'.format(x.pull_request_id,x.source_repo.repo_name) for x in c.rhodecode_db_repo.pull_requests_source]),
13 13 (_('Pull requests target'), len(c.rhodecode_db_repo.pull_requests_target), '', ['pr_id:{}, repo:{}'.format(x.pull_request_id,x.target_repo.repo_name) for x in c.rhodecode_db_repo.pull_requests_target]),
14 14 (_('Attached Artifacts'), len(c.rhodecode_db_repo.artifacts), '', ''),
15 15 ]
16 16 %>
17 17
18 18 <div class="panel panel-default">
19 19 <div class="panel-heading" id="advanced-info" >
20 20 <h3 class="panel-title">${_('Repository: %s') % c.rhodecode_db_repo.repo_name} <a class="permalink" href="#advanced-info"> ΒΆ</a></h3>
21 21 </div>
22 22 <div class="panel-body">
23 23 ${base.dt_info_panel(elems)}
24 24 </div>
25 25 </div>
26 26
27 27
28 28 <div class="panel panel-default">
29 29 <div class="panel-heading" id="advanced-fork">
30 30 <h3 class="panel-title">${_('Fork Reference')} <a class="permalink" href="#advanced-fork"> ΒΆ</a></h3>
31 31 </div>
32 32 <div class="panel-body">
33 33 ${h.secure_form(h.route_path('edit_repo_advanced_fork', repo_name=c.rhodecode_db_repo.repo_name), request=request)}
34 34
35 35 % if c.rhodecode_db_repo.fork:
36 36 <div class="panel-body-title-text">${h.literal(_('This repository is a fork of %(repo_link)s') % {'repo_link': h.link_to_if(c.has_origin_repo_read_perm,c.rhodecode_db_repo.fork.repo_name, h.route_path('repo_summary', repo_name=c.rhodecode_db_repo.fork.repo_name))})}
37 37 | <button class="btn btn-link btn-danger" type="submit">Remove fork reference</button></div>
38 38 % endif
39 39
40 40 <div class="field">
41 41 ${h.hidden('id_fork_of')}
42 42 ${h.submit('set_as_fork_%s' % c.rhodecode_db_repo.repo_name,_('Set'),class_="btn btn-small",)}
43 43 </div>
44 44 <div class="field">
45 45 <span class="help-block">${_('Manually set this repository as a fork of another from the list')}</span>
46 46 </div>
47 47 ${h.end_form()}
48 48 </div>
49 49 </div>
50 50
51 51
52 52 <div class="panel panel-default">
53 53 <div class="panel-heading" id="advanced-journal">
54 54 <h3 class="panel-title">${_('Public Journal Visibility')} <a class="permalink" href="#advanced-journal"> ΒΆ</a></h3>
55 55 </div>
56 56 <div class="panel-body">
57 57 ${h.secure_form(h.route_path('edit_repo_advanced_journal', repo_name=c.rhodecode_db_repo.repo_name), request=request)}
58 58 <div class="field">
59 59 %if c.in_public_journal:
60 60 <button class="btn btn-small" type="submit">
61 61 ${_('Remove from Public Journal')}
62 62 </button>
63 63 %else:
64 64 <button class="btn btn-small" type="submit">
65 65 ${_('Add to Public Journal')}
66 66 </button>
67 67 %endif
68 68 </div>
69 69 <div class="field" >
70 70 <span class="help-block">${_('All actions made on this repository will be visible to everyone following the public journal.')}</span>
71 71 </div>
72 72 ${h.end_form()}
73 73 </div>
74 74 </div>
75 75
76 76
77 77 <div class="panel panel-default">
78 78 <div class="panel-heading" id="advanced-locking">
79 79 <h3 class="panel-title">${_('Locking state')} <a class="permalink" href="#advanced-locking"> ΒΆ</a></h3>
80 80 </div>
81 81 <div class="panel-body">
82 82 ${h.secure_form(h.route_path('edit_repo_advanced_locking', repo_name=c.rhodecode_db_repo.repo_name), request=request)}
83 83
84 84 %if c.rhodecode_db_repo.locked[0]:
85 85 <div class="panel-body-title-text">${'Locked by %s on %s. Lock reason: %s' % (h.person_by_id(c.rhodecode_db_repo.locked[0]),
86 86 h.format_date(h. time_to_datetime(c.rhodecode_db_repo.locked[1])), c.rhodecode_db_repo.locked[2])}</div>
87 87 %else:
88 88 <div class="panel-body-title-text">${_('This Repository is not currently locked.')}</div>
89 89 %endif
90 90
91 91 <div class="field" >
92 92 %if c.rhodecode_db_repo.locked[0]:
93 93 ${h.hidden('set_unlock', '1')}
94 94 <button class="btn btn-small" type="submit"
95 95 onclick="return confirm('${_('Confirm to unlock repository.')}');">
96 96 <i class="icon-unlock"></i>
97 97 ${_('Unlock repository')}
98 98 </button>
99 99 %else:
100 100 ${h.hidden('set_lock', '1')}
101 101 <button class="btn btn-small" type="submit"
102 102 onclick="return confirm('${_('Confirm to lock repository.')}');">
103 103 <i class="icon-lock"></i>
104 104 ${_('Lock repository')}
105 105 </button>
106 106 %endif
107 107 </div>
108 108 <div class="field" >
109 109 <span class="help-block">
110 110 ${_('Force repository locking. This only works when anonymous access is disabled. Pulling from the repository locks the repository to that user until the same user pushes to that repository again.')}
111 111 </span>
112 112 </div>
113 113 ${h.end_form()}
114 114 </div>
115 115 </div>
116 116
117 117
118 118 <div class="panel panel-default">
119 119 <div class="panel-heading" id="advanced-hooks">
120 120 <h3 class="panel-title">${_('Hooks')} <a class="permalink" href="#advanced-hooks"> ΒΆ</a></h3>
121 121 </div>
122 122 <div class="panel-body">
123 123 <table class="rctable">
124 124 <th>${_('Hook type')}</th>
125 125 <th>${_('Hook version')}</th>
126 126 <th>${_('Current version')}</th>
127 127 % if c.ver_info_dict:
128 128 <tr>
129 129 <td>${_('PRE HOOK')}</td>
130 130 <td>${c.ver_info_dict['pre_version']}</td>
131 131 <td>${c.rhodecode_version}</td>
132 132 </tr>
133 133 <tr>
134 134 <td>${_('POST HOOK')}</td>
135 135 <td>${c.ver_info_dict['post_version']}</td>
136 136 <td>${c.rhodecode_version}</td>
137 137 </tr>
138 138 % else:
139 139 <tr>
140 140 <td>${_('Unable to read hook information from VCS Server')}</td>
141 141 </tr>
142 142 % endif
143 143 </table>
144 144
145 <a href="${h.route_path('edit_repo_advanced_hooks', repo_name=c.repo_name)}"
145 <a class="btn btn-primary" href="${h.route_path('edit_repo_advanced_hooks', repo_name=c.repo_name)}"
146 146 onclick="return confirm('${_('Confirm to reinstall hooks for this repository.')}');">
147 147 ${_('Update Hooks')}
148 148 </a>
149 149 </div>
150 150 </div>
151 151
152 152 <div class="panel panel-warning">
153 153 <div class="panel-heading" id="advanced-archive">
154 154 <h3 class="panel-title">${_('Archive repository')} <a class="permalink" href="#advanced-archive"> ΒΆ</a></h3>
155 155 </div>
156 156 <div class="panel-body">
157 157 ${h.secure_form(h.route_path('edit_repo_advanced_archive', repo_name=c.repo_name), request=request)}
158 158
159 159 <div style="margin: 0 0 20px 0" class="fake-space"></div>
160 160
161 161 <div class="field">
162 <button class="btn btn-small btn-danger" type="submit"
162 <button class="btn btn-small btn-warning" type="submit"
163 163 onclick="return confirm('${_('Confirm to archive this repository: %s') % c.repo_name}');">
164 <i class="icon-remove"></i>
165 164 ${_('Archive this repository')}
166 165 </button>
167 166 </div>
168 167 <div class="field">
169 168 <span class="help-block">
170 169 ${_('Archiving the repository will make it entirely read-only. The repository cannot be committed to.'
171 170 'It is hidden from the search results and dashboard. ')}
172 171 </span>
173 172 </div>
174 173
175 174 ${h.end_form()}
176 175 </div>
177 176 </div>
178 177
179 178
180 179 <div class="panel panel-danger">
181 180 <div class="panel-heading" id="advanced-delete">
182 181 <h3 class="panel-title">${_('Delete repository')} <a class="permalink" href="#advanced-delete"> ΒΆ</a></h3>
183 182 </div>
184 183 <div class="panel-body">
185 184 ${h.secure_form(h.route_path('edit_repo_advanced_delete', repo_name=c.repo_name), request=request)}
186 185 <table class="display">
187 186 <tr>
188 187 <td>
189 188 ${_ungettext('This repository has %s fork.', 'This repository has %s forks.', c.rhodecode_db_repo.forks.count()) % c.rhodecode_db_repo.forks.count()}
190 189 </td>
191 190 <td>
192 191 %if c.rhodecode_db_repo.forks.count():
193 192 <input type="radio" name="forks" value="detach_forks" checked="checked"/> <label for="forks">${_('Detach forks')}</label>
194 193 %endif
195 194 </td>
196 195 <td>
197 196 %if c.rhodecode_db_repo.forks.count():
198 197 <input type="radio" name="forks" value="delete_forks"/> <label for="forks">${_('Delete forks')}</label>
199 198 %endif
200 199 </td>
201 200 </tr>
202 201 <% attached_prs = len(c.rhodecode_db_repo.pull_requests_source + c.rhodecode_db_repo.pull_requests_target) %>
203 202 % if c.rhodecode_db_repo.pull_requests_source or c.rhodecode_db_repo.pull_requests_target:
204 203 <tr>
205 204 <td>
206 205 ${_ungettext('This repository has %s attached pull request.', 'This repository has %s attached pull requests.', attached_prs) % attached_prs}
207 206 <br/>
208 207 ${_('Consider to archive this repository instead.')}
209 208 </td>
210 209 <td></td>
211 210 <td></td>
212 211 </tr>
213 212 % endif
214 213 </table>
215 214 <div style="margin: 0 0 20px 0" class="fake-space"></div>
216 215
217 216 <div class="field">
218 217 <button class="btn btn-small btn-danger" type="submit"
219 218 onclick="return confirm('${_('Confirm to delete this repository: %s') % c.repo_name}');">
220 <i class="icon-remove"></i>
221 219 ${_('Delete this repository')}
222 220 </button>
223 221 </div>
224 222 <div class="field">
225 223 <span class="help-block">
226 224 ${_('This repository will be renamed in a special way in order to make it inaccessible to RhodeCode Enterprise and its VCS systems. If you need to fully delete it from the file system, please do it manually, or with rhodecode-cleanup-repos command available in rhodecode-tools.')}
227 225 </span>
228 226 </div>
229 227
230 228 ${h.end_form()}
231 229 </div>
232 230 </div>
233 231
234 232
235 233 <script>
236 234
237 235 var currentRepoId = ${c.rhodecode_db_repo.repo_id};
238 236
239 237 var repoTypeFilter = function(data) {
240 238 var results = [];
241 239
242 240 if (!data.results[0]) {
243 241 return data
244 242 }
245 243
246 244 $.each(data.results[0].children, function() {
247 245 // filter out the SAME repo, it cannot be used as fork of itself
248 246 if (this.repo_id != currentRepoId) {
249 247 this.id = this.repo_id;
250 248 results.push(this)
251 249 }
252 250 });
253 251 data.results[0].children = results;
254 252 return data;
255 253 };
256 254
257 255 $("#id_fork_of").select2({
258 256 cachedDataSource: {},
259 257 minimumInputLength: 2,
260 258 placeholder: "${_('Change repository') if c.rhodecode_db_repo.fork else _('Pick repository')}",
261 259 dropdownAutoWidth: true,
262 260 containerCssClass: "drop-menu",
263 261 dropdownCssClass: "drop-menu-dropdown",
264 262 formatResult: formatRepoResult,
265 263 query: $.debounce(250, function(query){
266 264 self = this;
267 265 var cacheKey = query.term;
268 266 var cachedData = self.cachedDataSource[cacheKey];
269 267
270 268 if (cachedData) {
271 269 query.callback({results: cachedData.results});
272 270 } else {
273 271 $.ajax({
274 272 url: pyroutes.url('repo_list_data'),
275 273 data: {'query': query.term, repo_type: '${c.rhodecode_db_repo.repo_type}'},
276 274 dataType: 'json',
277 275 type: 'GET',
278 276 success: function(data) {
279 277 data = repoTypeFilter(data);
280 278 self.cachedDataSource[cacheKey] = data;
281 279 query.callback({results: data.results});
282 280 },
283 281 error: function(data, textStatus, errorThrown) {
284 282 alert("Error while fetching entries.\nError code {0} ({1}).".format(data.status, data.statusText));
285 283 }
286 284 })
287 285 }
288 286 })
289 287 });
290 288 </script>
291 289
General Comments 0
You need to be logged in to leave comments. Login now