##// END OF EJS Templates
forms: unified usage of h.secure_form. Make sure we ALWAYS pass in...
marcink -
r2105:4ad1a937 default
parent child Browse files
Show More
@@ -1,81 +1,81 b''
1 1 <div class="panel panel-default">
2 2 <div class="panel-heading">
3 3 <h3 class="panel-title">${_('Default Settings For New Repositories')}</h3>
4 4 </div>
5 5 <div class="panel-body">
6 ${h.secure_form(h.route_path('admin_defaults_repositories_update'), method='POST', request=request)}
6 ${h.secure_form(h.route_path('admin_defaults_repositories_update'), request=request)}
7 7 <div class="form">
8 8 <!-- fields -->
9 9
10 10 <div class="fields">
11 11
12 12 <div class="field">
13 13 <div class="label">
14 14 <label for="default_repo_type">${_('Type')}:</label>
15 15 </div>
16 16 <div class="select">
17 17 ${h.select('default_repo_type','hg',c.backends,class_="medium")}
18 18 </div>
19 19 </div>
20 20
21 21 <div class="field">
22 22 <div class="label label-checkbox">
23 23 <label for="default_repo_private">${_('Private Repository')}:</label>
24 24 </div>
25 25 <div class="checkboxes">
26 26 ${h.checkbox('default_repo_private',value="True")}
27 27 <span class="help-block">${_('Private repositories are only visible to people explicitly added as collaborators.')}</span>
28 28 </div>
29 29 </div>
30 30
31 31
32 32 <div class="field">
33 33 <div class="label label-checkbox">
34 34 <label for="default_repo_enable_statistics">${_('Enable Statistics')}:</label>
35 35 </div>
36 36 <div class="checkboxes">
37 37 ${h.checkbox('default_repo_enable_statistics',value="True")}
38 38 <span class="help-block">${_('Enable a statistics window on the repository summary page.')}</span>
39 39 </div>
40 40 </div>
41 41
42 42 <div class="field">
43 43 <div class="label label-checkbox">
44 44 <label for="default_repo_enable_downloads">${_('Enable Downloads')}:</label>
45 45 </div>
46 46 <div class="checkboxes">
47 47 ${h.checkbox('default_repo_enable_downloads',value="True")}
48 48 <span class="help-block">${_('Enable the download option on the repository summary page.')}</span>
49 49 </div>
50 50 </div>
51 51
52 52 <div class="field">
53 53 <div class="label label-checkbox">
54 54 <label for="default_repo_enable_locking">${_('Enable Locking')}:</label>
55 55 </div>
56 56 <div class="checkboxes">
57 57 ${h.checkbox('default_repo_enable_locking',value="True")}
58 58 <span class="help-block">${_('Enable automatic repository locking. Pulling from a repository will lock it, and it is unlocked by pushing back by the same user.')}</span>
59 59 </div>
60 60 </div>
61 61
62 62 <div class="buttons">
63 63 ${h.submit('save',_('Save'),class_="btn")}
64 64 </div>
65 65 </div>
66 66 </div>
67 67 ${h.end_form()}
68 68 </div>
69 69
70 70 </div>
71 71
72 72 <script>
73 73 $(document).ready(function(){
74 74 $("#default_repo_type").select2({
75 75 containerCssClass: 'drop-menu',
76 76 dropdownCssClass: 'drop-menu-dropdown',
77 77 dropdownAutoWidth: true,
78 78 minimumResultsForSearch: -1
79 79 });
80 80 })
81 81 </script>
@@ -1,139 +1,139 b''
1 1 ## -*- coding: utf-8 -*-
2 2 <%inherit file="/base/base.mako"/>
3 3
4 4 <%def name="title()">
5 5 ${_('Edit Gist')} &middot; ${c.gist.gist_access_id}
6 6 %if c.rhodecode_name:
7 7 &middot; ${h.branding(c.rhodecode_name)}
8 8 %endif
9 9 </%def>
10 10
11 11 <%def name="breadcrumbs_links()">
12 12 ${_('Edit Gist')} &middot; ${c.gist.gist_access_id}
13 13 </%def>
14 14
15 15 <%def name="menu_bar_nav()">
16 16 ${self.menu_items(active='gists')}
17 17 </%def>
18 18
19 19 <%def name="main()">
20 20 <div class="box">
21 21 <!-- box / title -->
22 22 <div class="title">
23 23 ${self.breadcrumbs()}
24 24 </div>
25 25
26 26 <div class="table">
27 27
28 28 <div id="files_data">
29 ${h.secure_form(h.route_path('gist_update', gist_id=c.gist.gist_access_id), id='eform', method='POST', request=request)}
29 ${h.secure_form(h.route_path('gist_update', gist_id=c.gist.gist_access_id), id='eform', request=request)}
30 30 <div>
31 31 <input type="hidden" value="${c.file_last_commit.raw_id}" name="parent_hash">
32 32 <textarea id="description" name="description"
33 33 placeholder="${_('Gist description ...')}">${c.gist.gist_description}</textarea>
34 34 <div>
35 35 <span class="gist-gravatar">
36 36 ${self.gravatar(h.email_or_none(c.rhodecode_user.full_contact), 30)}
37 37 </span>
38 38 <label for='lifetime'>${_('Gist lifetime')}</label>
39 39 ${h.dropdownmenu('lifetime', '0', c.lifetime_options)}
40 40
41 41 <label for='gist_acl_level'>${_('Gist access level')}</label>
42 42 ${h.dropdownmenu('gist_acl_level', c.gist.acl_level, c.acl_options)}
43 43 </div>
44 44 </div>
45 45
46 46 ## peppercorn schema
47 47 <input type="hidden" name="__start__" value="nodes:sequence"/>
48 48 % for cnt, file in enumerate(c.files):
49 49 <input type="hidden" name="__start__" value="file:mapping"/>
50 50 <div id="codeblock" class="codeblock" >
51 51 <div class="code-header">
52 52 <div class="form">
53 53 <div class="fields">
54 54 <input type="hidden" name="filename_org" value="${file.path}" >
55 55 <input id="filename_${h.FID('f',file.path)}" name="filename" size="30" type="text" value="${file.path}">
56 56 ${h.dropdownmenu('mimetype' ,'plain',[('plain',_('plain'))],enable_filter=True, id='mimetype_'+h.FID('f',file.path))}
57 57 </div>
58 58 </div>
59 59 </div>
60 60 <div class="editor_container">
61 61 <pre id="editor_pre"></pre>
62 62 <textarea id="editor_${h.FID('f',file.path)}" name="content" >${file.content}</textarea>
63 63 </div>
64 64 </div>
65 65 <input type="hidden" name="__end__" />
66 66
67 67 ## dynamic edit box.
68 68 <script type="text/javascript">
69 69 $(document).ready(function(){
70 70 var myCodeMirror = initCodeMirror(
71 71 "editor_${h.FID('f',file.path)}", '');
72 72
73 73 var modes_select = $("#mimetype_${h.FID('f',file.path)}");
74 74 fillCodeMirrorOptions(modes_select);
75 75
76 76 // try to detect the mode based on the file we edit
77 77 var mimetype = "${file.mimetype}";
78 78 var detected_mode = detectCodeMirrorMode(
79 79 "${file.path}", mimetype);
80 80
81 81 if(detected_mode){
82 82 $(modes_select).select2("val", mimetype);
83 83 $(modes_select).change();
84 84 setCodeMirrorMode(myCodeMirror, detected_mode);
85 85 }
86 86
87 87 var filename_selector = "#filename_${h.FID('f',file.path)}";
88 88 // on change of select field set mode
89 89 setCodeMirrorModeFromSelect(
90 90 modes_select, filename_selector, myCodeMirror, null);
91 91
92 92 // on entering the new filename set mode, from given extension
93 93 setCodeMirrorModeFromInput(
94 94 modes_select, filename_selector, myCodeMirror, null);
95 95 });
96 96 </script>
97 97 %endfor
98 98 <input type="hidden" name="__end__" />
99 99
100 100 <div class="pull-right">
101 101 ${h.submit('update',_('Update Gist'),class_="btn btn-success")}
102 102 <a class="btn" href="${h.route_path('gist_show', gist_id=c.gist.gist_access_id)}">${_('Cancel')}</a>
103 103 </div>
104 104 ${h.end_form()}
105 105 </div>
106 106 </div>
107 107
108 108 </div>
109 109 <script>
110 110 $('#update').on('click', function(e){
111 111 e.preventDefault();
112 112
113 113 $(this).val('Updating...');
114 114 $(this).attr('disabled', 'disabled');
115 115 // check for newer version.
116 116 $.ajax({
117 117 url: "${h.route_path('gist_edit_check_revision', gist_id=c.gist.gist_access_id)}",
118 118 data: {
119 119 'revision': '${c.file_last_commit.raw_id}'
120 120 },
121 121 dataType: 'json',
122 122 type: 'GET',
123 123 success: function(data) {
124 124 if(data.success === false){
125 125 message = '${h.literal(_('Gist was updated since you started editing. Copy your changes and click %(here)s to reload the new version.')
126 126 % {'here': h.link_to('here', h.route_path('gist_edit', gist_id=c.gist.gist_access_id))})}'
127 127 alertMessage = [{"message": {
128 128 "message": message, "force": "true", "level": "warning"}}];
129 129 $.Topic('/notifications').publish(alertMessage[0]);
130 130 }
131 131 else{
132 132 $('#eform').submit();
133 133 }
134 134 }
135 135 });
136 136 })
137 137
138 138 </script>
139 139 </%def>
@@ -1,86 +1,86 b''
1 1 ## -*- coding: utf-8 -*-
2 2 <%inherit file="/base/base.mako"/>
3 3
4 4 <%def name="title()">
5 5 ${_('New Gist')}
6 6 %if c.rhodecode_name:
7 7 &middot; ${h.branding(c.rhodecode_name)}
8 8 %endif
9 9 </%def>
10 10
11 11 <%def name="breadcrumbs_links()">
12 12 ${_('New Gist')}
13 13 </%def>
14 14
15 15 <%def name="menu_bar_nav()">
16 16 ${self.menu_items(active='gists')}
17 17 </%def>
18 18
19 19 <%def name="main()">
20 20 <div class="box">
21 21 <!-- box / title -->
22 22 <div class="title">
23 23 ${self.breadcrumbs()}
24 24 </div>
25 25
26 26 <div class="table">
27 27 <div id="files_data">
28 ${h.secure_form(h.route_path('gists_create'), id='eform', method='POST', request=request)}
28 ${h.secure_form(h.route_path('gists_create'), id='eform', request=request)}
29 29 <div>
30 30 <textarea id="description" name="description" placeholder="${_('Gist description ...')}"></textarea>
31 31
32 32 <span class="gist-gravatar">
33 33 ${self.gravatar(c.rhodecode_user.email, 30)}
34 34 </span>
35 35 <label for='gistid'>${_('Gist id')}</label>
36 36 ${h.text('gistid', placeholder=_('Auto generated'))}
37 37
38 38 <label for='lifetime'>${_('Gist lifetime')}</label>
39 39 ${h.dropdownmenu('lifetime', '', c.lifetime_options)}
40 40
41 41 <label for='acl_level'>${_('Gist access level')}</label>
42 42 ${h.dropdownmenu('gist_acl_level', '', c.acl_options)}
43 43
44 44 </div>
45 45 <div id="codeblock" class="codeblock">
46 46 <div class="code-header">
47 47 <div class="form">
48 48 <div class="fields">
49 49 ${h.text('filename', size=30, placeholder=_('name this file...'))}
50 50 ${h.dropdownmenu('mimetype','plain',[('plain',_('plain'))],enable_filter=True)}
51 51 </div>
52 52 </div>
53 53 </div>
54 54 <div id="editor_container">
55 55 <div id="editor_pre"></div>
56 56 <textarea id="editor" name="content" ></textarea>
57 57 </div>
58 58 </div>
59 59 <div class="pull-right">
60 60 ${h.submit('private',_('Create Private Gist'),class_="btn")}
61 61 ${h.submit('public',_('Create Public Gist'),class_="btn")}
62 62 ${h.reset('reset',_('Reset'),class_="btn")}
63 63 </div>
64 64 ${h.end_form()}
65 65 </div>
66 66 </div>
67 67
68 68 </div>
69 69
70 70 <script type="text/javascript">
71 71 var myCodeMirror = initCodeMirror('editor', '');
72 72
73 73 var modes_select = $('#mimetype');
74 74 fillCodeMirrorOptions(modes_select);
75 75
76 76 var filename_selector = '#filename';
77 77 // on change of select field set mode
78 78 setCodeMirrorModeFromSelect(
79 79 modes_select, filename_selector, myCodeMirror, null);
80 80
81 81 // on entering the new filename set mode, from given extension
82 82 setCodeMirrorModeFromInput(
83 83 modes_select, filename_selector, myCodeMirror, null);
84 84
85 85 </script>
86 86 </%def>
@@ -1,110 +1,110 b''
1 1 ## -*- coding: utf-8 -*-
2 2 <%inherit file="/base/base.mako"/>
3 3
4 4 <%def name="robots()">
5 5 %if c.gist.gist_type != 'public':
6 6 <meta name="robots" content="noindex, nofollow">
7 7 %else:
8 8 ${parent.robots()}
9 9 %endif
10 10 </%def>
11 11
12 12 <%def name="title()">
13 13 ${_('Gist')} &middot; ${c.gist.gist_access_id}
14 14 %if c.rhodecode_name:
15 15 &middot; ${h.branding(c.rhodecode_name)}
16 16 %endif
17 17 </%def>
18 18
19 19 <%def name="breadcrumbs_links()">
20 20 ${_('Gist')} &middot; ${c.gist.gist_access_id}
21 21 </%def>
22 22
23 23 <%def name="menu_bar_nav()">
24 24 ${self.menu_items(active='gists')}
25 25 </%def>
26 26
27 27 <%def name="main()">
28 28 <div class="box">
29 29 <!-- box / title -->
30 30 <div class="title">
31 31 ${self.breadcrumbs()}
32 32 %if c.rhodecode_user.username != h.DEFAULT_USER:
33 33 <ul class="links">
34 34 <li>
35 35 <a href="${h.route_path('gists_new')}" class="btn btn-primary">${_(u'Create New Gist')}</a>
36 36 </li>
37 37 </ul>
38 38 %endif
39 39 </div>
40 40 <code>${c.gist.gist_url()}</code>
41 41 <div class="table">
42 42 <div id="files_data">
43 43 <div id="codeblock" class="codeblock">
44 44 <div class="code-header">
45 45 <div class="stats">
46 46 %if h.HasPermissionAny('hg.admin')() or c.gist.gist_owner == c.rhodecode_user.user_id:
47 47 <div class="remove_gist">
48 ${h.secure_form(h.route_path('gist_delete', gist_id=c.gist.gist_access_id), method='POST', request=request)}
48 ${h.secure_form(h.route_path('gist_delete', gist_id=c.gist.gist_access_id), request=request)}
49 49 ${h.submit('remove_gist', _('Delete'),class_="btn btn-mini btn-danger",onclick="return confirm('"+_('Confirm to delete this Gist')+"');")}
50 50 ${h.end_form()}
51 51 </div>
52 52 %endif
53 53 <div class="buttons">
54 54 ## only owner should see that
55 55 %if h.HasPermissionAny('hg.admin')() or c.gist.gist_owner == c.rhodecode_user.user_id:
56 56 ${h.link_to(_('Edit'), h.route_path('gist_edit', gist_id=c.gist.gist_access_id), class_="btn btn-mini")}
57 57 %endif
58 58 ${h.link_to(_('Show as Raw'), h.route_path('gist_show_formatted', gist_id=c.gist.gist_access_id, revision='tip', format='raw'), class_="btn btn-mini")}
59 59 </div>
60 60 <div class="left" >
61 61 %if c.gist.gist_type != 'public':
62 62 <span class="tag tag-ok disabled">${_('Private Gist')}</span>
63 63 %endif
64 64 <span> ${c.gist.gist_description}</span>
65 65 <span>${_('Expires')}:
66 66 %if c.gist.gist_expires == -1:
67 67 ${_('never')}
68 68 %else:
69 69 ${h.age_component(h.time_to_utcdatetime(c.gist.gist_expires))}
70 70 %endif
71 71 </span>
72 72 </div>
73 73 </div>
74 74
75 75 <div class="author">
76 76 <div title="${h.tooltip(c.file_last_commit.author)}">
77 77 ${self.gravatar_with_user(c.file_last_commit.author, 16)} - ${_('created')} ${h.age_component(c.file_last_commit.date)}
78 78 </div>
79 79
80 80 </div>
81 81 <div class="commit">${h.urlify_commit_message(c.file_last_commit.message, None)}</div>
82 82 </div>
83 83
84 84 ## iterate over the files
85 85 % for file in c.files:
86 86 <% renderer = c.render and h.renderer_from_filename(file.path, exclude=['.txt', '.TXT'])%>
87 87 <!--
88 88 <div id="${h.FID('G', file.path)}" class="stats" >
89 89 <a href="${c.gist.gist_url()}">¶</a>
90 90 <b >${file.path}</b>
91 91 <div>
92 92 ${h.link_to(_('Show as raw'), h.route_path('gist_show_formatted_path', gist_id=c.gist.gist_access_id, revision=file.commit.raw_id, format='raw', f_path=file.path), class_="btn btn-mini")}
93 93 </div>
94 94 </div>
95 95 -->
96 96 <div class="code-body textarea text-area editor">
97 97 %if renderer:
98 98 ${h.render(file.content, renderer=renderer)}
99 99 %else:
100 100 ${h.pygmentize(file,linenos=True,anchorlinenos=True,lineanchors='L',cssclass="code-highlight")}
101 101 %endif
102 102 </div>
103 103 %endfor
104 104 </div>
105 105 </div>
106 106 </div>
107 107
108 108
109 109 </div>
110 110 </%def>
@@ -1,180 +1,180 b''
1 1 <div class="panel panel-default">
2 2 <div class="panel-heading">
3 3 <h3 class="panel-title">${_('Authentication Tokens')}</h3>
4 4 </div>
5 5 <div class="panel-body">
6 6 <div class="apikeys_wrap">
7 7 <p>
8 8 ${_('Each token can have a role. Token with a role can be used only in given context, '
9 9 'e.g. VCS tokens can be used together with the authtoken auth plugin for git/hg/svn operations only.')}
10 10 </p>
11 11 <table class="rctable auth_tokens">
12 12 <tr>
13 13 <th>${_('Token')}</th>
14 14 <th>${_('Scope')}</th>
15 15 <th>${_('Description')}</th>
16 16 <th>${_('Role')}</th>
17 17 <th>${_('Expiration')}</th>
18 18 <th>${_('Action')}</th>
19 19 </tr>
20 20 %if c.user_auth_tokens:
21 21 %for auth_token in c.user_auth_tokens:
22 22 <tr class="${'expired' if auth_token.expired else ''}">
23 23 <td class="truncate-wrap td-authtoken">
24 24 <div class="user_auth_tokens truncate autoexpand">
25 25 <code>${auth_token.api_key}</code>
26 26 </div>
27 27 </td>
28 28 <td class="td">${auth_token.scope_humanized}</td>
29 29 <td class="td-wrap">${auth_token.description}</td>
30 30 <td class="td-tags">
31 31 <span class="tag disabled">${auth_token.role_humanized}</span>
32 32 </td>
33 33 <td class="td-exp">
34 34 %if auth_token.expires == -1:
35 35 ${_('never')}
36 36 %else:
37 37 %if auth_token.expired:
38 38 <span style="text-decoration: line-through">${h.age_component(h.time_to_utcdatetime(auth_token.expires))}</span>
39 39 %else:
40 40 ${h.age_component(h.time_to_utcdatetime(auth_token.expires))}
41 41 %endif
42 42 %endif
43 43 </td>
44 44 <td class="td-action">
45 ${h.secure_form(h.route_path('my_account_auth_tokens_delete'), method='POST', request=request)}
45 ${h.secure_form(h.route_path('my_account_auth_tokens_delete'), request=request)}
46 46 ${h.hidden('del_auth_token', auth_token.user_api_key_id)}
47 47 <button class="btn btn-link btn-danger" type="submit"
48 48 onclick="return confirm('${_('Confirm to remove this auth token: %s') % auth_token.token_obfuscated}');">
49 49 ${_('Delete')}
50 50 </button>
51 51 ${h.end_form()}
52 52 </td>
53 53 </tr>
54 54 %endfor
55 55 %else:
56 56 <tr><td><div class="ip">${_('No additional auth tokens specified')}</div></td></tr>
57 57 %endif
58 58 </table>
59 59 </div>
60 60
61 61 <div class="user_auth_tokens">
62 ${h.secure_form(h.route_path('my_account_auth_tokens_add'), method='POST', request=request)}
62 ${h.secure_form(h.route_path('my_account_auth_tokens_add'), request=request)}
63 63 <div class="form form-vertical">
64 64 <!-- fields -->
65 65 <div class="fields">
66 66 <div class="field">
67 67 <div class="label">
68 68 <label for="new_email">${_('New authentication token')}:</label>
69 69 </div>
70 70 <div class="input">
71 71 ${h.text('description', class_='medium', placeholder=_('Description'))}
72 72 ${h.hidden('lifetime')}
73 73 ${h.select('role', '', c.role_options)}
74 74
75 75 % if c.allow_scoped_tokens:
76 76 ${h.hidden('scope_repo_id')}
77 77 % else:
78 78 ${h.select('scope_repo_id_disabled', '', ['Scopes available in EE edition'], disabled='disabled')}
79 79 % endif
80 80 </div>
81 81 <p class="help-block">
82 82 ${_('Repository scope works only with tokens with VCS type.')}
83 83 </p>
84 84 </div>
85 85 <div class="buttons">
86 86 ${h.submit('save',_('Add'),class_="btn")}
87 87 ${h.reset('reset',_('Reset'),class_="btn")}
88 88 </div>
89 89 </div>
90 90 </div>
91 91 ${h.end_form()}
92 92 </div>
93 93 </div>
94 94 </div>
95 95 <script>
96 96 $(document).ready(function(){
97 97
98 98 var select2Options = {
99 99 'containerCssClass': "drop-menu",
100 100 'dropdownCssClass': "drop-menu-dropdown",
101 101 'dropdownAutoWidth': true
102 102 };
103 103 $("#role").select2(select2Options);
104 104
105 105
106 106 var preloadData = {
107 107 results: [
108 108 % for entry in c.lifetime_values:
109 109 {id:${entry[0]}, text:"${entry[1]}"}${'' if loop.last else ','}
110 110 % endfor
111 111 ]
112 112 };
113 113
114 114 $("#lifetime").select2({
115 115 containerCssClass: "drop-menu",
116 116 dropdownCssClass: "drop-menu-dropdown",
117 117 dropdownAutoWidth: true,
118 118 data: preloadData,
119 119 placeholder: "${_('Select or enter expiration date')}",
120 120 query: function(query) {
121 121 feedLifetimeOptions(query, preloadData);
122 122 }
123 123 });
124 124
125 125
126 126 var repoFilter = function(data) {
127 127 var results = [];
128 128
129 129 if (!data.results[0]) {
130 130 return data
131 131 }
132 132
133 133 $.each(data.results[0].children, function() {
134 134 // replace name to ID for submision
135 135 this.id = this.obj.repo_id;
136 136 results.push(this);
137 137 });
138 138
139 139 data.results[0].children = results;
140 140 return data;
141 141 };
142 142
143 143 $("#scope_repo_id_disabled").select2(select2Options);
144 144
145 145 $("#scope_repo_id").select2({
146 146 cachedDataSource: {},
147 147 minimumInputLength: 2,
148 148 placeholder: "${_('repository scope')}",
149 149 dropdownAutoWidth: true,
150 150 containerCssClass: "drop-menu",
151 151 dropdownCssClass: "drop-menu-dropdown",
152 152 formatResult: formatResult,
153 153 query: $.debounce(250, function(query){
154 154 self = this;
155 155 var cacheKey = query.term;
156 156 var cachedData = self.cachedDataSource[cacheKey];
157 157
158 158 if (cachedData) {
159 159 query.callback({results: cachedData.results});
160 160 } else {
161 161 $.ajax({
162 162 url: pyroutes.url('repo_list_data'),
163 163 data: {'query': query.term},
164 164 dataType: 'json',
165 165 type: 'GET',
166 166 success: function(data) {
167 167 data = repoFilter(data);
168 168 self.cachedDataSource[cacheKey] = data;
169 169 query.callback({results: data.results});
170 170 },
171 171 error: function(data, textStatus, errorThrown) {
172 172 alert("Error while fetching entries.\nError code {0} ({1}).".format(data.status, data.statusText));
173 173 }
174 174 })
175 175 }
176 176 })
177 177 });
178 178
179 179 });
180 180 </script>
@@ -1,72 +1,72 b''
1 1 <%namespace name="base" file="/base/base.mako"/>
2 2
3 3 <div class="panel panel-default">
4 4 <div class="panel-heading">
5 5 <h3 class="panel-title">${_('Account Emails')}</h3>
6 6 </div>
7 7
8 8 <div class="panel-body">
9 9 <div class="emails_wrap">
10 10 <table class="rctable account_emails">
11 11 <tr>
12 12 <td class="td-user">
13 13 ${base.gravatar(c.user.email, 16)}
14 14 <span class="user email">${c.user.email}</span>
15 15 </td>
16 16 <td class="td-tags">
17 17 <span class="tag tag1">${_('Primary')}</span>
18 18 </td>
19 19 </tr>
20 20 %if c.user_email_map:
21 21 %for em in c.user_email_map:
22 22 <tr>
23 23 <td class="td-user">
24 24 ${base.gravatar(em.email, 16)}
25 25 <span class="user email">${em.email}</span>
26 26 </td>
27 27 <td class="td-action">
28 ${h.secure_form(h.route_path('my_account_emails_delete'), method='POST', request=request)}
28 ${h.secure_form(h.route_path('my_account_emails_delete'), request=request)}
29 29 ${h.hidden('del_email_id',em.email_id)}
30 30 <button class="btn btn-link btn-danger" type="submit" id="${'remove_email_%s'.format(em.email_id)}"
31 31 onclick="return confirm('${_('Confirm to delete this email: {}').format(em.email)}');">
32 32 ${_('Delete')}
33 33 </button>
34 34 ${h.end_form()}
35 35 </td>
36 36 </tr>
37 37 %endfor
38 38 %else:
39 39 <tr class="noborder">
40 40 <td colspan="3">
41 41 <div class="td-email">
42 42 ${_('No additional emails specified')}
43 43 </div>
44 44 </td>
45 45 </tr>
46 46 %endif
47 47 </table>
48 48 </div>
49 49
50 50 <div>
51 ${h.secure_form(h.route_path('my_account_emails_add'), method='POST', request=request)}
51 ${h.secure_form(h.route_path('my_account_emails_add'), request=request)}
52 52 <div class="form">
53 53 <!-- fields -->
54 54 <div class="fields">
55 55 <div class="field">
56 56 <div class="label">
57 57 <label for="new_email">${_('New email address')}:</label>
58 58 </div>
59 59 <div class="input">
60 60 ${h.text('new_email', class_='medium')}
61 61 </div>
62 62 </div>
63 63 <div class="buttons">
64 64 ${h.submit('save',_('Add'),class_="btn")}
65 65 ${h.reset('reset',_('Reset'),class_="btn")}
66 66 </div>
67 67 </div>
68 68 </div>
69 69 ${h.end_form()}
70 70 </div>
71 71 </div>
72 72 </div>
@@ -1,113 +1,113 b''
1 1 <%namespace name="base" file="/base/base.mako"/>
2 2 <div class="panel panel-default user-profile">
3 3 <div class="panel-heading">
4 4 <h3 class="panel-title">${_('My Profile')}</h3>
5 5 <a href="${h.route_path('my_account_profile')}" class="panel-edit">Close</a>
6 6 </div>
7 7
8 8 <div class="panel-body">
9 ${h.secure_form(h.route_path('my_account_update'), class_='form', method='POST', request=request)}
9 ${h.secure_form(h.route_path('my_account_update'), class_='form', request=request)}
10 10 <% readonly = None %>
11 11 <% disabled = "" %>
12 12
13 13 % if c.extern_type != 'rhodecode':
14 14 <% readonly = "readonly" %>
15 15 <% disabled = "disabled" %>
16 16 <div class="infoform">
17 17 <div class="fields">
18 18 <p>${_('Your user account details are managed by an external source. Details cannot be managed here.')}
19 19 <br/>${_('Source type')}: <strong>${c.extern_type}</strong>
20 20 </p>
21 21
22 22 <div class="field">
23 23 <div class="label">
24 24 <label for="username">${_('Username')}:</label>
25 25 </div>
26 26 <div class="input">
27 27 ${h.text('username', class_='input-valuedisplay', readonly=readonly)}
28 28 </div>
29 29 </div>
30 30
31 31 <div class="field">
32 32 <div class="label">
33 33 <label for="name">${_('First Name')}:</label>
34 34 </div>
35 35 <div class="input">
36 36 ${h.text('firstname', class_='input-valuedisplay', readonly=readonly)}
37 37 </div>
38 38 </div>
39 39
40 40 <div class="field">
41 41 <div class="label">
42 42 <label for="lastname">${_('Last Name')}:</label>
43 43 </div>
44 44 <div class="input-valuedisplay">
45 45 ${h.text('lastname', class_='input-valuedisplay', readonly=readonly)}
46 46 </div>
47 47 </div>
48 48 </div>
49 49 </div>
50 50 % else:
51 51 <div class="form">
52 52 <div class="fields">
53 53 <div class="field">
54 54 <div class="label photo">
55 55 ${_('Photo')}:
56 56 </div>
57 57 <div class="input profile">
58 58 %if c.visual.use_gravatar:
59 59 ${base.gravatar(c.user.email, 100)}
60 60 <p class="help-block">${_('Change your avatar at')} <a href="http://gravatar.com">gravatar.com</a>.</p>
61 61 %else:
62 62 ${base.gravatar(c.user.email, 20)}
63 63 ${_('Avatars are disabled')}
64 64 %endif
65 65 </div>
66 66 </div>
67 67 <div class="field">
68 68 <div class="label">
69 69 <label for="username">${_('Username')}:</label>
70 70 </div>
71 71 <div class="input">
72 72 ${h.text('username', class_='medium%s' % disabled, readonly=readonly)}
73 73 ${h.hidden('extern_name', c.extern_name)}
74 74 ${h.hidden('extern_type', c.extern_type)}
75 75 </div>
76 76 </div>
77 77 <div class="field">
78 78 <div class="label">
79 79 <label for="name">${_('First Name')}:</label>
80 80 </div>
81 81 <div class="input">
82 82 ${h.text('firstname', class_="medium")}
83 83 </div>
84 84 </div>
85 85
86 86 <div class="field">
87 87 <div class="label">
88 88 <label for="lastname">${_('Last Name')}:</label>
89 89 </div>
90 90 <div class="input">
91 91 ${h.text('lastname', class_="medium")}
92 92 </div>
93 93 </div>
94 94
95 95 <div class="field">
96 96 <div class="label">
97 97 <label for="email">${_('Email')}:</label>
98 98 </div>
99 99 <div class="input">
100 100 ## we should be able to edit email !
101 101 ${h.text('email', class_="medium")}
102 102 </div>
103 103 </div>
104 104
105 105 <div class="buttons">
106 106 ${h.submit('save', _('Save'), class_="btn")}
107 107 ${h.reset('reset', _('Reset'), class_="btn")}
108 108 </div>
109 109 </div>
110 110 </div>
111 111 % endif
112 112 </div>
113 113 </div> No newline at end of file
@@ -1,84 +1,84 b''
1 1 <div class="panel panel-default">
2 2 <div class="panel-heading">
3 3 <h3 class="panel-title">${_('SSH Keys')}</h3>
4 4 </div>
5 5 <div class="panel-body">
6 6 <div class="sshkeys_wrap">
7 7 <table class="rctable ssh_keys">
8 8 <tr>
9 9 <th>${_('Fingerprint')}</th>
10 10 <th>${_('Description')}</th>
11 11 <th>${_('Created')}</th>
12 12 <th>${_('Action')}</th>
13 13 </tr>
14 14 % if not c.ssh_enabled:
15 15 <tr><td colspan="4"><div class="">${_('SSH Keys usage is currently disabled, please ask your administrator to enable them.')}</div></td></tr>
16 16 % else:
17 17 %if c.user_ssh_keys:
18 18 %for ssh_key in c.user_ssh_keys:
19 19 <tr class="">
20 20 <td class="">
21 21 <code>${ssh_key.ssh_key_fingerprint}</code>
22 22 </td>
23 23 <td class="td-wrap">${ssh_key.description}</td>
24 24 <td class="td-tags">${h.format_date(ssh_key.created_on)}</td>
25 25
26 26 <td class="td-action">
27 ${h.secure_form(h.route_path('my_account_ssh_keys_delete'), method='POST', request=request)}
27 ${h.secure_form(h.route_path('my_account_ssh_keys_delete'), request=request)}
28 28 ${h.hidden('del_ssh_key', ssh_key.ssh_key_id)}
29 29 <button class="btn btn-link btn-danger" type="submit"
30 30 onclick="return confirm('${_('Confirm to remove ssh key %s') % ssh_key.ssh_key_fingerprint}');">
31 31 ${_('Delete')}
32 32 </button>
33 33 ${h.end_form()}
34 34 </td>
35 35 </tr>
36 36 %endfor
37 37 %else:
38 38 <tr><td colspan="4"><div class="">${_('No additional ssh keys specified')}</div></td></tr>
39 39 %endif
40 40 % endif
41 41 </table>
42 42 </div>
43 43
44 44 % if c.ssh_enabled:
45 45 <div class="user_ssh_keys">
46 ${h.secure_form(h.route_path('my_account_ssh_keys_add'), method='POST', request=request)}
46 ${h.secure_form(h.route_path('my_account_ssh_keys_add'), request=request)}
47 47 <div class="form form-vertical">
48 48 <!-- fields -->
49 49 <div class="fields">
50 50 <div class="field">
51 51 <div class="label">
52 52 <label for="new_email">${_('New ssh key')}:</label>
53 53 </div>
54 54 <div class="input">
55 55 ${h.text('description', class_='medium', placeholder=_('Description'))}
56 56 <a href="${h.route_path('my_account_ssh_keys_generate')}">${_('Generate random RSA key')}</a>
57 57 </div>
58 58 </div>
59 59
60 60 <div class="field">
61 61 <div class="textarea text-area editor">
62 62 ${h.textarea('key_data',c.default_key, size=30, placeholder=_("Public key, begins with 'ssh-rsa', 'ssh-dss', 'ssh-ed25519', 'ecdsa-sha2-nistp256', 'ecdsa-sha2-nistp384', or 'ecdsa-sha2-nistp521'"))}
63 63 </div>
64 64 </div>
65 65
66 66 <div class="buttons">
67 67 ${h.submit('save',_('Add'),class_="btn")}
68 68 ${h.reset('reset',_('Reset'),class_="btn")}
69 69 </div>
70 70 </div>
71 71 </div>
72 72 ${h.end_form()}
73 73 </div>
74 74 % endif
75 75 </div>
76 76 </div>
77 77
78 78 <script>
79 79
80 80 $(document).ready(function(){
81 81
82 82
83 83 });
84 84 </script>
@@ -1,81 +1,81 b''
1 1 <div class="panel panel-default">
2 2 <div class="panel-heading">
3 3 <h3 class="panel-title">${_('System Wide Application Permissions')}</h3>
4 4 </div>
5 5 <div class="panel-body">
6 ${h.secure_form(h.route_path('admin_permissions_application_update'), method='POST', request=request)}
6 ${h.secure_form(h.route_path('admin_permissions_application_update'), request=request)}
7 7 <div class="form">
8 8 <!-- fields -->
9 9 <div class="fields">
10 10 <div class="field">
11 11 <div class="label label-checkbox">
12 12 <label for="anonymous">${_('Anonymous Access')}:</label>
13 13 </div>
14 14 <div class="checkboxes">
15 15 <div class="checkbox">
16 16 ${h.checkbox('anonymous',True)} Allow Anonymous Access
17 17 </div>
18 18 <span class="help-block">${h.literal(_('Allow access to RhodeCode Enterprise without requiring users to login. Anonymous users get the %s permission settings.' % (h.link_to('"default user"',h.route_path('admin_permissions_object')))))}</span>
19 19 </div>
20 20 </div>
21 21
22 22 <div class="field">
23 23 <div class="label label-select">
24 24 <label for="default_register">${_('Registration')}:</label>
25 25 </div>
26 26 <div class="select">
27 27 ${h.select('default_register','',c.register_choices)}
28 28 </div>
29 29 </div>
30 30
31 31 <div class="field">
32 32 <div class="label label-select">
33 33 <label for="default_password_reset">${_('Password Reset')}:</label>
34 34 </div>
35 35 <div class="select">
36 36 ${h.select('default_password_reset','',c.password_reset_choices)}
37 37 </div>
38 38 </div>
39 39
40 40 <div class="field">
41 41 <div class="label label-textarea">
42 42 <label for="default_register_message">${_('Registration Page Message')}:</label>
43 43 </div>
44 44 <div class="textarea text-area editor" >
45 45 ${h.textarea('default_register_message', class_="medium", )}
46 46 <span class="help-block">${_('Custom message to be displayed on the registration page. HTML syntax is supported.')}</span>
47 47 </div>
48 48 </div>
49 49
50 50 <div class="field">
51 51 <div class="label">
52 52 <label for="default_extern_activate">${_('External Authentication Account Activation')}:</label>
53 53 </div>
54 54 <div class="select">
55 55 ${h.select('default_extern_activate','',c.extern_activate_choices)}
56 56 </div>
57 57 </div>
58 58 <div class="buttons">
59 59 ${h.submit('save',_('Save'),class_="btn")}
60 60 ${h.reset('reset',_('Reset'),class_="btn")}
61 61 </div>
62 62 </div>
63 63 </div>
64 64 ${h.end_form()}
65 65 </div>
66 66 </div>
67 67
68 68 <script>
69 69 $(document).ready(function(){
70 70 var select2Options = {
71 71 containerCssClass: 'drop-menu',
72 72 dropdownCssClass: 'drop-menu-dropdown',
73 73 dropdownAutoWidth: true,
74 74 minimumResultsForSearch: -1
75 75 };
76 76
77 77 $("#default_register").select2(select2Options);
78 78 $("#default_password_reset").select2(select2Options);
79 79 $("#default_extern_activate").select2(select2Options);
80 80 });
81 81 </script>
@@ -1,10 +1,10 b''
1 1
2 ${h.secure_form(h.route_path('admin_permissions_global_update'), method='POST', request=request)}
2 ${h.secure_form(h.route_path('admin_permissions_global_update'), request=request)}
3 3 <div class="form permissions-global">
4 4 <!-- fields -->
5 5 <div class="fields">
6 6 <%namespace name="dpb" file="/base/default_perms_box.mako"/>
7 7 ${dpb.default_perms_radios(global_permissions_template = True)}
8 8 </div>
9 9 </div>
10 10 ${h.end_form()}
@@ -1,70 +1,70 b''
1 1
2 2
3 3 <div class="panel panel-default">
4 4 <div class="panel-heading">
5 5 <h3 class="panel-title">${_('Default IP Whitelist For All Users')}</h3>
6 6 </div>
7 7 <div class="panel-body">
8 8 <div class="ips_wrap">
9 9 <h5>${_('Current IP address')}: <code>${c.rhodecode_user.ip_addr}</code></h5>
10 10
11 11
12 12 <table class="rctable ip-whitelist">
13 13 <tr>
14 14 <th>IP Address</th>
15 15 <th>IP Range</th>
16 16 <th>Description</th>
17 17 <th></th>
18 18 </tr>
19 19 %if c.user_ip_map:
20 20 %for ip in c.user_ip_map:
21 21 <tr>
22 22 <td class="td-ip"><div class="ip">${ip.ip_addr}</div></td>
23 23 <td class="td-iprange"><div class="ip">${h.ip_range(ip.ip_addr)}</div></td>
24 24 <td class="td-description"><div class="ip">${ip.description}</div></td>
25 25 <td class="td-action">
26 ${h.secure_form(h.route_path('edit_user_ips_delete', user_id=c.user.user_id), method='POST', request=request)}
26 ${h.secure_form(h.route_path('edit_user_ips_delete', user_id=c.user.user_id), request=request)}
27 27 ${h.hidden('del_ip_id',ip.ip_id)}
28 28 ${h.hidden('default_user', 'True')}
29 29 ${h.submit('remove_',_('Delete'),id="remove_ip_%s" % ip.ip_id,
30 30 class_="btn btn-link btn-danger", onclick="return confirm('"+_('Confirm to delete this ip: %s') % ip.ip_addr+"');")}
31 31 ${h.end_form()}
32 32 </td>
33 33 </tr>
34 34 %endfor
35 35 %else:
36 36 <tr>
37 37 <td class="ip">${_('All IP addresses are allowed')}</td>
38 38 <td></td>
39 39 <td></td>
40 40 <td></td>
41 41 </tr>
42 42 %endif
43 43 </table>
44 44 </div>
45 45
46 ${h.secure_form(h.route_path('edit_user_ips_add', user_id=c.user.user_id), method='POST', request=request)}
46 ${h.secure_form(h.route_path('edit_user_ips_add', user_id=c.user.user_id), request=request)}
47 47 <div class="form">
48 48 <!-- fields -->
49 49 <div class="fields">
50 50 <div class="field">
51 51 <div class="label">
52 52 <label for="new_ip">${_('New IP Address')}:</label>
53 53 </div>
54 54 <div class="input">
55 55 ${h.hidden('default_user', 'True')}
56 56 ${h.text('new_ip')} ${h.text('description', placeholder=_('Description...'))}
57 57 <span class="help-block">${_('Enter a comma separated list of IP Addresses like 127.0.0.1,\n'
58 58 'or use an IP Address with a mask 127.0.0.1/24, to create a network range.\n'
59 59 'To specify multiple addresses in a range, use the 127.0.0.1-127.0.0.10 syntax')}</span>
60 60 </div>
61 61 </div>
62 62 <div class="buttons">
63 63 ${h.submit('save',_('Add'),class_="btn")}
64 64 ${h.reset('reset',_('Reset'),class_="btn")}
65 65 </div>
66 66 </div>
67 67 </div>
68 68 ${h.end_form()}
69 69 </div>
70 70 </div>
@@ -1,77 +1,77 b''
1 1 <div class="panel panel-default">
2 2 <div class="panel-heading">
3 3 <h3 class="panel-title">${_('Default Permissions for Repositories, User Groups and Repository Groups.')}</h3>
4 4 </div>
5 5 <div class="panel-body">
6 6 <p>${_('Default system permissions. Each permissions management entity will be created with the following default settings. Check the overwrite checkbox to force any permission changes on already existing settings.')}
7 7 </p>
8 ${h.secure_form(h.route_path('admin_permissions_object_update'), method='POST', request=request)}
8 ${h.secure_form(h.route_path('admin_permissions_object_update'), request=request)}
9 9 <div class="form">
10 10 <div class="fields">
11 11 <div class="field">
12 12 <div class="label">
13 13 <label for="default_repo_perm">${_('Repository')}:</label>
14 14 </div>
15 15 <div class="select">
16 16 ${h.select('default_repo_perm','',c.repo_perms_choices)}
17 17
18 18 ${h.checkbox('overwrite_default_repo','true')}
19 19 <label for="overwrite_default_repo">
20 20 <span class="tooltip" title="${h.tooltip(_('All default permissions on each repository will be reset to chosen permission, note that all custom default permission on repositories will be lost'))}">
21 21 ${_('Overwrite Existing Settings')}
22 22 </span>
23 23 </label>
24 24 </div>
25 25 </div>
26 26 <div class="field">
27 27 <div class="label">
28 28 <label for="default_group_perm">${_('Repository Groups')}:</label>
29 29 </div>
30 30 <div class="select">
31 31 ${h.select('default_group_perm','',c.group_perms_choices)}
32 32 ${h.checkbox('overwrite_default_group','true')}
33 33 <label for="overwrite_default_group">
34 34 <span class="tooltip" title="${h.tooltip(_('All default permissions on each repository group will be reset to chosen permission, note that all custom default permission on repository groups will be lost'))}">
35 35 ${_('Overwrite Existing Settings')}
36 36 </span>
37 37 </label>
38 38 </div>
39 39 </div>
40 40 <div class="field">
41 41 <div class="label">
42 42 <label for="default_group_perm">${_('User Groups')}:</label>
43 43 </div>
44 44 <div class="select">
45 45 ${h.select('default_user_group_perm','',c.user_group_perms_choices)}
46 46 ${h.checkbox('overwrite_default_user_group','true')}
47 47 <label for="overwrite_default_user_group">
48 48 <span class="tooltip" title="${h.tooltip(_('All default permissions on each user group will be reset to chosen permission, note that all custom default permission on repository groups will be lost'))}">
49 49 ${_('Overwrite Existing Settings')}
50 50 </span>
51 51 </label>
52 52 </div>
53 53 </div>
54 54
55 55 <div class="buttons">
56 56 ${h.submit('save',_('Save'),class_="btn")}
57 57 ${h.reset('reset',_('Reset'),class_="btn")}
58 58 </div>
59 59 </div>
60 60 </div>
61 61 ${h.end_form()}
62 62 </div>
63 63 </div>
64 64
65 65 <script>
66 66 $(document).ready(function(){
67 67 var select2Options = {
68 68 containerCssClass: 'drop-menu',
69 69 dropdownCssClass: 'drop-menu-dropdown',
70 70 dropdownAutoWidth: true,
71 71 minimumResultsForSearch: -1
72 72 };
73 73 $("#default_repo_perm").select2(select2Options);
74 74 $("#default_group_perm").select2(select2Options);
75 75 $("#default_user_group_perm").select2(select2Options);
76 76 });
77 77 </script>
@@ -1,91 +1,91 b''
1 1
2 2 <div class="panel panel-default">
3 3 <div class="panel-heading">
4 4 <h3 class="panel-title">${_('SSH Keys')} - <span id="ssh_keys_count"></span></h3>
5 5
6 ${h.secure_form(h.route_path('admin_permissions_ssh_keys_update'), method='POST', request=request)}
6 ${h.secure_form(h.route_path('admin_permissions_ssh_keys_update'), request=request)}
7 7 <button class="btn btn-link pull-right" type="submit">${_('Update SSH keys file')}</button>
8 8 ${h.end_form()}
9 9 </div>
10 10 <div class="panel-body">
11 11 <input class="q_filter_box" id="q_filter" size="15" type="text" name="filter" placeholder="${_('quick filter...')}" value=""/>
12 12
13 13 <div id="repos_list_wrap">
14 14 <table id="ssh_keys_table" class="display"></table>
15 15 </div>
16 16 </div>
17 17 </div>
18 18
19 19
20 20 <script type="text/javascript">
21 21
22 22 $(document).ready(function() {
23 23 var $sshKeyListTable = $('#ssh_keys_table');
24 24
25 25 var getDatatableCount = function(){
26 26 var table = $sshKeyListTable.dataTable();
27 27 var page = table.api().page.info();
28 28 var active = page.recordsDisplay;
29 29 var total = page.recordsTotal;
30 30
31 31 var _text = _gettext("{0} out of {1} ssh keys").format(active, total);
32 32 $('#ssh_keys_count').text(_text);
33 33 };
34 34
35 35 // user list
36 36 $sshKeyListTable.DataTable({
37 37 processing: true,
38 38 serverSide: true,
39 39 ajax: "${h.route_path('admin_permissions_ssh_keys_data')}",
40 40 dom: 'rtp',
41 41 pageLength: ${c.visual.admin_grid_items},
42 42 order: [[ 0, "asc" ]],
43 43 columns: [
44 44 { data: {"_": "username",
45 45 "sort": "username"}, title: "${_('Username')}", className: "td-user" },
46 46 { data: {"_": "fingerprint",
47 47 "sort": "fingerprint"}, title: "${_('Fingerprint')}", className: "td-type" },
48 48 { data: {"_": "description",
49 49 "sort": "description"}, title: "${_('Description')}", className: "td-type" },
50 50 { data: {"_": "created_on",
51 51 "sort": "created_on"}, title: "${_('Created on')}", className: "td-time" },
52 52 { data: {"_": "action",
53 53 "sort": "action"}, title: "${_('Action')}", className: "td-action", orderable: false }
54 54 ],
55 55 language: {
56 56 paginate: DEFAULT_GRID_PAGINATION,
57 57 sProcessing: _gettext('loading...'),
58 58 emptyTable: _gettext("No ssh keys available yet.")
59 59 },
60 60
61 61 "createdRow": function ( row, data, index ) {
62 62 if (!data['active_raw']){
63 63 $(row).addClass('closed')
64 64 }
65 65 }
66 66 });
67 67
68 68 $sshKeyListTable.on('xhr.dt', function(e, settings, json, xhr){
69 69 $sshKeyListTable.css('opacity', 1);
70 70 });
71 71
72 72 $sshKeyListTable.on('preXhr.dt', function(e, settings, data){
73 73 $sshKeyListTable.css('opacity', 0.3);
74 74 });
75 75
76 76 // refresh counters on draw
77 77 $sshKeyListTable.on('draw.dt', function(){
78 78 getDatatableCount();
79 79 });
80 80
81 81 // filter
82 82 $('#q_filter').on('keyup',
83 83 $.debounce(250, function() {
84 84 $sshKeyListTable.DataTable().search(
85 85 $('#q_filter').val()
86 86 ).draw();
87 87 })
88 88 );
89 89
90 90 });
91 91 </script>
@@ -1,106 +1,106 b''
1 1 ## -*- coding: utf-8 -*-
2 2 <%inherit file="/base/base.mako"/>
3 3
4 4 <%def name="title()">
5 5 ${_('Add repository group')}
6 6 %if c.rhodecode_name:
7 7 &middot; ${h.branding(c.rhodecode_name)}
8 8 %endif
9 9 </%def>
10 10
11 11 <%def name="breadcrumbs_links()">
12 12 ${h.link_to(_('Admin'),h.route_path('admin_home'))}
13 13 &raquo;
14 14 ${h.link_to(_('Repository groups'),h.url('repo_groups'))}
15 15 &raquo;
16 16 ${_('Add Repository Group')}
17 17 </%def>
18 18
19 19 <%def name="menu_bar_nav()">
20 20 ${self.menu_items(active='admin')}
21 21 </%def>
22 22
23 23 <%def name="main()">
24 24 <div class="box">
25 25 <!-- box / title -->
26 26 <div class="title">
27 27 ${self.breadcrumbs()}
28 28 </div>
29 29 <!-- end box / title -->
30 ${h.secure_form(h.url('repo_groups'), method='post')}
30 ${h.secure_form(h.url('repo_groups'), request=request)}
31 31 <div class="form">
32 32 <!-- fields -->
33 33 <div class="fields">
34 34 <div class="field">
35 35 <div class="label">
36 36 <label for="group_name">${_('Group Name')}:</label>
37 37 </div>
38 38 <div class="input">
39 39 ${h.text('group_name', class_="medium")}
40 40 </div>
41 41 </div>
42 42
43 43 <div class="field">
44 44 <div class="label">
45 45 <label for="group_description">${_('Description')}:</label>
46 46 </div>
47 47 <div class="textarea editor">
48 48 ${h.textarea('group_description',cols=23,rows=5,class_="medium")}
49 49 <% metatags_url = h.literal('''<a href="#metatagsShow" onclick="$('#meta-tags-desc').toggle();return false">meta-tags</a>''') %>
50 50 <span class="help-block">${_('Plain text format with support of {metatags}').format(metatags=metatags_url)|n}</span>
51 51 <span id="meta-tags-desc" style="display: none">
52 52 <%namespace name="dt" file="/data_table/_dt_elements.mako"/>
53 53 ${dt.metatags_help()}
54 54 </span>
55 55 </div>
56 56 </div>
57 57
58 58 <div class="field">
59 59 <div class="label">
60 60 <label for="group_parent_id">${_('Group Parent')}:</label>
61 61 </div>
62 62 <div class="select">
63 63 ${h.select('group_parent_id',request.GET.get('parent_group'),c.repo_groups,class_="medium")}
64 64 </div>
65 65 </div>
66 66
67 67 <div id="copy_perms" class="field">
68 68 <div class="label label-checkbox">
69 69 <label for="group_copy_permissions">${_('Copy Parent Group Permissions')}:</label>
70 70 </div>
71 71 <div class="checkboxes">
72 72 ${h.checkbox('group_copy_permissions', value="True", checked="checked")}
73 73 <span class="help-block">${_('Copy permission settings from parent repository group.')}</span>
74 74 </div>
75 75 </div>
76 76
77 77 <div class="buttons">
78 78 ${h.submit('save',_('Save'),class_="btn")}
79 79 </div>
80 80 </div>
81 81 </div>
82 82 ${h.end_form()}
83 83 </div>
84 84 <script>
85 85 $(document).ready(function(){
86 86 var setCopyPermsOption = function(group_val){
87 87 if(group_val != "-1"){
88 88 $('#copy_perms').show()
89 89 }
90 90 else{
91 91 $('#copy_perms').hide();
92 92 }
93 93 }
94 94 $("#group_parent_id").select2({
95 95 'containerCssClass': "drop-menu",
96 96 'dropdownCssClass': "drop-menu-dropdown",
97 97 'dropdownAutoWidth': true
98 98 });
99 99 setCopyPermsOption($('#group_parent_id').val())
100 100 $("#group_parent_id").on("change", function(e) {
101 101 setCopyPermsOption(e.val)
102 102 })
103 103 $('#group_name').focus();
104 104 })
105 105 </script>
106 106 </%def>
@@ -1,64 +1,64 b''
1 1 <%namespace name="base" file="/base/base.mako"/>
2 2
3 3 <%
4 4 elems = [
5 5 (_('Owner'), lambda:base.gravatar_with_user(c.repo_group.user.email), '', ''),
6 6 (_('Created on'), h.format_date(c.repo_group.created_on), '', ''),
7 7 (_('Is Personal Group'), c.repo_group.personal or False, '', ''),
8 8
9 9 (_('Total repositories'), c.repo_group.repositories_recursive_count, '', ''),
10 10 (_('Top level repositories'), c.repo_group.repositories.count(), '', c.repo_group.repositories.all()),
11 11
12 12 (_('Children groups'), c.repo_group.children.count(), '', c.repo_group.children.all()),
13 13 ]
14 14 %>
15 15
16 16 <div class="panel panel-default">
17 17 <div class="panel-heading">
18 18 <h3 class="panel-title">${_('Repository Group: %s') % c.repo_group.group_name}</h3>
19 19 </div>
20 20 <div class="panel-body">
21 21 ${base.dt_info_panel(elems)}
22 22 </div>
23 23
24 24 </div>
25 25
26 26 <div class="panel panel-danger">
27 27 <div class="panel-heading">
28 28 <h3 class="panel-title">${_('Delete repository group')}</h3>
29 29 </div>
30 30 <div class="panel-body">
31 ${h.secure_form(h.url('delete_repo_group', group_name=c.repo_group.group_name),method='delete')}
31 ${h.secure_form(h.url('delete_repo_group', group_name=c.repo_group.group_name),method='delete', request=request)}
32 32 <table class="display">
33 33
34 34 <tr>
35 35 <td>
36 36 ${_ungettext('This repository group includes %s children repository group.', 'This repository group includes %s children repository groups.', c.repo_group.children.count()) % c.repo_group.children.count()}
37 37 </td>
38 38 <td>
39 39 </td>
40 40 <td>
41 41 </td>
42 42 </tr>
43 43 <tr>
44 44 <td>
45 45 ${_ungettext('This repository group includes %s repository.', 'This repository group includes %s repositories.', c.repo_group.repositories_recursive_count) % c.repo_group.repositories_recursive_count}
46 46 </td>
47 47 <td>
48 48 </td>
49 49 <td>
50 50 </td>
51 51 </tr>
52 52
53 53 </table>
54 54 <div style="margin: 0 0 20px 0" class="fake-space"></div>
55 55
56 56 <button class="btn btn-small btn-danger" type="submit"
57 57 onclick="return confirm('${_('Confirm to delete this group: %s') % (c.repo_group.group_name)}');">
58 58 ${_('Delete this repository group')}
59 59 </button>
60 60 ${h.end_form()}
61 61 </div>
62 62 </div>
63 63
64 64
@@ -1,148 +1,148 b''
1 1 <%namespace name="base" file="/base/base.mako"/>
2 2
3 3 <div class="panel panel-default">
4 4 <div class="panel-heading">
5 5 <h3 class="panel-title">${_('Repository Group Permissions')}</h3>
6 6 </div>
7 7 <div class="panel-body">
8 ${h.secure_form(h.url('edit_repo_group_perms', group_name=c.repo_group.group_name),method='put')}
8 ${h.secure_form(h.url('edit_repo_group_perms', group_name=c.repo_group.group_name),method='put', request=request)}
9 9 <table id="permissions_manage" class="rctable permissions">
10 10 <tr>
11 11 <th class="td-radio">${_('None')}</th>
12 12 <th class="td-radio">${_('Read')}</th>
13 13 <th class="td-radio">${_('Write')}</th>
14 14 <th class="td-radio">${_('Admin')}</th>
15 15 <th class="td-user">${_('User/User Group')}</th>
16 16 <th></th>
17 17 </tr>
18 18 ## USERS
19 19 %for _user in c.repo_group.permissions():
20 20 %if getattr(_user, 'admin_row', None) or getattr(_user, 'owner_row', None):
21 21 <tr class="perm_admin_row">
22 22 <td class="td-radio">${h.radio('admin_perm_%s' % _user.user_id,'repository.none', disabled="disabled")}</td>
23 23 <td class="td-radio">${h.radio('admin_perm_%s' % _user.user_id,'repository.read', disabled="disabled")}</td>
24 24 <td class="td-radio">${h.radio('admin_perm_%s' % _user.user_id,'repository.write', disabled="disabled")}</td>
25 25 <td class="td-radio">${h.radio('admin_perm_%s' % _user.user_id,'repository.admin', 'repository.admin', disabled="disabled")}</td>
26 26 <td class="td-user">
27 27 ${base.gravatar(_user.email, 16)}
28 28 <span class="user">
29 29 ${h.link_to_user(_user.username)}
30 30 %if getattr(_user, 'admin_row', None):
31 31 (${_('super admin')})
32 32 %endif
33 33 %if getattr(_user, 'owner_row', None):
34 34 (${_('owner')})
35 35 %endif
36 36 </span>
37 37 </td>
38 38 <td></td>
39 39 </tr>
40 40 %else:
41 41 ##forbid revoking permission from yourself, except if you're an super admin
42 42 <tr>
43 43 %if c.rhodecode_user.user_id != _user.user_id or c.rhodecode_user.is_admin:
44 44 <td class="td-radio">${h.radio('u_perm_%s' % _user.user_id,'group.none')}</td>
45 45 <td class="td-radio">${h.radio('u_perm_%s' % _user.user_id,'group.read')}</td>
46 46 <td class="td-radio">${h.radio('u_perm_%s' % _user.user_id,'group.write')}</td>
47 47 <td class="td-radio">${h.radio('u_perm_%s' % _user.user_id,'group.admin')}</td>
48 48 <td class="td-user">
49 49 ${base.gravatar(_user.email, 16)}
50 50 <span class="user">
51 51 % if _user.username == h.DEFAULT_USER:
52 52 ${h.DEFAULT_USER} <span class="user-perm-help-text"> - ${_('permission for all other users')}</span>
53 53 % else:
54 54 ${h.link_to_user(_user.username)}
55 55 % endif
56 56 </span>
57 57 </td>
58 58 <td class="td-action">
59 59 %if _user.username != h.DEFAULT_USER:
60 60 <span class="btn btn-link btn-danger revoke_perm"
61 61 member="${_user.user_id}" member_type="user">
62 62 <i class="icon-remove"></i> ${_('Revoke')}
63 63 </span>
64 64 %endif
65 65 </td>
66 66 %else:
67 67 ## special case for current user permissions, we make sure he cannot take his own permissions
68 68 <td class="td-radio">${h.radio('u_perm_%s' % _user.user_id,'group.none', disabled="disabled")}</td>
69 69 <td class="td-radio">${h.radio('u_perm_%s' % _user.user_id,'group.read', disabled="disabled")}</td>
70 70 <td class="td-radio">${h.radio('u_perm_%s' % _user.user_id,'group.write', disabled="disabled")}</td>
71 71 <td class="td-radio">${h.radio('u_perm_%s' % _user.user_id,'group.admin', disabled="disabled")}</td>
72 72 <td class="td-user">
73 73 ${base.gravatar(_user.email, 16)}
74 74 <span class="user">
75 75 % if _user.username == h.DEFAULT_USER:
76 76 ${h.DEFAULT_USER} <span class="user-perm-help-text"> - ${_('permission for all other users')}</span>
77 77 % else:
78 78 ${h.link_to_user(_user.username)}
79 79 % endif
80 80 <span class="user-perm-help-text">(${_('delegated admin')})</span>
81 81 </span>
82 82 </td>
83 83 <td></td>
84 84 %endif
85 85 </tr>
86 86 %endif
87 87 %endfor
88 88
89 89 ## USER GROUPS
90 90 %for _user_group in c.repo_group.permission_user_groups():
91 91 <tr id="id${id(_user_group.users_group_name)}">
92 92 <td class="td-radio">${h.radio('g_perm_%s' % _user_group.users_group_id,'group.none')}</td>
93 93 <td class="td-radio">${h.radio('g_perm_%s' % _user_group.users_group_id,'group.read')}</td>
94 94 <td class="td-radio">${h.radio('g_perm_%s' % _user_group.users_group_id,'group.write')}</td>
95 95 <td class="td-radio">${h.radio('g_perm_%s' % _user_group.users_group_id,'group.admin')}</td>
96 96 <td class="td-componentname">
97 97 <i class="icon-group" ></i>
98 98 %if h.HasPermissionAny('hg.admin')():
99 99 <a href="${h.route_path('edit_user_group',user_group_id=_user_group.users_group_id)}">
100 100 ${_user_group.users_group_name}
101 101 </a>
102 102 %else:
103 103 ${_user_group.users_group_name}
104 104 %endif
105 105 </td>
106 106 <td class="td-action">
107 107 <span class="btn btn-link btn-danger revoke_perm"
108 108 member="${_user_group.users_group_id}" member_type="user_group">
109 109 <i class="icon-remove"></i> ${_('Revoke')}
110 110 </span>
111 111 </td>
112 112 </tr>
113 113 %endfor
114 114
115 115 <tr class="new_members" id="add_perm_input"></tr>
116 116 </table>
117 117 <div id="add_perm" class="link">
118 118 ${_('Add new')}
119 119 </div>
120 120 <div class="fields">
121 121 <div class="field">
122 122 <div class="label label-radio">
123 123 ${_('Apply to children')}:
124 124 </div>
125 125 <div class="radios">
126 126 ${h.radio('recursive', 'none', label=_('None'), checked="checked")}
127 127 ${h.radio('recursive', 'groups', label=_('Repository Groups'))}
128 128 ${h.radio('recursive', 'repos', label=_('Repositories'))}
129 129 ${h.radio('recursive', 'all', label=_('Both'))}
130 130 <span class="help-block">${_('Set or revoke permissions to selected types of children of this group, including non-private repositories and other groups if chosen.')}</span>
131 131 </div>
132 132 </div>
133 133 </div>
134 134 <div class="buttons">
135 135 ${h.submit('save',_('Save'),class_="btn btn-primary")}
136 136 ${h.reset('reset',_('Reset'),class_="btn btn-danger")}
137 137 </div>
138 138 ${h.end_form()}
139 139 </div>
140 140 </div>
141 141 <script type="text/javascript">
142 142 $('#add_perm').on('click', function(e){
143 143 addNewPermInput($(this), 'group');
144 144 });
145 145 $('.revoke_perm').on('click', function(e){
146 146 markRevokePermInput($(this), 'group');
147 147 })
148 148 </script>
@@ -1,90 +1,90 b''
1 1 ## -*- coding: utf-8 -*-
2 2 <%namespace name="base" file="/base/base.mako"/>
3 3
4 4 <div class="panel panel-default">
5 5 <div class="panel-heading">
6 6 <h3 class="panel-title">${_('Settings for Repository Group: %s') % c.repo_group.name}</h3>
7 7 </div>
8 8 <div class="panel-body">
9 ${h.secure_form(h.url('update_repo_group',group_name=c.repo_group.group_name),method='put')}
9 ${h.secure_form(h.url('update_repo_group',group_name=c.repo_group.group_name),method='put', request=request)}
10 10 <div class="form">
11 11 <!-- fields -->
12 12 <div class="fields">
13 13 <div class="field">
14 14 <div class="label">
15 15 <label for="group_name">${_('Group Name')}:</label>
16 16 </div>
17 17 <div class="input">
18 18 ${h.text('group_name',class_='medium')}
19 19 </div>
20 20 </div>
21 21
22 22 <div class="field badged-field">
23 23 <div class="label">
24 24 <label for="user">${_('Owner')}:</label>
25 25 </div>
26 26 <div class="input">
27 27 <div class="badge-input-container">
28 28 <div class="user-badge">
29 29 ${base.gravatar_with_user(c.repo_group.user.email, show_disabled=not c.repo_group.user.active)}
30 30 </div>
31 31 <div class="badge-input-wrap">
32 32 ${h.text('user', class_="medium", autocomplete="off")}
33 33 </div>
34 34 </div>
35 35 <form:error name="user"/>
36 36 <p class="help-block">${_('Change owner of this repository group.')}</p>
37 37 </div>
38 38 </div>
39 39
40 40 <div class="field">
41 41 <div class="label label-textarea">
42 42 <label for="group_description">${_('Description')}:</label>
43 43 </div>
44 44 <div class="textarea text-area editor">
45 45 ${h.textarea('group_description',cols=23,rows=5,class_="medium")}
46 46 <% metatags_url = h.literal('''<a href="#metatagsShow" onclick="$('#meta-tags-desc').toggle();return false">meta-tags</a>''') %>
47 47 <span class="help-block">${_('Plain text format with support of {metatags}').format(metatags=metatags_url)|n}</span>
48 48 <span id="meta-tags-desc" style="display: none">
49 49 <%namespace name="dt" file="/data_table/_dt_elements.mako"/>
50 50 ${dt.metatags_help()}
51 51 </span>
52 52 </div>
53 53 </div>
54 54
55 55 <div class="field">
56 56 <div class="label">
57 57 <label for="group_parent_id">${_('Group parent')}:</label>
58 58 </div>
59 59 <div class="select">
60 60 ${h.select('group_parent_id','',c.repo_groups,class_="medium")}
61 61 </div>
62 62 </div>
63 63 <div class="field">
64 64 <div class="label label-checkbox">
65 65 <label for="enable_locking">${_('Enable Repository Locking')}:</label>
66 66 </div>
67 67 <div class="checkboxes">
68 68 ${h.checkbox('enable_locking',value="True")}
69 69 <span class="help-block">${_('Repository locking will be enabled on all subgroups and repositories inside this repository group. Pulling from a repository locks it, and it is unlocked by pushing back by the same user.')}</span>
70 70 </div>
71 71 </div>
72 72 <div class="buttons">
73 73 ${h.submit('save',_('Save'),class_="btn")}
74 74 ${h.reset('reset',_('Reset'),class_="btn")}
75 75 </div>
76 76 </div>
77 77 </div>
78 78 ${h.end_form()}
79 79 </div>
80 80 </div>
81 81 <script>
82 82 $(document).ready(function(){
83 83 $("#group_parent_id").select2({
84 84 'containerCssClass': "drop-menu",
85 85 'dropdownCssClass': "drop-menu-dropdown",
86 86 'dropdownAutoWidth': true
87 87 });
88 88 UsersAutoComplete('user', '${c.rhodecode_user.user_id}');
89 89 })
90 90 </script>
@@ -1,164 +1,164 b''
1 1 ## -*- coding: utf-8 -*-
2 2
3 ${h.secure_form(h.route_path('repo_create'), method='POST', request=request)}
3 ${h.secure_form(h.route_path('repo_create'), request=request)}
4 4 <div class="form">
5 5 <!-- fields -->
6 6 <div class="fields">
7 7 <div class="field">
8 8 <div class="label">
9 9 <label for="repo_name">${_('Name')}:</label>
10 10 </div>
11 11 <div class="input">
12 12 ${h.text('repo_name', class_="medium")}
13 13 <div class="info-block">
14 14 <a id="remote_clone_toggle" href="#"><i class="icon-download-alt"></i> ${_('Import Existing Repository ?')}</a>
15 15 </div>
16 16 %if not c.rhodecode_user.is_admin:
17 17 ${h.hidden('user_created',True)}
18 18 %endif
19 19 </div>
20 20 </div>
21 21 <div id="remote_clone" class="field" style="display: none;">
22 22 <div class="label">
23 23 <label for="clone_uri">${_('Clone from')}:</label>
24 24 </div>
25 25 <div class="input">
26 26 ${h.text('clone_uri', class_="medium")}
27 27 <span class="help-block">
28 28 <pre>
29 29 - The repository must be accessible over http:// or https://
30 30 - For Git projects it's recommended appending .git to the end of clone url.
31 31 - Make sure to select proper repository type from the below selector before importing it.
32 32 - If your HTTP[S] repository is not publicly accessible,
33 33 add authentication information to the URL: https://username:password@server.company.com/repo-name.
34 34 - The Git LFS/Mercurial Largefiles objects will not be imported.
35 35 - For very large repositories, it's recommended to manually copy them into the
36 36 RhodeCode <a href="${h.url('admin_settings_vcs', anchor='vcs-storage-options')}">storage location</a> and run <a href="${h.url('admin_settings_mapping')}">Remap and Rescan</a>.
37 37 </pre>
38 38 </span>
39 39 </div>
40 40 </div>
41 41 <div class="field">
42 42 <div class="label">
43 43 <label for="repo_description">${_('Description')}:</label>
44 44 </div>
45 45 <div class="textarea editor">
46 46 ${h.textarea('repo_description')}
47 47 <% metatags_url = h.literal('''<a href="#metatagsShow" onclick="$('#meta-tags-desc').toggle();return false">meta-tags</a>''') %>
48 48 <span class="help-block">${_('Plain text format with support of {metatags}. Add a README file for longer descriptions').format(metatags=metatags_url)|n}</span>
49 49 <span id="meta-tags-desc" style="display: none">
50 50 <%namespace name="dt" file="/data_table/_dt_elements.mako"/>
51 51 ${dt.metatags_help()}
52 52 </span>
53 53 </div>
54 54 </div>
55 55 <div class="field">
56 56 <div class="label">
57 57 <label for="repo_group">${_('Repository Group')}:</label>
58 58 </div>
59 59 <div class="select">
60 60 ${h.select('repo_group',request.GET.get('parent_group'),c.repo_groups,class_="medium")}
61 61 % if c.personal_repo_group:
62 62 <a class="btn" href="#" id="select_my_group" data-personal-group-id="${c.personal_repo_group.group_id}">
63 63 ${_('Select my personal group (%(repo_group_name)s)') % {'repo_group_name': c.personal_repo_group.group_name}}
64 64 </a>
65 65 % endif
66 66 <span class="help-block">${_('Optionally select a group to put this repository into.')}</span>
67 67 </div>
68 68 </div>
69 69 <div id="copy_perms" class="field">
70 70 <div class="label label-checkbox">
71 71 <label for="repo_copy_permissions">${_('Copy Parent Group Permissions')}:</label>
72 72 </div>
73 73 <div class="checkboxes">
74 74 ${h.checkbox('repo_copy_permissions', value="True", checked="checked")}
75 75 <span class="help-block">${_('Copy permission set from the parent repository group.')}</span>
76 76 </div>
77 77 </div>
78 78 <div class="field">
79 79 <div class="label">
80 80 <label for="repo_type">${_('Type')}:</label>
81 81 </div>
82 82 <div class="select">
83 83 ${h.select('repo_type','hg',c.backends)}
84 84 <span class="help-block">${_('Set the type of repository to create.')}</span>
85 85 </div>
86 86 </div>
87 87 <div class="field">
88 88 <div class="label">
89 89 <label for="repo_landing_rev">${_('Landing commit')}:</label>
90 90 </div>
91 91 <div class="select">
92 92 ${h.select('repo_landing_rev','',c.landing_revs,class_="medium")}
93 93 <span class="help-block">${_('The default commit for file pages, downloads, full text search index, and README generation.')}</span>
94 94 </div>
95 95 </div>
96 96 <div class="field">
97 97 <div class="label label-checkbox">
98 98 <label for="repo_private">${_('Private Repository')}:</label>
99 99 </div>
100 100 <div class="checkboxes">
101 101 ${h.checkbox('repo_private',value="True")}
102 102 <span class="help-block">${_('Private repositories are only visible to people explicitly added as collaborators.')}</span>
103 103 </div>
104 104 </div>
105 105 <div class="buttons">
106 106 ${h.submit('save',_('Save'),class_="btn")}
107 107 </div>
108 108 </div>
109 109 </div>
110 110 <script>
111 111 $(document).ready(function(){
112 112 var setCopyPermsOption = function(group_val){
113 113 if(group_val != "-1"){
114 114 $('#copy_perms').show()
115 115 }
116 116 else{
117 117 $('#copy_perms').hide();
118 118 }
119 119 };
120 120
121 121 $('#remote_clone_toggle').on('click', function(e){
122 122 $('#remote_clone').show();
123 123 e.preventDefault();
124 124 });
125 125
126 126 if($('#remote_clone input').hasClass('error')){
127 127 $('#remote_clone').show();
128 128 }
129 129 if($('#remote_clone input').val()){
130 130 $('#remote_clone').show();
131 131 }
132 132
133 133 $("#repo_group").select2({
134 134 'containerCssClass': "drop-menu",
135 135 'dropdownCssClass': "drop-menu-dropdown",
136 136 'dropdownAutoWidth': true,
137 137 'width': "resolve"
138 138 });
139 139
140 140 setCopyPermsOption($('#repo_group').val());
141 141 $("#repo_group").on("change", function(e) {
142 142 setCopyPermsOption(e.val)
143 143 });
144 144
145 145 $("#repo_type").select2({
146 146 'containerCssClass': "drop-menu",
147 147 'dropdownCssClass': "drop-menu-dropdown",
148 148 'minimumResultsForSearch': -1,
149 149 });
150 150 $("#repo_landing_rev").select2({
151 151 'containerCssClass': "drop-menu",
152 152 'dropdownCssClass': "drop-menu-dropdown",
153 153 'minimumResultsForSearch': -1,
154 154 });
155 155 $('#repo_name').focus();
156 156
157 157 $('#select_my_group').on('click', function(e){
158 158 e.preventDefault();
159 159 $("#repo_group").val($(this).data('personalGroupId')).trigger("change");
160 160 })
161 161
162 162 })
163 163 </script>
164 164 ${h.end_form()}
@@ -1,210 +1,210 b''
1 1 <%namespace name="base" file="/base/base.mako"/>
2 2
3 3 <%
4 4 elems = [
5 5 (_('Owner'), lambda:base.gravatar_with_user(c.rhodecode_db_repo.user.email), '', ''),
6 6 (_('Created on'), h.format_date(c.rhodecode_db_repo.created_on), '', ''),
7 7 (_('Updated on'), h.format_date(c.rhodecode_db_repo.updated_on), '', ''),
8 8 (_('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'))), '', ''),
9 9 ]
10 10 %>
11 11
12 12 <div class="panel panel-default">
13 13 <div class="panel-heading" id="advanced-info" >
14 14 <h3 class="panel-title">${_('Repository: %s') % c.rhodecode_db_repo.repo_name} <a class="permalink" href="#advanced-info"> ¶</a></h3>
15 15 </div>
16 16 <div class="panel-body">
17 17 ${base.dt_info_panel(elems)}
18 18 </div>
19 19 </div>
20 20
21 21
22 22 <div class="panel panel-default">
23 23 <div class="panel-heading" id="advanced-fork">
24 24 <h3 class="panel-title">${_('Fork Reference')} <a class="permalink" href="#advanced-fork"> ¶</a></h3>
25 25 </div>
26 26 <div class="panel-body">
27 ${h.secure_form(h.route_path('edit_repo_advanced_fork', repo_name=c.rhodecode_db_repo.repo_name), method='POST', request=request)}
27 ${h.secure_form(h.route_path('edit_repo_advanced_fork', repo_name=c.rhodecode_db_repo.repo_name), request=request)}
28 28
29 29 % if c.rhodecode_db_repo.fork:
30 30 <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))})}
31 31 | <button class="btn btn-link btn-danger" type="submit">Remove fork reference</button></div>
32 32 % endif
33 33
34 34 <div class="field">
35 35 ${h.hidden('id_fork_of')}
36 36 ${h.submit('set_as_fork_%s' % c.rhodecode_db_repo.repo_name,_('Set'),class_="btn btn-small",)}
37 37 </div>
38 38 <div class="field">
39 39 <span class="help-block">${_('Manually set this repository as a fork of another from the list')}</span>
40 40 </div>
41 41 ${h.end_form()}
42 42 </div>
43 43 </div>
44 44
45 45
46 46 <div class="panel panel-default">
47 47 <div class="panel-heading" id="advanced-journal">
48 48 <h3 class="panel-title">${_('Public Journal Visibility')} <a class="permalink" href="#advanced-journal"> ¶</a></h3>
49 49 </div>
50 50 <div class="panel-body">
51 ${h.secure_form(h.route_path('edit_repo_advanced_journal', repo_name=c.rhodecode_db_repo.repo_name), method='POST', request=request)}
51 ${h.secure_form(h.route_path('edit_repo_advanced_journal', repo_name=c.rhodecode_db_repo.repo_name), request=request)}
52 52 <div class="field">
53 53 %if c.in_public_journal:
54 54 <button class="btn btn-small" type="submit">
55 55 ${_('Remove from Public Journal')}
56 56 </button>
57 57 %else:
58 58 <button class="btn btn-small" type="submit">
59 59 ${_('Add to Public Journal')}
60 60 </button>
61 61 %endif
62 62 </div>
63 63 <div class="field" >
64 64 <span class="help-block">${_('All actions made on this repository will be visible to everyone following the public journal.')}</span>
65 65 </div>
66 66 ${h.end_form()}
67 67 </div>
68 68 </div>
69 69
70 70
71 71 <div class="panel panel-default">
72 72 <div class="panel-heading" id="advanced-locking">
73 73 <h3 class="panel-title">${_('Locking state')} <a class="permalink" href="#advanced-locking"> ¶</a></h3>
74 74 </div>
75 75 <div class="panel-body">
76 ${h.secure_form(h.route_path('edit_repo_advanced_locking', repo_name=c.rhodecode_db_repo.repo_name), method='POST', request=request)}
76 ${h.secure_form(h.route_path('edit_repo_advanced_locking', repo_name=c.rhodecode_db_repo.repo_name), request=request)}
77 77
78 78 %if c.rhodecode_db_repo.locked[0]:
79 79 <div class="panel-body-title-text">${'Locked by %s on %s. Lock reason: %s' % (h.person_by_id(c.rhodecode_db_repo.locked[0]),
80 80 h.format_date(h. time_to_datetime(c.rhodecode_db_repo.locked[1])), c.rhodecode_db_repo.locked[2])}</div>
81 81 %else:
82 82 <div class="panel-body-title-text">${_('This Repository is not currently locked.')}</div>
83 83 %endif
84 84
85 85 <div class="field" >
86 86 %if c.rhodecode_db_repo.locked[0]:
87 87 ${h.hidden('set_unlock', '1')}
88 88 <button class="btn btn-small" type="submit"
89 89 onclick="return confirm('${_('Confirm to unlock repository.')}');">
90 90 <i class="icon-unlock"></i>
91 91 ${_('Unlock repository')}
92 92 </button>
93 93 %else:
94 94 ${h.hidden('set_lock', '1')}
95 95 <button class="btn btn-small" type="submit"
96 96 onclick="return confirm('${_('Confirm to lock repository.')}');">
97 97 <i class="icon-lock"></i>
98 98 ${_('Lock Repository')}
99 99 </button>
100 100 %endif
101 101 </div>
102 102 <div class="field" >
103 103 <span class="help-block">
104 104 ${_('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.')}
105 105 </span>
106 106 </div>
107 107 ${h.end_form()}
108 108 </div>
109 109 </div>
110 110
111 111 <div class="panel panel-danger">
112 112 <div class="panel-heading" id="advanced-delete">
113 113 <h3 class="panel-title">${_('Delete repository')} <a class="permalink" href="#advanced-delete"> ¶</a></h3>
114 114 </div>
115 115 <div class="panel-body">
116 ${h.secure_form(h.route_path('edit_repo_advanced_delete', repo_name=c.repo_name), method='POST', request=request)}
116 ${h.secure_form(h.route_path('edit_repo_advanced_delete', repo_name=c.repo_name), request=request)}
117 117 <table class="display">
118 118 <tr>
119 119 <td>
120 120 ${_ungettext('This repository has %s fork.', 'This repository has %s forks.', c.rhodecode_db_repo.forks.count()) % c.rhodecode_db_repo.forks.count()}
121 121 </td>
122 122 <td>
123 123 %if c.rhodecode_db_repo.forks.count():
124 124 <input type="radio" name="forks" value="detach_forks" checked="checked"/> <label for="forks">${_('Detach forks')}</label>
125 125 %endif
126 126 </td>
127 127 <td>
128 128 %if c.rhodecode_db_repo.forks.count():
129 129 <input type="radio" name="forks" value="delete_forks"/> <label for="forks">${_('Delete forks')}</label>
130 130 %endif
131 131 </td>
132 132 </tr>
133 133 </table>
134 134 <div style="margin: 0 0 20px 0" class="fake-space"></div>
135 135
136 136 <div class="field">
137 137 <button class="btn btn-small btn-danger" type="submit"
138 138 onclick="return confirm('${_('Confirm to delete this repository: %s') % c.repo_name}');">
139 139 <i class="icon-remove-sign"></i>
140 140 ${_('Delete This Repository')}
141 141 </button>
142 142 </div>
143 143 <div class="field">
144 144 <span class="help-block">
145 145 ${_('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.')}
146 146 </span>
147 147 </div>
148 148
149 149 ${h.end_form()}
150 150 </div>
151 151 </div>
152 152
153 153
154 154 <script>
155 155
156 156 var currentRepoId = ${c.rhodecode_db_repo.repo_id};
157 157
158 158 var repoTypeFilter = function(data) {
159 159 var results = [];
160 160
161 161 if (!data.results[0]) {
162 162 return data
163 163 }
164 164
165 165 $.each(data.results[0].children, function() {
166 166 // filter out the SAME repo, it cannot be used as fork of itself
167 167 if (this.obj.repo_id != currentRepoId) {
168 168 this.id = this.obj.repo_id;
169 169 results.push(this)
170 170 }
171 171 });
172 172 data.results[0].children = results;
173 173 return data;
174 174 };
175 175
176 176 $("#id_fork_of").select2({
177 177 cachedDataSource: {},
178 178 minimumInputLength: 2,
179 179 placeholder: "${_('Change repository') if c.rhodecode_db_repo.fork else _('Pick repository')}",
180 180 dropdownAutoWidth: true,
181 181 containerCssClass: "drop-menu",
182 182 dropdownCssClass: "drop-menu-dropdown",
183 183 formatResult: formatResult,
184 184 query: $.debounce(250, function(query){
185 185 self = this;
186 186 var cacheKey = query.term;
187 187 var cachedData = self.cachedDataSource[cacheKey];
188 188
189 189 if (cachedData) {
190 190 query.callback({results: cachedData.results});
191 191 } else {
192 192 $.ajax({
193 193 url: pyroutes.url('repo_list_data'),
194 194 data: {'query': query.term, repo_type: '${c.rhodecode_db_repo.repo_type}'},
195 195 dataType: 'json',
196 196 type: 'GET',
197 197 success: function(data) {
198 198 data = repoTypeFilter(data);
199 199 self.cachedDataSource[cacheKey] = data;
200 200 query.callback({results: data.results});
201 201 },
202 202 error: function(data, textStatus, errorThrown) {
203 203 alert("Error while fetching entries.\nError code {0} ({1}).".format(data.status, data.statusText));
204 204 }
205 205 })
206 206 }
207 207 })
208 208 });
209 209 </script>
210 210
@@ -1,53 +1,53 b''
1 1 <div class="panel panel-default">
2 2 <div class="panel-heading">
3 3 <h3 class="panel-title">${_('Invalidate Cache for Repository')}</h3>
4 4 </div>
5 5 <div class="panel-body">
6 6
7 7 <h4>${_('Manually invalidate the repository cache. On the next access a repository cache will be recreated.')}</h4>
8 8
9 9 <p>
10 10 ${_('Cache purge can be automated by such api call. Can be called periodically in crontab etc.')}
11 11 <br/>
12 12 <code>
13 13 ${h.api_call_example(method='invalidate_cache', args={"repoid": c.rhodecode_db_repo.repo_name})}
14 14 </code>
15 15 </p>
16 16
17 ${h.secure_form(h.route_path('edit_repo_caches', repo_name=c.repo_name), method='POST', request=request)}
17 ${h.secure_form(h.route_path('edit_repo_caches', repo_name=c.repo_name), request=request)}
18 18 <div class="form">
19 19 <div class="fields">
20 20 ${h.submit('reset_cache_%s' % c.rhodecode_db_repo.repo_name,_('Invalidate repository cache'),class_="btn btn-small",onclick="return confirm('"+_('Confirm to invalidate repository cache')+"');")}
21 21 </div>
22 22 </div>
23 23 ${h.end_form()}
24 24
25 25 </div>
26 26 </div>
27 27
28 28
29 29 <div class="panel panel-default">
30 30 <div class="panel-heading">
31 31 <h3 class="panel-title">
32 32 ${(_ungettext('List of repository caches (%(count)s entry)', 'List of repository caches (%(count)s entries)' ,len(c.rhodecode_db_repo.cache_keys)) % {'count': len(c.rhodecode_db_repo.cache_keys)})}
33 33 </h3>
34 34 </div>
35 35 <div class="panel-body">
36 36 <div class="field" >
37 37 <table class="rctable edit_cache">
38 38 <tr>
39 39 <th>${_('Prefix')}</th>
40 40 <th>${_('Key')}</th>
41 41 <th>${_('Active')}</th>
42 42 </tr>
43 43 %for cache in c.rhodecode_db_repo.cache_keys:
44 44 <tr>
45 45 <td class="td-prefix">${cache.get_prefix() or '-'}</td>
46 46 <td class="td-cachekey">${cache.cache_key}</td>
47 47 <td class="td-active">${h.bool2icon(cache.cache_active)}</td>
48 48 </tr>
49 49 %endfor
50 50 </table>
51 51 </div>
52 52 </div>
53 53 </div>
@@ -1,79 +1,79 b''
1 1 <div class="panel panel-default">
2 2 <div class="panel-heading">
3 3 <h3 class="panel-title">${_('Custom extra fields for this repository')}</h3>
4 4 </div>
5 5 <div class="panel-body">
6 6 %if c.visual.repository_fields:
7 7 %if c.repo_fields:
8 8 <div class="emails_wrap">
9 9 <table class="rctable edit_fields">
10 10 <th>${_('Label')}</th>
11 11 <th>${_('Key')}</th>
12 12 <th>${_('Type')}</th>
13 13 <th>${_('Action')}</th>
14 14
15 15 %for field in c.repo_fields:
16 16 <tr>
17 17 <td class="td-tags">${field.field_label}</td>
18 18 <td class="td-hash">${field.field_key}</td>
19 19 <td class="td-type">${field.field_type}</td>
20 20 <td class="td-action">
21 ${h.secure_form(h.route_path('edit_repo_fields_delete', repo_name=c.rhodecode_db_repo.repo_name, field_id=field.repo_field_id), method='POST', request=request)}
21 ${h.secure_form(h.route_path('edit_repo_fields_delete', repo_name=c.rhodecode_db_repo.repo_name, field_id=field.repo_field_id), request=request)}
22 22 ${h.hidden('del_repo_field',field.repo_field_id)}
23 23 <button class="btn btn-link btn-danger" type="submit"
24 24 onclick="return confirm('${_('Confirm to delete this field: %s') % field.field_key}');">
25 25 ${_('Delete')}
26 26 </button>
27 27 ${h.end_form()}
28 28 </td>
29 29 </tr>
30 30 %endfor
31 31 </table>
32 32 </div>
33 33 %endif
34 ${h.secure_form(h.route_path('edit_repo_fields_create', repo_name=c.repo_name), method='POST', request=request)}
34 ${h.secure_form(h.route_path('edit_repo_fields_create', repo_name=c.repo_name), request=request)}
35 35 <div class="form">
36 36 <!-- fields -->
37 37 <div class="fields">
38 38 <div class="field">
39 39 <div class="label">
40 40 <label for="new_field_key">${_('New Field Key')}:</label>
41 41 </div>
42 42 <div class="input">
43 43 ${h.text('new_field_key', class_='medium')}
44 44 </div>
45 45 </div>
46 46 <div class="field">
47 47 <div class="label">
48 48 <label for="new_field_label">${_('New Field Label')}:</label>
49 49 </div>
50 50 <div class="input">
51 51 ${h.text('new_field_label', class_='medium', placeholder=_('Enter short label'))}
52 52 </div>
53 53 </div>
54 54
55 55 <div class="field">
56 56 <div class="label">
57 57 <label for="new_field_desc">${_('New Field Description')}:</label>
58 58 </div>
59 59 <div class="input">
60 60 ${h.text('new_field_desc', class_='medium', placeholder=_('Enter a full description for the field'))}
61 61 </div>
62 62 </div>
63 63
64 64 <div class="buttons">
65 65 ${h.submit('save',_('Add'),class_="btn")}
66 66 ${h.reset('reset',_('Reset'),class_="btn")}
67 67 </div>
68 68 </div>
69 69 </div>
70 70 ${h.end_form()}
71 71 %else:
72 72 <h2>
73 73 ${_('Extra fields are disabled. You can enable them from the Admin/Settings/Visual page.')}
74 74 </h2>
75 75 %endif
76 76 </div>
77 77 </div>
78 78
79 79
@@ -1,109 +1,109 b''
1 1 <%namespace name="its" file="/base/issue_tracker_settings.mako"/>
2 2
3 3 <div id="repo_issue_tracker" class="${'inherited' if c.settings_model.inherit_global_settings else ''}">
4 ${h.secure_form(h.route_path('edit_repo_issuetracker_update', repo_name=c.repo_name), id="inherit-form", method='POST', request=request)}
4 ${h.secure_form(h.route_path('edit_repo_issuetracker_update', repo_name=c.repo_name), id="inherit-form", request=request)}
5 5 <div class="panel panel-default panel-body">
6 6 <div class="fields">
7 7 <div class="field">
8 8 <div class="label label-checkbox">
9 9 <label for="inherit_default_permissions">${_('Inherit from global settings')}:</label>
10 10 </div>
11 11 <div class="checkboxes">
12 12 ${h.checkbox('inherit_global_issuetracker', value='inherited', checked=c.settings_model.inherit_global_settings)}
13 13 <span class="help-block">
14 14 ${h.literal(_('Select to inherit global patterns for issue tracker.'))}
15 15 </span>
16 16 </div>
17 17 </div>
18 18 </div>
19 19 </div>
20 20
21 21 <div id="inherit_overlay">
22 22 <div class="panel panel-default">
23 23 <div class="panel-heading">
24 24 <h3 class="panel-title">${_('Inherited Issue Tracker Patterns')}</h3>
25 25 </div>
26 26 <div class="panel-body">
27 27 <table class="rctable issuetracker readonly">
28 28 <tr>
29 29 <th>${_('Description')}</th>
30 30 <th>${_('Pattern')}</th>
31 31 <th>${_('Url')}</th>
32 32 <th>${_('Prefix')}</th>
33 33 <th ></th>
34 34 </tr>
35 35 %for uid, entry in c.global_patterns.items():
36 36 <tr id="${uid}">
37 37 <td class="td-description issuetracker_desc">
38 38 <span class="entry">
39 39 ${entry.desc}
40 40 </span>
41 41 </td>
42 42 <td class="td-regex issuetracker_pat">
43 43 <span class="entry">
44 44 ${entry.pat}
45 45 </span>
46 46 </td>
47 47 <td class="td-url issuetracker_url">
48 48 <span class="entry">
49 49 ${entry.url}
50 50 </span>
51 51 </td>
52 52 <td class="td-prefix issuetracker_pref">
53 53 <span class="entry">
54 54 ${entry.pref}
55 55 </span>
56 56 </td>
57 57 <td class="td-action">
58 58 </td>
59 59 </tr>
60 60 %endfor
61 61
62 62 </table>
63 63 </div>
64 64 </div>
65 65 </div>
66 66
67 67 <div id="custom_overlay">
68 68 <div class="panel panel-default">
69 69 <div class="panel-heading">
70 70 <h3 class="panel-title">${_('Issue Tracker / Wiki Patterns')}</h3>
71 71 </div>
72 72 <div class="panel-body">
73 73 ${its.issue_tracker_settings_table(
74 74 patterns=c.repo_patterns.items(),
75 75 form_url=h.route_path('edit_repo_issuetracker', repo_name=c.rhodecode_db_repo.repo_name),
76 76 delete_url=h.route_path('edit_repo_issuetracker_delete', repo_name=c.rhodecode_db_repo.repo_name)
77 77 )}
78 78 <div class="buttons">
79 79 <button type="submit" class="btn btn-primary save-inheritance" id="save">${_('Save')}</button>
80 80 <button type="reset" class="btn reset-inheritance">${_('Reset')}</button>
81 81 </div>
82 82 </div>
83 83 </div>
84 84 </div>
85 85
86 86
87 87 ${h.end_form()}
88 88
89 89 <div class="panel panel-default">
90 90 <div class="panel-heading">
91 91 <h3 class="panel-title">${_('Test Patterns')}</h3>
92 92 </div>
93 93 <div class="panel-body">
94 94 ${its.issue_tracker_new_row()}
95 95 ${its.issue_tracker_settings_test(test_url=h.route_path('edit_repo_issuetracker_test', repo_name=c.rhodecode_db_repo.repo_name))}
96 96 </div>
97 97 </div>
98 98
99 99 </div>
100 100
101 101 <script>
102 102 $('#inherit_global_issuetracker').on('change', function(e){
103 103 $('#repo_issue_tracker').toggleClass('inherited',this.checked);
104 104 });
105 105
106 106 $('.reset-inheritance').on('click', function(e){
107 107 $('#inherit_global_issuetracker').prop('checked', false).change();
108 108 });
109 109 </script>
@@ -1,123 +1,123 b''
1 1 <%namespace name="base" file="/base/base.mako"/>
2 2
3 3 <div class="panel panel-default">
4 4 <div class="panel-heading">
5 5 <h3 class="panel-title">${_('Repository Permissions')}</h3>
6 6 </div>
7 7 <div class="panel-body">
8 ${h.secure_form(h.route_path('edit_repo_perms', repo_name=c.repo_name), method='POST', request=request)}
8 ${h.secure_form(h.route_path('edit_repo_perms', repo_name=c.repo_name), request=request)}
9 9 <table id="permissions_manage" class="rctable permissions">
10 10 <tr>
11 11 <th class="td-radio">${_('None')}</th>
12 12 <th class="td-radio">${_('Read')}</th>
13 13 <th class="td-radio">${_('Write')}</th>
14 14 <th class="td-radio">${_('Admin')}</th>
15 15 <th class="td-owner">${_('User/User Group')}</th>
16 16 <th></th>
17 17 </tr>
18 18 ## USERS
19 19 %for _user in c.rhodecode_db_repo.permissions():
20 20 %if getattr(_user, 'admin_row', None) or getattr(_user, 'owner_row', None):
21 21 <tr class="perm_admin_row">
22 22 <td class="td-radio">${h.radio('admin_perm_%s' % _user.user_id,'repository.none', disabled="disabled")}</td>
23 23 <td class="td-radio">${h.radio('admin_perm_%s' % _user.user_id,'repository.read', disabled="disabled")}</td>
24 24 <td class="td-radio">${h.radio('admin_perm_%s' % _user.user_id,'repository.write', disabled="disabled")}</td>
25 25 <td class="td-radio">${h.radio('admin_perm_%s' % _user.user_id,'repository.admin', 'repository.admin', disabled="disabled")}</td>
26 26 <td class="td-user">
27 27 ${base.gravatar(_user.email, 16)}
28 28 ${h.link_to_user(_user.username)}
29 29 %if getattr(_user, 'admin_row', None):
30 30 (${_('super admin')})
31 31 %endif
32 32 %if getattr(_user, 'owner_row', None):
33 33 (${_('owner')})
34 34 %endif
35 35 </td>
36 36 <td></td>
37 37 </tr>
38 38 %elif _user.username == h.DEFAULT_USER and c.rhodecode_db_repo.private:
39 39 <tr>
40 40 <td colspan="4">
41 41 <span class="private_repo_msg">
42 42 <strong title="${h.tooltip(_user.permission)}">${_('private repository')}</strong>
43 43 </span>
44 44 </td>
45 45 <td class="private_repo_msg">
46 46 ${base.gravatar(h.DEFAULT_USER_EMAIL, 16)}
47 47 ${h.DEFAULT_USER} - ${_('only users/user groups explicitly added here will have access')}</td>
48 48 <td></td>
49 49 </tr>
50 50 %else:
51 51 <tr>
52 52 <td class="td-radio">${h.radio('u_perm_%s' % _user.user_id,'repository.none', checked=_user.permission=='repository.none')}</td>
53 53 <td class="td-radio">${h.radio('u_perm_%s' % _user.user_id,'repository.read', checked=_user.permission=='repository.read')}</td>
54 54 <td class="td-radio">${h.radio('u_perm_%s' % _user.user_id,'repository.write', checked=_user.permission=='repository.write')}</td>
55 55 <td class="td-radio">${h.radio('u_perm_%s' % _user.user_id,'repository.admin', checked=_user.permission=='repository.admin')}</td>
56 56 <td class="td-user">
57 57 ${base.gravatar(_user.email, 16)}
58 58 <span class="user">
59 59 % if _user.username == h.DEFAULT_USER:
60 60 ${h.DEFAULT_USER} <span class="user-perm-help-text"> - ${_('permission for all other users')}</span>
61 61 % else:
62 62 ${h.link_to_user(_user.username)}
63 63 % endif
64 64 </span>
65 65 </td>
66 66 <td class="td-action">
67 67 %if _user.username != h.DEFAULT_USER:
68 68 <span class="btn btn-link btn-danger revoke_perm"
69 69 member="${_user.user_id}" member_type="user">
70 70 <i class="icon-remove"></i> ${_('Revoke')}
71 71 </span>
72 72 %endif
73 73 </td>
74 74 </tr>
75 75 %endif
76 76 %endfor
77 77
78 78 ## USER GROUPS
79 79 %for _user_group in c.rhodecode_db_repo.permission_user_groups():
80 80 <tr>
81 81 <td class="td-radio">${h.radio('g_perm_%s' % _user_group.users_group_id,'repository.none', checked=_user_group.permission=='repository.none')}</td>
82 82 <td class="td-radio">${h.radio('g_perm_%s' % _user_group.users_group_id,'repository.read', checked=_user_group.permission=='repository.read')}</td>
83 83 <td class="td-radio">${h.radio('g_perm_%s' % _user_group.users_group_id,'repository.write', checked=_user_group.permission=='repository.write')}</td>
84 84 <td class="td-radio">${h.radio('g_perm_%s' % _user_group.users_group_id,'repository.admin', checked=_user_group.permission=='repository.admin')}</td>
85 85 <td class="td-componentname">
86 86 <i class="icon-group" ></i>
87 87 %if h.HasPermissionAny('hg.admin')():
88 88 <a href="${h.route_path('edit_user_group',user_group_id=_user_group.users_group_id)}">
89 89 ${_user_group.users_group_name}
90 90 </a>
91 91 %else:
92 92 ${_user_group.users_group_name}
93 93 %endif
94 94 </td>
95 95 <td class="td-action">
96 96 <span class="btn btn-link btn-danger revoke_perm"
97 97 member="${_user_group.users_group_id}" member_type="user_group">
98 98 <i class="icon-remove"></i> ${_('Revoke')}
99 99 </span>
100 100 </td>
101 101 </tr>
102 102 %endfor
103 103 <tr class="new_members" id="add_perm_input"></tr>
104 104 </table>
105 105 <div id="add_perm" class="link">
106 106 ${_('Add new')}
107 107 </div>
108 108 <div class="buttons">
109 109 ${h.submit('save',_('Save'),class_="btn btn-primary")}
110 110 ${h.reset('reset',_('Reset'),class_="btn btn-danger")}
111 111 </div>
112 112 ${h.end_form()}
113 113 </div>
114 114 </div>
115 115
116 116 <script type="text/javascript">
117 117 $('#add_perm').on('click', function(e){
118 118 addNewPermInput($(this), 'repository');
119 119 });
120 120 $('.revoke_perm').on('click', function(e){
121 121 markRevokePermInput($(this), 'repository');
122 122 });
123 123 </script>
@@ -1,40 +1,40 b''
1 1 <div class="panel panel-default">
2 2 <div class="panel-heading">
3 3 <h3 class="panel-title">${_('Remote url')}</h3>
4 4 </div>
5 5 <div class="panel-body">
6 6
7 7 <h4>${_('Manually pull changes from external repository.')}</h4>
8 8
9 9 %if c.rhodecode_db_repo.clone_uri:
10 10
11 11 ${_('Remote mirror url')}:
12 12 <a href="${c.rhodecode_db_repo.clone_uri}">${c.rhodecode_db_repo.clone_uri_hidden}</a>
13 13
14 14 <p>
15 15 ${_('Pull can be automated by such api call. Can be called periodically in crontab etc.')}
16 16 <br/>
17 17 <code>
18 18 ${h.api_call_example(method='pull', args={"repoid": c.rhodecode_db_repo.repo_name})}
19 19 </code>
20 20 </p>
21 21
22 ${h.secure_form(h.route_path('edit_repo_remote_pull', repo_name=c.repo_name), method='POST', request=request)}
22 ${h.secure_form(h.route_path('edit_repo_remote_pull', repo_name=c.repo_name), request=request)}
23 23 <div class="form">
24 24 <div class="fields">
25 25 ${h.submit('remote_pull_%s' % c.rhodecode_db_repo.repo_name,_('Pull changes from remote location'),class_="btn btn-small",onclick="return confirm('"+_('Confirm to pull changes from remote side')+"');")}
26 26 </div>
27 27 </div>
28 28 ${h.end_form()}
29 29 %else:
30 30
31 31 ${_('This repository does not have any remote mirror url set.')}
32 32 <a href="${h.route_path('edit_repo', repo_name=c.rhodecode_db_repo.repo_name)}">${_('Set remote url.')}</a>
33 33 <br/>
34 34 <br/>
35 35 <button class="btn disabled" type="submit" disabled="disabled">
36 36 ${_('Pull changes from remote location')}
37 37 </button>
38 38 %endif
39 39 </div>
40 40 </div>
@@ -1,266 +1,266 b''
1 1 ## -*- coding: utf-8 -*-
2 2 <%namespace name="base" file="/base/base.mako"/>
3 3
4 4 <div class="panel panel-default">
5 5 <div class="panel-heading">
6 6 <h3 class="panel-title">${_('Settings for Repository: %s') % c.rhodecode_db_repo.repo_name}</h3>
7 7 </div>
8 8 <div class="panel-body">
9 ${h.secure_form(h.route_path('edit_repo', repo_name=c.rhodecode_db_repo.repo_name), method='POST', request=request)}
9 ${h.secure_form(h.route_path('edit_repo', repo_name=c.rhodecode_db_repo.repo_name), request=request)}
10 10 <div class="form">
11 11 <!-- fields -->
12 12 <div class="fields">
13 13
14 14 <div class="field">
15 15 <div class="label">
16 16 <label for="repo_name">${_('Name')}:</label>
17 17 </div>
18 18 <div class="input">
19 19 ${c.form['repo_name'].render(css_class='medium', oid='repo_name')|n}
20 20 ${c.form.render_error(request, c.form['repo_name'])|n}
21 21
22 22 <p class="help-block">${_('Non-changeable id')}: `_${c.rhodecode_db_repo.repo_id}` <span><a href="#" onclick="$('#clone_id').toggle();return false">${_('what is that ?')}</a></span></p>
23 23 <p id="clone_id" style="display:none;">
24 24 ${_('URL by id')}: `${c.rhodecode_db_repo.clone_url(with_id=True)}` <br/>
25 25 ${_('''In case this repository is renamed or moved into another group the repository url changes.
26 26 Using above url guarantees that this repository will always be accessible under such url.
27 27 Useful for CI systems, or any other cases that you need to hardcode the url into 3rd party service.''')}</p>
28 28 </div>
29 29 </div>
30 30
31 31 <div class="field">
32 32 <div class="label">
33 33 <label for="repo_group">${_('Repository group')}:</label>
34 34 </div>
35 35 <div class="select">
36 36 ${c.form['repo_group'].render(css_class='medium', oid='repo_group')|n}
37 37 ${c.form.render_error(request, c.form['repo_group'])|n}
38 38
39 39 % if c.personal_repo_group:
40 40 <a class="btn" href="#" data-personal-group-name="${c.personal_repo_group.group_name}" data-personal-group-id="${c.personal_repo_group.group_id}" onclick="selectMyGroup(this); return false">
41 41 ${_('Select my personal group (`%(repo_group_name)s`)') % {'repo_group_name': c.personal_repo_group.group_name}}
42 42 </a>
43 43 % endif
44 44 <p class="help-block">${_('Optional select a group to put this repository into.')}</p>
45 45 </div>
46 46 </div>
47 47
48 48 % if c.rhodecode_db_repo.repo_type != 'svn':
49 49 <div class="field">
50 50 <div class="label">
51 51 <label for="clone_uri">${_('Remote uri')}:</label>
52 52 </div>
53 53 <div class="input">
54 54 %if c.rhodecode_db_repo.clone_uri:
55 55 ## display, if we don't have any errors
56 56 % if not c.form['repo_clone_uri'].error:
57 57 <div id="clone_uri_hidden" class='text-as-placeholder'>
58 58 <span id="clone_uri_hidden_value">${c.rhodecode_db_repo.clone_uri_hidden}</span>
59 59 <span class="link" id="edit_clone_uri"><i class="icon-edit"></i>${_('edit')}</span>
60 60 </div>
61 61 % endif
62 62
63 63 ## alter field
64 64 <div id="alter_clone_uri" style="${'' if c.form['repo_clone_uri'].error else 'display: none'}">
65 65 ${c.form['repo_clone_uri'].render(css_class='medium', oid='clone_uri', placeholder=_('enter new value, or leave empty to remove'))|n}
66 66 ${c.form.render_error(request, c.form['repo_clone_uri'])|n}
67 67 % if c.form['repo_clone_uri'].error:
68 68 ## we got error from form subit, means we modify the url
69 69 ${h.hidden('repo_clone_uri_change', 'MOD')}
70 70 % else:
71 71 ${h.hidden('repo_clone_uri_change', 'OLD')}
72 72 % endif
73 73
74 74 % if not c.form['repo_clone_uri'].error:
75 75 <span class="link" id="cancel_edit_clone_uri">${_('cancel')}</span>
76 76 % endif
77 77
78 78 </div>
79 79 %else:
80 80 ## not set yet, display form to set it
81 81 ${c.form['repo_clone_uri'].render(css_class='medium', oid='clone_uri')|n}
82 82 ${c.form.render_error(request, c.form['repo_clone_uri'])|n}
83 83 ${h.hidden('repo_clone_uri_change', 'NEW')}
84 84 %endif
85 85 <p id="alter_clone_uri_help_block" class="help-block">
86 86 <% pull_link = h.literal(h.link_to('remote sync', h.route_path('edit_repo_remote', repo_name=c.repo_name))) %>
87 87 ${_('http[s] url where from repository was imported, this field can used for doing {pull_link}.').format(pull_link=pull_link)|n} <br/>
88 88 ${_('This field is stored encrypted inside Database, a format of http://user:password@server.com/repo_name can be used and will be hidden from display.')}
89 89 </p>
90 90 </div>
91 91 </div>
92 92 % else:
93 93 ${h.hidden('repo_clone_uri', '')}
94 94 % endif
95 95
96 96 <div class="field">
97 97 <div class="label">
98 98 <label for="repo_landing_commit_ref">${_('Landing commit')}:</label>
99 99 </div>
100 100 <div class="select">
101 101 ${c.form['repo_landing_commit_ref'].render(css_class='medium', oid='repo_landing_commit_ref')|n}
102 102 ${c.form.render_error(request, c.form['repo_landing_commit_ref'])|n}
103 103 <p class="help-block">${_('Default commit for files page, downloads, full text search index and readme')}</p>
104 104 </div>
105 105 </div>
106 106
107 107 <div class="field badged-field">
108 108 <div class="label">
109 109 <label for="repo_owner">${_('Owner')}:</label>
110 110 </div>
111 111 <div class="input">
112 112 <div class="badge-input-container">
113 113 <div class="user-badge">
114 114 ${base.gravatar_with_user(c.rhodecode_db_repo.user.email or c.rhodecode_db_repo.user.username, show_disabled=not c.rhodecode_db_repo.user.active)}
115 115 </div>
116 116 <div class="badge-input-wrap">
117 117 ${c.form['repo_owner'].render(css_class='medium', oid='repo_owner')|n}
118 118 </div>
119 119 </div>
120 120 ${c.form.render_error(request, c.form['repo_owner'])|n}
121 121 <p class="help-block">${_('Change owner of this repository.')}</p>
122 122 </div>
123 123 </div>
124 124
125 125 <div class="field">
126 126 <div class="label label-textarea">
127 127 <label for="repo_description">${_('Description')}:</label>
128 128 </div>
129 129 <div class="textarea text-area editor">
130 130 ${c.form['repo_description'].render(css_class='medium', oid='repo_description')|n}
131 131 ${c.form.render_error(request, c.form['repo_description'])|n}
132 132
133 133 <% metatags_url = h.literal('''<a href="#metatagsShow" onclick="$('#meta-tags-desc').toggle();return false">meta-tags</a>''') %>
134 134 <span class="help-block">${_('Plain text format with support of {metatags}. Add a README file for longer descriptions').format(metatags=metatags_url)|n}</span>
135 135 <span id="meta-tags-desc" style="display: none">
136 136 <%namespace name="dt" file="/data_table/_dt_elements.mako"/>
137 137 ${dt.metatags_help()}
138 138 </span>
139 139 </div>
140 140 </div>
141 141
142 142 <div class="field">
143 143 <div class="label label-checkbox">
144 144 <label for="${c.form['repo_private'].oid}">${_('Private repository')}:</label>
145 145 </div>
146 146 <div class="checkboxes">
147 147 ${c.form['repo_private'].render(css_class='medium')|n}
148 148 ${c.form.render_error(request, c.form['repo_private'])|n}
149 149 <span class="help-block">${_('Private repositories are only visible to people explicitly added as collaborators.')}</span>
150 150 </div>
151 151 </div>
152 152 <div class="field">
153 153 <div class="label label-checkbox">
154 154 <label for="${c.form['repo_enable_statistics'].oid}">${_('Enable statistics')}:</label>
155 155 </div>
156 156 <div class="checkboxes">
157 157 ${c.form['repo_enable_statistics'].render(css_class='medium')|n}
158 158 ${c.form.render_error(request, c.form['repo_enable_statistics'])|n}
159 159 <span class="help-block">${_('Enable statistics window on summary page.')}</span>
160 160 </div>
161 161 </div>
162 162 <div class="field">
163 163 <div class="label label-checkbox">
164 164 <label for="${c.form['repo_enable_downloads'].oid}">${_('Enable downloads')}:</label>
165 165 </div>
166 166 <div class="checkboxes">
167 167 ${c.form['repo_enable_downloads'].render(css_class='medium')|n}
168 168 ${c.form.render_error(request, c.form['repo_enable_downloads'])|n}
169 169 <span class="help-block">${_('Enable download menu on summary page.')}</span>
170 170 </div>
171 171 </div>
172 172 <div class="field">
173 173 <div class="label label-checkbox">
174 174 <label for="${c.form['repo_enable_locking'].oid}">${_('Enable automatic locking')}:</label>
175 175 </div>
176 176 <div class="checkboxes">
177 177 ${c.form['repo_enable_locking'].render(css_class='medium')|n}
178 178 ${c.form.render_error(request, c.form['repo_enable_locking'])|n}
179 179 <span class="help-block">${_('Enable automatic locking on repository. Pulling from this repository creates a lock that can be released by pushing back by the same user')}</span>
180 180 </div>
181 181 </div>
182 182
183 183 %if c.visual.repository_fields:
184 184 ## EXTRA FIELDS
185 185 %for field in c.repo_fields:
186 186 <div class="field">
187 187 <div class="label">
188 188 <label for="${field.field_key_prefixed}">${field.field_label} (${field.field_key}):</label>
189 189 </div>
190 190 <div class="input input-medium">
191 191 ${h.text(field.field_key_prefixed, field.field_value, class_='medium')}
192 192 %if field.field_desc:
193 193 <span class="help-block">${field.field_desc}</span>
194 194 %endif
195 195 </div>
196 196 </div>
197 197 %endfor
198 198 %endif
199 199 <div class="buttons">
200 200 ${h.submit('save',_('Save'),class_="btn")}
201 201 ${h.reset('reset',_('Reset'),class_="btn")}
202 202 </div>
203 203 </div>
204 204 </div>
205 205 ${h.end_form()}
206 206 </div>
207 207 </div>
208 208
209 209 <script>
210 210 $(document).ready(function(){
211 211 var cloneUrl = function() {
212 212 var alterButton = $('#alter_clone_uri');
213 213 var editButton = $('#edit_clone_uri');
214 214 var cancelEditButton = $('#cancel_edit_clone_uri');
215 215 var hiddenUrl = $('#clone_uri_hidden');
216 216 var hiddenUrlValue = $('#clone_uri_hidden_value');
217 217 var input = $('#clone_uri');
218 218 var helpBlock = $('#alter_clone_uri_help_block');
219 219 var changedFlag = $('#repo_clone_uri_change');
220 220 var originalText = helpBlock.html();
221 221 var obfuscatedUrl = hiddenUrlValue.html();
222 222
223 223 var edit = function(e) {
224 224 alterButton.show();
225 225 editButton.hide();
226 226 hiddenUrl.hide();
227 227
228 228 //add the old value next to input for verification
229 229 helpBlock.html("(" + obfuscatedUrl + ")" + "<br\>" + originalText);
230 230 changedFlag.val('MOD');
231 231 };
232 232
233 233 var cancelEdit = function(e) {
234 234 alterButton.hide();
235 235 editButton.show();
236 236 hiddenUrl.show();
237 237
238 238 helpBlock.html(originalText);
239 239 changedFlag.val('OLD');
240 240 input.val('');
241 241 };
242 242
243 243 var initEvents = function() {
244 244 editButton.on('click', edit);
245 245 cancelEditButton.on('click', cancelEdit);
246 246 };
247 247
248 248 var setInitialState = function() {
249 249 if (input.hasClass('error')) {
250 250 alterButton.show();
251 251 editButton.hide();
252 252 hiddenUrl.hide();
253 253 }
254 254 };
255 255
256 256 setInitialState();
257 257 initEvents();
258 258 }();
259 259
260 260 selectMyGroup = function(element) {
261 261 $("#repo_group").val($(element).data('personalGroupId')).trigger("change");
262 262 };
263 263
264 264 UsersAutoComplete('repo_owner', '${c.rhodecode_user.user_id}');
265 265 });
266 266 </script>
@@ -1,22 +1,22 b''
1 1 <div class="panel panel-default">
2 2 <div class="panel-heading">
3 3 <h3 class="panel-title">${_('Repository statistics')}</h3>
4 4 </div>
5 5 <div class="panel-body">
6 ${h.secure_form(h.route_path('edit_repo_statistics_reset', repo_name=c.rhodecode_db_repo.repo_name), method='POST', request=request)}
6 ${h.secure_form(h.route_path('edit_repo_statistics_reset', repo_name=c.rhodecode_db_repo.repo_name), request=request)}
7 7 <div class="form">
8 8 <div class="fields">
9 9 <div class="field" >
10 10 <dl class="dl-horizontal settings">
11 11 <dt>${_('Processed commits')}:</dt><dd>${c.stats_revision}/${c.repo_last_rev}</dd>
12 12 <dt>${_('Processed progress')}:</dt><dd>${c.stats_percentage}%</dd>
13 13 </dl>
14 14 </div>
15 15 ${h.submit('reset_stats_%s' % c.rhodecode_db_repo.repo_name,_('Reset statistics'),class_="btn btn-small",onclick="return confirm('"+_('Confirm to remove current statistics')+"');")}
16 16 </div>
17 17 </div>
18 18 ${h.end_form()}
19 19 </div>
20 20 </div>
21 21
22 22
@@ -1,197 +1,197 b''
1 1 <div class="panel panel-default">
2 2 <div class="panel-heading">
3 3 <h3 class="panel-title">${_('Strip commits from repository')}</h3>
4 4 </div>
5 5 <div class="panel-body">
6 6 %if c.rhodecode_db_repo.repo_type != 'svn':
7 7 <h4>${_('Please provide up to %d commits commits to strip') % c.strip_limit}</h4>
8 8 <p>
9 9 ${_('In the first step commits will be verified for existance in the repository')}. </br>
10 10 ${_('In the second step, correct commits will be available for stripping')}.
11 11 </p>
12 ${h.secure_form(h.route_path('strip_check', repo_name=c.rhodecode_db_repo.repo_name), method='POST', request=request)}
12 ${h.secure_form(h.route_path('strip_check', repo_name=c.rhodecode_db_repo.repo_name), request=request)}
13 13 <div id="change_body" class="field">
14 14 <div id="box-1" class="inputx locked_input">
15 15 <input class="text" id="changeset_id-1" name="changeset_id-1" size="59"
16 16 placeholder="${_('Enter full 40 character commit sha')}" type="text" value="">
17 17 <div id="plus_icon-1" class="btn btn-default plus_input_button" onclick="addNew(1);return false">
18 18 <i class="icon-plus">${_('Add another commit')}</i>
19 19 </div>
20 20 </div>
21 21 </div>
22 22
23 23 <div id="results" style="display:none; padding: 10px 0px;"></div>
24 24
25 25 <div class="buttons">
26 26 <button id="strip_action" class="btn btn-small btn-primary" onclick="checkCommits();return false">
27 27 ${_('Check commits')}
28 28 </button>
29 29 </div>
30 30
31 31 ${h.end_form()}
32 32 %else:
33 33 <h4>${_('Sorry this functionality is not available for SVN repository')}</h4>
34 34 %endif
35 35 </div>
36 36 </div>
37 37
38 38
39 39 <script>
40 40 var plus_leaf = 1;
41 41
42 42 addNew = function(number){
43 43 if (number >= ${c.strip_limit}){
44 44 return;
45 45 }
46 46 var minus = '<i class="icon-minus">${_('Remove')}</i>';
47 47 $('#plus_icon-'+number).detach();
48 48 number++;
49 49
50 50 var input = '<div id="box-'+number+'" class="inputx locked_input">'+
51 51 '<input class="text" id="changeset_id-'+number+'" name="changeset_id-'+number+'" size="59" type="text" value=""' +
52 52 'placeholder="${_('Enter full 40 character commit sha')}">'+
53 53 '<div id="plus_icon-'+number+'" class="btn btn-default plus_input_button" onclick="addNew('+number+');return false">'+
54 54 '<i class="icon-plus">${_('Add another commit')}</i>'+
55 55 '</div>'+
56 56 '<div id="minus_icon-'+number+'" class="btn btn-default minus_input_button" onclick="delOld('+(number)+');return false">'+
57 57 minus +
58 58 '</div>' +
59 59 '</div>';
60 60 $('#change_body').append(input);
61 61 plus_leaf++;
62 62 };
63 63
64 64 reIndex = function(number){
65 65 for(var i=number;i<=plus_leaf;i++){
66 66 var check = $('#box-'+i);
67 67 if (check.length == 0){
68 68 var change = $('#box-'+(i+1));
69 69 change.attr('id','box-'+i);
70 70 var plus = $('#plus_icon-'+(i+1));
71 71
72 72 if (plus.length != 0){
73 73 plus.attr('id','plus_icon-'+i);
74 74 plus.attr('onclick','addNew('+i+');return false');
75 75 plus_leaf--;
76 76 }
77 77 var minus = $('#minus_icon-'+(i+1));
78 78
79 79 minus.attr('id','minus_icon-'+i);
80 80
81 81 minus.attr('onclick','delOld('+i+');re' +
82 82 'turn false');
83 83 var input = $('input#changeset_id-'+(i+1));
84 84 input.attr('name','changeset_id-'+i);
85 85 input.attr('id','changeset_id-'+i);
86 86 }
87 87 }
88 88 };
89 89
90 90 delOld = function(number){
91 91 $('#box-'+number).remove();
92 92 number = number - 1;
93 93 var box = $('#box-'+number);
94 94 var plus = '<div id="plus_icon-'+number+'" class="btn btn-default plus_input_button" onclick="addNew('+number +');return false">'+
95 95 '<i id="i_plus_icon-'+number+'" class="icon-plus">${_('Add another commit')}</i></div>';
96 96 var minus = $('#minus_icon-'+number);
97 97 if(number +1 == plus_leaf){
98 98 minus.detach();
99 99 box.append(plus);
100 100 box.append(minus);
101 101 plus_leaf --;
102 102 }
103 103 reIndex(number+1);
104 104
105 105 };
106 106
107 107 var resultData = {
108 108 'csrf_token': CSRF_TOKEN
109 109 };
110 110
111 111 checkCommits = function() {
112 112 var postData = $('form').serialize();
113 113 $('#results').show();
114 114 $('#results').html('<h4>${_('Checking commits')}...</h4>');
115 115 var url = "${h.route_path('strip_check', repo_name=c.rhodecode_db_repo.repo_name)}";
116 116 var btn = $('#strip_action');
117 117 btn.attr('disabled', 'disabled');
118 118 btn.addClass('disabled');
119 119
120 120 var success = function (data) {
121 121 resultData = {
122 122 'csrf_token': CSRF_TOKEN
123 123 };
124 124 var i = 0;
125 125 var result = '<ol>';
126 126 $.each(data, function(index, value){
127 127 i= index;
128 128 var box = $('#box-'+index);
129 129 if (value.rev){
130 130 resultData[index] = JSON.stringify(value);
131 131
132 132 var verifiedHtml = (
133 133 '<li style="line-height:1.2em">' +
134 134 '<code>{0}</code>' +
135 135 '{1}' +
136 136 '<div style="white-space:pre">' +
137 137 'author: {2}\n' +
138 138 'description: {3}' +
139 139 '</div>' +
140 140 '</li>').format(
141 141 value.rev,
142 142 "${_(' commit verified positive')}",
143 143 value.author, value.comment
144 144 );
145 145 result += verifiedHtml;
146 146 }
147 147 else {
148 148 var verifiedHtml = (
149 149 '<li style="line-height:1.2em">' +
150 150 '<code><strike>{0}</strike></code>' +
151 151 '{1}' +
152 152 '</li>').format(
153 153 value.commit,
154 154 "${_(' commit verified negative')}"
155 155 );
156 156 result += verifiedHtml;
157 157 }
158 158 box.remove();
159 159 });
160 160 result += '</ol>';
161 161 var box = $('#box-'+(parseInt(i)+1));
162 162 box.remove();
163 163 $('#results').html(result);
164 164 };
165 165
166 166 btn.html('Strip');
167 167 btn.removeAttr('disabled');
168 168 btn.removeClass('disabled');
169 169 btn.attr('onclick','strip();return false;');
170 170 ajaxPOST(url, postData, success, null);
171 171 };
172 172
173 173 strip = function() {
174 174 var url = "${h.route_path('strip_execute', repo_name=c.rhodecode_db_repo.repo_name)}";
175 175 var success = function(data) {
176 176 var result = '<h4>Strip executed</h4><ol>';
177 177 $.each(data, function(index, value){
178 178 if(data[index]) {
179 179 result += '<li><code>' +index+ '</code> ${_(' commit striped successfully')}' + '</li>';
180 180 }
181 181 else {
182 182 result += '<li><code>' +index+ '</code> ${_(' commit strip failed')}' + '</li>';
183 183 }
184 184 });
185 185 if ($.isEmptyObject(data)) {
186 186 result += '<li>Nothing done...</li>'
187 187 }
188 188 result += '</ol>';
189 189 $('#results').html(result);
190 190
191 191 };
192 192 ajaxPOST(url, resultData, success, null);
193 193 var btn = $('#strip_action');
194 194 btn.remove();
195 195
196 196 };
197 197 </script>
@@ -1,73 +1,73 b''
1 1 <%namespace name="vcss" file="/base/vcs_settings.mako"/>
2 2
3 3 <div id="repo_vcs_settings" class="${'inherited' if c.inherit_global_settings else ''}">
4 ${h.secure_form(h.route_path('edit_repo_vcs_update', repo_name=c.rhodecode_db_repo.repo_name), method='POST', request=request)}
4 ${h.secure_form(h.route_path('edit_repo_vcs_update', repo_name=c.rhodecode_db_repo.repo_name), request=request)}
5 5 <div class="form panel panel-default">
6 6 <div class="fields panel-body">
7 7 <div class="field">
8 8 <div class="label label-checkbox">
9 9 <label for="inherit_global_settings">${_('Inherit from global settings')}:</label>
10 10 </div>
11 11 <div class="checkboxes">
12 12 ${h.checkbox('inherit_global_settings',value=True)}
13 13 <span class="help-block">${h.literal(_('Select to inherit global vcs settings.'))}</span>
14 14 </div>
15 15 </div>
16 16 </div>
17 17 </div>
18 18
19 19 <div id="inherit_overlay_vcs_default">
20 20 <div>
21 21 ${vcss.vcs_settings_fields(
22 22 suffix='_inherited',
23 23 svn_tag_patterns=c.global_svn_tag_patterns,
24 24 svn_branch_patterns=c.global_svn_branch_patterns,
25 25 repo_type=c.rhodecode_db_repo.repo_type,
26 26 disabled='disabled'
27 27 )}
28 28 </div>
29 29 </div>
30 30
31 31 <div id="inherit_overlay_vcs_custom">
32 32 <div>
33 33 ${vcss.vcs_settings_fields(
34 34 suffix='',
35 35 svn_tag_patterns=c.svn_tag_patterns,
36 36 svn_branch_patterns=c.svn_branch_patterns,
37 37 repo_type=c.rhodecode_db_repo.repo_type
38 38 )}
39 39 </div>
40 40 </div>
41 41
42 42 <div class="buttons">
43 43 ${h.submit('save',_('Save settings'),class_="btn")}
44 44 ${h.reset('reset',_('Reset'),class_="btn")}
45 45 </div>
46 46
47 47 ${h.end_form()}
48 48 </div>
49 49
50 50 <script type="text/javascript">
51 51
52 52 function ajaxDeletePattern(pattern_id, field_id) {
53 53 var sUrl = "${h.route_path('edit_repo_vcs_svn_pattern_delete', repo_name=c.rhodecode_db_repo.repo_name)}";
54 54 var callback = function (o) {
55 55 var elem = $("#"+field_id);
56 56 elem.remove();
57 57 };
58 58 var postData = {
59 59 'delete_svn_pattern': pattern_id,
60 60 'csrf_token': CSRF_TOKEN
61 61 };
62 62 var request = $.post(sUrl, postData)
63 63 .done(callback)
64 64 .fail(function (data, textStatus, errorThrown) {
65 65 alert("Error while deleting hooks.\nError code {0} ({1}). URL: {2}".format(data.status,data.statusText,$(this)[0].url));
66 66 });
67 67 }
68 68
69 69 $('#inherit_global_settings').on('change', function(e){
70 70 $('#repo_vcs_settings').toggleClass('inherited', this.checked);
71 71 });
72 72
73 73 </script>
@@ -1,56 +1,56 b''
1 1 <div class="panel panel-default">
2 2 <div class="panel-heading">
3 3 <h3 class="panel-title">${_('Email Configuration')}</h3>
4 4 </div>
5 5 <div class="panel-body">
6 6 <%
7 7 elems = [
8 8 (_('Email prefix'), c.rhodecode_ini.get('email_prefix'), ''),
9 9 (_('RhodeCode email from'), c.rhodecode_ini.get('app_email_from'), ''),
10 10 (_('Error email from'), c.rhodecode_ini.get('error_email_from'), ''),
11 11 (_('Error email recipients'), c.rhodecode_ini.get('email_to'), ''),
12 12
13 13 (_('SMTP server'), c.rhodecode_ini.get('smtp_server'), ''),
14 14 (_('SMTP username'), c.rhodecode_ini.get('smtp_username'), ''),
15 15 (_('SMTP password'), '%s chars' % len(c.rhodecode_ini.get('smtp_password', '')), ''),
16 16 (_('SMTP port'), c.rhodecode_ini.get('smtp_port'), ''),
17 17
18 18 (_('SMTP use TLS'), c.rhodecode_ini.get('smtp_use_tls'), ''),
19 19 (_('SMTP use SSL'), c.rhodecode_ini.get('smtp_use_ssl'), ''),
20 20 (_('SMTP auth'), c.rhodecode_ini.get('smtp_auth'), ''),
21 21 ]
22 22 %>
23 23 <dl class="dl-horizontal settings">
24 24 %for dt, dd, tt in elems:
25 25 <dt >${dt}:</dt>
26 26 <dd title="${h.tooltip(tt)}">${dd}</dd>
27 27 %endfor
28 28 </dl>
29 29 </div>
30 30 </div>
31 31
32 32 <div class="panel panel-default">
33 33 <div class="panel-heading">
34 34 <h3 class="panel-title">${_('Test Email')}</h3>
35 35 </div>
36 36 <div class="panel-body">
37 ${h.secure_form(h.url('admin_settings_email'), method='post')}
37 ${h.secure_form(h.url('admin_settings_email'), request=request)}
38 38
39 39 <div class="field input">
40 40 ${h.text('test_email', size=60, placeholder=_('enter valid email'))}
41 41 </div>
42 42 <div class="field">
43 43 <span class="help-block">
44 44 ${_('Send an auto-generated email from this server to above email...')}
45 45 </span>
46 46 </div>
47 47 <div class="buttons">
48 48 ${h.submit('send',_('Send'),class_="btn")}
49 49 </div>
50 50 ${h.end_form()}
51 51 </div>
52 52 </div>
53 53
54 54
55 55
56 56
@@ -1,295 +1,295 b''
1 ${h.secure_form(h.url('admin_settings_global'), method='post')}
1 ${h.secure_form(h.url('admin_settings_global'), request=request)}
2 2
3 3 <div class="panel panel-default">
4 4 <div class="panel-heading" id="branding-options">
5 5 <h3 class="panel-title">${_('Branding')} <a class="permalink" href="#branding-options"> ¶</a></h3>
6 6 </div>
7 7 <div class="panel-body">
8 8 <div class="label">
9 9 <label for="rhodecode_title">${_('Title')}</label>
10 10 </div>
11 11 <div class="field input">
12 12 ${h.text('rhodecode_title',size=60)}
13 13 </div>
14 14 <div class="field">
15 15 <span class="help-block">
16 16 ${_('Set a custom title for your RhodeCode instance (limited to 40 characters).')}
17 17 </span>
18 18 </div>
19 19 <div class="label">
20 20 <label for="rhodecode_realm">${_('HTTP[S] authentication realm')}</label>
21 21 </div>
22 22 <div class="field input">
23 23 ${h.text('rhodecode_realm',size=60)}
24 24 </div>
25 25 <div class="field">
26 26 <span class="help-block">
27 27 ${_('Set a custom text that is shown as authentication message to clients trying to connect.')}
28 28 </span>
29 29 </div>
30 30 </div>
31 31 </div>
32 32
33 33
34 34 <div class="panel panel-default">
35 35 <div class="panel-heading" id="personal-group-options">
36 36 <h3 class="panel-title">${_('Personal Repository Group')} <a class="permalink" href="#personal-group-options"> ¶</a></h3>
37 37 </div>
38 38 <div class="panel-body">
39 39 <div class="checkbox">
40 40 ${h.checkbox('rhodecode_create_personal_repo_group','True')}
41 41 <label for="rhodecode_create_personal_repo_group">${_('Create Personal Repository Group')}</label>
42 42 </div>
43 43 <span class="help-block">
44 44 ${_('Always create Personal Repository Groups for new users.')} <br/>
45 45 ${_('When creating new users from add user form or API you can still turn this off via a checkbox or flag')}
46 46 </span>
47 47
48 48 <div class="label">
49 49 <label for="rhodecode_personal_repo_group_pattern">${_('Personal Repo Group Pattern')}</label>
50 50 </div>
51 51 <div class="field input">
52 52 ${h.text('rhodecode_personal_repo_group_pattern',size=60, placeholder=c.personal_repo_group_default_pattern)}
53 53 </div>
54 54 <span class="help-block">
55 55 ${_('Pattern used to create Personal Repository Groups. Prefix can be other existing repository group path[s], eg. /u/${username}')} <br/>
56 56 ${_('Available variables are currently ${username} and ${user_id}')}
57 57 </span>
58 58 </div>
59 59 </div>
60 60
61 61
62 62 <div class="panel panel-default">
63 63 <div class="panel-heading" id="captcha-options">
64 64 <h3 class="panel-title">${_('Registration Captcha')} <a class="permalink" href="#captcha-options"> ¶</a></h3>
65 65 </div>
66 66 <div class="panel-body">
67 67 <div class="label">
68 68 <label for="rhodecode_captcha_public_key">${_('Google ReCaptcha public key')}</label>
69 69 </div>
70 70 <div class="field input">
71 71 ${h.text('rhodecode_captcha_public_key',size=60)}
72 72 </div>
73 73 <div class="field">
74 74 <span class="help-block">
75 75 ${_('Public key for reCaptcha system.')}
76 76 </span>
77 77 </div>
78 78
79 79 <div class="label">
80 80 <label for="rhodecode_captcha_private_key">${_('Google ReCaptcha private key')}</label>
81 81 </div>
82 82 <div class="field input">
83 83 ${h.text('rhodecode_captcha_private_key',size=60)}
84 84 </div>
85 85 <div class="field">
86 86 <span class="help-block">
87 87 ${_('Private key for reCaptcha system. Setting this value will enable captcha on registration')}
88 88 </span>
89 89 </div>
90 90 </div>
91 91 </div>
92 92
93 93 <div class="panel panel-default">
94 94 <div class="panel-heading" id="header-code-options">
95 95 <h3 class="panel-title">${_('Custom Header Code')} <a class="permalink" href="#header-code-options"> ¶</a></h3>
96 96 </div>
97 97 <div class="panel-body">
98 98 <div class="select">
99 99 <select id="pre_template" >
100 100 <option value="#">${_('Templates...')}</option>
101 101 <option value="ga">Google Analytics</option>
102 102 <option value="clicky">Clicky</option>
103 103 <option value="server_announce">${_('Server Announcement')}</option>
104 104 <option value="flash_filtering">${_('Flash message filtering')}</option>
105 105 </select>
106 106 </div>
107 107 <div style="padding: 10px 0px"></div>
108 108 <div class="textarea text-area">
109 109 ${h.textarea('rhodecode_pre_code',cols=23,rows=5,class_="medium")}
110 110 <span class="help-block">${_('Custom js/css code added at the end of the <header/> tag.')}
111 111 ${_('Use <script/> or <css/> tags to define custom styling or scripting')}</span>
112 112 </div>
113 113 </div>
114 114 </div>
115 115
116 116 <div class="panel panel-default">
117 117 <div class="panel-heading" id="footer-code-options">
118 118 <h3 class="panel-title">${_('Custom Footer Code')} <a class="permalink" href="#footer-code-options"> ¶</a></h3>
119 119 </div>
120 120 <div class="panel-body">
121 121 <div class="select">
122 122 <select id="post_template" >
123 123 <option value="#">${_('Templates...')}</option>
124 124 <option value="ga">Google Analytics</option>
125 125 <option value="clicky">Clicky</option>
126 126 <option value="server_announce">${_('Server Announcement')}</option>
127 127 </select>
128 128 </div>
129 129 <div style="padding: 10px 0px"></div>
130 130 <div class="textarea text-area">
131 131 ${h.textarea('rhodecode_post_code',cols=23,rows=5, class_="medium")}
132 132 <span class="help-block">${_('Custom js/css code added at the end of the <body> tag.')}
133 133 ${_('Use <script> or <css> tags to define custom styling or scripting')}</span>
134 134 </div>
135 135 </div>
136 136 </div>
137 137
138 138 <div class="buttons">
139 139 ${h.submit('save',_('Save settings'),class_="btn")}
140 140 ${h.reset('reset',_('Reset'),class_="btn")}
141 141 </div>
142 142 ${h.end_form()}
143 143
144 144
145 145
146 146 ## TEMPLATES ##
147 147 ###############
148 148
149 149 <script id="ga_tmpl" type="text/x-template">
150 150 <%text filter="h">
151 151 <script>
152 152 // Google Analytics
153 153 // Put your Google Analytics code instead of _GACODE_
154 154 var _gaq_code = '_GACODE_';
155 155 var _gaq = _gaq || [];
156 156 _gaq.push(['_setAccount', _gaq_code]);
157 157 _gaq.push(['_trackPageview']);
158 158
159 159 (function() {
160 160 var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
161 161 ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
162 162 var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
163 163 })();
164 164
165 165 rhodecode_statechange_callback = function(url, data){
166 166 // ANALYTICS callback on html5 history state changed
167 167 // triggered by file browser, url is the new url,
168 168 // data is extra info passed from the State object
169 169 if (typeof window._gaq !== 'undefined') {
170 170 _gaq.push(['_trackPageview', url]);
171 171 }
172 172 };
173 173 </script>
174 174 </%text>
175 175 </script>
176 176
177 177
178 178
179 179 <script id="clicky_tmpl" type="text/x-template">
180 180 <%text filter="h">
181 181 <script src="//static.getclicky.com/js" type="text/javascript"></script>
182 182 <script type="text/javascript">
183 183 // Clicky Analytics - should be used in the footer code section.
184 184 // Put your Clicky code instead of _CLICKYCODE_ here,
185 185 // and below in the <img> tag.
186 186 var _cl_code = _CLICKYCODE_;
187 187 try{clicky.init(_cl_code);}catch(e){}
188 188
189 189 rhodecode_statechange_callback = function(url, data){
190 190 // ANALYTICS callback on html5 history state changed
191 191 // triggered by file browser, url is the new url,
192 192 // data is extra info passed from the State object
193 193 if (typeof window.clicky !== 'undefined') {
194 194 clicky.log(url);
195 195 }
196 196 }
197 197 </script>
198 198 <noscript>
199 199 // Put your clicky code in the src file.
200 200 <p><img alt="Clicky" width="1" height="1"
201 201 src="//in.getclicky.com/_CLICKYCODE_ns.gif" /></p>
202 202 </noscript>
203 203 </%text>
204 204 </script>
205 205
206 206
207 207
208 208 <script id="server_announce_tmpl" type='text/x-template'>
209 209 <%text filter="h">
210 210 <script>
211 211 // Server announcement displayed on the top of the page.
212 212 // This can be used to send a global maintenance messages or other
213 213 // important messages to all users of the RhodeCode Enterprise system.
214 214
215 215 $(document).ready(function(e){
216 216
217 217 // EDIT - put your message below
218 218 var message = "TYPE YOUR MESSAGE HERE";
219 219
220 220 // EDIT - choose "info"/"warning"/"error"/"success"/"neutral" as appropriate
221 221 var alert_level = "info";
222 222
223 223 $("#body").prepend(
224 224 ("<div id='server-announcement' class='"+alert_level+"'>_MSG_"+"</div>").replace("_MSG_", message)
225 225 )
226 226 })
227 227 </script>
228 228 </%text>
229 229 </script>
230 230
231 231 <script id="flash_filtering_tmpl" type='text/x-template'>
232 232 <%text filter="h">
233 233 <script>
234 234 // This filters out some flash messages before they are presented to user
235 235 // based on their contents. Could be used to filter out warnings/errors
236 236 // of license messages
237 237
238 238 var filteredMessages = [];
239 239 for(var i =0; i< alertMessagePayloads.length; i++){
240 240 if (typeof alertMessagePayloads[i].message.subdata.subtype !== 'undefined' &&
241 241 alertMessagePayloads[i].message.subdata.subtype.indexOf('rc_license') !== -1){
242 242 continue
243 243 }
244 244 filteredMessages.push(alertMessagePayloads[i]);
245 245 }
246 246 alertMessagePayloads = filteredMessages;
247 247 </script>
248 248 </%text>
249 249 </script>
250 250
251 251 <script>
252 252 var pre_cm = initCodeMirror('rhodecode_pre_code', '', false);
253 253 var pre_old = pre_cm.getValue();
254 254
255 255 var post_cm = initCodeMirror('rhodecode_post_code', '', false);
256 256 var post_old = post_cm.getValue();
257 257
258 258 var get_data = function(type, old){
259 259 var get_tmpl = function(tmpl_name){
260 260 // unescape some stuff
261 261 return htmlEnDeCode.htmlDecode($('#'+tmpl_name+'_tmpl').html());
262 262 };
263 263 return {
264 264 '#': old,
265 265 'ga': get_tmpl('ga'),
266 266 'clicky': get_tmpl('clicky'),
267 267 'server_announce': get_tmpl('server_announce'),
268 268 'flash_filtering': get_tmpl('flash_filtering')
269 269 }[type]
270 270 };
271 271
272 272 $('#pre_template').select2({
273 273 containerCssClass: 'drop-menu',
274 274 dropdownCssClass: 'drop-menu-dropdown',
275 275 dropdownAutoWidth: true,
276 276 minimumResultsForSearch: -1
277 277 });
278 278
279 279 $('#post_template').select2({
280 280 containerCssClass: 'drop-menu',
281 281 dropdownCssClass: 'drop-menu-dropdown',
282 282 dropdownAutoWidth: true,
283 283 minimumResultsForSearch: -1
284 284 });
285 285
286 286 $('#post_template').on('change', function(e){
287 287 var sel = this.value;
288 288 post_cm.setValue(get_data(sel, post_old))
289 289 });
290 290
291 291 $('#pre_template').on('change', function(e){
292 292 var sel = this.value;
293 293 pre_cm.setValue(get_data(sel, pre_old))
294 294 })
295 295 </script>
@@ -1,93 +1,93 b''
1 1 <div class="panel panel-default">
2 2 <div class="panel-heading">
3 3 <h3 class="panel-title">${_('Built in Mercurial hooks - read only')}</h3>
4 4 </div>
5 5 <div class="panel-body">
6 6 <div class="form">
7 7 <div class="fields">
8 8 % for hook in c.hooks:
9 9 <div class="field">
10 10 <div class="label label">
11 11 <label for="${hook.ui_key}">${hook.ui_key}</label>
12 12 </div>
13 13 <div class="input" >
14 14 ${h.text(hook.ui_key,hook.ui_value,size=59,readonly="readonly")}
15 15 </div>
16 16 </div>
17 17 % endfor
18 18 </div>
19 19 <span class="help-block">${_('Hooks can be used to trigger actions on certain events such as push / pull. They can trigger Python functions or external applications.')}</span>
20 20 </div>
21 21 </div>
22 22 </div>
23 23
24 24
25 25 <div class="panel panel-default">
26 26 <div class="panel-heading">
27 27 <h3 class="panel-title">${_('Custom hooks')}</h3>
28 28 </div>
29 29 <div class="panel-body">
30 30 % if c.visual.allow_custom_hooks_settings:
31 ${h.secure_form(h.url('admin_settings_hooks'), method='post')}
31 ${h.secure_form(h.url('admin_settings_hooks'), request=request)}
32 32 <div class="form">
33 33 <div class="fields">
34 34
35 35 % for hook in c.custom_hooks:
36 36 <div class="field" id="${'id%s' % hook.ui_id }">
37 37 <div class="label label">
38 38 <label for="${hook.ui_key}">${hook.ui_key}</label>
39 39 </div>
40 40 <div class="input" >
41 41 ${h.hidden('hook_ui_key',hook.ui_key)}
42 42 ${h.hidden('hook_ui_value',hook.ui_value)}
43 43 ${h.text('hook_ui_value_new',hook.ui_value,size=59)}
44 44 <span class="btn btn-danger"
45 45 onclick="ajaxActionHook(${hook.ui_id},'${'id%s' % hook.ui_id }')">
46 46 ${_('Delete')}
47 47 </span>
48 48 </div>
49 49 </div>
50 50 % endfor
51 51
52 52 <div class="field customhooks">
53 53 <div class="label">
54 54 <div class="input-wrapper">
55 55 ${h.text('new_hook_ui_key',size=30)}
56 56 </div>
57 57 </div>
58 58 <div class="input">
59 59 ${h.text('new_hook_ui_value',size=59)}
60 60 </div>
61 61 </div>
62 62 <div class="buttons">
63 63 ${h.submit('save',_('Save'),class_="btn")}
64 64 </div>
65 65 </div>
66 66 </div>
67 67 ${h.end_form()}
68 68 %else:
69 69 DISABLED
70 70 % endif
71 71 </div>
72 72 </div>
73 73
74 74
75 75 <script type="text/javascript">
76 76 function ajaxActionHook(hook_id,field_id) {
77 77 var sUrl = "${h.url('admin_settings_hooks')}";
78 78 var callback = function (o) {
79 79 var elem = $("#"+field_id);
80 80 elem.remove();
81 81 };
82 82 var postData = {
83 83 '_method': 'delete',
84 84 'hook_id': hook_id,
85 85 'csrf_token': CSRF_TOKEN
86 86 };
87 87 var request = $.post(sUrl, postData)
88 88 .done(callback)
89 89 .fail(function (data, textStatus, errorThrown) {
90 90 alert("Error while deleting hooks.\nError code {0} ({1}). URL: {2}".format(data.status,data.statusText,$(this)[0].url));
91 91 });
92 92 };
93 93 </script>
@@ -1,34 +1,34 b''
1 1 <%namespace name="its" file="/base/issue_tracker_settings.mako"/>
2 2
3 3 <div class="panel panel-default">
4 4 <div class="panel-heading">
5 5 <h3 class="panel-title">${_('Issue Tracker / Wiki Patterns')}</h3>
6 6 </div>
7 7 <div class="panel-body">
8 ${h.secure_form(h.url('admin_settings_issuetracker_save'), method='post')}
8 ${h.secure_form(h.url('admin_settings_issuetracker_save'), request=request)}
9 9 ${its.issue_tracker_settings_table(
10 10 patterns=c.issuetracker_entries.items(),
11 11 form_url=h.url('admin_settings_issuetracker'),
12 12 delete_url=h.url('admin_issuetracker_delete')
13 13 )}
14 14 <div class="buttons">
15 15 <button type="submit" class="btn btn-primary" id="save">${_('Save')}</button>
16 16 <button type="reset" class="btn">${_('Reset')}</button>
17 17 </div>
18 18 ${h.end_form()}
19 19 </div>
20 20 </div>
21 21
22 22 <div class="panel panel-default">
23 23 <div class="panel-heading">
24 24 <h3 class="panel-title">${_('Test Patterns')}</h3>
25 25 </div>
26 26 <div class="panel-body">
27 27 ${its.issue_tracker_new_row()}
28 28 ${its.issue_tracker_settings_test(test_url=h.url('admin_issuetracker_test'))}
29 29 </div>
30 30 </div>
31 31
32 32
33 33
34 34
@@ -1,58 +1,58 b''
1 1 <div class="panel panel-default">
2 2 <div class="panel-heading">
3 3 <h3 class="panel-title">${_('Labs Settings')}</h3>
4 4 </div>
5 5 <div class="panel-body">
6 ${h.secure_form(h.url('admin_settings_labs'), method='post')}
6 ${h.secure_form(h.url('admin_settings_labs'), request=request)}
7 7 <div class="form">
8 8 <div class="fields">
9 9 % if not c.lab_settings:
10 10 ${_('There are no Labs settings currently')}
11 11 % else:
12 12 % for lab_setting in c.lab_settings:
13 13 <div class="field">
14 14 <div class="label">
15 15 <label>${lab_setting.group}:</label>
16 16 </div>
17 17 % if lab_setting.type == 'bool':
18 18 <div class="checkboxes">
19 19 <div class="checkbox">
20 20 ${h.checkbox(lab_setting.key, 'True')}
21 21 % if lab_setting.label:
22 22 <label for="${lab_setting.key}">${lab_setting.label}</label>
23 23 % endif
24 24 </div>
25 25 % if lab_setting.help:
26 26 <p class="help-block">${lab_setting.help}</p>
27 27 % endif
28 28 </div>
29 29 % else:
30 30 <div class="input">
31 31 ${h.text(lab_setting.key, size=60)}
32 32
33 33 ## TODO: johbo: This style does not yet exist for our forms,
34 34 ## the lab settings seem not to adhere to the structure which
35 35 ## we use in other places.
36 36 % if lab_setting.label:
37 37 <label for="${lab_setting.key}">${lab_setting.label}</label>
38 38 % endif
39 39
40 40 % if lab_setting.help:
41 41 <p class="help-block">${lab_setting.help}</p>
42 42 % endif
43 43 </div>
44 44 % endif
45 45 </div>
46 46 % endfor
47 47 <div class="buttons">
48 48 ${h.submit('save', _('Save settings'), class_='btn')}
49 49 ${h.reset('reset', _('Reset'), class_='btn')}
50 50 </div>
51 51 % endif
52 52 </div>
53 53 </div>
54 54 ${h.end_form()}
55 55 </div>
56 56 </div>
57 57
58 58
@@ -1,28 +1,28 b''
1 ${h.secure_form(h.url('admin_settings_mapping'), method='post')}
1 ${h.secure_form(h.url('admin_settings_mapping'), request=request)}
2 2
3 3 <div class="panel panel-default">
4 4 <div class="panel-heading">
5 5 <h3 class="panel-title">${_('Import New Groups or Repositories')}</h3>
6 6 </div>
7 7 <div class="panel-body">
8 8 <div class="checkbox">
9 9 ${h.checkbox('destroy',True)}
10 10 <label for="destroy">${_('Destroy old data')}</label>
11 11 </div>
12 12 <span class="help-block">${_('In case a repository or a group was deleted from the filesystem and it still exists in the database, check this option to remove obsolete data from the database.')}</span>
13 13
14 14 <div class="checkbox">
15 15 ${h.checkbox('invalidate',True)}
16 16 <label for="invalidate"> ${_('Invalidate cache for all repositories')}</label>
17 17 </div>
18 18 <span class="help-block">${_('Each cache data for repositories will be cleaned with this option selected. Use this to reload data and clear cache keys.')}</span>
19 19
20 20 <div class="buttons">
21 21 ${h.submit('rescan',_('Rescan Filesystem'),class_="btn")}
22 22 </div>
23 23
24 24 </div>
25 25 </div>
26 26
27 27
28 28 ${h.end_form()}
@@ -1,62 +1,62 b''
1 1 <div class="panel panel-default">
2 2 <div class="panel-heading">
3 3 <h3 class="panel-title">${_('User Sessions Configuration')}</h3>
4 4 </div>
5 5 <div class="panel-body">
6 6 <%
7 7 elems = [
8 8 (_('Session type'), c.session_model.SESSION_TYPE, ''),
9 9 (_('Session expiration period'), '{} seconds'.format(c.session_conf.get('beaker.session.timeout', 0)), ''),
10 10
11 11 (_('Total sessions'), c.session_count, ''),
12 12 (_('Expired sessions ({} days)').format(c.cleanup_older_days ), c.session_expired_count, ''),
13 13
14 14 ]
15 15 %>
16 16 <dl class="dl-horizontal settings">
17 17 %for dt, dd, tt in elems:
18 18 <dt>${dt}:</dt>
19 19 <dd title="${h.tooltip(tt)}">${dd}</dd>
20 20 %endfor
21 21 </dl>
22 22 </div>
23 23 </div>
24 24
25 25
26 26 <div class="panel panel-warning">
27 27 <div class="panel-heading">
28 28 <h3 class="panel-title">${_('Cleanup Old Sessions')}</h3>
29 29 </div>
30 30 <div class="panel-body">
31 ${h.secure_form(h.route_path('admin_settings_sessions_cleanup'), method='POST', request=request)}
31 ${h.secure_form(h.route_path('admin_settings_sessions_cleanup'), request=request)}
32 32
33 33 <p>
34 34 ${_('Cleanup user sessions that were not active during chosen time frame.')} <br/>
35 35 ${_('After performing this action users whose session will be removed will be required to log in again.')} <br/>
36 36 <strong>${_('Picking `All` will log-out you, and all users in the system.')}</strong>
37 37 </p>
38 38
39 39 <script type="text/javascript">
40 40 $(document).ready(function() {
41 41 $('#expire_days').select2({
42 42 containerCssClass: 'drop-menu',
43 43 dropdownCssClass: 'drop-menu-dropdown',
44 44 dropdownAutoWidth: true,
45 45 minimumResultsForSearch: -1
46 46 });
47 47 });
48 48 </script>
49 49 <select id="expire_days" name="expire_days">
50 50 % for n in [60, 90, 30, 7, 0]:
51 51 <option value="${n}">${'{} days'.format(n) if n != 0 else 'All'}</option>
52 52 % endfor
53 53 </select>
54 54 <button class="btn btn-small" type="submit"
55 55 onclick="return confirm('${_('Confirm to cleanup user sessions')}');">
56 56 ${_('Cleanup sessions')}
57 57 </button>
58 58 ${h.end_form()}
59 59 </div>
60 60 </div>
61 61
62 62
@@ -1,66 +1,66 b''
1 1 <%namespace name="vcss" file="/base/vcs_settings.mako"/>
2 2
3 ${h.secure_form(h.url('admin_settings_vcs'), method='post')}
3 ${h.secure_form(h.url('admin_settings_vcs'), request=request)}
4 4 <div>
5 5 ${vcss.vcs_settings_fields(
6 6 suffix='',
7 7 svn_tag_patterns=c.svn_tag_patterns,
8 8 svn_branch_patterns=c.svn_branch_patterns,
9 9 display_globals=True,
10 10 allow_repo_location_change=c.visual.allow_repo_location_change
11 11 )}
12 12 <div class="buttons">
13 13 ${h.submit('save',_('Save settings'),class_="btn")}
14 14 ${h.reset('reset',_('Reset'),class_="btn")}
15 15 </div>
16 16 </div>
17 17 ${h.end_form()}
18 18
19 19 <script type="text/javascript">
20 20
21 21 function ajaxDeletePattern(pattern_id, field_id) {
22 22 var sUrl = "${h.url('admin_settings_vcs')}";
23 23 var callback = function (o) {
24 24 var elem = $("#"+field_id);
25 25 elem.remove();
26 26 };
27 27 var postData = {
28 28 '_method': 'delete',
29 29 'delete_svn_pattern': pattern_id,
30 30 'csrf_token': CSRF_TOKEN
31 31 };
32 32 var request = $.post(sUrl, postData)
33 33 .done(callback)
34 34 .fail(function (data, textStatus, errorThrown) {
35 35 alert("Error while deleting hooks.\nError code {0} ({1}). URL: {2}".format(data.status,data.statusText,$(this)[0].url));
36 36 });
37 37 };
38 38
39 39 $(document).ready(function() {
40 40
41 41 var unlockpath = function() {
42 42 $('#path_unlock_icon').removeClass('icon-lock').addClass('icon-unlock');
43 43 $('#paths_root_path').removeAttr('readonly').removeClass('disabled');
44 44 };
45 45
46 46 $('#path_unlock').on('click', function(e) {
47 47 unlockpath();
48 48 });
49 49
50 50 if ($('.locked_input').children().hasClass('error-message')) {
51 51 unlockpath();
52 52 }
53 53
54 54 /* On click handler for the `Generate Apache Config` button. It sends a
55 55 POST request to trigger the (re)generation of the mod_dav_svn config. */
56 56 $('#vcs_svn_generate_cfg').on('click', function(event) {
57 57 event.preventDefault();
58 58 var url = "${h.route_path('admin_settings_vcs_svn_generate_cfg')}";
59 59 var jqxhr = $.post(url, {'csrf_token': CSRF_TOKEN});
60 60 jqxhr.done(function(data) {
61 61 $.Topic('/notifications').publish(data);
62 62 });
63 63 });
64 64
65 65 });
66 66 </script>
@@ -1,226 +1,226 b''
1 ${h.secure_form(h.url('admin_settings_visual'), method='post')}
1 ${h.secure_form(h.url('admin_settings_visual'), request=request)}
2 2
3 3 <div class="panel panel-default">
4 4 <div class="panel-heading" id="general">
5 5 <h3 class="panel-title">${_('General')}</h3>
6 6 </div>
7 7 <div class="panel-body">
8 8 <div class="checkbox">
9 9 ${h.checkbox('rhodecode_repository_fields','True')}
10 10 <label for="rhodecode_repository_fields">${_('Use repository extra fields')}</label>
11 11 </div>
12 12 <span class="help-block">${_('Allows storing additional customized fields per repository.')}</span>
13 13
14 14 <div></div>
15 15 <div class="checkbox">
16 16 ${h.checkbox('rhodecode_show_version','True')}
17 17 <label for="rhodecode_show_version">${_('Show RhodeCode version')}</label>
18 18 </div>
19 19 <span class="help-block">${_('Shows or hides a version number of RhodeCode displayed in the footer.')}</span>
20 20 </div>
21 21 </div>
22 22
23 23
24 24 <div class="panel panel-default">
25 25 <div class="panel-heading" id="gravatars">
26 26 <h3 class="panel-title">${_('Gravatars')}</h3>
27 27 </div>
28 28 <div class="panel-body">
29 29 <div class="checkbox">
30 30 ${h.checkbox('rhodecode_use_gravatar','True')}
31 31 <label for="rhodecode_use_gravatar">${_('Use Gravatars based avatars')}</label>
32 32 </div>
33 33 <span class="help-block">${_('Use gravatar.com as avatar system for RhodeCode accounts. If this is disabled avatars are generated based on initials and email.')}</span>
34 34
35 35 <div class="label">
36 36 <label for="rhodecode_gravatar_url">${_('Gravatar URL')}</label>
37 37 </div>
38 38 <div class="input">
39 39 <div class="field">
40 40 ${h.text('rhodecode_gravatar_url', size='100%')}
41 41 </div>
42 42
43 43 <div class="field">
44 44 <span class="help-block">${_('''Gravatar url allows you to use other avatar server application.
45 45 Following variables of the URL will be replaced accordingly.
46 46 {scheme} 'http' or 'https' sent from running RhodeCode server,
47 47 {email} user email,
48 48 {md5email} md5 hash of the user email (like at gravatar.com),
49 49 {size} size of the image that is expected from the server application,
50 50 {netloc} network location/server host of running RhodeCode server''')}</span>
51 51 </div>
52 52 </div>
53 53 </div>
54 54 </div>
55 55
56 56
57 57 <div class="panel panel-default">
58 58 <div class="panel-heading" id="meta-tagging">
59 59 <h3 class="panel-title">${_('Meta-Tagging')}</h3>
60 60 </div>
61 61 <div class="panel-body">
62 62 <div class="checkbox">
63 63 ${h.checkbox('rhodecode_stylify_metatags','True')}
64 64 <label for="rhodecode_stylify_metatags">${_('Stylify recognised meta tags')}</label>
65 65 </div>
66 66 <span class="help-block">${_('Parses meta tags from repository or repository group description fields and turns them into colored tags.')}</span>
67 67 <div>
68 68 <%namespace name="dt" file="/data_table/_dt_elements.mako"/>
69 69 ${dt.metatags_help()}
70 70 </div>
71 71 </div>
72 72 </div>
73 73
74 74
75 75 <div class="panel panel-default">
76 76 <div class="panel-heading">
77 77 <h3 class="panel-title">${_('Dashboard Items')}</h3>
78 78 </div>
79 79 <div class="panel-body">
80 80 <div class="label">
81 81 <label for="rhodecode_dashboard_items">${_('Main page dashboard items')}</label>
82 82 </div>
83 83 <div class="field input">
84 84 ${h.text('rhodecode_dashboard_items',size=5)}
85 85 </div>
86 86 <div class="field">
87 87 <span class="help-block">${_('Number of items displayed in the main page dashboard before pagination is shown.')}</span>
88 88 </div>
89 89
90 90 <div class="label">
91 91 <label for="rhodecode_admin_grid_items">${_('Admin pages items')}</label>
92 92 </div>
93 93 <div class="field input">
94 94 ${h.text('rhodecode_admin_grid_items',size=5)}
95 95 </div>
96 96 <div class="field">
97 97 <span class="help-block">${_('Number of items displayed in the admin pages grids before pagination is shown.')}</span>
98 98 </div>
99 99 </div>
100 100 </div>
101 101
102 102
103 103
104 104 <div class="panel panel-default">
105 105 <div class="panel-heading" id="commit-id">
106 106 <h3 class="panel-title">${_('Commit ID Style')}</h3>
107 107 </div>
108 108 <div class="panel-body">
109 109 <div class="label">
110 110 <label for="rhodecode_show_sha_length">${_('Commit sha length')}</label>
111 111 </div>
112 112 <div class="input">
113 113 <div class="field">
114 114 ${h.text('rhodecode_show_sha_length',size=5)}
115 115 </div>
116 116 <div class="field">
117 117 <span class="help-block">${_('''Number of chars to show in commit sha displayed in web interface.
118 118 By default it's shown as r123:9043a6a4c226 this value defines the
119 119 length of the sha after the `r123:` part.''')}</span>
120 120 </div>
121 121 </div>
122 122
123 123 <div class="checkbox">
124 124 ${h.checkbox('rhodecode_show_revision_number','True')}
125 125 <label for="rhodecode_show_revision_number">${_('Show commit ID numeric reference')} / ${_('Commit show revision number')}</label>
126 126 </div>
127 127 <span class="help-block">${_('''Show revision number in commit sha displayed in web interface.
128 128 By default it's shown as r123:9043a6a4c226 this value defines the
129 129 if the `r123:` part is shown.''')}</span>
130 130 </div>
131 131 </div>
132 132
133 133
134 134 <div class="panel panel-default">
135 135 <div class="panel-heading" id="icons">
136 136 <h3 class="panel-title">${_('Icons')}</h3>
137 137 </div>
138 138 <div class="panel-body">
139 139 <div class="checkbox">
140 140 ${h.checkbox('rhodecode_show_public_icon','True')}
141 141 <label for="rhodecode_show_public_icon">${_('Show public repo icon on repositories')}</label>
142 142 </div>
143 143 <div></div>
144 144
145 145 <div class="checkbox">
146 146 ${h.checkbox('rhodecode_show_private_icon','True')}
147 147 <label for="rhodecode_show_private_icon">${_('Show private repo icon on repositories')}</label>
148 148 </div>
149 149 <span class="help-block">${_('Show public/private icons next to repositories names.')}</span>
150 150 </div>
151 151 </div>
152 152
153 153
154 154 <div class="panel panel-default">
155 155 <div class="panel-heading">
156 156 <h3 class="panel-title">${_('Markup Renderer')}</h3>
157 157 </div>
158 158 <div class="panel-body">
159 159 <div class="field select">
160 160 ${h.select('rhodecode_markup_renderer', '', ['rst', 'markdown'])}
161 161 </div>
162 162 <div class="field">
163 163 <span class="help-block">${_('Default renderer used to render comments, pull request descriptions and other description elements. After change old entries will still work correctly.')}</span>
164 164 </div>
165 165 </div>
166 166 </div>
167 167
168 168 <div class="panel panel-default">
169 169 <div class="panel-heading">
170 170 <h3 class="panel-title">${_('Clone URL')}</h3>
171 171 </div>
172 172 <div class="panel-body">
173 173 <div class="field">
174 174 ${h.text('rhodecode_clone_uri_tmpl', size=60)}
175 175 </div>
176 176
177 177 <div class="field">
178 178 <span class="help-block">
179 179 ${_('''Schema of clone url construction eg. '{scheme}://{user}@{netloc}/{repo}', available vars:
180 180 {scheme} 'http' or 'https' sent from running RhodeCode server,
181 181 {user} current user username,
182 182 {netloc} network location/server host of running RhodeCode server,
183 183 {repo} full repository name,
184 184 {repoid} ID of repository, can be used to contruct clone-by-id''')}
185 185 </span>
186 186 </div>
187 187 </div>
188 188 </div>
189 189
190 190 <div class="panel panel-default">
191 191 <div class="panel-heading">
192 192 <h3 class="panel-title">${_('Custom Support Link')}</h3>
193 193 </div>
194 194 <div class="panel-body">
195 195 <div class="field">
196 196 ${h.text('rhodecode_support_url', size=60)}
197 197 </div>
198 198 <div class="field">
199 199 <span class="help-block">
200 200 ${_('''Custom url for the support link located at the bottom.
201 201 The default is set to %(default_url)s. In case there's a need
202 202 to change the support link to internal issue tracker, it should be done here.
203 203 ''') % {'default_url': h.url('rhodecode_support')}}
204 204 </span>
205 205 </div>
206 206 </div>
207 207 </div>
208 208
209 209 <div class="buttons">
210 210 ${h.submit('save',_('Save settings'),class_="btn")}
211 211 ${h.reset('reset',_('Reset'),class_="btn")}
212 212 </div>
213 213
214 214
215 215 ${h.end_form()}
216 216
217 217 <script>
218 218 $(document).ready(function() {
219 219 $('#rhodecode_markup_renderer').select2({
220 220 containerCssClass: 'drop-menu',
221 221 dropdownCssClass: 'drop-menu-dropdown',
222 222 dropdownAutoWidth: true,
223 223 minimumResultsForSearch: -1
224 224 });
225 225 });
226 226 </script>
@@ -1,72 +1,72 b''
1 1 ## -*- coding: utf-8 -*-
2 2 <%inherit file="/base/base.mako"/>
3 3
4 4 <%def name="title()">
5 5 ${_('Add user group')}
6 6 %if c.rhodecode_name:
7 7 &middot; ${h.branding(c.rhodecode_name)}
8 8 %endif
9 9 </%def>
10 10 <%def name="breadcrumbs_links()">
11 11 ${h.link_to(_('Admin'),h.route_path('admin_home'))}
12 12 &raquo;
13 13 ${h.link_to(_('User groups'),h.route_path('user_groups'))}
14 14 &raquo;
15 15 ${_('Add User Group')}
16 16 </%def>
17 17
18 18 <%def name="menu_bar_nav()">
19 19 ${self.menu_items(active='admin')}
20 20 </%def>
21 21
22 22 <%def name="main()">
23 23 <div class="box main-content">
24 24 <!-- box / title -->
25 25 <div class="title">
26 26 ${self.breadcrumbs()}
27 27 </div>
28 28 <!-- end box / title -->
29 ${h.secure_form(h.route_path('user_groups_create'), method='POST', request=request)}
29 ${h.secure_form(h.route_path('user_groups_create'), request=request)}
30 30 <div class="form">
31 31 <!-- fields -->
32 32 <div class="fields">
33 33 <div class="field">
34 34 <div class="label">
35 35 <label for="users_group_name">${_('Group name')}:</label>
36 36 </div>
37 37 <div class="input">
38 38 ${h.text('users_group_name', class_='medium')}
39 39 </div>
40 40 </div>
41 41 <div class="field">
42 42 <div class="label">
43 43 <label for="user_group_description">${_('Description')}:</label>
44 44 </div>
45 45 <div class="textarea editor">
46 46 ${h.textarea('user_group_description')}
47 47 <span class="help-block">${_('Short, optional description for this user group.')}</span>
48 48 </div>
49 49 </div>
50 50 <div class="field">
51 51 <div class="label">
52 52 <label for="users_group_active">${_('Active')}:</label>
53 53 </div>
54 54 <div class="checkboxes">
55 55 ${h.checkbox('users_group_active',value=True, checked='checked')}
56 56 </div>
57 57 </div>
58 58
59 59 <div class="buttons">
60 60 ${h.submit('save',_('Save'),class_="btn")}
61 61 </div>
62 62 </div>
63 63 </div>
64 64 ${h.end_form()}
65 65 </div>
66 66 </%def>
67 67
68 68 <script>
69 69 $(document).ready(function(){
70 70 $('#users_group_name').focus();
71 71 })
72 72 </script>
@@ -1,84 +1,84 b''
1 1 <%namespace name="base" file="/base/base.mako"/>
2 2
3 3 <%
4 4 elems = [
5 5 (_('Owner'), lambda:base.gravatar_with_user(c.user_group.user.email), '', ''),
6 6 (_('Created on'), h.format_date(c.user_group.created_on), '', '',),
7 7
8 8 (_('Members'), len(c.group_members_obj),'', [x for x in c.group_members_obj]),
9 9 (_('Automatic member sync'), 'Yes' if c.user_group.group_data.get('extern_type') else 'No', '', '',),
10 10
11 11 (_('Assigned to repositories'), len(c.group_to_repos),'', [x for x in c.group_to_repos]),
12 12 (_('Assigned to repo groups'), len(c.group_to_repo_groups), '', [x for x in c.group_to_repo_groups]),
13 13
14 14 (_('Assigned to review rules'), len(c.group_to_review_rules), '', [x for x in c.group_to_review_rules]),
15 15 ]
16 16 %>
17 17
18 18 <div class="panel panel-default">
19 19 <div class="panel-heading">
20 20 <h3 class="panel-title">${_('User Group: %s') % c.user_group.users_group_name}</h3>
21 21 </div>
22 22 <div class="panel-body">
23 23 ${base.dt_info_panel(elems)}
24 24 </div>
25 25
26 26 </div>
27 27
28 28 <div class="panel panel-default">
29 29 <div class="panel-heading">
30 30 <h3 class="panel-title">${_('Group members sync')}</h3>
31 31 </div>
32 32 <div class="panel-body">
33 33 <% sync_type = c.user_group.group_data.get('extern_type') %>
34 34
35 35 % if sync_type:
36 36 <p>
37 37 ${_('This group is set to be automatically synchronised.')}<br/>
38 38 ${_('This group synchronization was set by')}: <strong>${sync_type}</strong>
39 39 </p>
40 40 % else:
41 41 <p>
42 42 ${_('This group is not set to be automatically synchronised')}
43 43 </p>
44 44 % endif
45 45
46 46 <div>
47 ${h.secure_form(h.route_path('edit_user_group_advanced_sync', user_group_id=c.user_group.users_group_id), method='POST', request=request)}
47 ${h.secure_form(h.route_path('edit_user_group_advanced_sync', user_group_id=c.user_group.users_group_id), request=request)}
48 48 <div class="field">
49 49 <button class="btn btn-default" type="submit">
50 50 %if sync_type:
51 51 ${_('Disable synchronization')}
52 52 %else:
53 53 ${_('Enable synchronization')}
54 54 %endif
55 55 </button>
56 56 </div>
57 57 <div class="field">
58 58 <span class="help-block">
59 59 ${_('Users will be added or removed from this group when they authenticate with RhodeCode system, based on LDAP group membership. '
60 60 'This requires `LDAP+User group` authentication plugin to be configured and enabled. (EE only feature)')}
61 61 </span>
62 62 </div>
63 63 ${h.end_form()}
64 64 </div>
65 65
66 66 </div>
67 67 </div>
68 68
69 69
70 70 <div class="panel panel-danger">
71 71 <div class="panel-heading">
72 72 <h3 class="panel-title">${_('Delete User Group')}</h3>
73 73 </div>
74 74 <div class="panel-body">
75 ${h.secure_form(h.route_path('user_groups_delete', user_group_id=c.user_group.users_group_id), method='POST', request=request)}
75 ${h.secure_form(h.route_path('user_groups_delete', user_group_id=c.user_group.users_group_id), request=request)}
76 76 ${h.hidden('force', 1)}
77 77 <button class="btn btn-small btn-danger" type="submit"
78 78 onclick="return confirm('${_('Confirm to delete user group `%(ugroup)s` with all permission assignments') % {'ugroup': c.user_group.users_group_name}}');">
79 79 <i class="icon-remove-sign"></i>
80 80 ${_('Delete This User Group')}
81 81 </button>
82 82 ${h.end_form()}
83 83 </div>
84 84 </div>
@@ -1,134 +1,134 b''
1 1 <%namespace name="base" file="/base/base.mako"/>
2 2
3 3 <div class="panel panel-default">
4 4 <div class="panel-heading">
5 5 <h3 class="panel-title">${_('User Group Permissions')}</h3>
6 6 </div>
7 7 <div class="panel-body">
8 ${h.secure_form(h.route_path('edit_user_group_perms_update', user_group_id=c.user_group.users_group_id), method='POST', request=request)}
8 ${h.secure_form(h.route_path('edit_user_group_perms_update', user_group_id=c.user_group.users_group_id), request=request)}
9 9 <table id="permissions_manage" class="rctable permissions">
10 10 <tr>
11 11 <th class="td-radio">${_('None')}</th>
12 12 <th class="td-radio">${_('Read')}</th>
13 13 <th class="td-radio">${_('Write')}</th>
14 14 <th class="td-radio">${_('Admin')}</th>
15 15 <th>${_('User/User Group')}</th>
16 16 <th></th>
17 17 </tr>
18 18 ## USERS
19 19 %for _user in c.user_group.permissions():
20 20 %if getattr(_user, 'admin_row', None) or getattr(_user, 'owner_row', None):
21 21 <tr class="perm_admin_row">
22 22 <td class="td-radio">${h.radio('admin_perm_%s' % _user.user_id,'repository.none', disabled="disabled")}</td>
23 23 <td class="td-radio">${h.radio('admin_perm_%s' % _user.user_id,'repository.read', disabled="disabled")}</td>
24 24 <td class="td-radio">${h.radio('admin_perm_%s' % _user.user_id,'repository.write', disabled="disabled")}</td>
25 25 <td class="td-radio">${h.radio('admin_perm_%s' % _user.user_id,'repository.admin', 'repository.admin', disabled="disabled")}</td>
26 26 <td class="td-user">
27 27 ${base.gravatar(_user.email, 16)}
28 28 <span class="user">
29 29 ${h.link_to_user(_user.username)}
30 30 %if getattr(_user, 'admin_row', None):
31 31 (${_('super admin')})
32 32 %endif
33 33 %if getattr(_user, 'owner_row', None):
34 34 (${_('owner')})
35 35 %endif
36 36 </span>
37 37 </td>
38 38 <td></td>
39 39 </tr>
40 40 %else:
41 41 ##forbid revoking permission from yourself, except if you're an super admin
42 42 <tr>
43 43 %if c.rhodecode_user.user_id != _user.user_id or c.rhodecode_user.is_admin:
44 44 <td class="td-radio">${h.radio('u_perm_%s' % _user.user_id,'usergroup.none')}</td>
45 45 <td class="td-radio">${h.radio('u_perm_%s' % _user.user_id,'usergroup.read')}</td>
46 46 <td class="td-radio">${h.radio('u_perm_%s' % _user.user_id,'usergroup.write')}</td>
47 47 <td class="td-radio">${h.radio('u_perm_%s' % _user.user_id,'usergroup.admin')}</td>
48 48 <td class="td-user">
49 49 ${base.gravatar(_user.email, 16)}
50 50 <span class="user">
51 51 % if _user.username == h.DEFAULT_USER:
52 52 ${h.DEFAULT_USER} <span class="user-perm-help-text"> - ${_('permission for all other users')}</span>
53 53 % else:
54 54 ${h.link_to_user(_user.username)}
55 55 % endif
56 56 </span>
57 57 </td>
58 58 <td class="td-action">
59 59 %if _user.username != h.DEFAULT_USER:
60 60 <span class="btn btn-link btn-danger revoke_perm"
61 61 member="${_user.user_id}" member_type="user">
62 62 <i class="icon-remove"></i> ${_('revoke')}
63 63 </span>
64 64 %endif
65 65 </td>
66 66 %else:
67 67 ## special case for current user permissions, we make sure he cannot take his own permissions
68 68 <td class="td-radio">${h.radio('u_perm_%s' % _user.user_id,'usergroup.none', disabled="disabled")}</td>
69 69 <td class="td-radio">${h.radio('u_perm_%s' % _user.user_id,'usergroup.read', disabled="disabled")}</td>
70 70 <td class="td-radio">${h.radio('u_perm_%s' % _user.user_id,'usergroup.write', disabled="disabled")}</td>
71 71 <td class="td-radio">${h.radio('u_perm_%s' % _user.user_id,'usergroup.admin', disabled="disabled")}</td>
72 72 <td class="td-user">
73 73 ${base.gravatar(_user.email, 16)}
74 74 <span class="user">
75 75 % if _user.username == h.DEFAULT_USER:
76 76 ${h.DEFAULT_USER} <span class="user-perm-help-text"> - ${_('permission for all other users')}</span>
77 77 % else:
78 78 ${h.link_to_user(_user.username)}
79 79 % endif
80 80 <span class="user-perm-help-text">(${_('delegated admin')})</span>
81 81 </span>
82 82 </td>
83 83 <td></td>
84 84 %endif
85 85 </tr>
86 86 %endif
87 87 %endfor
88 88
89 89 ## USER GROUPS
90 90 %for _user_group in c.user_group.permission_user_groups():
91 91 <tr>
92 92 <td class="td-radio">${h.radio('g_perm_%s' % _user_group.users_group_id,'usergroup.none')}</td>
93 93 <td class="td-radio">${h.radio('g_perm_%s' % _user_group.users_group_id,'usergroup.read')}</td>
94 94 <td class="td-radio">${h.radio('g_perm_%s' % _user_group.users_group_id,'usergroup.write')}</td>
95 95 <td class="td-radio">${h.radio('g_perm_%s' % _user_group.users_group_id,'usergroup.admin')}</td>
96 96 <td class="td-user">
97 97 <i class="icon-group" ></i>
98 98 %if h.HasPermissionAny('hg.admin')():
99 99 <a href="${h.route_path('edit_user_group',user_group_id=_user_group.users_group_id)}">
100 100 ${_user_group.users_group_name}
101 101 </a>
102 102 %else:
103 103 ${_user_group.users_group_name}
104 104 %endif
105 105 </td>
106 106 <td class="td-action">
107 107 <span class="btn btn-link btn-danger revoke_perm"
108 108 member="${_user_group.users_group_id}" member_type="user_group">
109 109 <i class="icon-remove"></i> ${_('revoke')}
110 110 </span>
111 111 </td>
112 112 </tr>
113 113 %endfor
114 114 <tr class="new_members" id="add_perm_input"></tr>
115 115 </table>
116 116 <div id="add_perm" class="link">
117 117 ${_('Add new')}
118 118 </div>
119 119 <div class="buttons">
120 120 ${h.submit('save',_('Save'),class_="btn btn-primary")}
121 121 ${h.reset('reset',_('Reset'),class_="btn btn-danger")}
122 122 </div>
123 123 ${h.end_form()}
124 124 </div>
125 125 </div>
126 126
127 127 <script type="text/javascript">
128 128 $('#add_perm').on('click', function(e){
129 129 addNewPermInput($(this), 'usergroup');
130 130 });
131 131 $('.revoke_perm').on('click', function(e){
132 132 markRevokePermInput($(this), 'usergroup');
133 133 });
134 134 </script>
@@ -1,186 +1,186 b''
1 1 ## -*- coding: utf-8 -*-
2 2 <%namespace name="base" file="/base/base.mako"/>
3 3
4 4 <div class="panel panel-default">
5 5 <div class="panel-heading">
6 6 <h3 class="panel-title">${_('User Group: %s') % c.user_group.users_group_name}</h3>
7 7 </div>
8 8 <div class="panel-body">
9 ${h.secure_form(h.route_path('user_groups_update', user_group_id=c.user_group.users_group_id), id='edit_user_group', method='POST', request=request)}
9 ${h.secure_form(h.route_path('user_groups_update', user_group_id=c.user_group.users_group_id), id='edit_user_group', request=request)}
10 10 <div class="form">
11 11 <!-- fields -->
12 12 <div class="fields">
13 13 <div class="field">
14 14 <div class="label">
15 15 <label for="users_group_name">${_('Group name')}:</label>
16 16 </div>
17 17 <div class="input">
18 18 ${h.text('users_group_name',class_='medium')}
19 19 </div>
20 20 </div>
21 21
22 22 <div class="field badged-field">
23 23 <div class="label">
24 24 <label for="user">${_('Owner')}:</label>
25 25 </div>
26 26 <div class="input">
27 27 <div class="badge-input-container">
28 28 <div class="user-badge">
29 29 ${base.gravatar_with_user(c.user_group.user.email, show_disabled=not c.user_group.user.active)}
30 30 </div>
31 31 <div class="badge-input-wrap">
32 32 ${h.text('user', class_="medium", autocomplete="off")}
33 33 </div>
34 34 </div>
35 35 <form:error name="user"/>
36 36 <p class="help-block">${_('Change owner of this user group.')}</p>
37 37 </div>
38 38 </div>
39 39
40 40 <div class="field">
41 41 <div class="label label-textarea">
42 42 <label for="user_group_description">${_('Description')}:</label>
43 43 </div>
44 44 <div class="textarea textarea-small editor">
45 45 ${h.textarea('user_group_description',cols=23,rows=5,class_="medium")}
46 46 <span class="help-block">${_('Short, optional description for this user group.')}</span>
47 47 </div>
48 48 </div>
49 49 <div class="field">
50 50 <div class="label label-checkbox">
51 51 <label for="users_group_active">${_('Active')}:</label>
52 52 </div>
53 53 <div class="checkboxes">
54 54 ${h.checkbox('users_group_active',value=True)}
55 55 </div>
56 56 </div>
57 57
58 58 <div class="field">
59 59 <div class="label label-checkbox">
60 60 <label for="users_group_active">${_('Add members')}:</label>
61 61 </div>
62 62 <div class="input">
63 63 ${h.text('user_group_add_members', placeholder="user/usergroup", class_="medium")}
64 64 </div>
65 65 </div>
66 66
67 67 <input type="hidden" name="__start__" value="user_group_members:sequence"/>
68 68 <table id="group_members_placeholder" class="rctable group_members">
69 69 <tr>
70 70 <th>${_('Username')}</th>
71 71 <th>${_('Action')}</th>
72 72 </tr>
73 73
74 74 % if c.group_members_obj:
75 75 % for user in c.group_members_obj:
76 76 <tr>
77 77 <td id="member_user_${user.user_id}" class="td-author">
78 78 <div class="group_member">
79 79 ${base.gravatar(user.email, 16)}
80 80 <span class="username user">${h.link_to(h.person(user), h.url( 'edit_user',user_id=user.user_id))}</span>
81 81 <input type="hidden" name="__start__" value="member:mapping">
82 82 <input type="hidden" name="member_user_id" value="${user.user_id}">
83 83 <input type="hidden" name="type" value="existing" id="member_${user.user_id}">
84 84 <input type="hidden" name="__end__" value="member:mapping">
85 85 </div>
86 86 </td>
87 87 <td class="">
88 88 <div class="usergroup_member_remove action_button" onclick="removeUserGroupMember(${user.user_id}, true)" style="visibility: visible;">
89 89 <i class="icon-remove-sign"></i>
90 90 </div>
91 91 </td>
92 92 </tr>
93 93 % endfor
94 94
95 95 % else:
96 96 <tr><td colspan="2">${_('No members yet')}</td></tr>
97 97 % endif
98 98 </table>
99 99 <input type="hidden" name="__end__" value="user_group_members:sequence"/>
100 100
101 101 <div class="buttons">
102 102 ${h.submit('Save',_('Save'),class_="btn")}
103 103 </div>
104 104 </div>
105 105 </div>
106 106 ${h.end_form()}
107 107 </div>
108 108 </div>
109 109 <script>
110 110 $(document).ready(function(){
111 111 $("#group_parent_id").select2({
112 112 'containerCssClass': "drop-menu",
113 113 'dropdownCssClass': "drop-menu-dropdown",
114 114 'dropdownAutoWidth': true
115 115 });
116 116
117 117 removeUserGroupMember = function(userId){
118 118 $('#member_'+userId).val('remove');
119 119 $('#member_user_'+userId).addClass('to-delete');
120 120 };
121 121
122 122 $('#user_group_add_members').autocomplete({
123 123 serviceUrl: pyroutes.url('user_autocomplete_data'),
124 124 minChars:2,
125 125 maxHeight:400,
126 126 width:300,
127 127 deferRequestBy: 300, //miliseconds
128 128 showNoSuggestionNotice: true,
129 129 params: { user_groups:true },
130 130 formatResult: autocompleteFormatResult,
131 131 lookupFilter: autocompleteFilterResult,
132 132 onSelect: function(element, suggestion){
133 133
134 134 function addMember(user, fromUserGroup) {
135 135 var gravatar = user.icon_link;
136 136 var username = user.value_display;
137 137 var userLink = pyroutes.url('edit_user', {"user_id": user.id});
138 138 var uid = user.id;
139 139
140 140 if (fromUserGroup) {
141 141 username = username +" "+ _gettext('(from usergroup {0})'.format(fromUserGroup))
142 142 }
143 143
144 144 var elem = $(
145 145 ('<tr>'+
146 146 '<td id="member_user_{6}" class="td-author td-author-new-entry">'+
147 147 '<div class="group_member">'+
148 148 '<img class="gravatar" src="{0}" height="16" width="16">'+
149 149 '<span class="username user"><a href="{1}">{2}</a></span>'+
150 150 '<input type="hidden" name="__start__" value="member:mapping">'+
151 151 '<input type="hidden" name="member_user_id" value="{3}">'+
152 152 '<input type="hidden" name="type" value="new" id="member_{4}">'+
153 153 '<input type="hidden" name="__end__" value="member:mapping">'+
154 154 '</div>'+
155 155 '</td>'+
156 156 '<td class="td-author-new-entry">'+
157 157 '<div class="usergroup_member_remove action_button" onclick="removeUserGroupMember({5}, true)" style="visibility: visible;">'+
158 158 '<i class="icon-remove-sign"></i>'+
159 159 '</div>'+
160 160 '</td>'+
161 161 '</tr>').format(gravatar, userLink, username,
162 162 uid, uid, uid, uid)
163 163 );
164 164 $('#group_members_placeholder').append(elem)
165 165 }
166 166
167 167 if (suggestion.value_type == 'user_group') {
168 168 $.getJSON(
169 169 pyroutes.url('user_group_members_data',
170 170 {'user_group_id': suggestion.id}),
171 171 function(data) {
172 172 $.each(data.members, function(idx, user) {
173 173 addMember(user, suggestion.value)
174 174 });
175 175 }
176 176 );
177 177 } else if (suggestion.value_type == 'user') {
178 178 addMember(suggestion, null);
179 179 }
180 180 }
181 181 });
182 182
183 183
184 184 UsersAutoComplete('user', '${c.rhodecode_user.user_id}');
185 185 })
186 186 </script>
@@ -1,176 +1,176 b''
1 1 <div class="panel panel-default">
2 2 <div class="panel-heading">
3 3 <h3 class="panel-title">${_('Authentication Tokens')}</h3>
4 4 </div>
5 5 <div class="panel-body">
6 6 <div class="apikeys_wrap">
7 7 <p>
8 8 ${_('Each token can have a role. Token with a role can be used only in given context, '
9 9 'e.g. VCS tokens can be used together with the authtoken auth plugin for git/hg/svn operations only.')}
10 10 </p>
11 11 <table class="rctable auth_tokens">
12 12 <tr>
13 13 <th>${_('Token')}</th>
14 14 <th>${_('Scope')}</th>
15 15 <th>${_('Description')}</th>
16 16 <th>${_('Role')}</th>
17 17 <th>${_('Expiration')}</th>
18 18 <th>${_('Action')}</th>
19 19 </tr>
20 20 %if c.user_auth_tokens:
21 21 %for auth_token in c.user_auth_tokens:
22 22 <tr class="${'expired' if auth_token.expired else ''}">
23 23 <td class="truncate-wrap td-authtoken"><div class="user_auth_tokens truncate autoexpand"><code>${auth_token.api_key}</code></div></td>
24 24 <td class="td">${auth_token.scope_humanized}</td>
25 25 <td class="td-wrap">${auth_token.description}</td>
26 26 <td class="td-tags">
27 27 <span class="tag disabled">${auth_token.role_humanized}</span>
28 28 </td>
29 29 <td class="td-exp">
30 30 %if auth_token.expires == -1:
31 31 ${_('never')}
32 32 %else:
33 33 %if auth_token.expired:
34 34 <span style="text-decoration: line-through">${h.age_component(h.time_to_utcdatetime(auth_token.expires))}</span>
35 35 %else:
36 36 ${h.age_component(h.time_to_utcdatetime(auth_token.expires))}
37 37 %endif
38 38 %endif
39 39 </td>
40 40 <td class="td-action">
41 ${h.secure_form(h.route_path('edit_user_auth_tokens_delete', user_id=c.user.user_id), method='POST', request=request)}
41 ${h.secure_form(h.route_path('edit_user_auth_tokens_delete', user_id=c.user.user_id), request=request)}
42 42 ${h.hidden('del_auth_token', auth_token.user_api_key_id)}
43 43 <button class="btn btn-link btn-danger" type="submit"
44 44 onclick="return confirm('${_('Confirm to remove this auth token: %s') % auth_token.token_obfuscated}');">
45 45 ${_('Delete')}
46 46 </button>
47 47 ${h.end_form()}
48 48 </td>
49 49 </tr>
50 50 %endfor
51 51 %else:
52 52 <tr><td><div class="ip">${_('No additional auth tokens specified')}</div></td></tr>
53 53 %endif
54 54 </table>
55 55 </div>
56 56
57 57 <div class="user_auth_tokens">
58 ${h.secure_form(h.route_path('edit_user_auth_tokens_add', user_id=c.user.user_id), method='POST', request=request)}
58 ${h.secure_form(h.route_path('edit_user_auth_tokens_add', user_id=c.user.user_id), request=request)}
59 59 <div class="form form-vertical">
60 60 <!-- fields -->
61 61 <div class="fields">
62 62 <div class="field">
63 63 <div class="label">
64 64 <label for="new_email">${_('New authentication token')}:</label>
65 65 </div>
66 66 <div class="input">
67 67 ${h.text('description', class_='medium', placeholder=_('Description'))}
68 68 ${h.hidden('lifetime')}
69 69 ${h.select('role', '', c.role_options)}
70 70
71 71 % if c.allow_scoped_tokens:
72 72 ${h.hidden('scope_repo_id')}
73 73 % else:
74 74 ${h.select('scope_repo_id_disabled', '', ['Scopes available in EE edition'], disabled='disabled')}
75 75 % endif
76 76 </div>
77 77 <p class="help-block">
78 78 ${_('Repository scope works only with tokens with VCS type.')}
79 79 </p>
80 80 </div>
81 81 <div class="buttons">
82 82 ${h.submit('save',_('Add'),class_="btn")}
83 83 ${h.reset('reset',_('Reset'),class_="btn")}
84 84 </div>
85 85 </div>
86 86 </div>
87 87 ${h.end_form()}
88 88 </div>
89 89 </div>
90 90 </div>
91 91
92 92 <script>
93 93
94 94 $(document).ready(function(){
95 95 var select2Options = {
96 96 'containerCssClass': "drop-menu",
97 97 'dropdownCssClass': "drop-menu-dropdown",
98 98 'dropdownAutoWidth': true
99 99 };
100 100 $("#role").select2(select2Options);
101 101
102 102 var preloadData = {
103 103 results: [
104 104 % for entry in c.lifetime_values:
105 105 {id:${entry[0]}, text:"${entry[1]}"}${'' if loop.last else ','}
106 106 % endfor
107 107 ]
108 108 };
109 109
110 110 $("#lifetime").select2({
111 111 containerCssClass: "drop-menu",
112 112 dropdownCssClass: "drop-menu-dropdown",
113 113 dropdownAutoWidth: true,
114 114 data: preloadData,
115 115 placeholder: "${_('Select or enter expiration date')}",
116 116 query: function(query) {
117 117 feedLifetimeOptions(query, preloadData);
118 118 }
119 119 });
120 120
121 121
122 122 var repoFilter = function(data) {
123 123 var results = [];
124 124
125 125 if (!data.results[0]) {
126 126 return data
127 127 }
128 128
129 129 $.each(data.results[0].children, function() {
130 130 // replace name to ID for submision
131 131 this.id = this.obj.repo_id;
132 132 results.push(this);
133 133 });
134 134
135 135 data.results[0].children = results;
136 136 return data;
137 137 };
138 138
139 139 $("#scope_repo_id_disabled").select2(select2Options);
140 140
141 141 $("#scope_repo_id").select2({
142 142 cachedDataSource: {},
143 143 minimumInputLength: 2,
144 144 placeholder: "${_('repository scope')}",
145 145 dropdownAutoWidth: true,
146 146 containerCssClass: "drop-menu",
147 147 dropdownCssClass: "drop-menu-dropdown",
148 148 formatResult: formatResult,
149 149 query: $.debounce(250, function(query){
150 150 self = this;
151 151 var cacheKey = query.term;
152 152 var cachedData = self.cachedDataSource[cacheKey];
153 153
154 154 if (cachedData) {
155 155 query.callback({results: cachedData.results});
156 156 } else {
157 157 $.ajax({
158 158 url: pyroutes.url('repo_list_data'),
159 159 data: {'query': query.term},
160 160 dataType: 'json',
161 161 type: 'GET',
162 162 success: function(data) {
163 163 data = repoFilter(data);
164 164 self.cachedDataSource[cacheKey] = data;
165 165 query.callback({results: data.results});
166 166 },
167 167 error: function(data, textStatus, errorThrown) {
168 168 alert("Error while fetching entries.\nError code {0} ({1}).".format(data.status, data.statusText));
169 169 }
170 170 })
171 171 }
172 172 })
173 173 });
174 174
175 175 });
176 176 </script>
@@ -1,71 +1,71 b''
1 1 <%namespace name="base" file="/base/base.mako"/>
2 2
3 3 <div class="panel panel-default">
4 4 <div class="panel-heading">
5 5 <h3 class="panel-title">${_('Additional Email Addresses')}</h3>
6 6 </div>
7 7 <div class="panel-body">
8 8 <div class="emails_wrap">
9 9 <table class="rctable account_emails useremails">
10 10 <tr>
11 11 <td class="td-user">
12 12 ${base.gravatar(c.user.email, 16)}
13 13 <span class="user email">${c.user.email}</span>
14 14 </td>
15 15 <td class="td-tags">
16 16 <span class="tag">${_('Primary')}</span>
17 17 </td>
18 18 </tr>
19 19 %if c.user_email_map:
20 20 %for em in c.user_email_map:
21 21 <tr>
22 22 <td class="td-user">
23 23 ${base.gravatar(em.email, 16)}
24 24 <span class="user email">${em.email}</span>
25 25 </td>
26 26 <td class="td-action">
27 ${h.secure_form(h.route_path('edit_user_emails_delete', user_id=c.user.user_id), method='POST', request=request)}
27 ${h.secure_form(h.route_path('edit_user_emails_delete', user_id=c.user.user_id), request=request)}
28 28 ${h.hidden('del_email_id', em.email_id)}
29 29 <button class="btn btn-link btn-danger" type="submit"
30 30 onclick="return confirm('${_('Confirm to delete this email: %s') % em.email}');">
31 31 ${_('Delete')}
32 32 </button>
33 33 ${h.end_form()}
34 34 </td>
35 35 </tr>
36 36 %endfor
37 37 %else:
38 38 <tr class="noborder">
39 39 <td colspan="3">
40 40 <div class="td-email">
41 41 ${_('No additional emails specified')}
42 42 </div>
43 43 </td>
44 44 </tr>
45 45 %endif
46 46 </table>
47 47 </div>
48 48
49 ${h.secure_form(h.route_path('edit_user_emails_add', user_id=c.user.user_id), method='POST', request=request)}
49 ${h.secure_form(h.route_path('edit_user_emails_add', user_id=c.user.user_id), request=request)}
50 50 <div class="form">
51 51 <!-- fields -->
52 52 <div class="fields">
53 53 <div class="field">
54 54 <div class="label">
55 55 <label for="new_email">${_('New email address')}:</label>
56 56 </div>
57 57 <div class="input">
58 58 ${h.text('new_email', class_='medium')}
59 59 </div>
60 60 </div>
61 61 <div class="buttons">
62 62 ${h.submit('save',_('Add'),class_="btn btn-small")}
63 63 ${h.reset('reset',_('Reset'),class_="btn btn-small")}
64 64 </div>
65 65 </div>
66 66 </div>
67 67 ${h.end_form()}
68 68 </div>
69 69 </div>
70 70
71 71
@@ -1,147 +1,147 b''
1 1 ## -*- coding: utf-8 -*-
2 2
3 3
4 4 <div class="panel panel-default">
5 5 <div class="panel-heading">
6 6 <h3 class="panel-title">${_('User groups administration')}</h3>
7 7 </div>
8 8 <div class="panel-body">
9 9 <div class="fields">
10 10 <div class="field">
11 11 <div class="label label-checkbox">
12 12 <label for="users_group_active">${_('Add `%s` to user group') % c.user.username}:</label>
13 13 </div>
14 14 <div class="input">
15 15 ${h.text('add_user_to_group', placeholder="user group name", class_="medium")}
16 16 </div>
17 17
18 18 </div>
19 19 </div>
20 20
21 21 <div class="groups_management">
22 ${h.secure_form(h.route_path('edit_user_groups_management_updates', user_id=c.user.user_id), method='POST', request=request)}
22 ${h.secure_form(h.route_path('edit_user_groups_management_updates', user_id=c.user.user_id), request=request)}
23 23 <div id="repos_list_wrap">
24 24 <table id="user_group_list_table" class="display"></table>
25 25 </div>
26 26 <div class="buttons">
27 27 ${h.submit('save',_('Save'),class_="btn")}
28 28 </div>
29 29 ${h.end_form()}
30 30 </div>
31 31 </div>
32 32 </div>
33 33 <script>
34 34 var api;
35 35 $(document).ready(function() {
36 36
37 37 var get_datatable_count = function(){
38 38 $('#user_group_count').text(api.page.info().recordsDisplay);
39 39 };
40 40
41 41 $('#user_group_list_table').on('click', 'a.editor_remove', function (e) {
42 42 e.preventDefault();
43 43 var row = api.row($(this).closest('tr'));
44 44 row.remove().draw();
45 45 } );
46 46
47 47 $('#user_group_list_table').DataTable({
48 48 data: ${c.groups|n},
49 49 dom: 'rtp',
50 50 pageLength: ${c.visual.admin_grid_items},
51 51 order: [[ 0, "asc" ]],
52 52 columns: [
53 53 { data: {"_": "group_name",
54 54 "sort": "group_name"}, title: "${_('Name')}", className: "td-componentname," ,
55 55 render: function (data,type,full,meta)
56 56 {return '<div><i class="icon-group" title="User group">'+data+'</i></div>'}},
57 57
58 58 { data: {"_": "group_description",
59 59 "sort": "group_description"}, title: "${_('Description')}", className: "td-description" },
60 60 { data: {"_": "users_group_id"}, className: "td-user",
61 61 render: function (data,type,full,meta)
62 62 {return '<input type="hidden" name="users_group_id" value="'+data+'">'}},
63 63 { data: {"_": "active",
64 64 "sort": "active"}, title: "${_('Active')}", className: "td-active", className: "td-number"},
65 65 { data: {"_": "owner_data"}, title: "${_('Owner')}", className: "td-user",
66 66 render: function (data,type,full,meta)
67 67 {return '<div class="rc-user tooltip">'+
68 68 '<img class="gravatar" src="'+ data.owner_icon +'" height="16" width="16">'+
69 69 data.owner +'</div>'
70 70 }
71 71 },
72 72 { data: null,
73 73 title: "${_('Action')}",
74 74 className: "td-action",
75 75 defaultContent: '<a href="" class="btn btn-link btn-danger">Delete</a>'
76 76 },
77 77 ],
78 78 language: {
79 79 paginate: DEFAULT_GRID_PAGINATION,
80 80 emptyTable: _gettext("No user groups available yet.")
81 81 },
82 82 "initComplete": function( settings, json ) {
83 83 var data_grid = $('#user_group_list_table').dataTable();
84 84 api = data_grid.api();
85 85 get_datatable_count();
86 86 }
87 87 });
88 88
89 89 // update the counter when doing search
90 90 $('#user_group_list_table').on( 'search.dt', function (e,settings) {
91 91 get_datatable_count();
92 92 });
93 93
94 94 // filter, filter both grids
95 95 $('#q_filter').on( 'keyup', function () {
96 96 var user_api = $('#user_group_list_table').dataTable().api();
97 97 user_api
98 98 .columns(0)
99 99 .search(this.value)
100 100 .draw();
101 101 });
102 102
103 103 // refilter table if page load via back button
104 104 $("#q_filter").trigger('keyup');
105 105
106 106 });
107 107
108 108 $('#language').select2({
109 109 'containerCssClass': "drop-menu",
110 110 'dropdownCssClass': "drop-menu-dropdown",
111 111 'dropdownAutoWidth': true
112 112 });
113 113
114 114
115 115
116 116 $(document).ready(function(){
117 117 $("#group_parent_id").select2({
118 118 'containerCssClass': "drop-menu",
119 119 'dropdownCssClass': "drop-menu-dropdown",
120 120 'dropdownAutoWidth': true
121 121 });
122 122
123 123 $('#add_user_to_group').autocomplete({
124 124 serviceUrl: pyroutes.url('user_group_autocomplete_data'),
125 125 minChars:2,
126 126 maxHeight:400,
127 127 width:300,
128 128 deferRequestBy: 300, //miliseconds
129 129 showNoSuggestionNotice: true,
130 130 params: { user_groups:true },
131 131 formatResult: autocompleteFormatResult,
132 132 lookupFilter: autocompleteFilterResult,
133 133 onSelect: function(element, suggestion){
134 134 var owner = {owner_icon: suggestion.owner_icon, owner:suggestion.owner};
135 135 api.row.add(
136 136 {"active": suggestion.active,
137 137 "owner_data": owner,
138 138 "users_group_id": suggestion.id,
139 139 "group_description": suggestion.description,
140 140 "group_name": suggestion.value}).draw();
141 141 }
142 142 });
143 143 })
144 144
145 145 </script>
146 146
147 147
@@ -1,78 +1,78 b''
1 1 <div class="panel panel-default">
2 2 <div class="panel-heading">
3 3 <h3 class="panel-title">${_('Custom IP Whitelist')}</h3>
4 4 </div>
5 5 <div class="panel-body">
6 6 <div class="ips_wrap">
7 7 <h5>${_('Current IP address')}: <code>${c.rhodecode_user.ip_addr}</code></h5>
8 8 <table class="rctable ip-whitelist">
9 9 <tr>
10 10 <th>${_('IP Address')}</th>
11 11 <th>${_('IP Range')}</th>
12 12 <th>${_('Description')}</th>
13 13 <th></th>
14 14 </tr>
15 15 %if c.default_user_ip_map and c.inherit_default_ips:
16 16 %for ip in c.default_user_ip_map:
17 17 <tr>
18 18 <td class="td-ip"><div class="ip">${ip.ip_addr}</div></td>
19 19 <td class="td-iprange"><div class="ip">${h.ip_range(ip.ip_addr)}</div></td>
20 20 <td class="td-description">${h.literal(_('Inherited from %s') % h.link_to('*default*',h.route_path('admin_permissions_ips')))}</td>
21 21 <td></td>
22 22 </tr>
23 23 %endfor
24 24 %endif
25 25
26 26 %if c.user_ip_map:
27 27 %for ip in c.user_ip_map:
28 28 <tr>
29 29 <td class="td-ip"><div class="ip">${ip.ip_addr}</div></td>
30 30 <td class="td-iprange"><div class="ip">${h.ip_range(ip.ip_addr)}</div></td>
31 31 <td class="td-description"><div class="ip">${ip.description}</div></td>
32 32 <td class="td-action">
33 ${h.secure_form(h.route_path('edit_user_ips_delete', user_id=c.user.user_id), method='POST', request=request)}
33 ${h.secure_form(h.route_path('edit_user_ips_delete', user_id=c.user.user_id), request=request)}
34 34 ${h.hidden('del_ip_id', ip.ip_id)}
35 35 ${h.submit('remove_', _('Delete'),id="remove_ip_%s" % ip.ip_id,
36 36 class_="btn btn-link btn-danger", onclick="return confirm('"+_('Confirm to delete this ip: %s') % ip.ip_addr+"');")}
37 37 ${h.end_form()}
38 38 </td>
39 39 </tr>
40 40 %endfor
41 41 %endif
42 42 %if not c.default_user_ip_map and not c.user_ip_map:
43 43 <tr>
44 44 <td><h2 class="ip">${_('All IP addresses are allowed')}</h2></td>
45 45 <td></td>
46 46 <td></td>
47 47 <td></td>
48 48 </tr>
49 49 %endif
50 50 </table>
51 51 </div>
52 52
53 53 <div>
54 ${h.secure_form(h.route_path('edit_user_ips_add', user_id=c.user.user_id), method='POST', request=request)}
54 ${h.secure_form(h.route_path('edit_user_ips_add', user_id=c.user.user_id), request=request)}
55 55 <div class="form">
56 56 <!-- fields -->
57 57 <div class="fields">
58 58 <div class="field">
59 59 <div class="label">
60 60 <label for="new_ip">${_('New IP Address')}:</label>
61 61 </div>
62 62 <div class="input">
63 63 ${h.text('new_ip')} ${h.text('description', placeholder=_('Description...'))}
64 64 <span class="help-block">${_('Enter comma separated list of ip addresses like 127.0.0.1,\n'
65 65 'or use a ip address with a mask 127.0.0.1/24, to create a network range.\n'
66 66 'To specify multiple address range use 127.0.0.1-127.0.0.10 syntax')}</span>
67 67 </div>
68 68 </div>
69 69 <div class="buttons">
70 70 ${h.submit('save',_('Add'),class_="btn btn-small")}
71 71 ${h.reset('reset',_('Reset'),class_="btn btn-small")}
72 72 </div>
73 73 </div>
74 74 </div>
75 75 ${h.end_form()}
76 76 </div>
77 77 </div>
78 78 </div>
@@ -1,78 +1,78 b''
1 1 <div class="panel panel-default">
2 2 <div class="panel-heading">
3 3 <h3 class="panel-title">${_('SSH Keys')}</h3>
4 4 </div>
5 5 <div class="panel-body">
6 6 <div class="sshkeys_wrap">
7 7 <table class="rctable ssh_keys">
8 8 <tr>
9 9 <th>${_('Fingerprint')}</th>
10 10 <th>${_('Description')}</th>
11 11 <th>${_('Created')}</th>
12 12 <th>${_('Action')}</th>
13 13 </tr>
14 14 %if c.user_ssh_keys:
15 15 %for ssh_key in c.user_ssh_keys:
16 16 <tr class="">
17 17 <td class="">
18 18 <code>${ssh_key.ssh_key_fingerprint}</code>
19 19 </td>
20 20 <td class="td-wrap">${ssh_key.description}</td>
21 21 <td class="td-tags">${h.format_date(ssh_key.created_on)}</td>
22 22
23 23 <td class="td-action">
24 ${h.secure_form(h.route_path('edit_user_ssh_keys_delete', user_id=c.user.user_id), method='POST', request=request)}
24 ${h.secure_form(h.route_path('edit_user_ssh_keys_delete', user_id=c.user.user_id), request=request)}
25 25 ${h.hidden('del_ssh_key', ssh_key.ssh_key_id)}
26 26 <button class="btn btn-link btn-danger" type="submit"
27 27 onclick="return confirm('${_('Confirm to remove ssh key %s') % ssh_key.ssh_key_fingerprint}');">
28 28 ${_('Delete')}
29 29 </button>
30 30 ${h.end_form()}
31 31 </td>
32 32 </tr>
33 33 %endfor
34 34 %else:
35 35 <tr><td><div class="ip">${_('No additional ssh keys specified')}</div></td></tr>
36 36 %endif
37 37 </table>
38 38 </div>
39 39
40 40 <div class="user_ssh_keys">
41 ${h.secure_form(h.route_path('edit_user_ssh_keys_add', user_id=c.user.user_id), method='POST', request=request)}
41 ${h.secure_form(h.route_path('edit_user_ssh_keys_add', user_id=c.user.user_id), request=request)}
42 42 <div class="form form-vertical">
43 43 <!-- fields -->
44 44 <div class="fields">
45 45 <div class="field">
46 46 <div class="label">
47 47 <label for="new_email">${_('New ssh key')}:</label>
48 48 </div>
49 49 <div class="input">
50 50 ${h.text('description', class_='medium', placeholder=_('Description'))}
51 51 <a href="${h.route_path('edit_user_ssh_keys_generate_keypair', user_id=c.user.user_id)}">${_('Generate random RSA key')}</a>
52 52 </div>
53 53 </div>
54 54
55 55 <div class="field">
56 56 <div class="textarea text-area editor">
57 57 ${h.textarea('key_data',c.default_key, size=30, placeholder=_("Public key, begins with 'ssh-rsa', 'ssh-dss', 'ssh-ed25519', 'ecdsa-sha2-nistp256', 'ecdsa-sha2-nistp384', or 'ecdsa-sha2-nistp521'"))}
58 58 </div>
59 59 </div>
60 60
61 61 <div class="buttons">
62 62 ${h.submit('save',_('Add'),class_="btn")}
63 63 ${h.reset('reset',_('Reset'),class_="btn")}
64 64 </div>
65 65 </div>
66 66 </div>
67 67 ${h.end_form()}
68 68 </div>
69 69 </div>
70 70 </div>
71 71
72 72 <script>
73 73
74 74 $(document).ready(function(){
75 75
76 76
77 77 });
78 78 </script>
@@ -1,156 +1,156 b''
1 1 ## snippet for displaying default permission box
2 2 ## usage:
3 3 ## <%namespace name="dpb" file="/base/default_perms_box.mako"/>
4 4 ## ${dpb.default_perms_box(<url_to_form>)}
5 5 ## ${dpb.default_perms_radios()}
6 6
7 7 <%def name="default_perms_radios(global_permissions_template = False, suffix='', **kwargs)">
8 8 <div class="main-content-full-width">
9 9 <div class="panel panel-default">
10 10
11 11 ## displayed according to checkbox selection
12 12 <div class="panel-heading">
13 13 %if not global_permissions_template:
14 14 <h3 class="inherit_overlay_default panel-title">${_('Inherited Permissions')}</h3>
15 15 <h3 class="inherit_overlay panel-title">${_('Custom Permissions')}</h3>
16 16 %else:
17 17 <h3 class="panel-title">${_('Default Global Permissions')}</h3>
18 18 %endif
19 19 </div>
20 20
21 21 <div class="panel-body">
22 22 %if global_permissions_template:
23 23 <p>${_('The following options configure the default permissions each user or group will inherit. You can override these permissions for each individual user or user group using individual permissions settings.')}</p>
24 24 %endif
25 25 <div class="field">
26 26 <div class="label">
27 27 <label for="default_repo_create${suffix}">${_('Repository Creation')}:</label>
28 28 </div>
29 29 <div class="radios">
30 30 ${h.radio('default_repo_create' + suffix, c.repo_create_choices[1][0], label=c.repo_create_choices[1][1], **kwargs)}
31 31 ${h.radio('default_repo_create' + suffix, c.repo_create_choices[0][0], label=c.repo_create_choices[0][1], **kwargs)}
32 32 <span class="help-block">${_('Permission to create root level repositories. When disabled, users can still create repositories inside their own repository groups.')}</span>
33 33 </div>
34 34 </div>
35 35 <div class="field">
36 36 <div class="label">
37 37 <label for="default_repo_create_on_write${suffix}">${_('Repository Creation With Group Write Access')}:</label>
38 38 </div>
39 39 <div class="radios">
40 40 ${h.radio('default_repo_create_on_write' + suffix, c.repo_create_on_write_choices[1][0], label=c.repo_create_on_write_choices[1][1], **kwargs)}
41 41 ${h.radio('default_repo_create_on_write' + suffix, c.repo_create_on_write_choices[0][0], label=c.repo_create_on_write_choices[0][1], **kwargs)}
42 42 <span class="help-block">${_('Write permission given on a repository group will allow creating repositories inside that group.')}</span>
43 43 </div>
44 44 </div>
45 45 <div class="field">
46 46 <div class="label">
47 47 <label for="default_fork_create${suffix}">${_('Repository Forking')}:</label>
48 48 </div>
49 49 <div class="radios">
50 50 ${h.radio('default_fork_create' + suffix, c.fork_choices[1][0], label=c.fork_choices[1][1], **kwargs)}
51 51 ${h.radio('default_fork_create' + suffix, c.fork_choices[0][0], label=c.fork_choices[0][1], **kwargs)}
52 52 <span class="help-block">${_('Permission to create root level repository forks. When disabled, users can still fork repositories inside their own repository groups.')}</span>
53 53 </div>
54 54 </div>
55 55 <div class="field">
56 56 <div class="label">
57 57 <label for="default_repo_group_create${suffix}">${_('Repository Group Creation')}:</label>
58 58 </div>
59 59 <div class="radios">
60 60 ${h.radio('default_repo_group_create' + suffix, c.repo_group_create_choices[1][0], label=c.repo_group_create_choices[1][1], **kwargs)}
61 61 ${h.radio('default_repo_group_create' + suffix, c.repo_group_create_choices[0][0], label=c.repo_group_create_choices[0][1], **kwargs)}
62 62 <span class="help-block">${_('Permission to create root level repository groups. When disabled, repository group admins can still create repository subgroups within their repository groups.')}</span>
63 63 </div>
64 64 </div>
65 65 <div class="field">
66 66 <div class="label">
67 67 <label for="default_user_group_create${suffix}">${_('User Group Creation')}:</label>
68 68 </div>
69 69 <div class="radios">
70 70 ${h.radio('default_user_group_create' + suffix, c.user_group_create_choices[1][0], label=c.user_group_create_choices[1][1], **kwargs)}
71 71 ${h.radio('default_user_group_create' + suffix, c.user_group_create_choices[0][0], label=c.user_group_create_choices[0][1], **kwargs)}
72 72 <span class="help-block">${_('Permission to allow user group creation.')}</span>
73 73 </div>
74 74 </div>
75 75
76 76 <div class="field">
77 77 <div class="label">
78 78 <label for="default_inherit_default_permissions${suffix}">${_('Inherit Permissions From The Default User')}:</label>
79 79 </div>
80 80 <div class="radios">
81 81 ${h.radio('default_inherit_default_permissions' + suffix, c.inherit_default_permission_choices[1][0], label=c.inherit_default_permission_choices[1][1], **kwargs)}
82 82 ${h.radio('default_inherit_default_permissions' + suffix, c.inherit_default_permission_choices[0][0], label=c.inherit_default_permission_choices[0][1], **kwargs)}
83 83 <span class="help-block">${_('Inherit default permissions from the default user. Turn off this option to force explicit permissions for users, even if they are more restrictive than the default user permissions.')}</span>
84 84 </div>
85 85 </div>
86 86
87 87 <div class="buttons">
88 88 ${h.submit('save',_('Save'),class_="btn")}
89 89 ${h.reset('reset',_('Reset'),class_="btn")}
90 90 </div>
91 91 </div>
92 92 </div>
93 93 </div>
94 94 </%def>
95 95
96 96 <%def name="default_perms_box(form_url)">
97 ${h.secure_form(form_url, method='POST', request=request)}
97 ${h.secure_form(form_url, request=request)}
98 98 <div class="form">
99 99 <div class="fields">
100 100 <div class="field panel panel-default panel-body">
101 101 <div class="label label-checkbox">
102 102 <label for="inherit_default_permissions">${_('Inherit from default settings')}:</label>
103 103 </div>
104 104 <div class="checkboxes">
105 105 ${h.checkbox('inherit_default_permissions',value=True)}
106 106 <span class="help-block">
107 107 ${h.literal(_('Select to inherit permissions from %s permissions settings, '
108 108 'including default IP address whitelist and inheritance of \npermission by members of user groups.')
109 109 % h.link_to('default user', h.route_path('admin_permissions_global')))}
110 110 </span>
111 111 </div>
112 112 </div>
113 113
114 114 ## INHERITED permissions == the user permissions in admin
115 115 ## if inherit checkbox is set this is displayed in non-edit mode
116 116 <div class="inherit_overlay_default">
117 117 ${default_perms_radios(global_permissions_template = False, suffix='_inherited', disabled="disabled")}
118 118 </div>
119 119
120 120 ## CUSTOM permissions
121 121 <div class="inherit_overlay">
122 122 ${default_perms_radios(global_permissions_template = False)}
123 123 </div>
124 124 </div>
125 125 </div>
126 126 ${h.end_form()}
127 127
128 128
129 129 ## JS
130 130 <script>
131 131 var show_custom_perms = function(inherit_default){
132 132 if(inherit_default) {
133 133 $('.inherit_overlay_default').show();
134 134 $('.inherit_overlay').hide();
135 135 }
136 136 else {
137 137 $('.inherit_overlay').show();
138 138 $('.inherit_overlay_default').hide();
139 139 }
140 140 };
141 141 $(document).ready(function(e){
142 142 var inherit_checkbox = $('#inherit_default_permissions');
143 143 var defaults = inherit_checkbox.prop('checked');
144 144 show_custom_perms(defaults);
145 145 inherit_checkbox.on('change', function(){
146 146 if($(this).prop('checked')){
147 147 show_custom_perms(true);
148 148 }
149 149 else{
150 150 show_custom_perms(false);
151 151 }
152 152 })
153 153 })
154 154 </script>
155 155
156 156 </%def>
@@ -1,377 +1,377 b''
1 1 ## DATA TABLE RE USABLE ELEMENTS
2 2 ## usage:
3 3 ## <%namespace name="dt" file="/data_table/_dt_elements.mako"/>
4 4 <%namespace name="base" file="/base/base.mako"/>
5 5
6 6 <%def name="metatags_help()">
7 7 <table>
8 8 <%
9 9 example_tags = [
10 10 ('state','[stable]'),
11 11 ('state','[stale]'),
12 12 ('state','[featured]'),
13 13 ('state','[dev]'),
14 14 ('state','[dead]'),
15 15 ('state','[deprecated]'),
16 16
17 17 ('label','[personal]'),
18 18 ('generic','[v2.0.0]'),
19 19
20 20 ('lang','[lang =&gt; JavaScript]'),
21 21 ('license','[license =&gt; LicenseName]'),
22 22
23 23 ('ref','[requires =&gt; RepoName]'),
24 24 ('ref','[recommends =&gt; GroupName]'),
25 25 ('ref','[conflicts =&gt; SomeName]'),
26 26 ('ref','[base =&gt; SomeName]'),
27 27 ('url','[url =&gt; [linkName](https://rhodecode.com)]'),
28 28 ('see','[see =&gt; http://rhodecode.com]'),
29 29 ]
30 30 %>
31 31 % for tag_type, tag in example_tags:
32 32 <tr>
33 33 <td>${tag|n}</td>
34 34 <td>${h.style_metatag(tag_type, tag)|n}</td>
35 35 </tr>
36 36 % endfor
37 37 </table>
38 38 </%def>
39 39
40 40 ## REPOSITORY RENDERERS
41 41 <%def name="quick_menu(repo_name)">
42 42 <i class="icon-more"></i>
43 43 <div class="menu_items_container hidden">
44 44 <ul class="menu_items">
45 45 <li>
46 46 <a title="${_('Summary')}" href="${h.route_path('repo_summary',repo_name=repo_name)}">
47 47 <span>${_('Summary')}</span>
48 48 </a>
49 49 </li>
50 50 <li>
51 51 <a title="${_('Changelog')}" href="${h.route_path('repo_changelog',repo_name=repo_name)}">
52 52 <span>${_('Changelog')}</span>
53 53 </a>
54 54 </li>
55 55 <li>
56 56 <a title="${_('Files')}" href="${h.route_path('repo_files:default_commit',repo_name=repo_name)}">
57 57 <span>${_('Files')}</span>
58 58 </a>
59 59 </li>
60 60 <li>
61 61 <a title="${_('Fork')}" href="${h.route_path('repo_fork_new',repo_name=repo_name)}">
62 62 <span>${_('Fork')}</span>
63 63 </a>
64 64 </li>
65 65 </ul>
66 66 </div>
67 67 </%def>
68 68
69 69 <%def name="repo_name(name,rtype,rstate,private,fork_of,short_name=False,admin=False)">
70 70 <%
71 71 def get_name(name,short_name=short_name):
72 72 if short_name:
73 73 return name.split('/')[-1]
74 74 else:
75 75 return name
76 76 %>
77 77 <div class="${'repo_state_pending' if rstate == 'repo_state_pending' else ''} truncate">
78 78 ##NAME
79 79 <a href="${h.route_path('edit_repo',repo_name=name) if admin else h.route_path('repo_summary',repo_name=name)}">
80 80
81 81 ##TYPE OF REPO
82 82 %if h.is_hg(rtype):
83 83 <span title="${_('Mercurial repository')}"><i class="icon-hg" style="font-size: 14px;"></i></span>
84 84 %elif h.is_git(rtype):
85 85 <span title="${_('Git repository')}"><i class="icon-git" style="font-size: 14px"></i></span>
86 86 %elif h.is_svn(rtype):
87 87 <span title="${_('Subversion repository')}"><i class="icon-svn" style="font-size: 14px"></i></span>
88 88 %endif
89 89
90 90 ##PRIVATE/PUBLIC
91 91 %if private and c.visual.show_private_icon:
92 92 <i class="icon-lock" title="${_('Private repository')}"></i>
93 93 %elif not private and c.visual.show_public_icon:
94 94 <i class="icon-unlock-alt" title="${_('Public repository')}"></i>
95 95 %else:
96 96 <span></span>
97 97 %endif
98 98 ${get_name(name)}
99 99 </a>
100 100 %if fork_of:
101 101 <a href="${h.route_path('repo_summary',repo_name=fork_of.repo_name)}"><i class="icon-code-fork"></i></a>
102 102 %endif
103 103 %if rstate == 'repo_state_pending':
104 104 <span class="creation_in_progress tooltip" title="${_('This repository is being created in a background task')}">
105 105 (${_('creating...')})
106 106 </span>
107 107 %endif
108 108 </div>
109 109 </%def>
110 110
111 111 <%def name="repo_desc(description, stylify_metatags)">
112 112 <%
113 113 tags, description = h.extract_metatags(description)
114 114 %>
115 115
116 116 <div class="truncate-wrap">
117 117 % if stylify_metatags:
118 118 % for tag_type, tag in tags:
119 119 ${h.style_metatag(tag_type, tag)|n}
120 120 % endfor
121 121 % endif
122 122 ${description}
123 123 </div>
124 124
125 125 </%def>
126 126
127 127 <%def name="last_change(last_change)">
128 128 ${h.age_component(last_change)}
129 129 </%def>
130 130
131 131 <%def name="revision(name,rev,tip,author,last_msg)">
132 132 <div>
133 133 %if rev >= 0:
134 134 <code><a title="${h.tooltip('%s:\n\n%s' % (author,last_msg))}" class="tooltip" href="${h.route_path('repo_commit',repo_name=name,commit_id=tip)}">${'r%s:%s' % (rev,h.short_id(tip))}</a></code>
135 135 %else:
136 136 ${_('No commits yet')}
137 137 %endif
138 138 </div>
139 139 </%def>
140 140
141 141 <%def name="rss(name)">
142 142 %if c.rhodecode_user.username != h.DEFAULT_USER:
143 143 <a title="${h.tooltip(_('Subscribe to %s rss feed')% name)}" href="${h.route_path('rss_feed_home', repo_name=name, _query=dict(auth_token=c.rhodecode_user.feed_token))}"><i class="icon-rss-sign"></i></a>
144 144 %else:
145 145 <a title="${h.tooltip(_('Subscribe to %s rss feed')% name)}" href="${h.route_path('rss_feed_home', repo_name=name)}"><i class="icon-rss-sign"></i></a>
146 146 %endif
147 147 </%def>
148 148
149 149 <%def name="atom(name)">
150 150 %if c.rhodecode_user.username != h.DEFAULT_USER:
151 151 <a title="${h.tooltip(_('Subscribe to %s atom feed')% name)}" href="${h.route_path('atom_feed_home', repo_name=name, _query=dict(auth_token=c.rhodecode_user.feed_token))}"><i class="icon-rss-sign"></i></a>
152 152 %else:
153 153 <a title="${h.tooltip(_('Subscribe to %s atom feed')% name)}" href="${h.route_path('atom_feed_home', repo_name=name)}"><i class="icon-rss-sign"></i></a>
154 154 %endif
155 155 </%def>
156 156
157 157 <%def name="user_gravatar(email, size=16)">
158 158 <div class="rc-user tooltip" title="${h.tooltip(h.author_string(email))}">
159 159 ${base.gravatar(email, 16)}
160 160 </div>
161 161 </%def>
162 162
163 163 <%def name="repo_actions(repo_name, super_user=True)">
164 164 <div>
165 165 <div class="grid_edit">
166 166 <a href="${h.route_path('edit_repo',repo_name=repo_name)}" title="${_('Edit')}">
167 167 <i class="icon-pencil"></i>Edit</a>
168 168 </div>
169 169 <div class="grid_delete">
170 ${h.secure_form(h.route_path('edit_repo_advanced_delete', repo_name=repo_name), method='POST', request=request)}
170 ${h.secure_form(h.route_path('edit_repo_advanced_delete', repo_name=repo_name), request=request)}
171 171 ${h.submit('remove_%s' % repo_name,_('Delete'),class_="btn btn-link btn-danger",
172 172 onclick="return confirm('"+_('Confirm to delete this repository: %s') % repo_name+"');")}
173 173 ${h.end_form()}
174 174 </div>
175 175 </div>
176 176 </%def>
177 177
178 178 <%def name="repo_state(repo_state)">
179 179 <div>
180 180 %if repo_state == 'repo_state_pending':
181 181 <div class="tag tag4">${_('Creating')}</div>
182 182 %elif repo_state == 'repo_state_created':
183 183 <div class="tag tag1">${_('Created')}</div>
184 184 %else:
185 185 <div class="tag alert2" title="${h.tooltip(repo_state)}">invalid</div>
186 186 %endif
187 187 </div>
188 188 </%def>
189 189
190 190
191 191 ## REPO GROUP RENDERERS
192 192 <%def name="quick_repo_group_menu(repo_group_name)">
193 193 <i class="icon-more"></i>
194 194 <div class="menu_items_container hidden">
195 195 <ul class="menu_items">
196 196 <li>
197 197 <a href="${h.route_path('repo_group_home', repo_group_name=repo_group_name)}">${_('Summary')}</a>
198 198 </li>
199 199
200 200 </ul>
201 201 </div>
202 202 </%def>
203 203
204 204 <%def name="repo_group_name(repo_group_name, children_groups=None)">
205 205 <div>
206 206 <a href="${h.route_path('repo_group_home', repo_group_name=repo_group_name)}">
207 207 <i class="icon-folder-close" title="${_('Repository group')}" style="font-size: 16px"></i>
208 208 %if children_groups:
209 209 ${h.literal(' &raquo; '.join(children_groups))}
210 210 %else:
211 211 ${repo_group_name}
212 212 %endif
213 213 </a>
214 214 </div>
215 215 </%def>
216 216
217 217 <%def name="repo_group_desc(description, personal, stylify_metatags)">
218 218
219 219 <%
220 220 tags, description = h.extract_metatags(description)
221 221 %>
222 222
223 223 <div class="truncate-wrap">
224 224 % if personal:
225 225 <div class="metatag" tag="personal">${_('personal')}</div>
226 226 % endif
227 227
228 228 % if stylify_metatags:
229 229 % for tag_type, tag in tags:
230 230 ${h.style_metatag(tag_type, tag)|n}
231 231 % endfor
232 232 % endif
233 233 ${description}
234 234 </div>
235 235
236 236 </%def>
237 237
238 238 <%def name="repo_group_actions(repo_group_id, repo_group_name, gr_count)">
239 239 <div class="grid_edit">
240 240 <a href="${h.url('edit_repo_group',group_name=repo_group_name)}" title="${_('Edit')}">Edit</a>
241 241 </div>
242 242 <div class="grid_delete">
243 ${h.secure_form(h.url('delete_repo_group', group_name=repo_group_name),method='delete')}
243 ${h.secure_form(h.url('delete_repo_group', group_name=repo_group_name),method='delete', request=request)}
244 244 ${h.submit('remove_%s' % repo_group_name,_('Delete'),class_="btn btn-link btn-danger",
245 245 onclick="return confirm('"+_ungettext('Confirm to delete this group: %s with %s repository','Confirm to delete this group: %s with %s repositories',gr_count) % (repo_group_name, gr_count)+"');")}
246 246 ${h.end_form()}
247 247 </div>
248 248 </%def>
249 249
250 250
251 251 <%def name="user_actions(user_id, username)">
252 252 <div class="grid_edit">
253 253 <a href="${h.url('edit_user',user_id=user_id)}" title="${_('Edit')}">
254 254 <i class="icon-pencil"></i>Edit</a>
255 255 </div>
256 256 <div class="grid_delete">
257 257 ${h.secure_form(h.url('delete_user', user_id=user_id),method='delete')}
258 258 ${h.submit('remove_',_('Delete'),id="remove_user_%s" % user_id, class_="btn btn-link btn-danger",
259 259 onclick="return confirm('"+_('Confirm to delete this user: %s') % username+"');")}
260 260 ${h.end_form()}
261 261 </div>
262 262 </%def>
263 263
264 264 <%def name="user_group_actions(user_group_id, user_group_name)">
265 265 <div class="grid_edit">
266 266 <a href="${h.route_path('edit_user_group', user_group_id=user_group_id)}" title="${_('Edit')}">Edit</a>
267 267 </div>
268 268 <div class="grid_delete">
269 ${h.secure_form(h.route_path('user_groups_delete', user_group_id=user_group_id), method='POST', request=request)}
269 ${h.secure_form(h.route_path('user_groups_delete', user_group_id=user_group_id), request=request)}
270 270 ${h.submit('remove_',_('Delete'),id="remove_group_%s" % user_group_id, class_="btn btn-link btn-danger",
271 271 onclick="return confirm('"+_('Confirm to delete this user group: %s') % user_group_name+"');")}
272 272 ${h.end_form()}
273 273 </div>
274 274 </%def>
275 275
276 276
277 277 <%def name="user_name(user_id, username)">
278 278 ${h.link_to(h.person(username, 'username_or_name_or_email'), h.url('edit_user', user_id=user_id))}
279 279 </%def>
280 280
281 281 <%def name="user_profile(username)">
282 282 ${base.gravatar_with_user(username, 16)}
283 283 </%def>
284 284
285 285 <%def name="user_group_name(user_group_id, user_group_name)">
286 286 <div>
287 287 <a href="${h.route_path('edit_user_group', user_group_id=user_group_id)}">
288 288 <i class="icon-group" title="${_('User group')}"></i> ${user_group_name}</a>
289 289 </div>
290 290 </%def>
291 291
292 292
293 293 ## GISTS
294 294
295 295 <%def name="gist_gravatar(full_contact)">
296 296 <div class="gist_gravatar">
297 297 ${base.gravatar(full_contact, 30)}
298 298 </div>
299 299 </%def>
300 300
301 301 <%def name="gist_access_id(gist_access_id, full_contact)">
302 302 <div>
303 303 <b>
304 304 <a href="${h.route_path('gist_show', gist_id=gist_access_id)}">gist: ${gist_access_id}</a>
305 305 </b>
306 306 </div>
307 307 </%def>
308 308
309 309 <%def name="gist_author(full_contact, created_on, expires)">
310 310 ${base.gravatar_with_user(full_contact, 16)}
311 311 </%def>
312 312
313 313
314 314 <%def name="gist_created(created_on)">
315 315 <div class="created">
316 316 ${h.age_component(created_on, time_is_local=True)}
317 317 </div>
318 318 </%def>
319 319
320 320 <%def name="gist_expires(expires)">
321 321 <div class="created">
322 322 %if expires == -1:
323 323 ${_('never')}
324 324 %else:
325 325 ${h.age_component(h.time_to_utcdatetime(expires))}
326 326 %endif
327 327 </div>
328 328 </%def>
329 329
330 330 <%def name="gist_type(gist_type)">
331 331 %if gist_type != 'public':
332 332 <div class="tag">${_('Private')}</div>
333 333 %endif
334 334 </%def>
335 335
336 336 <%def name="gist_description(gist_description)">
337 337 ${gist_description}
338 338 </%def>
339 339
340 340
341 341 ## PULL REQUESTS GRID RENDERERS
342 342
343 343 <%def name="pullrequest_target_repo(repo_name)">
344 344 <div class="truncate">
345 345 ${h.link_to(repo_name,h.route_path('repo_summary',repo_name=repo_name))}
346 346 </div>
347 347 </%def>
348 348 <%def name="pullrequest_status(status)">
349 349 <div class="${'flag_status %s' % status} pull-left"></div>
350 350 </%def>
351 351
352 352 <%def name="pullrequest_title(title, description)">
353 353 ${title} <br/>
354 354 ${h.shorter(description, 40)}
355 355 </%def>
356 356
357 357 <%def name="pullrequest_comments(comments_nr)">
358 358 <i class="icon-comment"></i> ${comments_nr}
359 359 </%def>
360 360
361 361 <%def name="pullrequest_name(pull_request_id, target_repo_name, short=False)">
362 362 <a href="${h.route_path('pullrequest_show',repo_name=target_repo_name,pull_request_id=pull_request_id)}">
363 363 % if short:
364 364 #${pull_request_id}
365 365 % else:
366 366 ${_('Pull request #%(pr_number)s') % {'pr_number': pull_request_id,}}
367 367 % endif
368 368 </a>
369 369 </%def>
370 370
371 371 <%def name="pullrequest_updated_on(updated_on)">
372 372 ${h.age_component(h.time_to_utcdatetime(updated_on))}
373 373 </%def>
374 374
375 375 <%def name="pullrequest_author(full_contact)">
376 376 ${base.gravatar_with_user(full_contact, 16)}
377 377 </%def>
@@ -1,238 +1,238 b''
1 1 <%inherit file="/base/base.mako"/>
2 2
3 3 <%def name="title()">
4 4 ${_('%s Files Add') % c.repo_name}
5 5 %if c.rhodecode_name:
6 6 &middot; ${h.branding(c.rhodecode_name)}
7 7 %endif
8 8 </%def>
9 9
10 10 <%def name="menu_bar_nav()">
11 11 ${self.menu_items(active='repositories')}
12 12 </%def>
13 13
14 14 <%def name="breadcrumbs_links()">
15 15 ${_('Add new file')} @ ${h.show_id(c.commit)}
16 16 </%def>
17 17
18 18 <%def name="menu_bar_subnav()">
19 19 ${self.repo_menu(active='files')}
20 20 </%def>
21 21
22 22 <%def name="main()">
23 23 <div class="box">
24 24 <div class="title">
25 25 ${self.repo_page_title(c.rhodecode_db_repo)}
26 26 </div>
27 27 <div class="edit-file-title">
28 28 ${self.breadcrumbs()}
29 29 </div>
30 ${h.secure_form(h.route_path('repo_files_create_file', repo_name=c.repo_name, commit_id=c.commit.raw_id, f_path=c.f_path), id='eform', method='POST', enctype="multipart/form-data", class_="form-horizontal", request=request)}
30 ${h.secure_form(h.route_path('repo_files_create_file', repo_name=c.repo_name, commit_id=c.commit.raw_id, f_path=c.f_path), id='eform', enctype="multipart/form-data", class_="form-horizontal", request=request)}
31 31 <div class="edit-file-fieldset">
32 32 <div class="fieldset">
33 33 <div id="destination-label" class="left-label">
34 34 ${_('Path')}:
35 35 </div>
36 36 <div class="right-content">
37 37 <div id="specify-custom-path-container">
38 38 <span id="path-breadcrumbs">${h.files_breadcrumbs(c.repo_name,c.commit.raw_id,c.f_path)}</span>
39 39 <a class="custom-path-link" id="specify-custom-path" href="#">${_('Specify Custom Path')}</a>
40 40 </div>
41 41 <div id="remove-custom-path-container" style="display: none;">
42 42 ${c.repo_name}/
43 43 <input type="input-small" value="${c.f_path}" size="46" name="location" id="location">
44 44 <a class="custom-path-link" id="remove-custom-path" href="#">${_('Remove Custom Path')}</a>
45 45 </div>
46 46 </div>
47 47 </div>
48 48 <div id="filename_container" class="fieldset">
49 49 <div class="filename-label left-label">
50 50 ${_('Filename')}:
51 51 </div>
52 52 <div class="right-content">
53 53 <input class="input-small" type="text" value="" size="46" name="filename" id="filename">
54 54 <p>${_('or')} <a id="upload_file_enable" href="#">${_('Upload File')}</a></p>
55 55 </div>
56 56 </div>
57 57 <div id="upload_file_container" class="fieldset" style="display: none;">
58 58 <div class="filename-label left-label">
59 59 ${_('Filename')}:
60 60 </div>
61 61 <div class="right-content">
62 62 <input class="input-small" type="text" value="" size="46" name="filename_upload" id="filename_upload" placeholder="${_('No file selected')}">
63 63 </div>
64 64 <div class="filename-label left-label file-upload-label">
65 65 ${_('Upload file')}:
66 66 </div>
67 67 <div class="right-content file-upload-input">
68 68 <label for="upload_file" class="btn btn-default">Browse</label>
69 69
70 70 <input type="file" name="upload_file" id="upload_file">
71 71 <p>${_('or')} <a id="file_enable" href="#">${_('Create New File')}</a></p>
72 72 </div>
73 73 </div>
74 74 </div>
75 75 <div class="table">
76 76 <div id="files_data">
77 77 <div id="codeblock" class="codeblock">
78 78 <div class="code-header form" id="set_mode_header">
79 79 <div class="fields">
80 80 ${h.dropdownmenu('set_mode','plain',[('plain',_('plain'))],enable_filter=True)}
81 81 <label for="line_wrap">${_('line wraps')}</label>
82 82 ${h.dropdownmenu('line_wrap', 'off', [('on', _('on')), ('off', _('off')),])}
83 83
84 84 <div id="render_preview" class="btn btn-small preview hidden" >${_('Preview')}</div>
85 85 </div>
86 86 </div>
87 87 <div id="editor_container">
88 88 <pre id="editor_pre"></pre>
89 89 <textarea id="editor" name="content" ></textarea>
90 90 <div id="editor_preview"></div>
91 91 </div>
92 92 </div>
93 93 </div>
94 94 </div>
95 95
96 96 <div class="edit-file-fieldset">
97 97 <div class="fieldset">
98 98 <div id="commit-message-label" class="commit-message-label left-label">
99 99 ${_('Commit Message')}:
100 100 </div>
101 101 <div class="right-content">
102 102 <div class="message">
103 103 <textarea id="commit" name="message" placeholder="${c.default_message}"></textarea>
104 104 </div>
105 105 </div>
106 106 </div>
107 107 <div class="pull-right">
108 108 ${h.reset('reset',_('Cancel'),class_="btn btn-small")}
109 109 ${h.submit('commit_btn',_('Commit changes'),class_="btn btn-small btn-success")}
110 110 </div>
111 111 </div>
112 112 ${h.end_form()}
113 113 </div>
114 114 <script type="text/javascript">
115 115
116 116 $('#commit_btn').on('click', function() {
117 117 var button = $(this);
118 118 if (button.hasClass('clicked')) {
119 119 button.attr('disabled', true);
120 120 } else {
121 121 button.addClass('clicked');
122 122 }
123 123 });
124
124
125 125 $('#specify-custom-path').on('click', function(e){
126 126 e.preventDefault();
127 127 $('#specify-custom-path-container').hide();
128 128 $('#remove-custom-path-container').show();
129 129 $('#destination-label').css('margin-top', '13px');
130 130 });
131 131
132 132 $('#remove-custom-path').on('click', function(e){
133 133 e.preventDefault();
134 134 $('#specify-custom-path-container').show();
135 135 $('#remove-custom-path-container').hide();
136 136 $('#location').val('${c.f_path}');
137 137 $('#destination-label').css('margin-top', '0');
138 138 });
139 139
140 140 var hide_upload = function(){
141 141 $('#files_data').show();
142 142 $('#upload_file_container').hide();
143 143 $('#filename_container').show();
144 144 };
145 145
146 146 $('#file_enable').on('click', function(e){
147 147 e.preventDefault();
148 148 hide_upload();
149 149 });
150 150
151 151 $('#upload_file_enable').on('click', function(e){
152 152 e.preventDefault();
153 153 $('#files_data').hide();
154 154 $('#upload_file_container').show();
155 155 $('#filename_container').hide();
156 156 if (detectIE() && detectIE() <= 9) {
157 157 $('#upload_file_container .file-upload-input label').hide();
158 158 $('#upload_file_container .file-upload-input span').hide();
159 159 $('#upload_file_container .file-upload-input input').show();
160 160 }
161 161 });
162 162
163 163 $('#upload_file').on('change', function() {
164 164 if (this.files && this.files[0]) {
165 165 $('#filename_upload').val(this.files[0].name);
166 166 }
167 167 });
168 168
169 169 hide_upload();
170 170
171 171 var renderer = "";
172 172 var reset_url = "${h.route_path('repo_files',repo_name=c.repo_name,commit_id=c.commit.raw_id,f_path=c.f_path)}";
173 173 var myCodeMirror = initCodeMirror('editor', reset_url, false);
174 174
175 175 var modes_select = $('#set_mode');
176 176 fillCodeMirrorOptions(modes_select);
177 177
178 178 var filename_selector = '#filename';
179 179 var callback = function(filename, mimetype, mode){
180 180 CodeMirrorPreviewEnable(mode);
181 181 };
182 182 // on change of select field set mode
183 183 setCodeMirrorModeFromSelect(
184 184 modes_select, filename_selector, myCodeMirror, callback);
185 185
186 186 // on entering the new filename set mode, from given extension
187 187 setCodeMirrorModeFromInput(
188 188 modes_select, filename_selector, myCodeMirror, callback);
189 189
190 190 // if the file is renderable set line wraps automatically
191 191 if (renderer !== ""){
192 192 var line_wrap = 'on';
193 193 $($('#line_wrap option[value="'+line_wrap+'"]')[0]).attr("selected", "selected");
194 194 setCodeMirrorLineWrap(myCodeMirror, true);
195 195 }
196 196
197 197 // on select line wraps change the editor
198 198 $('#line_wrap').on('change', function(e){
199 199 var selected = e.currentTarget;
200 200 var line_wraps = {'on': true, 'off': false}[selected.value];
201 201 setCodeMirrorLineWrap(myCodeMirror, line_wraps)
202 202 });
203 203
204 204 // render preview/edit button
205 205 $('#render_preview').on('click', function(e){
206 206 if($(this).hasClass('preview')){
207 207 $(this).removeClass('preview');
208 208 $(this).html("${_('Edit')}");
209 209 $('#editor_preview').show();
210 210 $(myCodeMirror.getWrapperElement()).hide();
211 211
212 212 var possible_renderer = {
213 213 'rst':'rst',
214 214 'markdown':'markdown',
215 215 'gfm': 'markdown'}[myCodeMirror.getMode().name];
216 216 var _text = myCodeMirror.getValue();
217 217 var _renderer = possible_renderer || DEFAULT_RENDERER;
218 218 var post_data = {'text': _text, 'renderer': _renderer, 'csrf_token': CSRF_TOKEN};
219 219 $('#editor_preview').html(_gettext('Loading ...'));
220 220 var url = pyroutes.url('repo_commit_comment_preview',
221 221 {'repo_name': '${c.repo_name}',
222 222 'commit_id': '${c.commit.raw_id}'});
223 223
224 224 ajaxPOST(url, post_data, function(o){
225 225 $('#editor_preview').html(o);
226 226 })
227 227 }
228 228 else{
229 229 $(this).addClass('preview');
230 230 $(this).html("${_('Preview')}");
231 231 $('#editor_preview').hide();
232 232 $(myCodeMirror.getWrapperElement()).show();
233 233 }
234 234 });
235 235 $('#filename').focus();
236 236
237 237 </script>
238 238 </%def>
@@ -1,75 +1,75 b''
1 1 <%inherit file="/base/base.mako"/>
2 2
3 3 <%def name="title()">
4 4 ${_('%s Files Delete') % c.repo_name}
5 5 %if c.rhodecode_name:
6 6 &middot; ${h.branding(c.rhodecode_name)}
7 7 %endif
8 8 </%def>
9 9
10 10 <%def name="menu_bar_nav()">
11 11 ${self.menu_items(active='repositories')}
12 12 </%def>
13 13
14 14 <%def name="breadcrumbs_links()">
15 15 ${_('Delete file')} @ ${h.show_id(c.commit)}
16 16 </%def>
17 17
18 18 <%def name="menu_bar_subnav()">
19 19 ${self.repo_menu(active='files')}
20 20 </%def>
21 21
22 22 <%def name="main()">
23 23 <div class="box">
24 24 <div class="title">
25 25 ${self.repo_page_title(c.rhodecode_db_repo)}
26 26 </div>
27 27 <div class="edit-file-title">
28 28 ${self.breadcrumbs()}
29 29 </div>
30 ${h.secure_form(h.route_path('repo_files_delete_file', repo_name=c.repo_name, commit_id=c.commit.raw_id, f_path=c.f_path), id='eform', method='POST', class_="form-horizontal", request=request)}
30 ${h.secure_form(h.route_path('repo_files_delete_file', repo_name=c.repo_name, commit_id=c.commit.raw_id, f_path=c.f_path), id='eform', class_="form-horizontal", request=request)}
31 31 <div class="edit-file-fieldset">
32 32 <div class="fieldset">
33 33 <div id="destination-label" class="left-label">
34 34 ${_('Path')}:
35 35 </div>
36 36 <div class="right-content">
37 37 <span id="path-breadcrumbs">${h.files_breadcrumbs(c.repo_name,c.commit.raw_id,c.f_path)}</span>
38 38 </div>
39 39 </div>
40 40 </div>
41 41
42 42 <div id="codeblock" class="codeblock delete-file-preview">
43 43 <div class="code-body">
44 44 %if c.file.is_binary:
45 45 ${_('Binary file (%s)') % c.file.mimetype}
46 46 %else:
47 47 %if c.file.size < c.visual.cut_off_limit_file:
48 48 ${h.pygmentize(c.file,linenos=True,anchorlinenos=False,cssclass="code-highlight")}
49 49 %else:
50 50 ${_('File size {} is bigger then allowed limit {}. ').format(h.format_byte_size_binary(c.file.size), h.format_byte_size_binary(c.visual.cut_off_limit_file))} ${h.link_to(_('Show as raw'),
51 51 h.route_path('repo_file_raw',repo_name=c.repo_name,commit_id=c.commit.raw_id,f_path=c.f_path))}
52 52 %endif
53 53 %endif
54 54 </div>
55 55 </div>
56 56
57 57 <div class="edit-file-fieldset">
58 58 <div class="fieldset">
59 59 <div id="commit-message-label" class="commit-message-label left-label">
60 60 ${_('Commit Message')}:
61 61 </div>
62 62 <div class="right-content">
63 63 <div class="message">
64 64 <textarea id="commit" name="message" placeholder="${c.default_message}"></textarea>
65 65 </div>
66 66 </div>
67 67 </div>
68 68 <div class="pull-right">
69 69 ${h.reset('reset',_('Cancel'),class_="btn btn-small btn-danger")}
70 70 ${h.submit('commit',_('Delete File'),class_="btn btn-small btn-danger-action")}
71 71 </div>
72 72 </div>
73 73 ${h.end_form()}
74 74 </div>
75 75 </%def>
@@ -1,197 +1,197 b''
1 1 <%inherit file="/base/base.mako"/>
2 2
3 3 <%def name="title()">
4 4 ${_('%s File Edit') % c.repo_name}
5 5 %if c.rhodecode_name:
6 6 &middot; ${h.branding(c.rhodecode_name)}
7 7 %endif
8 8 </%def>
9 9
10 10 <%def name="menu_bar_nav()">
11 11 ${self.menu_items(active='repositories')}
12 12 </%def>
13 13
14 14 <%def name="breadcrumbs_links()">
15 15 ${_('Edit file')} @ ${h.show_id(c.commit)}
16 16 </%def>
17 17
18 18 <%def name="menu_bar_subnav()">
19 19 ${self.repo_menu(active='files')}
20 20 </%def>
21 21
22 22 <%def name="main()">
23 23 <% renderer = h.renderer_from_filename(c.f_path)%>
24 24 <div class="box">
25 25 <div class="title">
26 26 ${self.repo_page_title(c.rhodecode_db_repo)}
27 27 </div>
28 28 <div class="edit-file-title">
29 29 ${self.breadcrumbs()}
30 30 </div>
31 31 <div class="edit-file-fieldset">
32 32 <div class="fieldset">
33 33 <div id="destination-label" class="left-label">
34 34 ${_('Path')}:
35 35 </div>
36 36 <div class="right-content">
37 37 <div id="specify-custom-path-container">
38 38 <span id="path-breadcrumbs">${h.files_breadcrumbs(c.repo_name,c.commit.raw_id,c.f_path)}</span>
39 39 </div>
40 40 </div>
41 41 </div>
42 42 </div>
43 43
44 44 <div class="table">
45 ${h.secure_form(h.route_path('repo_files_update_file', repo_name=c.repo_name, commit_id=c.commit.raw_id, f_path=c.f_path), id='eform', method='POST', request=request)}
45 ${h.secure_form(h.route_path('repo_files_update_file', repo_name=c.repo_name, commit_id=c.commit.raw_id, f_path=c.f_path), id='eform', request=request)}
46 46 <div id="codeblock" class="codeblock" >
47 47 <div class="code-header">
48 48 <div class="stats">
49 49 <i class="icon-file"></i>
50 50 <span class="item">${h.link_to("r%s:%s" % (c.file.commit.idx,h.short_id(c.file.commit.raw_id)),h.route_path('repo_commit',repo_name=c.repo_name,commit_id=c.file.commit.raw_id))}</span>
51 51 <span class="item">${h.format_byte_size_binary(c.file.size)}</span>
52 52 <span class="item last">${c.file.mimetype}</span>
53 53 <div class="buttons">
54 54 <a class="btn btn-mini" href="${h.route_path('repo_changelog_file',repo_name=c.repo_name, commit_id=c.commit.raw_id, f_path=c.f_path)}">
55 55 <i class="icon-time"></i> ${_('history')}
56 56 </a>
57 57
58 58 % if h.HasRepoPermissionAny('repository.write','repository.admin')(c.repo_name):
59 59 % if not c.file.is_binary:
60 60 %if True:
61 61 ${h.link_to(_('source'), h.route_path('repo_files', repo_name=c.repo_name,commit_id=c.commit.raw_id,f_path=c.f_path),class_="btn btn-mini")}
62 62 %else:
63 63 ${h.link_to(_('annotation'),h.route_path('repo_files:annotated',repo_name=c.repo_name,commit_id=c.commit.raw_id,f_path=c.f_path),class_="btn btn-mini")}
64 64 %endif
65 65
66 66 <a class="btn btn-mini" href="${h.route_path('repo_file_raw',repo_name=c.repo_name,commit_id=c.commit.raw_id,f_path=c.f_path)}">
67 67 ${_('raw')}
68 68 </a>
69 69 <a class="btn btn-mini" href="${h.route_path('repo_file_download',repo_name=c.repo_name,commit_id=c.commit.raw_id,f_path=c.f_path)}">
70 70 <i class="icon-archive"></i> ${_('download')}
71 71 </a>
72 72 % endif
73 73 % endif
74 74 </div>
75 75 </div>
76 76 <div class="form">
77 77 <label for="set_mode">${_('Editing file')}:</label>
78 78 ${'%s /' % c.file.dir_path if c.file.dir_path else c.file.dir_path}
79 79 <input id="filename" type="text" name="filename" value="${c.file.name}">
80 80
81 81 ${h.dropdownmenu('set_mode','plain',[('plain',_('plain'))],enable_filter=True)}
82 82 <label for="line_wrap">${_('line wraps')}</label>
83 83 ${h.dropdownmenu('line_wrap', 'off', [('on', _('on')), ('off', _('off')),])}
84 84
85 85 <div id="render_preview" class="btn btn-small preview hidden">${_('Preview')}</div>
86 86 </div>
87 87 </div>
88 88 <div id="editor_container">
89 89 <pre id="editor_pre"></pre>
90 90 <textarea id="editor" name="content" >${h.escape(c.file.content)|n}</textarea>
91 91 <div id="editor_preview" ></div>
92 92 </div>
93 93 </div>
94 94 </div>
95 95
96 96 <div class="edit-file-fieldset">
97 97 <div class="fieldset">
98 98 <div id="commit-message-label" class="commit-message-label left-label">
99 99 ${_('Commit Message')}:
100 100 </div>
101 101 <div class="right-content">
102 102 <div class="message">
103 103 <textarea id="commit" name="message" placeholder="${c.default_message}"></textarea>
104 104 </div>
105 105 </div>
106 106 </div>
107 107 <div class="pull-right">
108 108 ${h.reset('reset',_('Cancel'),class_="btn btn-small")}
109 109 ${h.submit('commit',_('Commit changes'),class_="btn btn-small btn-success")}
110 110 </div>
111 111 </div>
112 112 ${h.end_form()}
113 113 </div>
114 114
115 115 <script type="text/javascript">
116 116 $(document).ready(function(){
117 117 var renderer = "${renderer}";
118 118 var reset_url = "${h.route_path('repo_files',repo_name=c.repo_name,commit_id=c.commit.raw_id,f_path=c.file.path)}";
119 119 var myCodeMirror = initCodeMirror('editor', reset_url);
120 120
121 121 var modes_select = $('#set_mode');
122 122 fillCodeMirrorOptions(modes_select);
123 123
124 124 // try to detect the mode based on the file we edit
125 125 var mimetype = "${c.file.mimetype}";
126 126 var detected_mode = detectCodeMirrorMode(
127 127 "${c.file.name}", mimetype);
128 128
129 129 if(detected_mode){
130 130 setCodeMirrorMode(myCodeMirror, detected_mode);
131 131 $(modes_select).select2("val", mimetype);
132 132 $(modes_select).change();
133 133 setCodeMirrorMode(myCodeMirror, detected_mode);
134 134 }
135 135
136 136 var filename_selector = '#filename';
137 137 var callback = function(filename, mimetype, mode){
138 138 CodeMirrorPreviewEnable(mode);
139 139 };
140 140 // on change of select field set mode
141 141 setCodeMirrorModeFromSelect(
142 142 modes_select, filename_selector, myCodeMirror, callback);
143 143
144 144 // on entering the new filename set mode, from given extension
145 145 setCodeMirrorModeFromInput(
146 146 modes_select, filename_selector, myCodeMirror, callback);
147 147
148 148 // if the file is renderable set line wraps automatically
149 149 if (renderer !== ""){
150 150 var line_wrap = 'on';
151 151 $($('#line_wrap option[value="'+line_wrap+'"]')[0]).attr("selected", "selected");
152 152 setCodeMirrorLineWrap(myCodeMirror, true);
153 153 }
154 154 // on select line wraps change the editor
155 155 $('#line_wrap').on('change', function(e){
156 156 var selected = e.currentTarget;
157 157 var line_wraps = {'on': true, 'off': false}[selected.value];
158 158 setCodeMirrorLineWrap(myCodeMirror, line_wraps)
159 159 });
160 160
161 161 // render preview/edit button
162 162 if (mimetype === 'text/x-rst' || mimetype === 'text/plain') {
163 163 $('#render_preview').removeClass('hidden');
164 164 }
165 165 $('#render_preview').on('click', function(e){
166 166 if($(this).hasClass('preview')){
167 167 $(this).removeClass('preview');
168 168 $(this).html("${_('Edit')}");
169 169 $('#editor_preview').show();
170 170 $(myCodeMirror.getWrapperElement()).hide();
171 171
172 172 var possible_renderer = {
173 173 'rst':'rst',
174 174 'markdown':'markdown',
175 175 'gfm': 'markdown'}[myCodeMirror.getMode().name];
176 176 var _text = myCodeMirror.getValue();
177 177 var _renderer = possible_renderer || DEFAULT_RENDERER;
178 178 var post_data = {'text': _text, 'renderer': _renderer, 'csrf_token': CSRF_TOKEN};
179 179 $('#editor_preview').html(_gettext('Loading ...'));
180 180 var url = pyroutes.url('repo_commit_comment_preview',
181 181 {'repo_name': '${c.repo_name}',
182 182 'commit_id': '${c.commit.raw_id}'});
183 183 ajaxPOST(url, post_data, function(o){
184 184 $('#editor_preview').html(o);
185 185 })
186 186 }
187 187 else{
188 188 $(this).addClass('preview');
189 189 $(this).html("${_('Preview')}");
190 190 $('#editor_preview').hide();
191 191 $(myCodeMirror.getWrapperElement()).show();
192 192 }
193 193 });
194 194
195 195 })
196 196 </script>
197 197 </%def>
@@ -1,134 +1,134 b''
1 1 ## -*- coding: utf-8 -*-
2 2 <%inherit file="/base/base.mako"/>
3 3
4 4 <%def name="title()">
5 5 ${_('Fork repository %s') % c.repo_name}
6 6 %if c.rhodecode_name:
7 7 &middot; ${h.branding(c.rhodecode_name)}
8 8 %endif
9 9 </%def>
10 10
11 11 <%def name="breadcrumbs_links()">
12 12 ${_('New Fork')}
13 13 </%def>
14 14
15 15 <%def name="menu_bar_nav()">
16 16 ${self.menu_items(active='repositories')}
17 17 </%def>
18 18
19 19 <%def name="menu_bar_subnav()">
20 20 ${self.repo_menu(active='options')}
21 21 </%def>
22 22
23 23 <%def name="main()">
24 24 <div class="box">
25 25 <div class="title">
26 26 ${self.repo_page_title(c.rhodecode_db_repo)}
27 27 ${self.breadcrumbs()}
28 28 </div>
29 29
30 ${h.secure_form(h.route_path('repo_fork_create',repo_name=c.rhodecode_db_repo.repo_name), method='POST', request=request)}
30 ${h.secure_form(h.route_path('repo_fork_create',repo_name=c.rhodecode_db_repo.repo_name), request=request)}
31 31 <div class="form">
32 32 <!-- fields -->
33 33 <div class="fields">
34 34
35 35 <div class="field">
36 36 <div class="label">
37 37 <label for="repo_name">${_('Fork name')}:</label>
38 38 </div>
39 39 <div class="input">
40 40 ${h.text('repo_name', class_="medium")}
41 41 ${h.hidden('repo_type',c.rhodecode_db_repo.repo_type)}
42 42 ${h.hidden('fork_parent_id',c.rhodecode_db_repo.repo_id)}
43 43 </div>
44 44 </div>
45 45
46 46 <div class="field">
47 47 <div class="label label-textarea">
48 48 <label for="description">${_('Description')}:</label>
49 49 </div>
50 50 <div class="textarea-repo textarea text-area editor">
51 51 ${h.textarea('description')}
52 52 <% metatags_url = h.literal('''<a href="#metatagsShow" onclick="$('#meta-tags-desc').toggle();return false">meta-tags</a>''') %>
53 53 <span class="help-block">${_('Plain text format with support of {metatags}. Add a README file for longer descriptions').format(metatags=metatags_url)|n}</span>
54 54 <span id="meta-tags-desc" style="display: none">
55 55 <%namespace name="dt" file="/data_table/_dt_elements.mako"/>
56 56 ${dt.metatags_help()}
57 57 </span>
58 58 </div>
59 59 </div>
60 60
61 61 <div class="field">
62 62 <div class="label">
63 63 <label for="repo_group">${_('Repository group')}:</label>
64 64 </div>
65 65 <div class="select">
66 66 ${h.select('repo_group','',c.repo_groups,class_="medium")}
67 67 % if c.personal_repo_group:
68 68 <a class="btn" href="#" id="select_my_group" data-personal-group-id="${c.personal_repo_group.group_id}">
69 69 ${_('Select my personal group (%(repo_group_name)s)') % {'repo_group_name': c.personal_repo_group.group_name}}
70 70 </a>
71 71 % endif
72 72 <span class="help-block">${_('Optionally select a group to put this repository into.')}</span>
73 73 </div>
74 74 </div>
75 75
76 76 <div class="field">
77 77 <div class="label">
78 78 <label for="landing_rev">${_('Landing commit')}:</label>
79 79 </div>
80 80 <div class="select">
81 81 ${h.select('landing_rev','',c.landing_revs,class_="medium")}
82 82 <span class="help-block">${_('Default commit for files page, downloads, whoosh and readme')}</span>
83 83 </div>
84 84 </div>
85 85
86 86 <div class="field">
87 87 <div class="label label-checkbox">
88 88 <label for="private">${_('Private')}:</label>
89 89 </div>
90 90 <div class="checkboxes">
91 91 ${h.checkbox('private',value="True")}
92 92 <span class="help-block">${_('Private repositories are only visible to people explicitly added as collaborators.')}</span>
93 93 </div>
94 94 </div>
95 95
96 96 <div class="field">
97 97 <div class="label label-checkbox">
98 98 <label for="private">${_('Copy permissions')}:</label>
99 99 </div>
100 100 <div class="checkboxes">
101 101 ${h.checkbox('copy_permissions',value="True", checked="checked")}
102 102 <span class="help-block">${_('Copy permissions from forked repository')}</span>
103 103 </div>
104 104 </div>
105 105
106 106 <div class="buttons">
107 107 ${h.submit('',_('Fork this Repository'),class_="btn")}
108 108 </div>
109 109 </div>
110 110 </div>
111 111 ${h.end_form()}
112 112 </div>
113 113 <script>
114 114 $(document).ready(function(){
115 115 $("#repo_group").select2({
116 116 'dropdownAutoWidth': true,
117 117 'containerCssClass': "drop-menu",
118 118 'dropdownCssClass': "drop-menu-dropdown",
119 119 'width': "resolve"
120 120 });
121 121 $("#landing_rev").select2({
122 122 'containerCssClass': "drop-menu",
123 123 'dropdownCssClass': "drop-menu-dropdown",
124 124 'minimumResultsForSearch': -1
125 125 });
126 126 $('#repo_name').focus();
127 127
128 128 $('#select_my_group').on('click', function(e){
129 129 e.preventDefault();
130 130 $("#repo_group").val($(this).data('personalGroupId')).trigger("change");
131 131 })
132 132 })
133 133 </script>
134 134 </%def>
@@ -1,526 +1,526 b''
1 1 <%inherit file="/base/base.mako"/>
2 2
3 3 <%def name="title()">
4 4 ${c.repo_name} ${_('New pull request')}
5 5 </%def>
6 6
7 7 <%def name="breadcrumbs_links()">
8 8 ${_('New pull request')}
9 9 </%def>
10 10
11 11 <%def name="menu_bar_nav()">
12 12 ${self.menu_items(active='repositories')}
13 13 </%def>
14 14
15 15 <%def name="menu_bar_subnav()">
16 16 ${self.repo_menu(active='showpullrequest')}
17 17 </%def>
18 18
19 19 <%def name="main()">
20 20 <div class="box">
21 21 <div class="title">
22 22 ${self.repo_page_title(c.rhodecode_db_repo)}
23 23 </div>
24 24
25 ${h.secure_form(h.route_path('pullrequest_create', repo_name=c.repo_name, _query=request.GET.mixed()), id='pull_request_form', method='POST', request=request)}
25 ${h.secure_form(h.route_path('pullrequest_create', repo_name=c.repo_name, _query=request.GET.mixed()), id='pull_request_form', request=request)}
26 26
27 27 ${self.breadcrumbs()}
28 28
29 29 <div class="box pr-summary">
30 30
31 31 <div class="summary-details block-left">
32 32
33 33
34 34 <div class="pr-details-title">
35 35 ${_('Pull request summary')}
36 36 </div>
37 37
38 38 <div class="form" style="padding-top: 10px">
39 39 <!-- fields -->
40 40
41 41 <div class="fields" >
42 42
43 43 <div class="field">
44 44 <div class="label">
45 45 <label for="pullrequest_title">${_('Title')}:</label>
46 46 </div>
47 47 <div class="input">
48 48 ${h.text('pullrequest_title', c.default_title, class_="medium autogenerated-title")}
49 49 </div>
50 50 </div>
51 51
52 52 <div class="field">
53 53 <div class="label label-textarea">
54 54 <label for="pullrequest_desc">${_('Description')}:</label>
55 55 </div>
56 56 <div class="textarea text-area editor">
57 57 ${h.textarea('pullrequest_desc',size=30, )}
58 58 <span class="help-block">${_('Write a short description on this pull request')}</span>
59 59 </div>
60 60 </div>
61 61
62 62 <div class="field">
63 63 <div class="label label-textarea">
64 64 <label for="pullrequest_desc">${_('Commit flow')}:</label>
65 65 </div>
66 66
67 67 ## TODO: johbo: Abusing the "content" class here to get the
68 68 ## desired effect. Should be replaced by a proper solution.
69 69
70 70 ##ORG
71 71 <div class="content">
72 72 <strong>${_('Source repository')}:</strong>
73 73 ${c.rhodecode_db_repo.description}
74 74 </div>
75 75 <div class="content">
76 76 ${h.hidden('source_repo')}
77 77 ${h.hidden('source_ref')}
78 78 </div>
79 79
80 80 ##OTHER, most Probably the PARENT OF THIS FORK
81 81 <div class="content">
82 82 ## filled with JS
83 83 <div id="target_repo_desc"></div>
84 84 </div>
85 85
86 86 <div class="content">
87 87 ${h.hidden('target_repo')}
88 88 ${h.hidden('target_ref')}
89 89 <span id="target_ref_loading" style="display: none">
90 90 ${_('Loading refs...')}
91 91 </span>
92 92 </div>
93 93 </div>
94 94
95 95 <div class="field">
96 96 <div class="label label-textarea">
97 97 <label for="pullrequest_submit"></label>
98 98 </div>
99 99 <div class="input">
100 100 <div class="pr-submit-button">
101 101 ${h.submit('save',_('Submit Pull Request'),class_="btn")}
102 102 </div>
103 103 <div id="pr_open_message"></div>
104 104 </div>
105 105 </div>
106 106
107 107 <div class="pr-spacing-container"></div>
108 108 </div>
109 109 </div>
110 110 </div>
111 111 <div>
112 112 ## AUTHOR
113 113 <div class="reviewers-title block-right">
114 114 <div class="pr-details-title">
115 115 ${_('Author of this pull request')}
116 116 </div>
117 117 </div>
118 118 <div class="block-right pr-details-content reviewers">
119 119 <ul class="group_members">
120 120 <li>
121 121 ${self.gravatar_with_user(c.rhodecode_user.email, 16)}
122 122 </li>
123 123 </ul>
124 124 </div>
125 125
126 126 ## REVIEW RULES
127 127 <div id="review_rules" style="display: none" class="reviewers-title block-right">
128 128 <div class="pr-details-title">
129 129 ${_('Reviewer rules')}
130 130 </div>
131 131 <div class="pr-reviewer-rules">
132 132 ## review rules will be appended here, by default reviewers logic
133 133 </div>
134 134 </div>
135 135
136 136 ## REVIEWERS
137 137 <div class="reviewers-title block-right">
138 138 <div class="pr-details-title">
139 139 ${_('Pull request reviewers')}
140 140 <span class="calculate-reviewers"> - ${_('loading...')}</span>
141 141 </div>
142 142 </div>
143 143 <div id="reviewers" class="block-right pr-details-content reviewers">
144 144 ## members goes here, filled via JS based on initial selection !
145 145 <input type="hidden" name="__start__" value="review_members:sequence">
146 146 <ul id="review_members" class="group_members"></ul>
147 147 <input type="hidden" name="__end__" value="review_members:sequence">
148 148 <div id="add_reviewer_input" class='ac'>
149 149 <div class="reviewer_ac">
150 150 ${h.text('user', class_='ac-input', placeholder=_('Add reviewer or reviewer group'))}
151 151 <div id="reviewers_container"></div>
152 152 </div>
153 153 </div>
154 154 </div>
155 155 </div>
156 156 </div>
157 157 <div class="box">
158 158 <div>
159 159 ## overview pulled by ajax
160 160 <div id="pull_request_overview"></div>
161 161 </div>
162 162 </div>
163 163 ${h.end_form()}
164 164 </div>
165 165
166 166 <script type="text/javascript">
167 167 $(function(){
168 168 var defaultSourceRepo = '${c.default_repo_data['source_repo_name']}';
169 169 var defaultSourceRepoData = ${c.default_repo_data['source_refs_json']|n};
170 170 var defaultTargetRepo = '${c.default_repo_data['target_repo_name']}';
171 171 var defaultTargetRepoData = ${c.default_repo_data['target_refs_json']|n};
172 172
173 173 var $pullRequestForm = $('#pull_request_form');
174 174 var $sourceRepo = $('#source_repo', $pullRequestForm);
175 175 var $targetRepo = $('#target_repo', $pullRequestForm);
176 176 var $sourceRef = $('#source_ref', $pullRequestForm);
177 177 var $targetRef = $('#target_ref', $pullRequestForm);
178 178
179 179 var sourceRepo = function() { return $sourceRepo.eq(0).val() };
180 180 var sourceRef = function() { return $sourceRef.eq(0).val().split(':') };
181 181
182 182 var targetRepo = function() { return $targetRepo.eq(0).val() };
183 183 var targetRef = function() { return $targetRef.eq(0).val().split(':') };
184 184
185 185 var calculateContainerWidth = function() {
186 186 var maxWidth = 0;
187 187 var repoSelect2Containers = ['#source_repo', '#target_repo'];
188 188 $.each(repoSelect2Containers, function(idx, value) {
189 189 $(value).select2('container').width('auto');
190 190 var curWidth = $(value).select2('container').width();
191 191 if (maxWidth <= curWidth) {
192 192 maxWidth = curWidth;
193 193 }
194 194 $.each(repoSelect2Containers, function(idx, value) {
195 195 $(value).select2('container').width(maxWidth + 10);
196 196 });
197 197 });
198 198 };
199 199
200 200 var initRefSelection = function(selectedRef) {
201 201 return function(element, callback) {
202 202 // translate our select2 id into a text, it's a mapping to show
203 203 // simple label when selecting by internal ID.
204 204 var id, refData;
205 205 if (selectedRef === undefined) {
206 206 id = element.val();
207 207 refData = element.val().split(':');
208 208 } else {
209 209 id = selectedRef;
210 210 refData = selectedRef.split(':');
211 211 }
212 212
213 213 var text = refData[1];
214 214 if (refData[0] === 'rev') {
215 215 text = text.substring(0, 12);
216 216 }
217 217
218 218 var data = {id: id, text: text};
219 219
220 220 callback(data);
221 221 };
222 222 };
223 223
224 224 var formatRefSelection = function(item) {
225 225 var prefix = '';
226 226 var refData = item.id.split(':');
227 227 if (refData[0] === 'branch') {
228 228 prefix = '<i class="icon-branch"></i>';
229 229 }
230 230 else if (refData[0] === 'book') {
231 231 prefix = '<i class="icon-bookmark"></i>';
232 232 }
233 233 else if (refData[0] === 'tag') {
234 234 prefix = '<i class="icon-tag"></i>';
235 235 }
236 236
237 237 var originalOption = item.element;
238 238 return prefix + item.text;
239 239 };
240 240
241 241 // custom code mirror
242 242 var codeMirrorInstance = initPullRequestsCodeMirror('#pullrequest_desc');
243 243
244 244 reviewersController = new ReviewersController();
245 245
246 246 var queryTargetRepo = function(self, query) {
247 247 // cache ALL results if query is empty
248 248 var cacheKey = query.term || '__';
249 249 var cachedData = self.cachedDataSource[cacheKey];
250 250
251 251 if (cachedData) {
252 252 query.callback({results: cachedData.results});
253 253 } else {
254 254 $.ajax({
255 255 url: pyroutes.url('pullrequest_repo_destinations', {'repo_name': templateContext.repo_name}),
256 256 data: {query: query.term},
257 257 dataType: 'json',
258 258 type: 'GET',
259 259 success: function(data) {
260 260 self.cachedDataSource[cacheKey] = data;
261 261 query.callback({results: data.results});
262 262 },
263 263 error: function(data, textStatus, errorThrown) {
264 264 alert(
265 265 "Error while fetching entries.\nError code {0} ({1}).".format(data.status, data.statusText));
266 266 }
267 267 });
268 268 }
269 269 };
270 270
271 271 var queryTargetRefs = function(initialData, query) {
272 272 var data = {results: []};
273 273 // filter initialData
274 274 $.each(initialData, function() {
275 275 var section = this.text;
276 276 var children = [];
277 277 $.each(this.children, function() {
278 278 if (query.term.length === 0 ||
279 279 this.text.toUpperCase().indexOf(query.term.toUpperCase()) >= 0 ) {
280 280 children.push({'id': this.id, 'text': this.text})
281 281 }
282 282 });
283 283 data.results.push({'text': section, 'children': children})
284 284 });
285 285 query.callback({results: data.results});
286 286 };
287 287
288 288 var loadRepoRefDiffPreview = function() {
289 289
290 290 var url_data = {
291 291 'repo_name': targetRepo(),
292 292 'target_repo': sourceRepo(),
293 293 'source_ref': targetRef()[2],
294 294 'source_ref_type': 'rev',
295 295 'target_ref': sourceRef()[2],
296 296 'target_ref_type': 'rev',
297 297 'merge': true,
298 298 '_': Date.now() // bypass browser caching
299 299 }; // gather the source/target ref and repo here
300 300
301 301 if (sourceRef().length !== 3 || targetRef().length !== 3) {
302 302 prButtonLock(true, "${_('Please select source and target')}");
303 303 return;
304 304 }
305 305 var url = pyroutes.url('repo_compare', url_data);
306 306
307 307 // lock PR button, so we cannot send PR before it's calculated
308 308 prButtonLock(true, "${_('Loading compare ...')}", 'compare');
309 309
310 310 if (loadRepoRefDiffPreview._currentRequest) {
311 311 loadRepoRefDiffPreview._currentRequest.abort();
312 312 }
313 313
314 314 loadRepoRefDiffPreview._currentRequest = $.get(url)
315 315 .error(function(data, textStatus, errorThrown) {
316 316 alert(
317 317 "Error while processing request.\nError code {0} ({1}).".format(
318 318 data.status, data.statusText));
319 319 })
320 320 .done(function(data) {
321 321 loadRepoRefDiffPreview._currentRequest = null;
322 322 $('#pull_request_overview').html(data);
323 323
324 324 var commitElements = $(data).find('tr[commit_id]');
325 325
326 326 var prTitleAndDesc = getTitleAndDescription(
327 327 sourceRef()[1], commitElements, 5);
328 328
329 329 var title = prTitleAndDesc[0];
330 330 var proposedDescription = prTitleAndDesc[1];
331 331
332 332 var useGeneratedTitle = (
333 333 $('#pullrequest_title').hasClass('autogenerated-title') ||
334 334 $('#pullrequest_title').val() === "");
335 335
336 336 if (title && useGeneratedTitle) {
337 337 // use generated title if we haven't specified our own
338 338 $('#pullrequest_title').val(title);
339 339 $('#pullrequest_title').addClass('autogenerated-title');
340 340
341 341 }
342 342
343 343 var useGeneratedDescription = (
344 344 !codeMirrorInstance._userDefinedDesc ||
345 345 codeMirrorInstance.getValue() === "");
346 346
347 347 if (proposedDescription && useGeneratedDescription) {
348 348 // set proposed content, if we haven't defined our own,
349 349 // or we don't have description written
350 350 codeMirrorInstance._userDefinedDesc = false; // reset state
351 351 codeMirrorInstance.setValue(proposedDescription);
352 352 }
353 353
354 354 var msg = '';
355 355 if (commitElements.length === 1) {
356 356 msg = "${_ungettext('This pull request will consist of __COMMITS__ commit.', 'This pull request will consist of __COMMITS__ commits.', 1)}";
357 357 } else {
358 358 msg = "${_ungettext('This pull request will consist of __COMMITS__ commit.', 'This pull request will consist of __COMMITS__ commits.', 2)}";
359 359 }
360 360
361 361 msg += ' <a id="pull_request_overview_url" href="{0}" target="_blank">${_('Show detailed compare.')}</a>'.format(url);
362 362
363 363 if (commitElements.length) {
364 364 var commitsLink = '<a href="#pull_request_overview"><strong>{0}</strong></a>'.format(commitElements.length);
365 365 prButtonLock(false, msg.replace('__COMMITS__', commitsLink), 'compare');
366 366 }
367 367 else {
368 368 prButtonLock(true, "${_('There are no commits to merge.')}", 'compare');
369 369 }
370 370
371 371
372 372 });
373 373 };
374 374
375 375 var Select2Box = function(element, overrides) {
376 376 var globalDefaults = {
377 377 dropdownAutoWidth: true,
378 378 containerCssClass: "drop-menu",
379 379 dropdownCssClass: "drop-menu-dropdown"
380 380 };
381 381
382 382 var initSelect2 = function(defaultOptions) {
383 383 var options = jQuery.extend(globalDefaults, defaultOptions, overrides);
384 384 element.select2(options);
385 385 };
386 386
387 387 return {
388 388 initRef: function() {
389 389 var defaultOptions = {
390 390 minimumResultsForSearch: 5,
391 391 formatSelection: formatRefSelection
392 392 };
393 393
394 394 initSelect2(defaultOptions);
395 395 },
396 396
397 397 initRepo: function(defaultValue, readOnly) {
398 398 var defaultOptions = {
399 399 initSelection : function (element, callback) {
400 400 var data = {id: defaultValue, text: defaultValue};
401 401 callback(data);
402 402 }
403 403 };
404 404
405 405 initSelect2(defaultOptions);
406 406
407 407 element.select2('val', defaultSourceRepo);
408 408 if (readOnly === true) {
409 409 element.select2('readonly', true);
410 410 }
411 411 }
412 412 };
413 413 };
414 414
415 415 var initTargetRefs = function(refsData, selectedRef){
416 416 Select2Box($targetRef, {
417 417 query: function(query) {
418 418 queryTargetRefs(refsData, query);
419 419 },
420 420 initSelection : initRefSelection(selectedRef)
421 421 }).initRef();
422 422
423 423 if (!(selectedRef === undefined)) {
424 424 $targetRef.select2('val', selectedRef);
425 425 }
426 426 };
427 427
428 428 var targetRepoChanged = function(repoData) {
429 429 // generate new DESC of target repo displayed next to select
430 430 $('#target_repo_desc').html(
431 431 "<strong>${_('Target repository')}</strong>: {0}".format(repoData['description'])
432 432 );
433 433
434 434 // generate dynamic select2 for refs.
435 435 initTargetRefs(repoData['refs']['select2_refs'],
436 436 repoData['refs']['selected_ref']);
437 437
438 438 };
439 439
440 440 var sourceRefSelect2 = Select2Box($sourceRef, {
441 441 placeholder: "${_('Select commit reference')}",
442 442 query: function(query) {
443 443 var initialData = defaultSourceRepoData['refs']['select2_refs'];
444 444 queryTargetRefs(initialData, query)
445 445 },
446 446 initSelection: initRefSelection()
447 447 }
448 448 );
449 449
450 450 var sourceRepoSelect2 = Select2Box($sourceRepo, {
451 451 query: function(query) {}
452 452 });
453 453
454 454 var targetRepoSelect2 = Select2Box($targetRepo, {
455 455 cachedDataSource: {},
456 456 query: $.debounce(250, function(query) {
457 457 queryTargetRepo(this, query);
458 458 }),
459 459 formatResult: formatResult
460 460 });
461 461
462 462 sourceRefSelect2.initRef();
463 463
464 464 sourceRepoSelect2.initRepo(defaultSourceRepo, true);
465 465
466 466 targetRepoSelect2.initRepo(defaultTargetRepo, false);
467 467
468 468 $sourceRef.on('change', function(e){
469 469 loadRepoRefDiffPreview();
470 470 reviewersController.loadDefaultReviewers(
471 471 sourceRepo(), sourceRef(), targetRepo(), targetRef());
472 472 });
473 473
474 474 $targetRef.on('change', function(e){
475 475 loadRepoRefDiffPreview();
476 476 reviewersController.loadDefaultReviewers(
477 477 sourceRepo(), sourceRef(), targetRepo(), targetRef());
478 478 });
479 479
480 480 $targetRepo.on('change', function(e){
481 481 var repoName = $(this).val();
482 482 calculateContainerWidth();
483 483 $targetRef.select2('destroy');
484 484 $('#target_ref_loading').show();
485 485
486 486 $.ajax({
487 487 url: pyroutes.url('pullrequest_repo_refs',
488 488 {'repo_name': templateContext.repo_name, 'target_repo_name':repoName}),
489 489 data: {},
490 490 dataType: 'json',
491 491 type: 'GET',
492 492 success: function(data) {
493 493 $('#target_ref_loading').hide();
494 494 targetRepoChanged(data);
495 495 loadRepoRefDiffPreview();
496 496 },
497 497 error: function(data, textStatus, errorThrown) {
498 498 alert("Error while fetching entries.\nError code {0} ({1}).".format(data.status, data.statusText));
499 499 }
500 500 })
501 501
502 502 });
503 503
504 504 prButtonLock(true, "${_('Please select source and target')}", 'all');
505 505
506 506 // auto-load on init, the target refs select2
507 507 calculateContainerWidth();
508 508 targetRepoChanged(defaultTargetRepoData);
509 509
510 510 $('#pullrequest_title').on('keyup', function(e){
511 511 $(this).removeClass('autogenerated-title');
512 512 });
513 513
514 514 % if c.default_source_ref:
515 515 // in case we have a pre-selected value, use it now
516 516 $sourceRef.select2('val', '${c.default_source_ref}');
517 517 loadRepoRefDiffPreview();
518 518 reviewersController.loadDefaultReviewers(
519 519 sourceRepo(), sourceRef(), targetRepo(), targetRef());
520 520 % endif
521 521
522 522 ReviewerAutoComplete('#user');
523 523 });
524 524 </script>
525 525
526 526 </%def>
@@ -1,78 +1,78 b''
1 1
2 2 <div class="pull-request-wrap">
3 3
4 4 % if c.pr_merge_possible:
5 5 <h2 class="merge-status">
6 6 <span class="merge-icon success"><i class="icon-ok"></i></span>
7 7 ${_('This pull request can be merged automatically.')}
8 8 </h2>
9 9 % else:
10 10 <h2 class="merge-status">
11 11 <span class="merge-icon warning"><i class="icon-false"></i></span>
12 12 ${_('Merge is not currently possible because of below failed checks.')}
13 13 </h2>
14 14 % endif
15 15
16 16 % if c.pr_merge_errors.items():
17 17 <ul>
18 18 % for pr_check_key, pr_check_details in c.pr_merge_errors.items():
19 19 <% pr_check_type = pr_check_details['error_type'] %>
20 20 <li>
21 21 <span class="merge-message ${pr_check_type}" data-role="merge-message">
22 22 - ${pr_check_details['message']}
23 23 % if pr_check_key == 'todo':
24 24 % for co in pr_check_details['details']:
25 25 <a class="permalink" href="#comment-${co.comment_id}" onclick="Rhodecode.comments.scrollToComment($('#comment-${co.comment_id}'), 0, ${h.json.dumps(co.outdated)})"> #${co.comment_id}</a>${'' if loop.last else ','}
26 26 % endfor
27 27 % endif
28 28 </span>
29 29 </li>
30 30 % endfor
31 31 </ul>
32 32 % endif
33 33
34 34 <div class="pull-request-merge-actions">
35 35 % if c.allowed_to_merge:
36 36 ## Merge info, show only if all errors are taken care of
37 37 % if not c.pr_merge_errors and c.pr_merge_info:
38 38 <div class="pull-request-merge-info">
39 39 <ul>
40 40 % for pr_merge_key, pr_merge_details in c.pr_merge_info.items():
41 41 <li>
42 42 - ${pr_merge_details['message']}
43 43 </li>
44 44 % endfor
45 45 </ul>
46 46 </div>
47 47 % endif
48 48
49 49 <div>
50 ${h.secure_form(h.route_path('pullrequest_merge', repo_name=c.repo_name, pull_request_id=c.pull_request.pull_request_id), id='merge_pull_request_form', method='POST', request=request)}
50 ${h.secure_form(h.route_path('pullrequest_merge', repo_name=c.repo_name, pull_request_id=c.pull_request.pull_request_id), id='merge_pull_request_form', request=request)}
51 51 <% merge_disabled = ' disabled' if c.pr_merge_possible is False else '' %>
52 52 <a class="btn" href="#" onclick="refreshMergeChecks(); return false;">${_('refresh checks')}</a>
53 53 <input type="submit" id="merge_pull_request" value="${_('Merge Pull Request')}" class="btn${merge_disabled}"${merge_disabled}>
54 54 ${h.end_form()}
55 55 </div>
56 56 % elif c.rhodecode_user.username != h.DEFAULT_USER:
57 57 <a class="btn" href="#" onclick="refreshMergeChecks(); return false;">${_('refresh checks')}</a>
58 58 <input type="submit" value="${_('Merge Pull Request')}" class="btn disabled" disabled="disabled" title="${_('You are not allowed to merge this pull request.')}">
59 59 % else:
60 60 <input type="submit" value="${_('Login to Merge this Pull Request')}" class="btn disabled" disabled="disabled">
61 61 % endif
62 62 </div>
63 63
64 64 % if c.allowed_to_close:
65 65 ## close PR action, injected later next to COMMENT button
66 66 <div id="close-pull-request-action" style="display: none">
67 67 % if c.pull_request_review_status == c.REVIEW_STATUS_APPROVED:
68 68 <a class="btn btn-approved-status" href="#close-as-approved" onclick="closePullRequest('${c.REVIEW_STATUS_APPROVED}'); return false;">
69 69 ${_('Close with status {}').format(h.commit_status_lbl(c.REVIEW_STATUS_APPROVED))}
70 70 </a>
71 71 % else:
72 72 <a class="btn btn-rejected-status" href="#close-as-rejected" onclick="closePullRequest('${c.REVIEW_STATUS_REJECTED}'); return false;">
73 73 ${_('Close with status {}').format(h.commit_status_lbl(c.REVIEW_STATUS_REJECTED))}
74 74 </a>
75 75 % endif
76 76 </div>
77 77 % endif
78 78 </div>
@@ -1,866 +1,866 b''
1 1 <%inherit file="/base/base.mako"/>
2 2 <%namespace name="base" file="/base/base.mako"/>
3 3
4 4 <%def name="title()">
5 5 ${_('%s Pull Request #%s') % (c.repo_name, c.pull_request.pull_request_id)}
6 6 %if c.rhodecode_name:
7 7 &middot; ${h.branding(c.rhodecode_name)}
8 8 %endif
9 9 </%def>
10 10
11 11 <%def name="breadcrumbs_links()">
12 12 <span id="pr-title">
13 13 ${c.pull_request.title}
14 14 %if c.pull_request.is_closed():
15 15 (${_('Closed')})
16 16 %endif
17 17 </span>
18 18 <div id="pr-title-edit" class="input" style="display: none;">
19 19 ${h.text('pullrequest_title', id_="pr-title-input", class_="large", value=c.pull_request.title)}
20 20 </div>
21 21 </%def>
22 22
23 23 <%def name="menu_bar_nav()">
24 24 ${self.menu_items(active='repositories')}
25 25 </%def>
26 26
27 27 <%def name="menu_bar_subnav()">
28 28 ${self.repo_menu(active='showpullrequest')}
29 29 </%def>
30 30
31 31 <%def name="main()">
32 32
33 33 <script type="text/javascript">
34 34 // TODO: marcink switch this to pyroutes
35 35 AJAX_COMMENT_DELETE_URL = "${h.route_path('pullrequest_comment_delete',repo_name=c.repo_name,pull_request_id=c.pull_request.pull_request_id,comment_id='__COMMENT_ID__')}";
36 36 templateContext.pull_request_data.pull_request_id = ${c.pull_request.pull_request_id};
37 37 </script>
38 38 <div class="box">
39 39
40 40 <div class="title">
41 41 ${self.repo_page_title(c.rhodecode_db_repo)}
42 42 </div>
43 43
44 44 ${self.breadcrumbs()}
45 45
46 46 <div class="box pr-summary">
47 47
48 48 <div class="summary-details block-left">
49 49 <% summary = lambda n:{False:'summary-short'}.get(n) %>
50 50 <div class="pr-details-title">
51 51 <a href="${h.route_path('pull_requests_global', pull_request_id=c.pull_request.pull_request_id)}">${_('Pull request #%s') % c.pull_request.pull_request_id}</a> ${_('From')} ${h.format_date(c.pull_request.created_on)}
52 52 %if c.allowed_to_update:
53 53 <div id="delete_pullrequest" class="pull-right action_button ${'' if c.allowed_to_delete else 'disabled' }" style="clear:inherit;padding: 0">
54 54 % if c.allowed_to_delete:
55 ${h.secure_form(h.route_path('pullrequest_delete', repo_name=c.pull_request.target_repo.repo_name, pull_request_id=c.pull_request.pull_request_id), method='POST', request=request)}
55 ${h.secure_form(h.route_path('pullrequest_delete', repo_name=c.pull_request.target_repo.repo_name, pull_request_id=c.pull_request.pull_request_id), request=request)}
56 56 ${h.submit('remove_%s' % c.pull_request.pull_request_id, _('Delete'),
57 57 class_="btn btn-link btn-danger no-margin",onclick="return confirm('"+_('Confirm to delete this pull request')+"');")}
58 58 ${h.end_form()}
59 59 % else:
60 60 ${_('Delete')}
61 61 % endif
62 62 </div>
63 63 <div id="open_edit_pullrequest" class="pull-right action_button">${_('Edit')}</div>
64 64 <div id="close_edit_pullrequest" class="pull-right action_button" style="display: none;padding: 0">${_('Cancel')}</div>
65 65 %endif
66 66 </div>
67 67
68 68 <div id="summary" class="fields pr-details-content">
69 69 <div class="field">
70 70 <div class="label-summary">
71 71 <label>${_('Source')}:</label>
72 72 </div>
73 73 <div class="input">
74 74 <div class="pr-origininfo">
75 75 ## branch link is only valid if it is a branch
76 76 <span class="tag">
77 77 %if c.pull_request.source_ref_parts.type == 'branch':
78 78 <a href="${h.route_path('repo_changelog', repo_name=c.pull_request.source_repo.repo_name, _query=dict(branch=c.pull_request.source_ref_parts.name))}">${c.pull_request.source_ref_parts.type}: ${c.pull_request.source_ref_parts.name}</a>
79 79 %else:
80 80 ${c.pull_request.source_ref_parts.type}: ${c.pull_request.source_ref_parts.name}
81 81 %endif
82 82 </span>
83 83 <span class="clone-url">
84 84 <a href="${h.route_path('repo_summary', repo_name=c.pull_request.source_repo.repo_name)}">${c.pull_request.source_repo.clone_url()}</a>
85 85 </span>
86 86 <br/>
87 87 % if c.ancestor_commit:
88 88 ${_('Common ancestor')}:
89 89 <code><a href="${h.route_path('repo_commit', repo_name=c.target_repo.repo_name, commit_id=c.ancestor_commit.raw_id)}">${h.show_id(c.ancestor_commit)}</a></code>
90 90 % endif
91 91 </div>
92 92 %if h.is_hg(c.pull_request.source_repo):
93 93 <% clone_url = 'hg pull -r {} {}'.format(h.short_id(c.source_ref), c.pull_request.source_repo.clone_url()) %>
94 94 %elif h.is_git(c.pull_request.source_repo):
95 95 <% clone_url = 'git pull {} {}'.format(c.pull_request.source_repo.clone_url(), c.pull_request.source_ref_parts.name) %>
96 96 %endif
97 97
98 98 <div class="">
99 99 <input type="text" class="input-monospace pr-pullinfo" value="${clone_url}" readonly="readonly">
100 100 <i class="tooltip icon-clipboard clipboard-action pull-right pr-pullinfo-copy" data-clipboard-text="${clone_url}" title="${_('Copy the pull url')}"></i>
101 101 </div>
102 102
103 103 </div>
104 104 </div>
105 105 <div class="field">
106 106 <div class="label-summary">
107 107 <label>${_('Target')}:</label>
108 108 </div>
109 109 <div class="input">
110 110 <div class="pr-targetinfo">
111 111 ## branch link is only valid if it is a branch
112 112 <span class="tag">
113 113 %if c.pull_request.target_ref_parts.type == 'branch':
114 114 <a href="${h.route_path('repo_changelog', repo_name=c.pull_request.target_repo.repo_name, _query=dict(branch=c.pull_request.target_ref_parts.name))}">${c.pull_request.target_ref_parts.type}: ${c.pull_request.target_ref_parts.name}</a>
115 115 %else:
116 116 ${c.pull_request.target_ref_parts.type}: ${c.pull_request.target_ref_parts.name}
117 117 %endif
118 118 </span>
119 119 <span class="clone-url">
120 120 <a href="${h.route_path('repo_summary', repo_name=c.pull_request.target_repo.repo_name)}">${c.pull_request.target_repo.clone_url()}</a>
121 121 </span>
122 122 </div>
123 123 </div>
124 124 </div>
125 125
126 126 ## Link to the shadow repository.
127 127 <div class="field">
128 128 <div class="label-summary">
129 129 <label>${_('Merge')}:</label>
130 130 </div>
131 131 <div class="input">
132 132 % if not c.pull_request.is_closed() and c.pull_request.shadow_merge_ref:
133 133 %if h.is_hg(c.pull_request.target_repo):
134 134 <% clone_url = 'hg clone --update {} {} pull-request-{}'.format(c.pull_request.shadow_merge_ref.name, c.shadow_clone_url, c.pull_request.pull_request_id) %>
135 135 %elif h.is_git(c.pull_request.target_repo):
136 136 <% clone_url = 'git clone --branch {} {} pull-request-{}'.format(c.pull_request.shadow_merge_ref.name, c.shadow_clone_url, c.pull_request.pull_request_id) %>
137 137 %endif
138 138 <div class="">
139 139 <input type="text" class="input-monospace pr-mergeinfo" value="${clone_url}" readonly="readonly">
140 140 <i class="tooltip icon-clipboard clipboard-action pull-right pr-mergeinfo-copy" data-clipboard-text="${clone_url}" title="${_('Copy the clone url')}"></i>
141 141 </div>
142 142 % else:
143 143 <div class="">
144 144 ${_('Shadow repository data not available')}.
145 145 </div>
146 146 % endif
147 147 </div>
148 148 </div>
149 149
150 150 <div class="field">
151 151 <div class="label-summary">
152 152 <label>${_('Review')}:</label>
153 153 </div>
154 154 <div class="input">
155 155 %if c.pull_request_review_status:
156 156 <div class="${'flag_status %s' % c.pull_request_review_status} tooltip pull-left"></div>
157 157 <span class="changeset-status-lbl tooltip">
158 158 %if c.pull_request.is_closed():
159 159 ${_('Closed')},
160 160 %endif
161 161 ${h.commit_status_lbl(c.pull_request_review_status)}
162 162 </span>
163 163 - ${_ungettext('calculated based on %s reviewer vote', 'calculated based on %s reviewers votes', len(c.pull_request_reviewers)) % len(c.pull_request_reviewers)}
164 164 %endif
165 165 </div>
166 166 </div>
167 167 <div class="field">
168 168 <div class="pr-description-label label-summary">
169 169 <label>${_('Description')}:</label>
170 170 </div>
171 171 <div id="pr-desc" class="input">
172 172 <div class="pr-description">${h.urlify_commit_message(c.pull_request.description, c.repo_name)}</div>
173 173 </div>
174 174 <div id="pr-desc-edit" class="input textarea editor" style="display: none;">
175 175 <textarea id="pr-description-input" size="30">${c.pull_request.description}</textarea>
176 176 </div>
177 177 </div>
178 178
179 179 <div class="field">
180 180 <div class="label-summary">
181 181 <label>${_('Versions')}:</label>
182 182 </div>
183 183
184 184 <% outdated_comm_count_ver = len(c.inline_versions[None]['outdated']) %>
185 185 <% general_outdated_comm_count_ver = len(c.comment_versions[None]['outdated']) %>
186 186
187 187 <div class="pr-versions">
188 188 % if c.show_version_changes:
189 189 <% outdated_comm_count_ver = len(c.inline_versions[c.at_version_num]['outdated']) %>
190 190 <% general_outdated_comm_count_ver = len(c.comment_versions[c.at_version_num]['outdated']) %>
191 191 <a id="show-pr-versions" class="input" onclick="return versionController.toggleVersionView(this)" href="#show-pr-versions"
192 192 data-toggle-on="${_ungettext('{} version available for this pull request, show it.', '{} versions available for this pull request, show them.', len(c.versions)).format(len(c.versions))}"
193 193 data-toggle-off="${_('Hide all versions of this pull request')}">
194 194 ${_ungettext('{} version available for this pull request, show it.', '{} versions available for this pull request, show them.', len(c.versions)).format(len(c.versions))}
195 195 </a>
196 196 <table>
197 197 ## SHOW ALL VERSIONS OF PR
198 198 <% ver_pr = None %>
199 199
200 200 % for data in reversed(list(enumerate(c.versions, 1))):
201 201 <% ver_pos = data[0] %>
202 202 <% ver = data[1] %>
203 203 <% ver_pr = ver.pull_request_version_id %>
204 204 <% display_row = '' if c.at_version and (c.at_version_num == ver_pr or c.from_version_num == ver_pr) else 'none' %>
205 205
206 206 <tr class="version-pr" style="display: ${display_row}">
207 207 <td>
208 208 <code>
209 209 <a href="${request.current_route_path(_query=dict(version=ver_pr or 'latest'))}">v${ver_pos}</a>
210 210 </code>
211 211 </td>
212 212 <td>
213 213 <input ${'checked="checked"' if c.from_version_num == ver_pr else ''} class="compare-radio-button" type="radio" name="ver_source" value="${ver_pr or 'latest'}" data-ver-pos="${ver_pos}"/>
214 214 <input ${'checked="checked"' if c.at_version_num == ver_pr else ''} class="compare-radio-button" type="radio" name="ver_target" value="${ver_pr or 'latest'}" data-ver-pos="${ver_pos}"/>
215 215 </td>
216 216 <td>
217 217 <% review_status = c.review_versions[ver_pr].status if ver_pr in c.review_versions else 'not_reviewed' %>
218 218 <div class="${'flag_status %s' % review_status} tooltip pull-left" title="${_('Your review status at this version')}">
219 219 </div>
220 220 </td>
221 221 <td>
222 222 % if c.at_version_num != ver_pr:
223 223 <i class="icon-comment"></i>
224 224 <code class="tooltip" title="${_('Comment from pull request version {0}, general:{1} inline:{2}').format(ver_pos, len(c.comment_versions[ver_pr]['at']), len(c.inline_versions[ver_pr]['at']))}">
225 225 G:${len(c.comment_versions[ver_pr]['at'])} / I:${len(c.inline_versions[ver_pr]['at'])}
226 226 </code>
227 227 % endif
228 228 </td>
229 229 <td>
230 230 ##<code>${ver.source_ref_parts.commit_id[:6]}</code>
231 231 </td>
232 232 <td>
233 233 ${h.age_component(ver.updated_on, time_is_local=True)}
234 234 </td>
235 235 </tr>
236 236 % endfor
237 237
238 238 <tr>
239 239 <td colspan="6">
240 240 <button id="show-version-diff" onclick="return versionController.showVersionDiff()" class="btn btn-sm" style="display: none"
241 241 data-label-text-locked="${_('select versions to show changes')}"
242 242 data-label-text-diff="${_('show changes between versions')}"
243 243 data-label-text-show="${_('show pull request for this version')}"
244 244 >
245 245 ${_('select versions to show changes')}
246 246 </button>
247 247 </td>
248 248 </tr>
249 249
250 250 ## show comment/inline comments summary
251 251 <%def name="comments_summary()">
252 252 <tr>
253 253 <td colspan="6" class="comments-summary-td">
254 254
255 255 % if c.at_version:
256 256 <% inline_comm_count_ver = len(c.inline_versions[c.at_version_num]['display']) %>
257 257 <% general_comm_count_ver = len(c.comment_versions[c.at_version_num]['display']) %>
258 258 ${_('Comments at this version')}:
259 259 % else:
260 260 <% inline_comm_count_ver = len(c.inline_versions[c.at_version_num]['until']) %>
261 261 <% general_comm_count_ver = len(c.comment_versions[c.at_version_num]['until']) %>
262 262 ${_('Comments for this pull request')}:
263 263 % endif
264 264
265 265
266 266 %if general_comm_count_ver:
267 267 <a href="#comments">${_("%d General ") % general_comm_count_ver}</a>
268 268 %else:
269 269 ${_("%d General ") % general_comm_count_ver}
270 270 %endif
271 271
272 272 %if inline_comm_count_ver:
273 273 , <a href="#" onclick="return Rhodecode.comments.nextComment();" id="inline-comments-counter">${_("%d Inline") % inline_comm_count_ver}</a>
274 274 %else:
275 275 , ${_("%d Inline") % inline_comm_count_ver}
276 276 %endif
277 277
278 278 %if outdated_comm_count_ver:
279 279 , <a href="#" onclick="showOutdated(); Rhodecode.comments.nextOutdatedComment(); return false;">${_("%d Outdated") % outdated_comm_count_ver}</a>
280 280 <a href="#" class="showOutdatedComments" onclick="showOutdated(this); return false;"> | ${_('show outdated comments')}</a>
281 281 <a href="#" class="hideOutdatedComments" style="display: none" onclick="hideOutdated(this); return false;"> | ${_('hide outdated comments')}</a>
282 282 %else:
283 283 , ${_("%d Outdated") % outdated_comm_count_ver}
284 284 %endif
285 285 </td>
286 286 </tr>
287 287 </%def>
288 288 ${comments_summary()}
289 289 </table>
290 290 % else:
291 291 <div class="input">
292 292 ${_('Pull request versions not available')}.
293 293 </div>
294 294 <div>
295 295 <table>
296 296 ${comments_summary()}
297 297 </table>
298 298 </div>
299 299 % endif
300 300 </div>
301 301 </div>
302 302
303 303 <div id="pr-save" class="field" style="display: none;">
304 304 <div class="label-summary"></div>
305 305 <div class="input">
306 306 <span id="edit_pull_request" class="btn btn-small no-margin">${_('Save Changes')}</span>
307 307 </div>
308 308 </div>
309 309 </div>
310 310 </div>
311 311 <div>
312 312 ## AUTHOR
313 313 <div class="reviewers-title block-right">
314 314 <div class="pr-details-title">
315 315 ${_('Author of this pull request')}
316 316 </div>
317 317 </div>
318 318 <div class="block-right pr-details-content reviewers">
319 319 <ul class="group_members">
320 320 <li>
321 321 ${self.gravatar_with_user(c.pull_request.author.email, 16)}
322 322 </li>
323 323 </ul>
324 324 </div>
325 325
326 326 ## REVIEW RULES
327 327 <div id="review_rules" style="display: none" class="reviewers-title block-right">
328 328 <div class="pr-details-title">
329 329 ${_('Reviewer rules')}
330 330 %if c.allowed_to_update:
331 331 <span id="close_edit_reviewers" class="block-right action_button last-item" style="display: none;">${_('Close')}</span>
332 332 %endif
333 333 </div>
334 334 <div class="pr-reviewer-rules">
335 335 ## review rules will be appended here, by default reviewers logic
336 336 </div>
337 337 <input id="review_data" type="hidden" name="review_data" value="">
338 338 </div>
339 339
340 340 ## REVIEWERS
341 341 <div class="reviewers-title block-right">
342 342 <div class="pr-details-title">
343 343 ${_('Pull request reviewers')}
344 344 %if c.allowed_to_update:
345 345 <span id="open_edit_reviewers" class="block-right action_button last-item">${_('Edit')}</span>
346 346 %endif
347 347 </div>
348 348 </div>
349 349 <div id="reviewers" class="block-right pr-details-content reviewers">
350 350 ## members goes here !
351 351 <input type="hidden" name="__start__" value="review_members:sequence">
352 352 <ul id="review_members" class="group_members">
353 353 %for member,reasons,mandatory,status in c.pull_request_reviewers:
354 354 <li id="reviewer_${member.user_id}" class="reviewer_entry">
355 355 <div class="reviewers_member">
356 356 <div class="reviewer_status tooltip" title="${h.tooltip(h.commit_status_lbl(status[0][1].status if status else 'not_reviewed'))}">
357 357 <div class="${'flag_status %s' % (status[0][1].status if status else 'not_reviewed')} pull-left reviewer_member_status"></div>
358 358 </div>
359 359 <div id="reviewer_${member.user_id}_name" class="reviewer_name">
360 360 ${self.gravatar_with_user(member.email, 16)}
361 361 </div>
362 362 <input type="hidden" name="__start__" value="reviewer:mapping">
363 363 <input type="hidden" name="__start__" value="reasons:sequence">
364 364 %for reason in reasons:
365 365 <div class="reviewer_reason">- ${reason}</div>
366 366 <input type="hidden" name="reason" value="${reason}">
367 367
368 368 %endfor
369 369 <input type="hidden" name="__end__" value="reasons:sequence">
370 370 <input id="reviewer_${member.user_id}_input" type="hidden" value="${member.user_id}" name="user_id" />
371 371 <input type="hidden" name="mandatory" value="${mandatory}"/>
372 372 <input type="hidden" name="__end__" value="reviewer:mapping">
373 373 % if mandatory:
374 374 <div class="reviewer_member_mandatory_remove">
375 375 <i class="icon-remove-sign"></i>
376 376 </div>
377 377 <div class="reviewer_member_mandatory">
378 378 <i class="icon-lock" title="${h.tooltip(_('Mandatory reviewer'))}"></i>
379 379 </div>
380 380 % else:
381 381 %if c.allowed_to_update:
382 382 <div class="reviewer_member_remove action_button" onclick="reviewersController.removeReviewMember(${member.user_id}, true)" style="visibility: hidden;">
383 383 <i class="icon-remove-sign" ></i>
384 384 </div>
385 385 %endif
386 386 % endif
387 387 </div>
388 388 </li>
389 389 %endfor
390 390 </ul>
391 391 <input type="hidden" name="__end__" value="review_members:sequence">
392 392
393 393 %if not c.pull_request.is_closed():
394 394 <div id="add_reviewer" class="ac" style="display: none;">
395 395 %if c.allowed_to_update:
396 396 % if not c.forbid_adding_reviewers:
397 397 <div id="add_reviewer_input" class="reviewer_ac">
398 398 ${h.text('user', class_='ac-input', placeholder=_('Add reviewer or reviewer group'))}
399 399 <div id="reviewers_container"></div>
400 400 </div>
401 401 % endif
402 402 <div class="pull-right">
403 403 <button id="update_pull_request" class="btn btn-small no-margin">${_('Save Changes')}</button>
404 404 </div>
405 405 %endif
406 406 </div>
407 407 %endif
408 408 </div>
409 409 </div>
410 410 </div>
411 411 <div class="box">
412 412 ##DIFF
413 413 <div class="table" >
414 414 <div id="changeset_compare_view_content">
415 415 ##CS
416 416 % if c.missing_requirements:
417 417 <div class="box">
418 418 <div class="alert alert-warning">
419 419 <div>
420 420 <strong>${_('Missing requirements:')}</strong>
421 421 ${_('These commits cannot be displayed, because this repository uses the Mercurial largefiles extension, which was not enabled.')}
422 422 </div>
423 423 </div>
424 424 </div>
425 425 % elif c.missing_commits:
426 426 <div class="box">
427 427 <div class="alert alert-warning">
428 428 <div>
429 429 <strong>${_('Missing commits')}:</strong>
430 430 ${_('This pull request cannot be displayed, because one or more commits no longer exist in the source repository.')}
431 431 ${_('Please update this pull request, push the commits back into the source repository, or consider closing this pull request.')}
432 432 </div>
433 433 </div>
434 434 </div>
435 435 % endif
436 436
437 437 <div class="compare_view_commits_title">
438 438 % if not c.compare_mode:
439 439
440 440 % if c.at_version_pos:
441 441 <h4>
442 442 ${_('Showing changes at v%d, commenting is disabled.') % c.at_version_pos}
443 443 </h4>
444 444 % endif
445 445
446 446 <div class="pull-left">
447 447 <div class="btn-group">
448 448 <a
449 449 class="btn"
450 450 href="#"
451 451 onclick="$('.compare_select').show();$('.compare_select_hidden').hide(); return false">
452 452 ${_ungettext('Expand %s commit','Expand %s commits', len(c.commit_ranges)) % len(c.commit_ranges)}
453 453 </a>
454 454 <a
455 455 class="btn"
456 456 href="#"
457 457 onclick="$('.compare_select').hide();$('.compare_select_hidden').show(); return false">
458 458 ${_ungettext('Collapse %s commit','Collapse %s commits', len(c.commit_ranges)) % len(c.commit_ranges)}
459 459 </a>
460 460 </div>
461 461 </div>
462 462
463 463 <div class="pull-right">
464 464 % if c.allowed_to_update and not c.pull_request.is_closed():
465 465 <a id="update_commits" class="btn btn-primary no-margin pull-right">${_('Update commits')}</a>
466 466 % else:
467 467 <a class="tooltip btn disabled pull-right" disabled="disabled" title="${_('Update is disabled for current view')}">${_('Update commits')}</a>
468 468 % endif
469 469
470 470 </div>
471 471 % endif
472 472 </div>
473 473
474 474 % if not c.missing_commits:
475 475 % if c.compare_mode:
476 476 % if c.at_version:
477 477 <h4>
478 478 ${_('Commits and changes between v{ver_from} and {ver_to} of this pull request, commenting is disabled').format(ver_from=c.from_version_pos, ver_to=c.at_version_pos if c.at_version_pos else 'latest')}:
479 479 </h4>
480 480
481 481 <div class="subtitle-compare">
482 482 ${_('commits added: {}, removed: {}').format(len(c.commit_changes_summary.added), len(c.commit_changes_summary.removed))}
483 483 </div>
484 484
485 485 <div class="container">
486 486 <table class="rctable compare_view_commits">
487 487 <tr>
488 488 <th></th>
489 489 <th>${_('Time')}</th>
490 490 <th>${_('Author')}</th>
491 491 <th>${_('Commit')}</th>
492 492 <th></th>
493 493 <th>${_('Description')}</th>
494 494 </tr>
495 495
496 496 % for c_type, commit in c.commit_changes:
497 497 % if c_type in ['a', 'r']:
498 498 <%
499 499 if c_type == 'a':
500 500 cc_title = _('Commit added in displayed changes')
501 501 elif c_type == 'r':
502 502 cc_title = _('Commit removed in displayed changes')
503 503 else:
504 504 cc_title = ''
505 505 %>
506 506 <tr id="row-${commit.raw_id}" commit_id="${commit.raw_id}" class="compare_select">
507 507 <td>
508 508 <div class="commit-change-indicator color-${c_type}-border">
509 509 <div class="commit-change-content color-${c_type} tooltip" title="${h.tooltip(cc_title)}">
510 510 ${c_type.upper()}
511 511 </div>
512 512 </div>
513 513 </td>
514 514 <td class="td-time">
515 515 ${h.age_component(commit.date)}
516 516 </td>
517 517 <td class="td-user">
518 518 ${base.gravatar_with_user(commit.author, 16)}
519 519 </td>
520 520 <td class="td-hash">
521 521 <code>
522 522 <a href="${h.route_path('repo_commit', repo_name=c.target_repo.repo_name, commit_id=commit.raw_id)}">
523 523 r${commit.revision}:${h.short_id(commit.raw_id)}
524 524 </a>
525 525 ${h.hidden('revisions', commit.raw_id)}
526 526 </code>
527 527 </td>
528 528 <td class="expand_commit" data-commit-id="${commit.raw_id}" title="${_( 'Expand commit message')}">
529 529 <div class="show_more_col">
530 530 <i class="show_more"></i>
531 531 </div>
532 532 </td>
533 533 <td class="mid td-description">
534 534 <div class="log-container truncate-wrap">
535 535 <div class="message truncate" id="c-${commit.raw_id}" data-message-raw="${commit.message}">
536 536 ${h.urlify_commit_message(commit.message, c.repo_name)}
537 537 </div>
538 538 </div>
539 539 </td>
540 540 </tr>
541 541 % endif
542 542 % endfor
543 543 </table>
544 544 </div>
545 545
546 546 <script>
547 547 $('.expand_commit').on('click',function(e){
548 548 var target_expand = $(this);
549 549 var cid = target_expand.data('commitId');
550 550
551 551 if (target_expand.hasClass('open')){
552 552 $('#c-'+cid).css({
553 553 'height': '1.5em',
554 554 'white-space': 'nowrap',
555 555 'text-overflow': 'ellipsis',
556 556 'overflow':'hidden'
557 557 });
558 558 target_expand.removeClass('open');
559 559 }
560 560 else {
561 561 $('#c-'+cid).css({
562 562 'height': 'auto',
563 563 'white-space': 'pre-line',
564 564 'text-overflow': 'initial',
565 565 'overflow':'visible'
566 566 });
567 567 target_expand.addClass('open');
568 568 }
569 569 });
570 570 </script>
571 571
572 572 % endif
573 573
574 574 % else:
575 575 <%include file="/compare/compare_commits.mako" />
576 576 % endif
577 577
578 578 <div class="cs_files">
579 579 <%namespace name="cbdiffs" file="/codeblocks/diffs.mako"/>
580 580 ${cbdiffs.render_diffset_menu()}
581 581 ${cbdiffs.render_diffset(
582 582 c.diffset, use_comments=True,
583 583 collapse_when_files_over=30,
584 584 disable_new_comments=not c.allowed_to_comment,
585 585 deleted_files_comments=c.deleted_files_comments)}
586 586 </div>
587 587 % else:
588 588 ## skipping commits we need to clear the view for missing commits
589 589 <div style="clear:both;"></div>
590 590 % endif
591 591
592 592 </div>
593 593 </div>
594 594
595 595 ## template for inline comment form
596 596 <%namespace name="comment" file="/changeset/changeset_file_comment.mako"/>
597 597
598 598 ## render general comments
599 599
600 600 <div id="comment-tr-show">
601 601 <div class="comment">
602 602 % if general_outdated_comm_count_ver:
603 603 <div class="meta">
604 604 % if general_outdated_comm_count_ver == 1:
605 605 ${_('there is {num} general comment from older versions').format(num=general_outdated_comm_count_ver)},
606 606 <a href="#show-hidden-comments" onclick="$('.comment-general.comment-outdated').show(); $(this).parent().hide(); return false;">${_('show it')}</a>
607 607 % else:
608 608 ${_('there are {num} general comments from older versions').format(num=general_outdated_comm_count_ver)},
609 609 <a href="#show-hidden-comments" onclick="$('.comment-general.comment-outdated').show(); $(this).parent().hide(); return false;">${_('show them')}</a>
610 610 % endif
611 611 </div>
612 612 % endif
613 613 </div>
614 614 </div>
615 615
616 616 ${comment.generate_comments(c.comments, include_pull_request=True, is_pull_request=True)}
617 617
618 618 % if not c.pull_request.is_closed():
619 619 ## merge status, and merge action
620 620 <div class="pull-request-merge">
621 621 <%include file="/pullrequests/pullrequest_merge_checks.mako"/>
622 622 </div>
623 623
624 624 ## main comment form and it status
625 625 ${comment.comments(h.route_path('pullrequest_comment_create', repo_name=c.repo_name,
626 626 pull_request_id=c.pull_request.pull_request_id),
627 627 c.pull_request_review_status,
628 628 is_pull_request=True, change_status=c.allowed_to_change_status)}
629 629 %endif
630 630
631 631 <script type="text/javascript">
632 632 if (location.hash) {
633 633 var result = splitDelimitedHash(location.hash);
634 634 var line = $('html').find(result.loc);
635 635 // show hidden comments if we use location.hash
636 636 if (line.hasClass('comment-general')) {
637 637 $(line).show();
638 638 } else if (line.hasClass('comment-inline')) {
639 639 $(line).show();
640 640 var $cb = $(line).closest('.cb');
641 641 $cb.removeClass('cb-collapsed')
642 642 }
643 643 if (line.length > 0){
644 644 offsetScroll(line, 70);
645 645 }
646 646 }
647 647
648 648 versionController = new VersionController();
649 649 versionController.init();
650 650
651 651 reviewersController = new ReviewersController();
652 652
653 653 $(function(){
654 654
655 655 // custom code mirror
656 656 var codeMirrorInstance = initPullRequestsCodeMirror('#pr-description-input');
657 657
658 658 var PRDetails = {
659 659 editButton: $('#open_edit_pullrequest'),
660 660 closeButton: $('#close_edit_pullrequest'),
661 661 deleteButton: $('#delete_pullrequest'),
662 662 viewFields: $('#pr-desc, #pr-title'),
663 663 editFields: $('#pr-desc-edit, #pr-title-edit, #pr-save'),
664 664
665 665 init: function() {
666 666 var that = this;
667 667 this.editButton.on('click', function(e) { that.edit(); });
668 668 this.closeButton.on('click', function(e) { that.view(); });
669 669 },
670 670
671 671 edit: function(event) {
672 672 this.viewFields.hide();
673 673 this.editButton.hide();
674 674 this.deleteButton.hide();
675 675 this.closeButton.show();
676 676 this.editFields.show();
677 677 codeMirrorInstance.refresh();
678 678 },
679 679
680 680 view: function(event) {
681 681 this.editButton.show();
682 682 this.deleteButton.show();
683 683 this.editFields.hide();
684 684 this.closeButton.hide();
685 685 this.viewFields.show();
686 686 }
687 687 };
688 688
689 689 var ReviewersPanel = {
690 690 editButton: $('#open_edit_reviewers'),
691 691 closeButton: $('#close_edit_reviewers'),
692 692 addButton: $('#add_reviewer'),
693 693 removeButtons: $('.reviewer_member_remove,.reviewer_member_mandatory_remove,.reviewer_member_mandatory'),
694 694
695 695 init: function() {
696 696 var self = this;
697 697 this.editButton.on('click', function(e) { self.edit(); });
698 698 this.closeButton.on('click', function(e) { self.close(); });
699 699 },
700 700
701 701 edit: function(event) {
702 702 this.editButton.hide();
703 703 this.closeButton.show();
704 704 this.addButton.show();
705 705 this.removeButtons.css('visibility', 'visible');
706 706 // review rules
707 707 reviewersController.loadReviewRules(
708 708 ${c.pull_request.reviewer_data_json | n});
709 709 },
710 710
711 711 close: function(event) {
712 712 this.editButton.show();
713 713 this.closeButton.hide();
714 714 this.addButton.hide();
715 715 this.removeButtons.css('visibility', 'hidden');
716 716 // hide review rules
717 717 reviewersController.hideReviewRules()
718 718 }
719 719 };
720 720
721 721 PRDetails.init();
722 722 ReviewersPanel.init();
723 723
724 724 showOutdated = function(self){
725 725 $('.comment-inline.comment-outdated').show();
726 726 $('.filediff-outdated').show();
727 727 $('.showOutdatedComments').hide();
728 728 $('.hideOutdatedComments').show();
729 729 };
730 730
731 731 hideOutdated = function(self){
732 732 $('.comment-inline.comment-outdated').hide();
733 733 $('.filediff-outdated').hide();
734 734 $('.hideOutdatedComments').hide();
735 735 $('.showOutdatedComments').show();
736 736 };
737 737
738 738 refreshMergeChecks = function(){
739 739 var loadUrl = "${request.current_route_path(_query=dict(merge_checks=1))}";
740 740 $('.pull-request-merge').css('opacity', 0.3);
741 741 $('.action-buttons-extra').css('opacity', 0.3);
742 742
743 743 $('.pull-request-merge').load(
744 744 loadUrl, function() {
745 745 $('.pull-request-merge').css('opacity', 1);
746 746
747 747 $('.action-buttons-extra').css('opacity', 1);
748 748 injectCloseAction();
749 749 }
750 750 );
751 751 };
752 752
753 753 injectCloseAction = function() {
754 754 var closeAction = $('#close-pull-request-action').html();
755 755 var $actionButtons = $('.action-buttons-extra');
756 756 // clear the action before
757 757 $actionButtons.html("");
758 758 $actionButtons.html(closeAction);
759 759 };
760 760
761 761 closePullRequest = function (status) {
762 762 // inject closing flag
763 763 $('.action-buttons-extra').append('<input type="hidden" class="close-pr-input" id="close_pull_request" value="1">');
764 764 $(generalCommentForm.statusChange).select2("val", status).trigger('change');
765 765 $(generalCommentForm.submitForm).submit();
766 766 };
767 767
768 768 $('#show-outdated-comments').on('click', function(e){
769 769 var button = $(this);
770 770 var outdated = $('.comment-outdated');
771 771
772 772 if (button.html() === "(Show)") {
773 773 button.html("(Hide)");
774 774 outdated.show();
775 775 } else {
776 776 button.html("(Show)");
777 777 outdated.hide();
778 778 }
779 779 });
780 780
781 781 $('.show-inline-comments').on('change', function(e){
782 782 var show = 'none';
783 783 var target = e.currentTarget;
784 784 if(target.checked){
785 785 show = ''
786 786 }
787 787 var boxid = $(target).attr('id_for');
788 788 var comments = $('#{0} .inline-comments'.format(boxid));
789 789 var fn_display = function(idx){
790 790 $(this).css('display', show);
791 791 };
792 792 $(comments).each(fn_display);
793 793 var btns = $('#{0} .inline-comments-button'.format(boxid));
794 794 $(btns).each(fn_display);
795 795 });
796 796
797 797 $('#merge_pull_request_form').submit(function() {
798 798 if (!$('#merge_pull_request').attr('disabled')) {
799 799 $('#merge_pull_request').attr('disabled', 'disabled');
800 800 }
801 801 return true;
802 802 });
803 803
804 804 $('#edit_pull_request').on('click', function(e){
805 805 var title = $('#pr-title-input').val();
806 806 var description = codeMirrorInstance.getValue();
807 807 editPullRequest(
808 808 "${c.repo_name}", "${c.pull_request.pull_request_id}",
809 809 title, description);
810 810 });
811 811
812 812 $('#update_pull_request').on('click', function(e){
813 813 $(this).attr('disabled', 'disabled');
814 814 $(this).addClass('disabled');
815 815 $(this).html(_gettext('Saving...'));
816 816 reviewersController.updateReviewers(
817 817 "${c.repo_name}", "${c.pull_request.pull_request_id}");
818 818 });
819 819
820 820 $('#update_commits').on('click', function(e){
821 821 var isDisabled = !$(e.currentTarget).attr('disabled');
822 822 $(e.currentTarget).attr('disabled', 'disabled');
823 823 $(e.currentTarget).addClass('disabled');
824 824 $(e.currentTarget).removeClass('btn-primary');
825 825 $(e.currentTarget).text(_gettext('Updating...'));
826 826 if(isDisabled){
827 827 updateCommits(
828 828 "${c.repo_name}", "${c.pull_request.pull_request_id}");
829 829 }
830 830 });
831 831 // fixing issue with caches on firefox
832 832 $('#update_commits').removeAttr("disabled");
833 833
834 834 $('.show-inline-comments').on('click', function(e){
835 835 var boxid = $(this).attr('data-comment-id');
836 836 var button = $(this);
837 837
838 838 if(button.hasClass("comments-visible")) {
839 839 $('#{0} .inline-comments'.format(boxid)).each(function(index){
840 840 $(this).hide();
841 841 });
842 842 button.removeClass("comments-visible");
843 843 } else {
844 844 $('#{0} .inline-comments'.format(boxid)).each(function(index){
845 845 $(this).show();
846 846 });
847 847 button.addClass("comments-visible");
848 848 }
849 849 });
850 850
851 851 // register submit callback on commentForm form to track TODOs
852 852 window.commentFormGlobalSubmitSuccessCallback = function(){
853 853 refreshMergeChecks();
854 854 };
855 855 // initial injection
856 856 injectCloseAction();
857 857
858 858 ReviewerAutoComplete('#user');
859 859
860 860 })
861 861 </script>
862 862
863 863 </div>
864 864 </div>
865 865
866 866 </%def>
General Comments 0
You need to be logged in to leave comments. Login now