##// 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 <div class="panel panel-default">
1 <div class="panel panel-default">
2 <div class="panel-heading">
2 <div class="panel-heading">
3 <h3 class="panel-title">${_('Default Settings For New Repositories')}</h3>
3 <h3 class="panel-title">${_('Default Settings For New Repositories')}</h3>
4 </div>
4 </div>
5 <div class="panel-body">
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 <div class="form">
7 <div class="form">
8 <!-- fields -->
8 <!-- fields -->
9
9
10 <div class="fields">
10 <div class="fields">
11
11
12 <div class="field">
12 <div class="field">
13 <div class="label">
13 <div class="label">
14 <label for="default_repo_type">${_('Type')}:</label>
14 <label for="default_repo_type">${_('Type')}:</label>
15 </div>
15 </div>
16 <div class="select">
16 <div class="select">
17 ${h.select('default_repo_type','hg',c.backends,class_="medium")}
17 ${h.select('default_repo_type','hg',c.backends,class_="medium")}
18 </div>
18 </div>
19 </div>
19 </div>
20
20
21 <div class="field">
21 <div class="field">
22 <div class="label label-checkbox">
22 <div class="label label-checkbox">
23 <label for="default_repo_private">${_('Private Repository')}:</label>
23 <label for="default_repo_private">${_('Private Repository')}:</label>
24 </div>
24 </div>
25 <div class="checkboxes">
25 <div class="checkboxes">
26 ${h.checkbox('default_repo_private',value="True")}
26 ${h.checkbox('default_repo_private',value="True")}
27 <span class="help-block">${_('Private repositories are only visible to people explicitly added as collaborators.')}</span>
27 <span class="help-block">${_('Private repositories are only visible to people explicitly added as collaborators.')}</span>
28 </div>
28 </div>
29 </div>
29 </div>
30
30
31
31
32 <div class="field">
32 <div class="field">
33 <div class="label label-checkbox">
33 <div class="label label-checkbox">
34 <label for="default_repo_enable_statistics">${_('Enable Statistics')}:</label>
34 <label for="default_repo_enable_statistics">${_('Enable Statistics')}:</label>
35 </div>
35 </div>
36 <div class="checkboxes">
36 <div class="checkboxes">
37 ${h.checkbox('default_repo_enable_statistics',value="True")}
37 ${h.checkbox('default_repo_enable_statistics',value="True")}
38 <span class="help-block">${_('Enable a statistics window on the repository summary page.')}</span>
38 <span class="help-block">${_('Enable a statistics window on the repository summary page.')}</span>
39 </div>
39 </div>
40 </div>
40 </div>
41
41
42 <div class="field">
42 <div class="field">
43 <div class="label label-checkbox">
43 <div class="label label-checkbox">
44 <label for="default_repo_enable_downloads">${_('Enable Downloads')}:</label>
44 <label for="default_repo_enable_downloads">${_('Enable Downloads')}:</label>
45 </div>
45 </div>
46 <div class="checkboxes">
46 <div class="checkboxes">
47 ${h.checkbox('default_repo_enable_downloads',value="True")}
47 ${h.checkbox('default_repo_enable_downloads',value="True")}
48 <span class="help-block">${_('Enable the download option on the repository summary page.')}</span>
48 <span class="help-block">${_('Enable the download option on the repository summary page.')}</span>
49 </div>
49 </div>
50 </div>
50 </div>
51
51
52 <div class="field">
52 <div class="field">
53 <div class="label label-checkbox">
53 <div class="label label-checkbox">
54 <label for="default_repo_enable_locking">${_('Enable Locking')}:</label>
54 <label for="default_repo_enable_locking">${_('Enable Locking')}:</label>
55 </div>
55 </div>
56 <div class="checkboxes">
56 <div class="checkboxes">
57 ${h.checkbox('default_repo_enable_locking',value="True")}
57 ${h.checkbox('default_repo_enable_locking',value="True")}
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>
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 </div>
59 </div>
60 </div>
60 </div>
61
61
62 <div class="buttons">
62 <div class="buttons">
63 ${h.submit('save',_('Save'),class_="btn")}
63 ${h.submit('save',_('Save'),class_="btn")}
64 </div>
64 </div>
65 </div>
65 </div>
66 </div>
66 </div>
67 ${h.end_form()}
67 ${h.end_form()}
68 </div>
68 </div>
69
69
70 </div>
70 </div>
71
71
72 <script>
72 <script>
73 $(document).ready(function(){
73 $(document).ready(function(){
74 $("#default_repo_type").select2({
74 $("#default_repo_type").select2({
75 containerCssClass: 'drop-menu',
75 containerCssClass: 'drop-menu',
76 dropdownCssClass: 'drop-menu-dropdown',
76 dropdownCssClass: 'drop-menu-dropdown',
77 dropdownAutoWidth: true,
77 dropdownAutoWidth: true,
78 minimumResultsForSearch: -1
78 minimumResultsForSearch: -1
79 });
79 });
80 })
80 })
81 </script>
81 </script>
@@ -1,139 +1,139 b''
1 ## -*- coding: utf-8 -*-
1 ## -*- coding: utf-8 -*-
2 <%inherit file="/base/base.mako"/>
2 <%inherit file="/base/base.mako"/>
3
3
4 <%def name="title()">
4 <%def name="title()">
5 ${_('Edit Gist')} &middot; ${c.gist.gist_access_id}
5 ${_('Edit Gist')} &middot; ${c.gist.gist_access_id}
6 %if c.rhodecode_name:
6 %if c.rhodecode_name:
7 &middot; ${h.branding(c.rhodecode_name)}
7 &middot; ${h.branding(c.rhodecode_name)}
8 %endif
8 %endif
9 </%def>
9 </%def>
10
10
11 <%def name="breadcrumbs_links()">
11 <%def name="breadcrumbs_links()">
12 ${_('Edit Gist')} &middot; ${c.gist.gist_access_id}
12 ${_('Edit Gist')} &middot; ${c.gist.gist_access_id}
13 </%def>
13 </%def>
14
14
15 <%def name="menu_bar_nav()">
15 <%def name="menu_bar_nav()">
16 ${self.menu_items(active='gists')}
16 ${self.menu_items(active='gists')}
17 </%def>
17 </%def>
18
18
19 <%def name="main()">
19 <%def name="main()">
20 <div class="box">
20 <div class="box">
21 <!-- box / title -->
21 <!-- box / title -->
22 <div class="title">
22 <div class="title">
23 ${self.breadcrumbs()}
23 ${self.breadcrumbs()}
24 </div>
24 </div>
25
25
26 <div class="table">
26 <div class="table">
27
27
28 <div id="files_data">
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 <div>
30 <div>
31 <input type="hidden" value="${c.file_last_commit.raw_id}" name="parent_hash">
31 <input type="hidden" value="${c.file_last_commit.raw_id}" name="parent_hash">
32 <textarea id="description" name="description"
32 <textarea id="description" name="description"
33 placeholder="${_('Gist description ...')}">${c.gist.gist_description}</textarea>
33 placeholder="${_('Gist description ...')}">${c.gist.gist_description}</textarea>
34 <div>
34 <div>
35 <span class="gist-gravatar">
35 <span class="gist-gravatar">
36 ${self.gravatar(h.email_or_none(c.rhodecode_user.full_contact), 30)}
36 ${self.gravatar(h.email_or_none(c.rhodecode_user.full_contact), 30)}
37 </span>
37 </span>
38 <label for='lifetime'>${_('Gist lifetime')}</label>
38 <label for='lifetime'>${_('Gist lifetime')}</label>
39 ${h.dropdownmenu('lifetime', '0', c.lifetime_options)}
39 ${h.dropdownmenu('lifetime', '0', c.lifetime_options)}
40
40
41 <label for='gist_acl_level'>${_('Gist access level')}</label>
41 <label for='gist_acl_level'>${_('Gist access level')}</label>
42 ${h.dropdownmenu('gist_acl_level', c.gist.acl_level, c.acl_options)}
42 ${h.dropdownmenu('gist_acl_level', c.gist.acl_level, c.acl_options)}
43 </div>
43 </div>
44 </div>
44 </div>
45
45
46 ## peppercorn schema
46 ## peppercorn schema
47 <input type="hidden" name="__start__" value="nodes:sequence"/>
47 <input type="hidden" name="__start__" value="nodes:sequence"/>
48 % for cnt, file in enumerate(c.files):
48 % for cnt, file in enumerate(c.files):
49 <input type="hidden" name="__start__" value="file:mapping"/>
49 <input type="hidden" name="__start__" value="file:mapping"/>
50 <div id="codeblock" class="codeblock" >
50 <div id="codeblock" class="codeblock" >
51 <div class="code-header">
51 <div class="code-header">
52 <div class="form">
52 <div class="form">
53 <div class="fields">
53 <div class="fields">
54 <input type="hidden" name="filename_org" value="${file.path}" >
54 <input type="hidden" name="filename_org" value="${file.path}" >
55 <input id="filename_${h.FID('f',file.path)}" name="filename" size="30" type="text" value="${file.path}">
55 <input id="filename_${h.FID('f',file.path)}" name="filename" size="30" type="text" value="${file.path}">
56 ${h.dropdownmenu('mimetype' ,'plain',[('plain',_('plain'))],enable_filter=True, id='mimetype_'+h.FID('f',file.path))}
56 ${h.dropdownmenu('mimetype' ,'plain',[('plain',_('plain'))],enable_filter=True, id='mimetype_'+h.FID('f',file.path))}
57 </div>
57 </div>
58 </div>
58 </div>
59 </div>
59 </div>
60 <div class="editor_container">
60 <div class="editor_container">
61 <pre id="editor_pre"></pre>
61 <pre id="editor_pre"></pre>
62 <textarea id="editor_${h.FID('f',file.path)}" name="content" >${file.content}</textarea>
62 <textarea id="editor_${h.FID('f',file.path)}" name="content" >${file.content}</textarea>
63 </div>
63 </div>
64 </div>
64 </div>
65 <input type="hidden" name="__end__" />
65 <input type="hidden" name="__end__" />
66
66
67 ## dynamic edit box.
67 ## dynamic edit box.
68 <script type="text/javascript">
68 <script type="text/javascript">
69 $(document).ready(function(){
69 $(document).ready(function(){
70 var myCodeMirror = initCodeMirror(
70 var myCodeMirror = initCodeMirror(
71 "editor_${h.FID('f',file.path)}", '');
71 "editor_${h.FID('f',file.path)}", '');
72
72
73 var modes_select = $("#mimetype_${h.FID('f',file.path)}");
73 var modes_select = $("#mimetype_${h.FID('f',file.path)}");
74 fillCodeMirrorOptions(modes_select);
74 fillCodeMirrorOptions(modes_select);
75
75
76 // try to detect the mode based on the file we edit
76 // try to detect the mode based on the file we edit
77 var mimetype = "${file.mimetype}";
77 var mimetype = "${file.mimetype}";
78 var detected_mode = detectCodeMirrorMode(
78 var detected_mode = detectCodeMirrorMode(
79 "${file.path}", mimetype);
79 "${file.path}", mimetype);
80
80
81 if(detected_mode){
81 if(detected_mode){
82 $(modes_select).select2("val", mimetype);
82 $(modes_select).select2("val", mimetype);
83 $(modes_select).change();
83 $(modes_select).change();
84 setCodeMirrorMode(myCodeMirror, detected_mode);
84 setCodeMirrorMode(myCodeMirror, detected_mode);
85 }
85 }
86
86
87 var filename_selector = "#filename_${h.FID('f',file.path)}";
87 var filename_selector = "#filename_${h.FID('f',file.path)}";
88 // on change of select field set mode
88 // on change of select field set mode
89 setCodeMirrorModeFromSelect(
89 setCodeMirrorModeFromSelect(
90 modes_select, filename_selector, myCodeMirror, null);
90 modes_select, filename_selector, myCodeMirror, null);
91
91
92 // on entering the new filename set mode, from given extension
92 // on entering the new filename set mode, from given extension
93 setCodeMirrorModeFromInput(
93 setCodeMirrorModeFromInput(
94 modes_select, filename_selector, myCodeMirror, null);
94 modes_select, filename_selector, myCodeMirror, null);
95 });
95 });
96 </script>
96 </script>
97 %endfor
97 %endfor
98 <input type="hidden" name="__end__" />
98 <input type="hidden" name="__end__" />
99
99
100 <div class="pull-right">
100 <div class="pull-right">
101 ${h.submit('update',_('Update Gist'),class_="btn btn-success")}
101 ${h.submit('update',_('Update Gist'),class_="btn btn-success")}
102 <a class="btn" href="${h.route_path('gist_show', gist_id=c.gist.gist_access_id)}">${_('Cancel')}</a>
102 <a class="btn" href="${h.route_path('gist_show', gist_id=c.gist.gist_access_id)}">${_('Cancel')}</a>
103 </div>
103 </div>
104 ${h.end_form()}
104 ${h.end_form()}
105 </div>
105 </div>
106 </div>
106 </div>
107
107
108 </div>
108 </div>
109 <script>
109 <script>
110 $('#update').on('click', function(e){
110 $('#update').on('click', function(e){
111 e.preventDefault();
111 e.preventDefault();
112
112
113 $(this).val('Updating...');
113 $(this).val('Updating...');
114 $(this).attr('disabled', 'disabled');
114 $(this).attr('disabled', 'disabled');
115 // check for newer version.
115 // check for newer version.
116 $.ajax({
116 $.ajax({
117 url: "${h.route_path('gist_edit_check_revision', gist_id=c.gist.gist_access_id)}",
117 url: "${h.route_path('gist_edit_check_revision', gist_id=c.gist.gist_access_id)}",
118 data: {
118 data: {
119 'revision': '${c.file_last_commit.raw_id}'
119 'revision': '${c.file_last_commit.raw_id}'
120 },
120 },
121 dataType: 'json',
121 dataType: 'json',
122 type: 'GET',
122 type: 'GET',
123 success: function(data) {
123 success: function(data) {
124 if(data.success === false){
124 if(data.success === false){
125 message = '${h.literal(_('Gist was updated since you started editing. Copy your changes and click %(here)s to reload the new version.')
125 message = '${h.literal(_('Gist was updated since you started editing. Copy your changes and click %(here)s to reload the new version.')
126 % {'here': h.link_to('here', h.route_path('gist_edit', gist_id=c.gist.gist_access_id))})}'
126 % {'here': h.link_to('here', h.route_path('gist_edit', gist_id=c.gist.gist_access_id))})}'
127 alertMessage = [{"message": {
127 alertMessage = [{"message": {
128 "message": message, "force": "true", "level": "warning"}}];
128 "message": message, "force": "true", "level": "warning"}}];
129 $.Topic('/notifications').publish(alertMessage[0]);
129 $.Topic('/notifications').publish(alertMessage[0]);
130 }
130 }
131 else{
131 else{
132 $('#eform').submit();
132 $('#eform').submit();
133 }
133 }
134 }
134 }
135 });
135 });
136 })
136 })
137
137
138 </script>
138 </script>
139 </%def>
139 </%def>
@@ -1,86 +1,86 b''
1 ## -*- coding: utf-8 -*-
1 ## -*- coding: utf-8 -*-
2 <%inherit file="/base/base.mako"/>
2 <%inherit file="/base/base.mako"/>
3
3
4 <%def name="title()">
4 <%def name="title()">
5 ${_('New Gist')}
5 ${_('New Gist')}
6 %if c.rhodecode_name:
6 %if c.rhodecode_name:
7 &middot; ${h.branding(c.rhodecode_name)}
7 &middot; ${h.branding(c.rhodecode_name)}
8 %endif
8 %endif
9 </%def>
9 </%def>
10
10
11 <%def name="breadcrumbs_links()">
11 <%def name="breadcrumbs_links()">
12 ${_('New Gist')}
12 ${_('New Gist')}
13 </%def>
13 </%def>
14
14
15 <%def name="menu_bar_nav()">
15 <%def name="menu_bar_nav()">
16 ${self.menu_items(active='gists')}
16 ${self.menu_items(active='gists')}
17 </%def>
17 </%def>
18
18
19 <%def name="main()">
19 <%def name="main()">
20 <div class="box">
20 <div class="box">
21 <!-- box / title -->
21 <!-- box / title -->
22 <div class="title">
22 <div class="title">
23 ${self.breadcrumbs()}
23 ${self.breadcrumbs()}
24 </div>
24 </div>
25
25
26 <div class="table">
26 <div class="table">
27 <div id="files_data">
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 <div>
29 <div>
30 <textarea id="description" name="description" placeholder="${_('Gist description ...')}"></textarea>
30 <textarea id="description" name="description" placeholder="${_('Gist description ...')}"></textarea>
31
31
32 <span class="gist-gravatar">
32 <span class="gist-gravatar">
33 ${self.gravatar(c.rhodecode_user.email, 30)}
33 ${self.gravatar(c.rhodecode_user.email, 30)}
34 </span>
34 </span>
35 <label for='gistid'>${_('Gist id')}</label>
35 <label for='gistid'>${_('Gist id')}</label>
36 ${h.text('gistid', placeholder=_('Auto generated'))}
36 ${h.text('gistid', placeholder=_('Auto generated'))}
37
37
38 <label for='lifetime'>${_('Gist lifetime')}</label>
38 <label for='lifetime'>${_('Gist lifetime')}</label>
39 ${h.dropdownmenu('lifetime', '', c.lifetime_options)}
39 ${h.dropdownmenu('lifetime', '', c.lifetime_options)}
40
40
41 <label for='acl_level'>${_('Gist access level')}</label>
41 <label for='acl_level'>${_('Gist access level')}</label>
42 ${h.dropdownmenu('gist_acl_level', '', c.acl_options)}
42 ${h.dropdownmenu('gist_acl_level', '', c.acl_options)}
43
43
44 </div>
44 </div>
45 <div id="codeblock" class="codeblock">
45 <div id="codeblock" class="codeblock">
46 <div class="code-header">
46 <div class="code-header">
47 <div class="form">
47 <div class="form">
48 <div class="fields">
48 <div class="fields">
49 ${h.text('filename', size=30, placeholder=_('name this file...'))}
49 ${h.text('filename', size=30, placeholder=_('name this file...'))}
50 ${h.dropdownmenu('mimetype','plain',[('plain',_('plain'))],enable_filter=True)}
50 ${h.dropdownmenu('mimetype','plain',[('plain',_('plain'))],enable_filter=True)}
51 </div>
51 </div>
52 </div>
52 </div>
53 </div>
53 </div>
54 <div id="editor_container">
54 <div id="editor_container">
55 <div id="editor_pre"></div>
55 <div id="editor_pre"></div>
56 <textarea id="editor" name="content" ></textarea>
56 <textarea id="editor" name="content" ></textarea>
57 </div>
57 </div>
58 </div>
58 </div>
59 <div class="pull-right">
59 <div class="pull-right">
60 ${h.submit('private',_('Create Private Gist'),class_="btn")}
60 ${h.submit('private',_('Create Private Gist'),class_="btn")}
61 ${h.submit('public',_('Create Public Gist'),class_="btn")}
61 ${h.submit('public',_('Create Public Gist'),class_="btn")}
62 ${h.reset('reset',_('Reset'),class_="btn")}
62 ${h.reset('reset',_('Reset'),class_="btn")}
63 </div>
63 </div>
64 ${h.end_form()}
64 ${h.end_form()}
65 </div>
65 </div>
66 </div>
66 </div>
67
67
68 </div>
68 </div>
69
69
70 <script type="text/javascript">
70 <script type="text/javascript">
71 var myCodeMirror = initCodeMirror('editor', '');
71 var myCodeMirror = initCodeMirror('editor', '');
72
72
73 var modes_select = $('#mimetype');
73 var modes_select = $('#mimetype');
74 fillCodeMirrorOptions(modes_select);
74 fillCodeMirrorOptions(modes_select);
75
75
76 var filename_selector = '#filename';
76 var filename_selector = '#filename';
77 // on change of select field set mode
77 // on change of select field set mode
78 setCodeMirrorModeFromSelect(
78 setCodeMirrorModeFromSelect(
79 modes_select, filename_selector, myCodeMirror, null);
79 modes_select, filename_selector, myCodeMirror, null);
80
80
81 // on entering the new filename set mode, from given extension
81 // on entering the new filename set mode, from given extension
82 setCodeMirrorModeFromInput(
82 setCodeMirrorModeFromInput(
83 modes_select, filename_selector, myCodeMirror, null);
83 modes_select, filename_selector, myCodeMirror, null);
84
84
85 </script>
85 </script>
86 </%def>
86 </%def>
@@ -1,110 +1,110 b''
1 ## -*- coding: utf-8 -*-
1 ## -*- coding: utf-8 -*-
2 <%inherit file="/base/base.mako"/>
2 <%inherit file="/base/base.mako"/>
3
3
4 <%def name="robots()">
4 <%def name="robots()">
5 %if c.gist.gist_type != 'public':
5 %if c.gist.gist_type != 'public':
6 <meta name="robots" content="noindex, nofollow">
6 <meta name="robots" content="noindex, nofollow">
7 %else:
7 %else:
8 ${parent.robots()}
8 ${parent.robots()}
9 %endif
9 %endif
10 </%def>
10 </%def>
11
11
12 <%def name="title()">
12 <%def name="title()">
13 ${_('Gist')} &middot; ${c.gist.gist_access_id}
13 ${_('Gist')} &middot; ${c.gist.gist_access_id}
14 %if c.rhodecode_name:
14 %if c.rhodecode_name:
15 &middot; ${h.branding(c.rhodecode_name)}
15 &middot; ${h.branding(c.rhodecode_name)}
16 %endif
16 %endif
17 </%def>
17 </%def>
18
18
19 <%def name="breadcrumbs_links()">
19 <%def name="breadcrumbs_links()">
20 ${_('Gist')} &middot; ${c.gist.gist_access_id}
20 ${_('Gist')} &middot; ${c.gist.gist_access_id}
21 </%def>
21 </%def>
22
22
23 <%def name="menu_bar_nav()">
23 <%def name="menu_bar_nav()">
24 ${self.menu_items(active='gists')}
24 ${self.menu_items(active='gists')}
25 </%def>
25 </%def>
26
26
27 <%def name="main()">
27 <%def name="main()">
28 <div class="box">
28 <div class="box">
29 <!-- box / title -->
29 <!-- box / title -->
30 <div class="title">
30 <div class="title">
31 ${self.breadcrumbs()}
31 ${self.breadcrumbs()}
32 %if c.rhodecode_user.username != h.DEFAULT_USER:
32 %if c.rhodecode_user.username != h.DEFAULT_USER:
33 <ul class="links">
33 <ul class="links">
34 <li>
34 <li>
35 <a href="${h.route_path('gists_new')}" class="btn btn-primary">${_(u'Create New Gist')}</a>
35 <a href="${h.route_path('gists_new')}" class="btn btn-primary">${_(u'Create New Gist')}</a>
36 </li>
36 </li>
37 </ul>
37 </ul>
38 %endif
38 %endif
39 </div>
39 </div>
40 <code>${c.gist.gist_url()}</code>
40 <code>${c.gist.gist_url()}</code>
41 <div class="table">
41 <div class="table">
42 <div id="files_data">
42 <div id="files_data">
43 <div id="codeblock" class="codeblock">
43 <div id="codeblock" class="codeblock">
44 <div class="code-header">
44 <div class="code-header">
45 <div class="stats">
45 <div class="stats">
46 %if h.HasPermissionAny('hg.admin')() or c.gist.gist_owner == c.rhodecode_user.user_id:
46 %if h.HasPermissionAny('hg.admin')() or c.gist.gist_owner == c.rhodecode_user.user_id:
47 <div class="remove_gist">
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 ${h.submit('remove_gist', _('Delete'),class_="btn btn-mini btn-danger",onclick="return confirm('"+_('Confirm to delete this Gist')+"');")}
49 ${h.submit('remove_gist', _('Delete'),class_="btn btn-mini btn-danger",onclick="return confirm('"+_('Confirm to delete this Gist')+"');")}
50 ${h.end_form()}
50 ${h.end_form()}
51 </div>
51 </div>
52 %endif
52 %endif
53 <div class="buttons">
53 <div class="buttons">
54 ## only owner should see that
54 ## only owner should see that
55 %if h.HasPermissionAny('hg.admin')() or c.gist.gist_owner == c.rhodecode_user.user_id:
55 %if h.HasPermissionAny('hg.admin')() or c.gist.gist_owner == c.rhodecode_user.user_id:
56 ${h.link_to(_('Edit'), h.route_path('gist_edit', gist_id=c.gist.gist_access_id), class_="btn btn-mini")}
56 ${h.link_to(_('Edit'), h.route_path('gist_edit', gist_id=c.gist.gist_access_id), class_="btn btn-mini")}
57 %endif
57 %endif
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")}
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 </div>
59 </div>
60 <div class="left" >
60 <div class="left" >
61 %if c.gist.gist_type != 'public':
61 %if c.gist.gist_type != 'public':
62 <span class="tag tag-ok disabled">${_('Private Gist')}</span>
62 <span class="tag tag-ok disabled">${_('Private Gist')}</span>
63 %endif
63 %endif
64 <span> ${c.gist.gist_description}</span>
64 <span> ${c.gist.gist_description}</span>
65 <span>${_('Expires')}:
65 <span>${_('Expires')}:
66 %if c.gist.gist_expires == -1:
66 %if c.gist.gist_expires == -1:
67 ${_('never')}
67 ${_('never')}
68 %else:
68 %else:
69 ${h.age_component(h.time_to_utcdatetime(c.gist.gist_expires))}
69 ${h.age_component(h.time_to_utcdatetime(c.gist.gist_expires))}
70 %endif
70 %endif
71 </span>
71 </span>
72 </div>
72 </div>
73 </div>
73 </div>
74
74
75 <div class="author">
75 <div class="author">
76 <div title="${h.tooltip(c.file_last_commit.author)}">
76 <div title="${h.tooltip(c.file_last_commit.author)}">
77 ${self.gravatar_with_user(c.file_last_commit.author, 16)} - ${_('created')} ${h.age_component(c.file_last_commit.date)}
77 ${self.gravatar_with_user(c.file_last_commit.author, 16)} - ${_('created')} ${h.age_component(c.file_last_commit.date)}
78 </div>
78 </div>
79
79
80 </div>
80 </div>
81 <div class="commit">${h.urlify_commit_message(c.file_last_commit.message, None)}</div>
81 <div class="commit">${h.urlify_commit_message(c.file_last_commit.message, None)}</div>
82 </div>
82 </div>
83
83
84 ## iterate over the files
84 ## iterate over the files
85 % for file in c.files:
85 % for file in c.files:
86 <% renderer = c.render and h.renderer_from_filename(file.path, exclude=['.txt', '.TXT'])%>
86 <% renderer = c.render and h.renderer_from_filename(file.path, exclude=['.txt', '.TXT'])%>
87 <!--
87 <!--
88 <div id="${h.FID('G', file.path)}" class="stats" >
88 <div id="${h.FID('G', file.path)}" class="stats" >
89 <a href="${c.gist.gist_url()}">¶</a>
89 <a href="${c.gist.gist_url()}">¶</a>
90 <b >${file.path}</b>
90 <b >${file.path}</b>
91 <div>
91 <div>
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")}
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 </div>
93 </div>
94 </div>
94 </div>
95 -->
95 -->
96 <div class="code-body textarea text-area editor">
96 <div class="code-body textarea text-area editor">
97 %if renderer:
97 %if renderer:
98 ${h.render(file.content, renderer=renderer)}
98 ${h.render(file.content, renderer=renderer)}
99 %else:
99 %else:
100 ${h.pygmentize(file,linenos=True,anchorlinenos=True,lineanchors='L',cssclass="code-highlight")}
100 ${h.pygmentize(file,linenos=True,anchorlinenos=True,lineanchors='L',cssclass="code-highlight")}
101 %endif
101 %endif
102 </div>
102 </div>
103 %endfor
103 %endfor
104 </div>
104 </div>
105 </div>
105 </div>
106 </div>
106 </div>
107
107
108
108
109 </div>
109 </div>
110 </%def>
110 </%def>
@@ -1,180 +1,180 b''
1 <div class="panel panel-default">
1 <div class="panel panel-default">
2 <div class="panel-heading">
2 <div class="panel-heading">
3 <h3 class="panel-title">${_('Authentication Tokens')}</h3>
3 <h3 class="panel-title">${_('Authentication Tokens')}</h3>
4 </div>
4 </div>
5 <div class="panel-body">
5 <div class="panel-body">
6 <div class="apikeys_wrap">
6 <div class="apikeys_wrap">
7 <p>
7 <p>
8 ${_('Each token can have a role. Token with a role can be used only in given context, '
8 ${_('Each token can have a role. Token with a role can be used only in given context, '
9 'e.g. VCS tokens can be used together with the authtoken auth plugin for git/hg/svn operations only.')}
9 'e.g. VCS tokens can be used together with the authtoken auth plugin for git/hg/svn operations only.')}
10 </p>
10 </p>
11 <table class="rctable auth_tokens">
11 <table class="rctable auth_tokens">
12 <tr>
12 <tr>
13 <th>${_('Token')}</th>
13 <th>${_('Token')}</th>
14 <th>${_('Scope')}</th>
14 <th>${_('Scope')}</th>
15 <th>${_('Description')}</th>
15 <th>${_('Description')}</th>
16 <th>${_('Role')}</th>
16 <th>${_('Role')}</th>
17 <th>${_('Expiration')}</th>
17 <th>${_('Expiration')}</th>
18 <th>${_('Action')}</th>
18 <th>${_('Action')}</th>
19 </tr>
19 </tr>
20 %if c.user_auth_tokens:
20 %if c.user_auth_tokens:
21 %for auth_token in c.user_auth_tokens:
21 %for auth_token in c.user_auth_tokens:
22 <tr class="${'expired' if auth_token.expired else ''}">
22 <tr class="${'expired' if auth_token.expired else ''}">
23 <td class="truncate-wrap td-authtoken">
23 <td class="truncate-wrap td-authtoken">
24 <div class="user_auth_tokens truncate autoexpand">
24 <div class="user_auth_tokens truncate autoexpand">
25 <code>${auth_token.api_key}</code>
25 <code>${auth_token.api_key}</code>
26 </div>
26 </div>
27 </td>
27 </td>
28 <td class="td">${auth_token.scope_humanized}</td>
28 <td class="td">${auth_token.scope_humanized}</td>
29 <td class="td-wrap">${auth_token.description}</td>
29 <td class="td-wrap">${auth_token.description}</td>
30 <td class="td-tags">
30 <td class="td-tags">
31 <span class="tag disabled">${auth_token.role_humanized}</span>
31 <span class="tag disabled">${auth_token.role_humanized}</span>
32 </td>
32 </td>
33 <td class="td-exp">
33 <td class="td-exp">
34 %if auth_token.expires == -1:
34 %if auth_token.expires == -1:
35 ${_('never')}
35 ${_('never')}
36 %else:
36 %else:
37 %if auth_token.expired:
37 %if auth_token.expired:
38 <span style="text-decoration: line-through">${h.age_component(h.time_to_utcdatetime(auth_token.expires))}</span>
38 <span style="text-decoration: line-through">${h.age_component(h.time_to_utcdatetime(auth_token.expires))}</span>
39 %else:
39 %else:
40 ${h.age_component(h.time_to_utcdatetime(auth_token.expires))}
40 ${h.age_component(h.time_to_utcdatetime(auth_token.expires))}
41 %endif
41 %endif
42 %endif
42 %endif
43 </td>
43 </td>
44 <td class="td-action">
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 ${h.hidden('del_auth_token', auth_token.user_api_key_id)}
46 ${h.hidden('del_auth_token', auth_token.user_api_key_id)}
47 <button class="btn btn-link btn-danger" type="submit"
47 <button class="btn btn-link btn-danger" type="submit"
48 onclick="return confirm('${_('Confirm to remove this auth token: %s') % auth_token.token_obfuscated}');">
48 onclick="return confirm('${_('Confirm to remove this auth token: %s') % auth_token.token_obfuscated}');">
49 ${_('Delete')}
49 ${_('Delete')}
50 </button>
50 </button>
51 ${h.end_form()}
51 ${h.end_form()}
52 </td>
52 </td>
53 </tr>
53 </tr>
54 %endfor
54 %endfor
55 %else:
55 %else:
56 <tr><td><div class="ip">${_('No additional auth tokens specified')}</div></td></tr>
56 <tr><td><div class="ip">${_('No additional auth tokens specified')}</div></td></tr>
57 %endif
57 %endif
58 </table>
58 </table>
59 </div>
59 </div>
60
60
61 <div class="user_auth_tokens">
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 <div class="form form-vertical">
63 <div class="form form-vertical">
64 <!-- fields -->
64 <!-- fields -->
65 <div class="fields">
65 <div class="fields">
66 <div class="field">
66 <div class="field">
67 <div class="label">
67 <div class="label">
68 <label for="new_email">${_('New authentication token')}:</label>
68 <label for="new_email">${_('New authentication token')}:</label>
69 </div>
69 </div>
70 <div class="input">
70 <div class="input">
71 ${h.text('description', class_='medium', placeholder=_('Description'))}
71 ${h.text('description', class_='medium', placeholder=_('Description'))}
72 ${h.hidden('lifetime')}
72 ${h.hidden('lifetime')}
73 ${h.select('role', '', c.role_options)}
73 ${h.select('role', '', c.role_options)}
74
74
75 % if c.allow_scoped_tokens:
75 % if c.allow_scoped_tokens:
76 ${h.hidden('scope_repo_id')}
76 ${h.hidden('scope_repo_id')}
77 % else:
77 % else:
78 ${h.select('scope_repo_id_disabled', '', ['Scopes available in EE edition'], disabled='disabled')}
78 ${h.select('scope_repo_id_disabled', '', ['Scopes available in EE edition'], disabled='disabled')}
79 % endif
79 % endif
80 </div>
80 </div>
81 <p class="help-block">
81 <p class="help-block">
82 ${_('Repository scope works only with tokens with VCS type.')}
82 ${_('Repository scope works only with tokens with VCS type.')}
83 </p>
83 </p>
84 </div>
84 </div>
85 <div class="buttons">
85 <div class="buttons">
86 ${h.submit('save',_('Add'),class_="btn")}
86 ${h.submit('save',_('Add'),class_="btn")}
87 ${h.reset('reset',_('Reset'),class_="btn")}
87 ${h.reset('reset',_('Reset'),class_="btn")}
88 </div>
88 </div>
89 </div>
89 </div>
90 </div>
90 </div>
91 ${h.end_form()}
91 ${h.end_form()}
92 </div>
92 </div>
93 </div>
93 </div>
94 </div>
94 </div>
95 <script>
95 <script>
96 $(document).ready(function(){
96 $(document).ready(function(){
97
97
98 var select2Options = {
98 var select2Options = {
99 'containerCssClass': "drop-menu",
99 'containerCssClass': "drop-menu",
100 'dropdownCssClass': "drop-menu-dropdown",
100 'dropdownCssClass': "drop-menu-dropdown",
101 'dropdownAutoWidth': true
101 'dropdownAutoWidth': true
102 };
102 };
103 $("#role").select2(select2Options);
103 $("#role").select2(select2Options);
104
104
105
105
106 var preloadData = {
106 var preloadData = {
107 results: [
107 results: [
108 % for entry in c.lifetime_values:
108 % for entry in c.lifetime_values:
109 {id:${entry[0]}, text:"${entry[1]}"}${'' if loop.last else ','}
109 {id:${entry[0]}, text:"${entry[1]}"}${'' if loop.last else ','}
110 % endfor
110 % endfor
111 ]
111 ]
112 };
112 };
113
113
114 $("#lifetime").select2({
114 $("#lifetime").select2({
115 containerCssClass: "drop-menu",
115 containerCssClass: "drop-menu",
116 dropdownCssClass: "drop-menu-dropdown",
116 dropdownCssClass: "drop-menu-dropdown",
117 dropdownAutoWidth: true,
117 dropdownAutoWidth: true,
118 data: preloadData,
118 data: preloadData,
119 placeholder: "${_('Select or enter expiration date')}",
119 placeholder: "${_('Select or enter expiration date')}",
120 query: function(query) {
120 query: function(query) {
121 feedLifetimeOptions(query, preloadData);
121 feedLifetimeOptions(query, preloadData);
122 }
122 }
123 });
123 });
124
124
125
125
126 var repoFilter = function(data) {
126 var repoFilter = function(data) {
127 var results = [];
127 var results = [];
128
128
129 if (!data.results[0]) {
129 if (!data.results[0]) {
130 return data
130 return data
131 }
131 }
132
132
133 $.each(data.results[0].children, function() {
133 $.each(data.results[0].children, function() {
134 // replace name to ID for submision
134 // replace name to ID for submision
135 this.id = this.obj.repo_id;
135 this.id = this.obj.repo_id;
136 results.push(this);
136 results.push(this);
137 });
137 });
138
138
139 data.results[0].children = results;
139 data.results[0].children = results;
140 return data;
140 return data;
141 };
141 };
142
142
143 $("#scope_repo_id_disabled").select2(select2Options);
143 $("#scope_repo_id_disabled").select2(select2Options);
144
144
145 $("#scope_repo_id").select2({
145 $("#scope_repo_id").select2({
146 cachedDataSource: {},
146 cachedDataSource: {},
147 minimumInputLength: 2,
147 minimumInputLength: 2,
148 placeholder: "${_('repository scope')}",
148 placeholder: "${_('repository scope')}",
149 dropdownAutoWidth: true,
149 dropdownAutoWidth: true,
150 containerCssClass: "drop-menu",
150 containerCssClass: "drop-menu",
151 dropdownCssClass: "drop-menu-dropdown",
151 dropdownCssClass: "drop-menu-dropdown",
152 formatResult: formatResult,
152 formatResult: formatResult,
153 query: $.debounce(250, function(query){
153 query: $.debounce(250, function(query){
154 self = this;
154 self = this;
155 var cacheKey = query.term;
155 var cacheKey = query.term;
156 var cachedData = self.cachedDataSource[cacheKey];
156 var cachedData = self.cachedDataSource[cacheKey];
157
157
158 if (cachedData) {
158 if (cachedData) {
159 query.callback({results: cachedData.results});
159 query.callback({results: cachedData.results});
160 } else {
160 } else {
161 $.ajax({
161 $.ajax({
162 url: pyroutes.url('repo_list_data'),
162 url: pyroutes.url('repo_list_data'),
163 data: {'query': query.term},
163 data: {'query': query.term},
164 dataType: 'json',
164 dataType: 'json',
165 type: 'GET',
165 type: 'GET',
166 success: function(data) {
166 success: function(data) {
167 data = repoFilter(data);
167 data = repoFilter(data);
168 self.cachedDataSource[cacheKey] = data;
168 self.cachedDataSource[cacheKey] = data;
169 query.callback({results: data.results});
169 query.callback({results: data.results});
170 },
170 },
171 error: function(data, textStatus, errorThrown) {
171 error: function(data, textStatus, errorThrown) {
172 alert("Error while fetching entries.\nError code {0} ({1}).".format(data.status, data.statusText));
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 </script>
180 </script>
@@ -1,72 +1,72 b''
1 <%namespace name="base" file="/base/base.mako"/>
1 <%namespace name="base" file="/base/base.mako"/>
2
2
3 <div class="panel panel-default">
3 <div class="panel panel-default">
4 <div class="panel-heading">
4 <div class="panel-heading">
5 <h3 class="panel-title">${_('Account Emails')}</h3>
5 <h3 class="panel-title">${_('Account Emails')}</h3>
6 </div>
6 </div>
7
7
8 <div class="panel-body">
8 <div class="panel-body">
9 <div class="emails_wrap">
9 <div class="emails_wrap">
10 <table class="rctable account_emails">
10 <table class="rctable account_emails">
11 <tr>
11 <tr>
12 <td class="td-user">
12 <td class="td-user">
13 ${base.gravatar(c.user.email, 16)}
13 ${base.gravatar(c.user.email, 16)}
14 <span class="user email">${c.user.email}</span>
14 <span class="user email">${c.user.email}</span>
15 </td>
15 </td>
16 <td class="td-tags">
16 <td class="td-tags">
17 <span class="tag tag1">${_('Primary')}</span>
17 <span class="tag tag1">${_('Primary')}</span>
18 </td>
18 </td>
19 </tr>
19 </tr>
20 %if c.user_email_map:
20 %if c.user_email_map:
21 %for em in c.user_email_map:
21 %for em in c.user_email_map:
22 <tr>
22 <tr>
23 <td class="td-user">
23 <td class="td-user">
24 ${base.gravatar(em.email, 16)}
24 ${base.gravatar(em.email, 16)}
25 <span class="user email">${em.email}</span>
25 <span class="user email">${em.email}</span>
26 </td>
26 </td>
27 <td class="td-action">
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 ${h.hidden('del_email_id',em.email_id)}
29 ${h.hidden('del_email_id',em.email_id)}
30 <button class="btn btn-link btn-danger" type="submit" id="${'remove_email_%s'.format(em.email_id)}"
30 <button class="btn btn-link btn-danger" type="submit" id="${'remove_email_%s'.format(em.email_id)}"
31 onclick="return confirm('${_('Confirm to delete this email: {}').format(em.email)}');">
31 onclick="return confirm('${_('Confirm to delete this email: {}').format(em.email)}');">
32 ${_('Delete')}
32 ${_('Delete')}
33 </button>
33 </button>
34 ${h.end_form()}
34 ${h.end_form()}
35 </td>
35 </td>
36 </tr>
36 </tr>
37 %endfor
37 %endfor
38 %else:
38 %else:
39 <tr class="noborder">
39 <tr class="noborder">
40 <td colspan="3">
40 <td colspan="3">
41 <div class="td-email">
41 <div class="td-email">
42 ${_('No additional emails specified')}
42 ${_('No additional emails specified')}
43 </div>
43 </div>
44 </td>
44 </td>
45 </tr>
45 </tr>
46 %endif
46 %endif
47 </table>
47 </table>
48 </div>
48 </div>
49
49
50 <div>
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 <div class="form">
52 <div class="form">
53 <!-- fields -->
53 <!-- fields -->
54 <div class="fields">
54 <div class="fields">
55 <div class="field">
55 <div class="field">
56 <div class="label">
56 <div class="label">
57 <label for="new_email">${_('New email address')}:</label>
57 <label for="new_email">${_('New email address')}:</label>
58 </div>
58 </div>
59 <div class="input">
59 <div class="input">
60 ${h.text('new_email', class_='medium')}
60 ${h.text('new_email', class_='medium')}
61 </div>
61 </div>
62 </div>
62 </div>
63 <div class="buttons">
63 <div class="buttons">
64 ${h.submit('save',_('Add'),class_="btn")}
64 ${h.submit('save',_('Add'),class_="btn")}
65 ${h.reset('reset',_('Reset'),class_="btn")}
65 ${h.reset('reset',_('Reset'),class_="btn")}
66 </div>
66 </div>
67 </div>
67 </div>
68 </div>
68 </div>
69 ${h.end_form()}
69 ${h.end_form()}
70 </div>
70 </div>
71 </div>
71 </div>
72 </div>
72 </div>
@@ -1,113 +1,113 b''
1 <%namespace name="base" file="/base/base.mako"/>
1 <%namespace name="base" file="/base/base.mako"/>
2 <div class="panel panel-default user-profile">
2 <div class="panel panel-default user-profile">
3 <div class="panel-heading">
3 <div class="panel-heading">
4 <h3 class="panel-title">${_('My Profile')}</h3>
4 <h3 class="panel-title">${_('My Profile')}</h3>
5 <a href="${h.route_path('my_account_profile')}" class="panel-edit">Close</a>
5 <a href="${h.route_path('my_account_profile')}" class="panel-edit">Close</a>
6 </div>
6 </div>
7
7
8 <div class="panel-body">
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 <% readonly = None %>
10 <% readonly = None %>
11 <% disabled = "" %>
11 <% disabled = "" %>
12
12
13 % if c.extern_type != 'rhodecode':
13 % if c.extern_type != 'rhodecode':
14 <% readonly = "readonly" %>
14 <% readonly = "readonly" %>
15 <% disabled = "disabled" %>
15 <% disabled = "disabled" %>
16 <div class="infoform">
16 <div class="infoform">
17 <div class="fields">
17 <div class="fields">
18 <p>${_('Your user account details are managed by an external source. Details cannot be managed here.')}
18 <p>${_('Your user account details are managed by an external source. Details cannot be managed here.')}
19 <br/>${_('Source type')}: <strong>${c.extern_type}</strong>
19 <br/>${_('Source type')}: <strong>${c.extern_type}</strong>
20 </p>
20 </p>
21
21
22 <div class="field">
22 <div class="field">
23 <div class="label">
23 <div class="label">
24 <label for="username">${_('Username')}:</label>
24 <label for="username">${_('Username')}:</label>
25 </div>
25 </div>
26 <div class="input">
26 <div class="input">
27 ${h.text('username', class_='input-valuedisplay', readonly=readonly)}
27 ${h.text('username', class_='input-valuedisplay', readonly=readonly)}
28 </div>
28 </div>
29 </div>
29 </div>
30
30
31 <div class="field">
31 <div class="field">
32 <div class="label">
32 <div class="label">
33 <label for="name">${_('First Name')}:</label>
33 <label for="name">${_('First Name')}:</label>
34 </div>
34 </div>
35 <div class="input">
35 <div class="input">
36 ${h.text('firstname', class_='input-valuedisplay', readonly=readonly)}
36 ${h.text('firstname', class_='input-valuedisplay', readonly=readonly)}
37 </div>
37 </div>
38 </div>
38 </div>
39
39
40 <div class="field">
40 <div class="field">
41 <div class="label">
41 <div class="label">
42 <label for="lastname">${_('Last Name')}:</label>
42 <label for="lastname">${_('Last Name')}:</label>
43 </div>
43 </div>
44 <div class="input-valuedisplay">
44 <div class="input-valuedisplay">
45 ${h.text('lastname', class_='input-valuedisplay', readonly=readonly)}
45 ${h.text('lastname', class_='input-valuedisplay', readonly=readonly)}
46 </div>
46 </div>
47 </div>
47 </div>
48 </div>
48 </div>
49 </div>
49 </div>
50 % else:
50 % else:
51 <div class="form">
51 <div class="form">
52 <div class="fields">
52 <div class="fields">
53 <div class="field">
53 <div class="field">
54 <div class="label photo">
54 <div class="label photo">
55 ${_('Photo')}:
55 ${_('Photo')}:
56 </div>
56 </div>
57 <div class="input profile">
57 <div class="input profile">
58 %if c.visual.use_gravatar:
58 %if c.visual.use_gravatar:
59 ${base.gravatar(c.user.email, 100)}
59 ${base.gravatar(c.user.email, 100)}
60 <p class="help-block">${_('Change your avatar at')} <a href="http://gravatar.com">gravatar.com</a>.</p>
60 <p class="help-block">${_('Change your avatar at')} <a href="http://gravatar.com">gravatar.com</a>.</p>
61 %else:
61 %else:
62 ${base.gravatar(c.user.email, 20)}
62 ${base.gravatar(c.user.email, 20)}
63 ${_('Avatars are disabled')}
63 ${_('Avatars are disabled')}
64 %endif
64 %endif
65 </div>
65 </div>
66 </div>
66 </div>
67 <div class="field">
67 <div class="field">
68 <div class="label">
68 <div class="label">
69 <label for="username">${_('Username')}:</label>
69 <label for="username">${_('Username')}:</label>
70 </div>
70 </div>
71 <div class="input">
71 <div class="input">
72 ${h.text('username', class_='medium%s' % disabled, readonly=readonly)}
72 ${h.text('username', class_='medium%s' % disabled, readonly=readonly)}
73 ${h.hidden('extern_name', c.extern_name)}
73 ${h.hidden('extern_name', c.extern_name)}
74 ${h.hidden('extern_type', c.extern_type)}
74 ${h.hidden('extern_type', c.extern_type)}
75 </div>
75 </div>
76 </div>
76 </div>
77 <div class="field">
77 <div class="field">
78 <div class="label">
78 <div class="label">
79 <label for="name">${_('First Name')}:</label>
79 <label for="name">${_('First Name')}:</label>
80 </div>
80 </div>
81 <div class="input">
81 <div class="input">
82 ${h.text('firstname', class_="medium")}
82 ${h.text('firstname', class_="medium")}
83 </div>
83 </div>
84 </div>
84 </div>
85
85
86 <div class="field">
86 <div class="field">
87 <div class="label">
87 <div class="label">
88 <label for="lastname">${_('Last Name')}:</label>
88 <label for="lastname">${_('Last Name')}:</label>
89 </div>
89 </div>
90 <div class="input">
90 <div class="input">
91 ${h.text('lastname', class_="medium")}
91 ${h.text('lastname', class_="medium")}
92 </div>
92 </div>
93 </div>
93 </div>
94
94
95 <div class="field">
95 <div class="field">
96 <div class="label">
96 <div class="label">
97 <label for="email">${_('Email')}:</label>
97 <label for="email">${_('Email')}:</label>
98 </div>
98 </div>
99 <div class="input">
99 <div class="input">
100 ## we should be able to edit email !
100 ## we should be able to edit email !
101 ${h.text('email', class_="medium")}
101 ${h.text('email', class_="medium")}
102 </div>
102 </div>
103 </div>
103 </div>
104
104
105 <div class="buttons">
105 <div class="buttons">
106 ${h.submit('save', _('Save'), class_="btn")}
106 ${h.submit('save', _('Save'), class_="btn")}
107 ${h.reset('reset', _('Reset'), class_="btn")}
107 ${h.reset('reset', _('Reset'), class_="btn")}
108 </div>
108 </div>
109 </div>
109 </div>
110 </div>
110 </div>
111 % endif
111 % endif
112 </div>
112 </div>
113 </div> No newline at end of file
113 </div>
@@ -1,84 +1,84 b''
1 <div class="panel panel-default">
1 <div class="panel panel-default">
2 <div class="panel-heading">
2 <div class="panel-heading">
3 <h3 class="panel-title">${_('SSH Keys')}</h3>
3 <h3 class="panel-title">${_('SSH Keys')}</h3>
4 </div>
4 </div>
5 <div class="panel-body">
5 <div class="panel-body">
6 <div class="sshkeys_wrap">
6 <div class="sshkeys_wrap">
7 <table class="rctable ssh_keys">
7 <table class="rctable ssh_keys">
8 <tr>
8 <tr>
9 <th>${_('Fingerprint')}</th>
9 <th>${_('Fingerprint')}</th>
10 <th>${_('Description')}</th>
10 <th>${_('Description')}</th>
11 <th>${_('Created')}</th>
11 <th>${_('Created')}</th>
12 <th>${_('Action')}</th>
12 <th>${_('Action')}</th>
13 </tr>
13 </tr>
14 % if not c.ssh_enabled:
14 % if not c.ssh_enabled:
15 <tr><td colspan="4"><div class="">${_('SSH Keys usage is currently disabled, please ask your administrator to enable them.')}</div></td></tr>
15 <tr><td colspan="4"><div class="">${_('SSH Keys usage is currently disabled, please ask your administrator to enable them.')}</div></td></tr>
16 % else:
16 % else:
17 %if c.user_ssh_keys:
17 %if c.user_ssh_keys:
18 %for ssh_key in c.user_ssh_keys:
18 %for ssh_key in c.user_ssh_keys:
19 <tr class="">
19 <tr class="">
20 <td class="">
20 <td class="">
21 <code>${ssh_key.ssh_key_fingerprint}</code>
21 <code>${ssh_key.ssh_key_fingerprint}</code>
22 </td>
22 </td>
23 <td class="td-wrap">${ssh_key.description}</td>
23 <td class="td-wrap">${ssh_key.description}</td>
24 <td class="td-tags">${h.format_date(ssh_key.created_on)}</td>
24 <td class="td-tags">${h.format_date(ssh_key.created_on)}</td>
25
25
26 <td class="td-action">
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 ${h.hidden('del_ssh_key', ssh_key.ssh_key_id)}
28 ${h.hidden('del_ssh_key', ssh_key.ssh_key_id)}
29 <button class="btn btn-link btn-danger" type="submit"
29 <button class="btn btn-link btn-danger" type="submit"
30 onclick="return confirm('${_('Confirm to remove ssh key %s') % ssh_key.ssh_key_fingerprint}');">
30 onclick="return confirm('${_('Confirm to remove ssh key %s') % ssh_key.ssh_key_fingerprint}');">
31 ${_('Delete')}
31 ${_('Delete')}
32 </button>
32 </button>
33 ${h.end_form()}
33 ${h.end_form()}
34 </td>
34 </td>
35 </tr>
35 </tr>
36 %endfor
36 %endfor
37 %else:
37 %else:
38 <tr><td colspan="4"><div class="">${_('No additional ssh keys specified')}</div></td></tr>
38 <tr><td colspan="4"><div class="">${_('No additional ssh keys specified')}</div></td></tr>
39 %endif
39 %endif
40 % endif
40 % endif
41 </table>
41 </table>
42 </div>
42 </div>
43
43
44 % if c.ssh_enabled:
44 % if c.ssh_enabled:
45 <div class="user_ssh_keys">
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 <div class="form form-vertical">
47 <div class="form form-vertical">
48 <!-- fields -->
48 <!-- fields -->
49 <div class="fields">
49 <div class="fields">
50 <div class="field">
50 <div class="field">
51 <div class="label">
51 <div class="label">
52 <label for="new_email">${_('New ssh key')}:</label>
52 <label for="new_email">${_('New ssh key')}:</label>
53 </div>
53 </div>
54 <div class="input">
54 <div class="input">
55 ${h.text('description', class_='medium', placeholder=_('Description'))}
55 ${h.text('description', class_='medium', placeholder=_('Description'))}
56 <a href="${h.route_path('my_account_ssh_keys_generate')}">${_('Generate random RSA key')}</a>
56 <a href="${h.route_path('my_account_ssh_keys_generate')}">${_('Generate random RSA key')}</a>
57 </div>
57 </div>
58 </div>
58 </div>
59
59
60 <div class="field">
60 <div class="field">
61 <div class="textarea text-area editor">
61 <div class="textarea text-area editor">
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'"))}
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 </div>
63 </div>
64 </div>
64 </div>
65
65
66 <div class="buttons">
66 <div class="buttons">
67 ${h.submit('save',_('Add'),class_="btn")}
67 ${h.submit('save',_('Add'),class_="btn")}
68 ${h.reset('reset',_('Reset'),class_="btn")}
68 ${h.reset('reset',_('Reset'),class_="btn")}
69 </div>
69 </div>
70 </div>
70 </div>
71 </div>
71 </div>
72 ${h.end_form()}
72 ${h.end_form()}
73 </div>
73 </div>
74 % endif
74 % endif
75 </div>
75 </div>
76 </div>
76 </div>
77
77
78 <script>
78 <script>
79
79
80 $(document).ready(function(){
80 $(document).ready(function(){
81
81
82
82
83 });
83 });
84 </script>
84 </script>
@@ -1,81 +1,81 b''
1 <div class="panel panel-default">
1 <div class="panel panel-default">
2 <div class="panel-heading">
2 <div class="panel-heading">
3 <h3 class="panel-title">${_('System Wide Application Permissions')}</h3>
3 <h3 class="panel-title">${_('System Wide Application Permissions')}</h3>
4 </div>
4 </div>
5 <div class="panel-body">
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 <div class="form">
7 <div class="form">
8 <!-- fields -->
8 <!-- fields -->
9 <div class="fields">
9 <div class="fields">
10 <div class="field">
10 <div class="field">
11 <div class="label label-checkbox">
11 <div class="label label-checkbox">
12 <label for="anonymous">${_('Anonymous Access')}:</label>
12 <label for="anonymous">${_('Anonymous Access')}:</label>
13 </div>
13 </div>
14 <div class="checkboxes">
14 <div class="checkboxes">
15 <div class="checkbox">
15 <div class="checkbox">
16 ${h.checkbox('anonymous',True)} Allow Anonymous Access
16 ${h.checkbox('anonymous',True)} Allow Anonymous Access
17 </div>
17 </div>
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>
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 </div>
19 </div>
20 </div>
20 </div>
21
21
22 <div class="field">
22 <div class="field">
23 <div class="label label-select">
23 <div class="label label-select">
24 <label for="default_register">${_('Registration')}:</label>
24 <label for="default_register">${_('Registration')}:</label>
25 </div>
25 </div>
26 <div class="select">
26 <div class="select">
27 ${h.select('default_register','',c.register_choices)}
27 ${h.select('default_register','',c.register_choices)}
28 </div>
28 </div>
29 </div>
29 </div>
30
30
31 <div class="field">
31 <div class="field">
32 <div class="label label-select">
32 <div class="label label-select">
33 <label for="default_password_reset">${_('Password Reset')}:</label>
33 <label for="default_password_reset">${_('Password Reset')}:</label>
34 </div>
34 </div>
35 <div class="select">
35 <div class="select">
36 ${h.select('default_password_reset','',c.password_reset_choices)}
36 ${h.select('default_password_reset','',c.password_reset_choices)}
37 </div>
37 </div>
38 </div>
38 </div>
39
39
40 <div class="field">
40 <div class="field">
41 <div class="label label-textarea">
41 <div class="label label-textarea">
42 <label for="default_register_message">${_('Registration Page Message')}:</label>
42 <label for="default_register_message">${_('Registration Page Message')}:</label>
43 </div>
43 </div>
44 <div class="textarea text-area editor" >
44 <div class="textarea text-area editor" >
45 ${h.textarea('default_register_message', class_="medium", )}
45 ${h.textarea('default_register_message', class_="medium", )}
46 <span class="help-block">${_('Custom message to be displayed on the registration page. HTML syntax is supported.')}</span>
46 <span class="help-block">${_('Custom message to be displayed on the registration page. HTML syntax is supported.')}</span>
47 </div>
47 </div>
48 </div>
48 </div>
49
49
50 <div class="field">
50 <div class="field">
51 <div class="label">
51 <div class="label">
52 <label for="default_extern_activate">${_('External Authentication Account Activation')}:</label>
52 <label for="default_extern_activate">${_('External Authentication Account Activation')}:</label>
53 </div>
53 </div>
54 <div class="select">
54 <div class="select">
55 ${h.select('default_extern_activate','',c.extern_activate_choices)}
55 ${h.select('default_extern_activate','',c.extern_activate_choices)}
56 </div>
56 </div>
57 </div>
57 </div>
58 <div class="buttons">
58 <div class="buttons">
59 ${h.submit('save',_('Save'),class_="btn")}
59 ${h.submit('save',_('Save'),class_="btn")}
60 ${h.reset('reset',_('Reset'),class_="btn")}
60 ${h.reset('reset',_('Reset'),class_="btn")}
61 </div>
61 </div>
62 </div>
62 </div>
63 </div>
63 </div>
64 ${h.end_form()}
64 ${h.end_form()}
65 </div>
65 </div>
66 </div>
66 </div>
67
67
68 <script>
68 <script>
69 $(document).ready(function(){
69 $(document).ready(function(){
70 var select2Options = {
70 var select2Options = {
71 containerCssClass: 'drop-menu',
71 containerCssClass: 'drop-menu',
72 dropdownCssClass: 'drop-menu-dropdown',
72 dropdownCssClass: 'drop-menu-dropdown',
73 dropdownAutoWidth: true,
73 dropdownAutoWidth: true,
74 minimumResultsForSearch: -1
74 minimumResultsForSearch: -1
75 };
75 };
76
76
77 $("#default_register").select2(select2Options);
77 $("#default_register").select2(select2Options);
78 $("#default_password_reset").select2(select2Options);
78 $("#default_password_reset").select2(select2Options);
79 $("#default_extern_activate").select2(select2Options);
79 $("#default_extern_activate").select2(select2Options);
80 });
80 });
81 </script>
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 <div class="form permissions-global">
3 <div class="form permissions-global">
4 <!-- fields -->
4 <!-- fields -->
5 <div class="fields">
5 <div class="fields">
6 <%namespace name="dpb" file="/base/default_perms_box.mako"/>
6 <%namespace name="dpb" file="/base/default_perms_box.mako"/>
7 ${dpb.default_perms_radios(global_permissions_template = True)}
7 ${dpb.default_perms_radios(global_permissions_template = True)}
8 </div>
8 </div>
9 </div>
9 </div>
10 ${h.end_form()}
10 ${h.end_form()}
@@ -1,70 +1,70 b''
1
1
2
2
3 <div class="panel panel-default">
3 <div class="panel panel-default">
4 <div class="panel-heading">
4 <div class="panel-heading">
5 <h3 class="panel-title">${_('Default IP Whitelist For All Users')}</h3>
5 <h3 class="panel-title">${_('Default IP Whitelist For All Users')}</h3>
6 </div>
6 </div>
7 <div class="panel-body">
7 <div class="panel-body">
8 <div class="ips_wrap">
8 <div class="ips_wrap">
9 <h5>${_('Current IP address')}: <code>${c.rhodecode_user.ip_addr}</code></h5>
9 <h5>${_('Current IP address')}: <code>${c.rhodecode_user.ip_addr}</code></h5>
10
10
11
11
12 <table class="rctable ip-whitelist">
12 <table class="rctable ip-whitelist">
13 <tr>
13 <tr>
14 <th>IP Address</th>
14 <th>IP Address</th>
15 <th>IP Range</th>
15 <th>IP Range</th>
16 <th>Description</th>
16 <th>Description</th>
17 <th></th>
17 <th></th>
18 </tr>
18 </tr>
19 %if c.user_ip_map:
19 %if c.user_ip_map:
20 %for ip in c.user_ip_map:
20 %for ip in c.user_ip_map:
21 <tr>
21 <tr>
22 <td class="td-ip"><div class="ip">${ip.ip_addr}</div></td>
22 <td class="td-ip"><div class="ip">${ip.ip_addr}</div></td>
23 <td class="td-iprange"><div class="ip">${h.ip_range(ip.ip_addr)}</div></td>
23 <td class="td-iprange"><div class="ip">${h.ip_range(ip.ip_addr)}</div></td>
24 <td class="td-description"><div class="ip">${ip.description}</div></td>
24 <td class="td-description"><div class="ip">${ip.description}</div></td>
25 <td class="td-action">
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 ${h.hidden('del_ip_id',ip.ip_id)}
27 ${h.hidden('del_ip_id',ip.ip_id)}
28 ${h.hidden('default_user', 'True')}
28 ${h.hidden('default_user', 'True')}
29 ${h.submit('remove_',_('Delete'),id="remove_ip_%s" % ip.ip_id,
29 ${h.submit('remove_',_('Delete'),id="remove_ip_%s" % ip.ip_id,
30 class_="btn btn-link btn-danger", onclick="return confirm('"+_('Confirm to delete this ip: %s') % ip.ip_addr+"');")}
30 class_="btn btn-link btn-danger", onclick="return confirm('"+_('Confirm to delete this ip: %s') % ip.ip_addr+"');")}
31 ${h.end_form()}
31 ${h.end_form()}
32 </td>
32 </td>
33 </tr>
33 </tr>
34 %endfor
34 %endfor
35 %else:
35 %else:
36 <tr>
36 <tr>
37 <td class="ip">${_('All IP addresses are allowed')}</td>
37 <td class="ip">${_('All IP addresses are allowed')}</td>
38 <td></td>
38 <td></td>
39 <td></td>
39 <td></td>
40 <td></td>
40 <td></td>
41 </tr>
41 </tr>
42 %endif
42 %endif
43 </table>
43 </table>
44 </div>
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 <div class="form">
47 <div class="form">
48 <!-- fields -->
48 <!-- fields -->
49 <div class="fields">
49 <div class="fields">
50 <div class="field">
50 <div class="field">
51 <div class="label">
51 <div class="label">
52 <label for="new_ip">${_('New IP Address')}:</label>
52 <label for="new_ip">${_('New IP Address')}:</label>
53 </div>
53 </div>
54 <div class="input">
54 <div class="input">
55 ${h.hidden('default_user', 'True')}
55 ${h.hidden('default_user', 'True')}
56 ${h.text('new_ip')} ${h.text('description', placeholder=_('Description...'))}
56 ${h.text('new_ip')} ${h.text('description', placeholder=_('Description...'))}
57 <span class="help-block">${_('Enter a comma separated list of IP Addresses like 127.0.0.1,\n'
57 <span class="help-block">${_('Enter a comma separated list of IP Addresses like 127.0.0.1,\n'
58 'or use an IP Address with a mask 127.0.0.1/24, to create a network range.\n'
58 'or use an IP Address with a mask 127.0.0.1/24, to create a network range.\n'
59 'To specify multiple addresses in a range, use the 127.0.0.1-127.0.0.10 syntax')}</span>
59 'To specify multiple addresses in a range, use the 127.0.0.1-127.0.0.10 syntax')}</span>
60 </div>
60 </div>
61 </div>
61 </div>
62 <div class="buttons">
62 <div class="buttons">
63 ${h.submit('save',_('Add'),class_="btn")}
63 ${h.submit('save',_('Add'),class_="btn")}
64 ${h.reset('reset',_('Reset'),class_="btn")}
64 ${h.reset('reset',_('Reset'),class_="btn")}
65 </div>
65 </div>
66 </div>
66 </div>
67 </div>
67 </div>
68 ${h.end_form()}
68 ${h.end_form()}
69 </div>
69 </div>
70 </div>
70 </div>
@@ -1,77 +1,77 b''
1 <div class="panel panel-default">
1 <div class="panel panel-default">
2 <div class="panel-heading">
2 <div class="panel-heading">
3 <h3 class="panel-title">${_('Default Permissions for Repositories, User Groups and Repository Groups.')}</h3>
3 <h3 class="panel-title">${_('Default Permissions for Repositories, User Groups and Repository Groups.')}</h3>
4 </div>
4 </div>
5 <div class="panel-body">
5 <div class="panel-body">
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.')}
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 </p>
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 <div class="form">
9 <div class="form">
10 <div class="fields">
10 <div class="fields">
11 <div class="field">
11 <div class="field">
12 <div class="label">
12 <div class="label">
13 <label for="default_repo_perm">${_('Repository')}:</label>
13 <label for="default_repo_perm">${_('Repository')}:</label>
14 </div>
14 </div>
15 <div class="select">
15 <div class="select">
16 ${h.select('default_repo_perm','',c.repo_perms_choices)}
16 ${h.select('default_repo_perm','',c.repo_perms_choices)}
17
17
18 ${h.checkbox('overwrite_default_repo','true')}
18 ${h.checkbox('overwrite_default_repo','true')}
19 <label for="overwrite_default_repo">
19 <label for="overwrite_default_repo">
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'))}">
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 ${_('Overwrite Existing Settings')}
21 ${_('Overwrite Existing Settings')}
22 </span>
22 </span>
23 </label>
23 </label>
24 </div>
24 </div>
25 </div>
25 </div>
26 <div class="field">
26 <div class="field">
27 <div class="label">
27 <div class="label">
28 <label for="default_group_perm">${_('Repository Groups')}:</label>
28 <label for="default_group_perm">${_('Repository Groups')}:</label>
29 </div>
29 </div>
30 <div class="select">
30 <div class="select">
31 ${h.select('default_group_perm','',c.group_perms_choices)}
31 ${h.select('default_group_perm','',c.group_perms_choices)}
32 ${h.checkbox('overwrite_default_group','true')}
32 ${h.checkbox('overwrite_default_group','true')}
33 <label for="overwrite_default_group">
33 <label for="overwrite_default_group">
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'))}">
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 ${_('Overwrite Existing Settings')}
35 ${_('Overwrite Existing Settings')}
36 </span>
36 </span>
37 </label>
37 </label>
38 </div>
38 </div>
39 </div>
39 </div>
40 <div class="field">
40 <div class="field">
41 <div class="label">
41 <div class="label">
42 <label for="default_group_perm">${_('User Groups')}:</label>
42 <label for="default_group_perm">${_('User Groups')}:</label>
43 </div>
43 </div>
44 <div class="select">
44 <div class="select">
45 ${h.select('default_user_group_perm','',c.user_group_perms_choices)}
45 ${h.select('default_user_group_perm','',c.user_group_perms_choices)}
46 ${h.checkbox('overwrite_default_user_group','true')}
46 ${h.checkbox('overwrite_default_user_group','true')}
47 <label for="overwrite_default_user_group">
47 <label for="overwrite_default_user_group">
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'))}">
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 ${_('Overwrite Existing Settings')}
49 ${_('Overwrite Existing Settings')}
50 </span>
50 </span>
51 </label>
51 </label>
52 </div>
52 </div>
53 </div>
53 </div>
54
54
55 <div class="buttons">
55 <div class="buttons">
56 ${h.submit('save',_('Save'),class_="btn")}
56 ${h.submit('save',_('Save'),class_="btn")}
57 ${h.reset('reset',_('Reset'),class_="btn")}
57 ${h.reset('reset',_('Reset'),class_="btn")}
58 </div>
58 </div>
59 </div>
59 </div>
60 </div>
60 </div>
61 ${h.end_form()}
61 ${h.end_form()}
62 </div>
62 </div>
63 </div>
63 </div>
64
64
65 <script>
65 <script>
66 $(document).ready(function(){
66 $(document).ready(function(){
67 var select2Options = {
67 var select2Options = {
68 containerCssClass: 'drop-menu',
68 containerCssClass: 'drop-menu',
69 dropdownCssClass: 'drop-menu-dropdown',
69 dropdownCssClass: 'drop-menu-dropdown',
70 dropdownAutoWidth: true,
70 dropdownAutoWidth: true,
71 minimumResultsForSearch: -1
71 minimumResultsForSearch: -1
72 };
72 };
73 $("#default_repo_perm").select2(select2Options);
73 $("#default_repo_perm").select2(select2Options);
74 $("#default_group_perm").select2(select2Options);
74 $("#default_group_perm").select2(select2Options);
75 $("#default_user_group_perm").select2(select2Options);
75 $("#default_user_group_perm").select2(select2Options);
76 });
76 });
77 </script>
77 </script>
@@ -1,91 +1,91 b''
1
1
2 <div class="panel panel-default">
2 <div class="panel panel-default">
3 <div class="panel-heading">
3 <div class="panel-heading">
4 <h3 class="panel-title">${_('SSH Keys')} - <span id="ssh_keys_count"></span></h3>
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 <button class="btn btn-link pull-right" type="submit">${_('Update SSH keys file')}</button>
7 <button class="btn btn-link pull-right" type="submit">${_('Update SSH keys file')}</button>
8 ${h.end_form()}
8 ${h.end_form()}
9 </div>
9 </div>
10 <div class="panel-body">
10 <div class="panel-body">
11 <input class="q_filter_box" id="q_filter" size="15" type="text" name="filter" placeholder="${_('quick filter...')}" value=""/>
11 <input class="q_filter_box" id="q_filter" size="15" type="text" name="filter" placeholder="${_('quick filter...')}" value=""/>
12
12
13 <div id="repos_list_wrap">
13 <div id="repos_list_wrap">
14 <table id="ssh_keys_table" class="display"></table>
14 <table id="ssh_keys_table" class="display"></table>
15 </div>
15 </div>
16 </div>
16 </div>
17 </div>
17 </div>
18
18
19
19
20 <script type="text/javascript">
20 <script type="text/javascript">
21
21
22 $(document).ready(function() {
22 $(document).ready(function() {
23 var $sshKeyListTable = $('#ssh_keys_table');
23 var $sshKeyListTable = $('#ssh_keys_table');
24
24
25 var getDatatableCount = function(){
25 var getDatatableCount = function(){
26 var table = $sshKeyListTable.dataTable();
26 var table = $sshKeyListTable.dataTable();
27 var page = table.api().page.info();
27 var page = table.api().page.info();
28 var active = page.recordsDisplay;
28 var active = page.recordsDisplay;
29 var total = page.recordsTotal;
29 var total = page.recordsTotal;
30
30
31 var _text = _gettext("{0} out of {1} ssh keys").format(active, total);
31 var _text = _gettext("{0} out of {1} ssh keys").format(active, total);
32 $('#ssh_keys_count').text(_text);
32 $('#ssh_keys_count').text(_text);
33 };
33 };
34
34
35 // user list
35 // user list
36 $sshKeyListTable.DataTable({
36 $sshKeyListTable.DataTable({
37 processing: true,
37 processing: true,
38 serverSide: true,
38 serverSide: true,
39 ajax: "${h.route_path('admin_permissions_ssh_keys_data')}",
39 ajax: "${h.route_path('admin_permissions_ssh_keys_data')}",
40 dom: 'rtp',
40 dom: 'rtp',
41 pageLength: ${c.visual.admin_grid_items},
41 pageLength: ${c.visual.admin_grid_items},
42 order: [[ 0, "asc" ]],
42 order: [[ 0, "asc" ]],
43 columns: [
43 columns: [
44 { data: {"_": "username",
44 { data: {"_": "username",
45 "sort": "username"}, title: "${_('Username')}", className: "td-user" },
45 "sort": "username"}, title: "${_('Username')}", className: "td-user" },
46 { data: {"_": "fingerprint",
46 { data: {"_": "fingerprint",
47 "sort": "fingerprint"}, title: "${_('Fingerprint')}", className: "td-type" },
47 "sort": "fingerprint"}, title: "${_('Fingerprint')}", className: "td-type" },
48 { data: {"_": "description",
48 { data: {"_": "description",
49 "sort": "description"}, title: "${_('Description')}", className: "td-type" },
49 "sort": "description"}, title: "${_('Description')}", className: "td-type" },
50 { data: {"_": "created_on",
50 { data: {"_": "created_on",
51 "sort": "created_on"}, title: "${_('Created on')}", className: "td-time" },
51 "sort": "created_on"}, title: "${_('Created on')}", className: "td-time" },
52 { data: {"_": "action",
52 { data: {"_": "action",
53 "sort": "action"}, title: "${_('Action')}", className: "td-action", orderable: false }
53 "sort": "action"}, title: "${_('Action')}", className: "td-action", orderable: false }
54 ],
54 ],
55 language: {
55 language: {
56 paginate: DEFAULT_GRID_PAGINATION,
56 paginate: DEFAULT_GRID_PAGINATION,
57 sProcessing: _gettext('loading...'),
57 sProcessing: _gettext('loading...'),
58 emptyTable: _gettext("No ssh keys available yet.")
58 emptyTable: _gettext("No ssh keys available yet.")
59 },
59 },
60
60
61 "createdRow": function ( row, data, index ) {
61 "createdRow": function ( row, data, index ) {
62 if (!data['active_raw']){
62 if (!data['active_raw']){
63 $(row).addClass('closed')
63 $(row).addClass('closed')
64 }
64 }
65 }
65 }
66 });
66 });
67
67
68 $sshKeyListTable.on('xhr.dt', function(e, settings, json, xhr){
68 $sshKeyListTable.on('xhr.dt', function(e, settings, json, xhr){
69 $sshKeyListTable.css('opacity', 1);
69 $sshKeyListTable.css('opacity', 1);
70 });
70 });
71
71
72 $sshKeyListTable.on('preXhr.dt', function(e, settings, data){
72 $sshKeyListTable.on('preXhr.dt', function(e, settings, data){
73 $sshKeyListTable.css('opacity', 0.3);
73 $sshKeyListTable.css('opacity', 0.3);
74 });
74 });
75
75
76 // refresh counters on draw
76 // refresh counters on draw
77 $sshKeyListTable.on('draw.dt', function(){
77 $sshKeyListTable.on('draw.dt', function(){
78 getDatatableCount();
78 getDatatableCount();
79 });
79 });
80
80
81 // filter
81 // filter
82 $('#q_filter').on('keyup',
82 $('#q_filter').on('keyup',
83 $.debounce(250, function() {
83 $.debounce(250, function() {
84 $sshKeyListTable.DataTable().search(
84 $sshKeyListTable.DataTable().search(
85 $('#q_filter').val()
85 $('#q_filter').val()
86 ).draw();
86 ).draw();
87 })
87 })
88 );
88 );
89
89
90 });
90 });
91 </script>
91 </script>
@@ -1,106 +1,106 b''
1 ## -*- coding: utf-8 -*-
1 ## -*- coding: utf-8 -*-
2 <%inherit file="/base/base.mako"/>
2 <%inherit file="/base/base.mako"/>
3
3
4 <%def name="title()">
4 <%def name="title()">
5 ${_('Add repository group')}
5 ${_('Add repository group')}
6 %if c.rhodecode_name:
6 %if c.rhodecode_name:
7 &middot; ${h.branding(c.rhodecode_name)}
7 &middot; ${h.branding(c.rhodecode_name)}
8 %endif
8 %endif
9 </%def>
9 </%def>
10
10
11 <%def name="breadcrumbs_links()">
11 <%def name="breadcrumbs_links()">
12 ${h.link_to(_('Admin'),h.route_path('admin_home'))}
12 ${h.link_to(_('Admin'),h.route_path('admin_home'))}
13 &raquo;
13 &raquo;
14 ${h.link_to(_('Repository groups'),h.url('repo_groups'))}
14 ${h.link_to(_('Repository groups'),h.url('repo_groups'))}
15 &raquo;
15 &raquo;
16 ${_('Add Repository Group')}
16 ${_('Add Repository Group')}
17 </%def>
17 </%def>
18
18
19 <%def name="menu_bar_nav()">
19 <%def name="menu_bar_nav()">
20 ${self.menu_items(active='admin')}
20 ${self.menu_items(active='admin')}
21 </%def>
21 </%def>
22
22
23 <%def name="main()">
23 <%def name="main()">
24 <div class="box">
24 <div class="box">
25 <!-- box / title -->
25 <!-- box / title -->
26 <div class="title">
26 <div class="title">
27 ${self.breadcrumbs()}
27 ${self.breadcrumbs()}
28 </div>
28 </div>
29 <!-- end box / title -->
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 <div class="form">
31 <div class="form">
32 <!-- fields -->
32 <!-- fields -->
33 <div class="fields">
33 <div class="fields">
34 <div class="field">
34 <div class="field">
35 <div class="label">
35 <div class="label">
36 <label for="group_name">${_('Group Name')}:</label>
36 <label for="group_name">${_('Group Name')}:</label>
37 </div>
37 </div>
38 <div class="input">
38 <div class="input">
39 ${h.text('group_name', class_="medium")}
39 ${h.text('group_name', class_="medium")}
40 </div>
40 </div>
41 </div>
41 </div>
42
42
43 <div class="field">
43 <div class="field">
44 <div class="label">
44 <div class="label">
45 <label for="group_description">${_('Description')}:</label>
45 <label for="group_description">${_('Description')}:</label>
46 </div>
46 </div>
47 <div class="textarea editor">
47 <div class="textarea editor">
48 ${h.textarea('group_description',cols=23,rows=5,class_="medium")}
48 ${h.textarea('group_description',cols=23,rows=5,class_="medium")}
49 <% metatags_url = h.literal('''<a href="#metatagsShow" onclick="$('#meta-tags-desc').toggle();return false">meta-tags</a>''') %>
49 <% metatags_url = h.literal('''<a href="#metatagsShow" onclick="$('#meta-tags-desc').toggle();return false">meta-tags</a>''') %>
50 <span class="help-block">${_('Plain text format with support of {metatags}').format(metatags=metatags_url)|n}</span>
50 <span class="help-block">${_('Plain text format with support of {metatags}').format(metatags=metatags_url)|n}</span>
51 <span id="meta-tags-desc" style="display: none">
51 <span id="meta-tags-desc" style="display: none">
52 <%namespace name="dt" file="/data_table/_dt_elements.mako"/>
52 <%namespace name="dt" file="/data_table/_dt_elements.mako"/>
53 ${dt.metatags_help()}
53 ${dt.metatags_help()}
54 </span>
54 </span>
55 </div>
55 </div>
56 </div>
56 </div>
57
57
58 <div class="field">
58 <div class="field">
59 <div class="label">
59 <div class="label">
60 <label for="group_parent_id">${_('Group Parent')}:</label>
60 <label for="group_parent_id">${_('Group Parent')}:</label>
61 </div>
61 </div>
62 <div class="select">
62 <div class="select">
63 ${h.select('group_parent_id',request.GET.get('parent_group'),c.repo_groups,class_="medium")}
63 ${h.select('group_parent_id',request.GET.get('parent_group'),c.repo_groups,class_="medium")}
64 </div>
64 </div>
65 </div>
65 </div>
66
66
67 <div id="copy_perms" class="field">
67 <div id="copy_perms" class="field">
68 <div class="label label-checkbox">
68 <div class="label label-checkbox">
69 <label for="group_copy_permissions">${_('Copy Parent Group Permissions')}:</label>
69 <label for="group_copy_permissions">${_('Copy Parent Group Permissions')}:</label>
70 </div>
70 </div>
71 <div class="checkboxes">
71 <div class="checkboxes">
72 ${h.checkbox('group_copy_permissions', value="True", checked="checked")}
72 ${h.checkbox('group_copy_permissions', value="True", checked="checked")}
73 <span class="help-block">${_('Copy permission settings from parent repository group.')}</span>
73 <span class="help-block">${_('Copy permission settings from parent repository group.')}</span>
74 </div>
74 </div>
75 </div>
75 </div>
76
76
77 <div class="buttons">
77 <div class="buttons">
78 ${h.submit('save',_('Save'),class_="btn")}
78 ${h.submit('save',_('Save'),class_="btn")}
79 </div>
79 </div>
80 </div>
80 </div>
81 </div>
81 </div>
82 ${h.end_form()}
82 ${h.end_form()}
83 </div>
83 </div>
84 <script>
84 <script>
85 $(document).ready(function(){
85 $(document).ready(function(){
86 var setCopyPermsOption = function(group_val){
86 var setCopyPermsOption = function(group_val){
87 if(group_val != "-1"){
87 if(group_val != "-1"){
88 $('#copy_perms').show()
88 $('#copy_perms').show()
89 }
89 }
90 else{
90 else{
91 $('#copy_perms').hide();
91 $('#copy_perms').hide();
92 }
92 }
93 }
93 }
94 $("#group_parent_id").select2({
94 $("#group_parent_id").select2({
95 'containerCssClass': "drop-menu",
95 'containerCssClass': "drop-menu",
96 'dropdownCssClass': "drop-menu-dropdown",
96 'dropdownCssClass': "drop-menu-dropdown",
97 'dropdownAutoWidth': true
97 'dropdownAutoWidth': true
98 });
98 });
99 setCopyPermsOption($('#group_parent_id').val())
99 setCopyPermsOption($('#group_parent_id').val())
100 $("#group_parent_id").on("change", function(e) {
100 $("#group_parent_id").on("change", function(e) {
101 setCopyPermsOption(e.val)
101 setCopyPermsOption(e.val)
102 })
102 })
103 $('#group_name').focus();
103 $('#group_name').focus();
104 })
104 })
105 </script>
105 </script>
106 </%def>
106 </%def>
@@ -1,64 +1,64 b''
1 <%namespace name="base" file="/base/base.mako"/>
1 <%namespace name="base" file="/base/base.mako"/>
2
2
3 <%
3 <%
4 elems = [
4 elems = [
5 (_('Owner'), lambda:base.gravatar_with_user(c.repo_group.user.email), '', ''),
5 (_('Owner'), lambda:base.gravatar_with_user(c.repo_group.user.email), '', ''),
6 (_('Created on'), h.format_date(c.repo_group.created_on), '', ''),
6 (_('Created on'), h.format_date(c.repo_group.created_on), '', ''),
7 (_('Is Personal Group'), c.repo_group.personal or False, '', ''),
7 (_('Is Personal Group'), c.repo_group.personal or False, '', ''),
8
8
9 (_('Total repositories'), c.repo_group.repositories_recursive_count, '', ''),
9 (_('Total repositories'), c.repo_group.repositories_recursive_count, '', ''),
10 (_('Top level repositories'), c.repo_group.repositories.count(), '', c.repo_group.repositories.all()),
10 (_('Top level repositories'), c.repo_group.repositories.count(), '', c.repo_group.repositories.all()),
11
11
12 (_('Children groups'), c.repo_group.children.count(), '', c.repo_group.children.all()),
12 (_('Children groups'), c.repo_group.children.count(), '', c.repo_group.children.all()),
13 ]
13 ]
14 %>
14 %>
15
15
16 <div class="panel panel-default">
16 <div class="panel panel-default">
17 <div class="panel-heading">
17 <div class="panel-heading">
18 <h3 class="panel-title">${_('Repository Group: %s') % c.repo_group.group_name}</h3>
18 <h3 class="panel-title">${_('Repository Group: %s') % c.repo_group.group_name}</h3>
19 </div>
19 </div>
20 <div class="panel-body">
20 <div class="panel-body">
21 ${base.dt_info_panel(elems)}
21 ${base.dt_info_panel(elems)}
22 </div>
22 </div>
23
23
24 </div>
24 </div>
25
25
26 <div class="panel panel-danger">
26 <div class="panel panel-danger">
27 <div class="panel-heading">
27 <div class="panel-heading">
28 <h3 class="panel-title">${_('Delete repository group')}</h3>
28 <h3 class="panel-title">${_('Delete repository group')}</h3>
29 </div>
29 </div>
30 <div class="panel-body">
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 <table class="display">
32 <table class="display">
33
33
34 <tr>
34 <tr>
35 <td>
35 <td>
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()}
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 </td>
37 </td>
38 <td>
38 <td>
39 </td>
39 </td>
40 <td>
40 <td>
41 </td>
41 </td>
42 </tr>
42 </tr>
43 <tr>
43 <tr>
44 <td>
44 <td>
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}
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 </td>
46 </td>
47 <td>
47 <td>
48 </td>
48 </td>
49 <td>
49 <td>
50 </td>
50 </td>
51 </tr>
51 </tr>
52
52
53 </table>
53 </table>
54 <div style="margin: 0 0 20px 0" class="fake-space"></div>
54 <div style="margin: 0 0 20px 0" class="fake-space"></div>
55
55
56 <button class="btn btn-small btn-danger" type="submit"
56 <button class="btn btn-small btn-danger" type="submit"
57 onclick="return confirm('${_('Confirm to delete this group: %s') % (c.repo_group.group_name)}');">
57 onclick="return confirm('${_('Confirm to delete this group: %s') % (c.repo_group.group_name)}');">
58 ${_('Delete this repository group')}
58 ${_('Delete this repository group')}
59 </button>
59 </button>
60 ${h.end_form()}
60 ${h.end_form()}
61 </div>
61 </div>
62 </div>
62 </div>
63
63
64
64
@@ -1,148 +1,148 b''
1 <%namespace name="base" file="/base/base.mako"/>
1 <%namespace name="base" file="/base/base.mako"/>
2
2
3 <div class="panel panel-default">
3 <div class="panel panel-default">
4 <div class="panel-heading">
4 <div class="panel-heading">
5 <h3 class="panel-title">${_('Repository Group Permissions')}</h3>
5 <h3 class="panel-title">${_('Repository Group Permissions')}</h3>
6 </div>
6 </div>
7 <div class="panel-body">
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 <table id="permissions_manage" class="rctable permissions">
9 <table id="permissions_manage" class="rctable permissions">
10 <tr>
10 <tr>
11 <th class="td-radio">${_('None')}</th>
11 <th class="td-radio">${_('None')}</th>
12 <th class="td-radio">${_('Read')}</th>
12 <th class="td-radio">${_('Read')}</th>
13 <th class="td-radio">${_('Write')}</th>
13 <th class="td-radio">${_('Write')}</th>
14 <th class="td-radio">${_('Admin')}</th>
14 <th class="td-radio">${_('Admin')}</th>
15 <th class="td-user">${_('User/User Group')}</th>
15 <th class="td-user">${_('User/User Group')}</th>
16 <th></th>
16 <th></th>
17 </tr>
17 </tr>
18 ## USERS
18 ## USERS
19 %for _user in c.repo_group.permissions():
19 %for _user in c.repo_group.permissions():
20 %if getattr(_user, 'admin_row', None) or getattr(_user, 'owner_row', None):
20 %if getattr(_user, 'admin_row', None) or getattr(_user, 'owner_row', None):
21 <tr class="perm_admin_row">
21 <tr class="perm_admin_row">
22 <td class="td-radio">${h.radio('admin_perm_%s' % _user.user_id,'repository.none', disabled="disabled")}</td>
22 <td class="td-radio">${h.radio('admin_perm_%s' % _user.user_id,'repository.none', disabled="disabled")}</td>
23 <td class="td-radio">${h.radio('admin_perm_%s' % _user.user_id,'repository.read', disabled="disabled")}</td>
23 <td class="td-radio">${h.radio('admin_perm_%s' % _user.user_id,'repository.read', disabled="disabled")}</td>
24 <td class="td-radio">${h.radio('admin_perm_%s' % _user.user_id,'repository.write', disabled="disabled")}</td>
24 <td class="td-radio">${h.radio('admin_perm_%s' % _user.user_id,'repository.write', disabled="disabled")}</td>
25 <td class="td-radio">${h.radio('admin_perm_%s' % _user.user_id,'repository.admin', 'repository.admin', disabled="disabled")}</td>
25 <td class="td-radio">${h.radio('admin_perm_%s' % _user.user_id,'repository.admin', 'repository.admin', disabled="disabled")}</td>
26 <td class="td-user">
26 <td class="td-user">
27 ${base.gravatar(_user.email, 16)}
27 ${base.gravatar(_user.email, 16)}
28 <span class="user">
28 <span class="user">
29 ${h.link_to_user(_user.username)}
29 ${h.link_to_user(_user.username)}
30 %if getattr(_user, 'admin_row', None):
30 %if getattr(_user, 'admin_row', None):
31 (${_('super admin')})
31 (${_('super admin')})
32 %endif
32 %endif
33 %if getattr(_user, 'owner_row', None):
33 %if getattr(_user, 'owner_row', None):
34 (${_('owner')})
34 (${_('owner')})
35 %endif
35 %endif
36 </span>
36 </span>
37 </td>
37 </td>
38 <td></td>
38 <td></td>
39 </tr>
39 </tr>
40 %else:
40 %else:
41 ##forbid revoking permission from yourself, except if you're an super admin
41 ##forbid revoking permission from yourself, except if you're an super admin
42 <tr>
42 <tr>
43 %if c.rhodecode_user.user_id != _user.user_id or c.rhodecode_user.is_admin:
43 %if c.rhodecode_user.user_id != _user.user_id or c.rhodecode_user.is_admin:
44 <td class="td-radio">${h.radio('u_perm_%s' % _user.user_id,'group.none')}</td>
44 <td class="td-radio">${h.radio('u_perm_%s' % _user.user_id,'group.none')}</td>
45 <td class="td-radio">${h.radio('u_perm_%s' % _user.user_id,'group.read')}</td>
45 <td class="td-radio">${h.radio('u_perm_%s' % _user.user_id,'group.read')}</td>
46 <td class="td-radio">${h.radio('u_perm_%s' % _user.user_id,'group.write')}</td>
46 <td class="td-radio">${h.radio('u_perm_%s' % _user.user_id,'group.write')}</td>
47 <td class="td-radio">${h.radio('u_perm_%s' % _user.user_id,'group.admin')}</td>
47 <td class="td-radio">${h.radio('u_perm_%s' % _user.user_id,'group.admin')}</td>
48 <td class="td-user">
48 <td class="td-user">
49 ${base.gravatar(_user.email, 16)}
49 ${base.gravatar(_user.email, 16)}
50 <span class="user">
50 <span class="user">
51 % if _user.username == h.DEFAULT_USER:
51 % if _user.username == h.DEFAULT_USER:
52 ${h.DEFAULT_USER} <span class="user-perm-help-text"> - ${_('permission for all other users')}</span>
52 ${h.DEFAULT_USER} <span class="user-perm-help-text"> - ${_('permission for all other users')}</span>
53 % else:
53 % else:
54 ${h.link_to_user(_user.username)}
54 ${h.link_to_user(_user.username)}
55 % endif
55 % endif
56 </span>
56 </span>
57 </td>
57 </td>
58 <td class="td-action">
58 <td class="td-action">
59 %if _user.username != h.DEFAULT_USER:
59 %if _user.username != h.DEFAULT_USER:
60 <span class="btn btn-link btn-danger revoke_perm"
60 <span class="btn btn-link btn-danger revoke_perm"
61 member="${_user.user_id}" member_type="user">
61 member="${_user.user_id}" member_type="user">
62 <i class="icon-remove"></i> ${_('Revoke')}
62 <i class="icon-remove"></i> ${_('Revoke')}
63 </span>
63 </span>
64 %endif
64 %endif
65 </td>
65 </td>
66 %else:
66 %else:
67 ## special case for current user permissions, we make sure he cannot take his own permissions
67 ## special case for current user permissions, we make sure he cannot take his own permissions
68 <td class="td-radio">${h.radio('u_perm_%s' % _user.user_id,'group.none', disabled="disabled")}</td>
68 <td class="td-radio">${h.radio('u_perm_%s' % _user.user_id,'group.none', disabled="disabled")}</td>
69 <td class="td-radio">${h.radio('u_perm_%s' % _user.user_id,'group.read', disabled="disabled")}</td>
69 <td class="td-radio">${h.radio('u_perm_%s' % _user.user_id,'group.read', disabled="disabled")}</td>
70 <td class="td-radio">${h.radio('u_perm_%s' % _user.user_id,'group.write', disabled="disabled")}</td>
70 <td class="td-radio">${h.radio('u_perm_%s' % _user.user_id,'group.write', disabled="disabled")}</td>
71 <td class="td-radio">${h.radio('u_perm_%s' % _user.user_id,'group.admin', disabled="disabled")}</td>
71 <td class="td-radio">${h.radio('u_perm_%s' % _user.user_id,'group.admin', disabled="disabled")}</td>
72 <td class="td-user">
72 <td class="td-user">
73 ${base.gravatar(_user.email, 16)}
73 ${base.gravatar(_user.email, 16)}
74 <span class="user">
74 <span class="user">
75 % if _user.username == h.DEFAULT_USER:
75 % if _user.username == h.DEFAULT_USER:
76 ${h.DEFAULT_USER} <span class="user-perm-help-text"> - ${_('permission for all other users')}</span>
76 ${h.DEFAULT_USER} <span class="user-perm-help-text"> - ${_('permission for all other users')}</span>
77 % else:
77 % else:
78 ${h.link_to_user(_user.username)}
78 ${h.link_to_user(_user.username)}
79 % endif
79 % endif
80 <span class="user-perm-help-text">(${_('delegated admin')})</span>
80 <span class="user-perm-help-text">(${_('delegated admin')})</span>
81 </span>
81 </span>
82 </td>
82 </td>
83 <td></td>
83 <td></td>
84 %endif
84 %endif
85 </tr>
85 </tr>
86 %endif
86 %endif
87 %endfor
87 %endfor
88
88
89 ## USER GROUPS
89 ## USER GROUPS
90 %for _user_group in c.repo_group.permission_user_groups():
90 %for _user_group in c.repo_group.permission_user_groups():
91 <tr id="id${id(_user_group.users_group_name)}">
91 <tr id="id${id(_user_group.users_group_name)}">
92 <td class="td-radio">${h.radio('g_perm_%s' % _user_group.users_group_id,'group.none')}</td>
92 <td class="td-radio">${h.radio('g_perm_%s' % _user_group.users_group_id,'group.none')}</td>
93 <td class="td-radio">${h.radio('g_perm_%s' % _user_group.users_group_id,'group.read')}</td>
93 <td class="td-radio">${h.radio('g_perm_%s' % _user_group.users_group_id,'group.read')}</td>
94 <td class="td-radio">${h.radio('g_perm_%s' % _user_group.users_group_id,'group.write')}</td>
94 <td class="td-radio">${h.radio('g_perm_%s' % _user_group.users_group_id,'group.write')}</td>
95 <td class="td-radio">${h.radio('g_perm_%s' % _user_group.users_group_id,'group.admin')}</td>
95 <td class="td-radio">${h.radio('g_perm_%s' % _user_group.users_group_id,'group.admin')}</td>
96 <td class="td-componentname">
96 <td class="td-componentname">
97 <i class="icon-group" ></i>
97 <i class="icon-group" ></i>
98 %if h.HasPermissionAny('hg.admin')():
98 %if h.HasPermissionAny('hg.admin')():
99 <a href="${h.route_path('edit_user_group',user_group_id=_user_group.users_group_id)}">
99 <a href="${h.route_path('edit_user_group',user_group_id=_user_group.users_group_id)}">
100 ${_user_group.users_group_name}
100 ${_user_group.users_group_name}
101 </a>
101 </a>
102 %else:
102 %else:
103 ${_user_group.users_group_name}
103 ${_user_group.users_group_name}
104 %endif
104 %endif
105 </td>
105 </td>
106 <td class="td-action">
106 <td class="td-action">
107 <span class="btn btn-link btn-danger revoke_perm"
107 <span class="btn btn-link btn-danger revoke_perm"
108 member="${_user_group.users_group_id}" member_type="user_group">
108 member="${_user_group.users_group_id}" member_type="user_group">
109 <i class="icon-remove"></i> ${_('Revoke')}
109 <i class="icon-remove"></i> ${_('Revoke')}
110 </span>
110 </span>
111 </td>
111 </td>
112 </tr>
112 </tr>
113 %endfor
113 %endfor
114
114
115 <tr class="new_members" id="add_perm_input"></tr>
115 <tr class="new_members" id="add_perm_input"></tr>
116 </table>
116 </table>
117 <div id="add_perm" class="link">
117 <div id="add_perm" class="link">
118 ${_('Add new')}
118 ${_('Add new')}
119 </div>
119 </div>
120 <div class="fields">
120 <div class="fields">
121 <div class="field">
121 <div class="field">
122 <div class="label label-radio">
122 <div class="label label-radio">
123 ${_('Apply to children')}:
123 ${_('Apply to children')}:
124 </div>
124 </div>
125 <div class="radios">
125 <div class="radios">
126 ${h.radio('recursive', 'none', label=_('None'), checked="checked")}
126 ${h.radio('recursive', 'none', label=_('None'), checked="checked")}
127 ${h.radio('recursive', 'groups', label=_('Repository Groups'))}
127 ${h.radio('recursive', 'groups', label=_('Repository Groups'))}
128 ${h.radio('recursive', 'repos', label=_('Repositories'))}
128 ${h.radio('recursive', 'repos', label=_('Repositories'))}
129 ${h.radio('recursive', 'all', label=_('Both'))}
129 ${h.radio('recursive', 'all', label=_('Both'))}
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>
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 </div>
131 </div>
132 </div>
132 </div>
133 </div>
133 </div>
134 <div class="buttons">
134 <div class="buttons">
135 ${h.submit('save',_('Save'),class_="btn btn-primary")}
135 ${h.submit('save',_('Save'),class_="btn btn-primary")}
136 ${h.reset('reset',_('Reset'),class_="btn btn-danger")}
136 ${h.reset('reset',_('Reset'),class_="btn btn-danger")}
137 </div>
137 </div>
138 ${h.end_form()}
138 ${h.end_form()}
139 </div>
139 </div>
140 </div>
140 </div>
141 <script type="text/javascript">
141 <script type="text/javascript">
142 $('#add_perm').on('click', function(e){
142 $('#add_perm').on('click', function(e){
143 addNewPermInput($(this), 'group');
143 addNewPermInput($(this), 'group');
144 });
144 });
145 $('.revoke_perm').on('click', function(e){
145 $('.revoke_perm').on('click', function(e){
146 markRevokePermInput($(this), 'group');
146 markRevokePermInput($(this), 'group');
147 })
147 })
148 </script>
148 </script>
@@ -1,90 +1,90 b''
1 ## -*- coding: utf-8 -*-
1 ## -*- coding: utf-8 -*-
2 <%namespace name="base" file="/base/base.mako"/>
2 <%namespace name="base" file="/base/base.mako"/>
3
3
4 <div class="panel panel-default">
4 <div class="panel panel-default">
5 <div class="panel-heading">
5 <div class="panel-heading">
6 <h3 class="panel-title">${_('Settings for Repository Group: %s') % c.repo_group.name}</h3>
6 <h3 class="panel-title">${_('Settings for Repository Group: %s') % c.repo_group.name}</h3>
7 </div>
7 </div>
8 <div class="panel-body">
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 <div class="form">
10 <div class="form">
11 <!-- fields -->
11 <!-- fields -->
12 <div class="fields">
12 <div class="fields">
13 <div class="field">
13 <div class="field">
14 <div class="label">
14 <div class="label">
15 <label for="group_name">${_('Group Name')}:</label>
15 <label for="group_name">${_('Group Name')}:</label>
16 </div>
16 </div>
17 <div class="input">
17 <div class="input">
18 ${h.text('group_name',class_='medium')}
18 ${h.text('group_name',class_='medium')}
19 </div>
19 </div>
20 </div>
20 </div>
21
21
22 <div class="field badged-field">
22 <div class="field badged-field">
23 <div class="label">
23 <div class="label">
24 <label for="user">${_('Owner')}:</label>
24 <label for="user">${_('Owner')}:</label>
25 </div>
25 </div>
26 <div class="input">
26 <div class="input">
27 <div class="badge-input-container">
27 <div class="badge-input-container">
28 <div class="user-badge">
28 <div class="user-badge">
29 ${base.gravatar_with_user(c.repo_group.user.email, show_disabled=not c.repo_group.user.active)}
29 ${base.gravatar_with_user(c.repo_group.user.email, show_disabled=not c.repo_group.user.active)}
30 </div>
30 </div>
31 <div class="badge-input-wrap">
31 <div class="badge-input-wrap">
32 ${h.text('user', class_="medium", autocomplete="off")}
32 ${h.text('user', class_="medium", autocomplete="off")}
33 </div>
33 </div>
34 </div>
34 </div>
35 <form:error name="user"/>
35 <form:error name="user"/>
36 <p class="help-block">${_('Change owner of this repository group.')}</p>
36 <p class="help-block">${_('Change owner of this repository group.')}</p>
37 </div>
37 </div>
38 </div>
38 </div>
39
39
40 <div class="field">
40 <div class="field">
41 <div class="label label-textarea">
41 <div class="label label-textarea">
42 <label for="group_description">${_('Description')}:</label>
42 <label for="group_description">${_('Description')}:</label>
43 </div>
43 </div>
44 <div class="textarea text-area editor">
44 <div class="textarea text-area editor">
45 ${h.textarea('group_description',cols=23,rows=5,class_="medium")}
45 ${h.textarea('group_description',cols=23,rows=5,class_="medium")}
46 <% metatags_url = h.literal('''<a href="#metatagsShow" onclick="$('#meta-tags-desc').toggle();return false">meta-tags</a>''') %>
46 <% metatags_url = h.literal('''<a href="#metatagsShow" onclick="$('#meta-tags-desc').toggle();return false">meta-tags</a>''') %>
47 <span class="help-block">${_('Plain text format with support of {metatags}').format(metatags=metatags_url)|n}</span>
47 <span class="help-block">${_('Plain text format with support of {metatags}').format(metatags=metatags_url)|n}</span>
48 <span id="meta-tags-desc" style="display: none">
48 <span id="meta-tags-desc" style="display: none">
49 <%namespace name="dt" file="/data_table/_dt_elements.mako"/>
49 <%namespace name="dt" file="/data_table/_dt_elements.mako"/>
50 ${dt.metatags_help()}
50 ${dt.metatags_help()}
51 </span>
51 </span>
52 </div>
52 </div>
53 </div>
53 </div>
54
54
55 <div class="field">
55 <div class="field">
56 <div class="label">
56 <div class="label">
57 <label for="group_parent_id">${_('Group parent')}:</label>
57 <label for="group_parent_id">${_('Group parent')}:</label>
58 </div>
58 </div>
59 <div class="select">
59 <div class="select">
60 ${h.select('group_parent_id','',c.repo_groups,class_="medium")}
60 ${h.select('group_parent_id','',c.repo_groups,class_="medium")}
61 </div>
61 </div>
62 </div>
62 </div>
63 <div class="field">
63 <div class="field">
64 <div class="label label-checkbox">
64 <div class="label label-checkbox">
65 <label for="enable_locking">${_('Enable Repository Locking')}:</label>
65 <label for="enable_locking">${_('Enable Repository Locking')}:</label>
66 </div>
66 </div>
67 <div class="checkboxes">
67 <div class="checkboxes">
68 ${h.checkbox('enable_locking',value="True")}
68 ${h.checkbox('enable_locking',value="True")}
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>
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 </div>
70 </div>
71 </div>
71 </div>
72 <div class="buttons">
72 <div class="buttons">
73 ${h.submit('save',_('Save'),class_="btn")}
73 ${h.submit('save',_('Save'),class_="btn")}
74 ${h.reset('reset',_('Reset'),class_="btn")}
74 ${h.reset('reset',_('Reset'),class_="btn")}
75 </div>
75 </div>
76 </div>
76 </div>
77 </div>
77 </div>
78 ${h.end_form()}
78 ${h.end_form()}
79 </div>
79 </div>
80 </div>
80 </div>
81 <script>
81 <script>
82 $(document).ready(function(){
82 $(document).ready(function(){
83 $("#group_parent_id").select2({
83 $("#group_parent_id").select2({
84 'containerCssClass': "drop-menu",
84 'containerCssClass': "drop-menu",
85 'dropdownCssClass': "drop-menu-dropdown",
85 'dropdownCssClass': "drop-menu-dropdown",
86 'dropdownAutoWidth': true
86 'dropdownAutoWidth': true
87 });
87 });
88 UsersAutoComplete('user', '${c.rhodecode_user.user_id}');
88 UsersAutoComplete('user', '${c.rhodecode_user.user_id}');
89 })
89 })
90 </script>
90 </script>
@@ -1,164 +1,164 b''
1 ## -*- coding: utf-8 -*-
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 <div class="form">
4 <div class="form">
5 <!-- fields -->
5 <!-- fields -->
6 <div class="fields">
6 <div class="fields">
7 <div class="field">
7 <div class="field">
8 <div class="label">
8 <div class="label">
9 <label for="repo_name">${_('Name')}:</label>
9 <label for="repo_name">${_('Name')}:</label>
10 </div>
10 </div>
11 <div class="input">
11 <div class="input">
12 ${h.text('repo_name', class_="medium")}
12 ${h.text('repo_name', class_="medium")}
13 <div class="info-block">
13 <div class="info-block">
14 <a id="remote_clone_toggle" href="#"><i class="icon-download-alt"></i> ${_('Import Existing Repository ?')}</a>
14 <a id="remote_clone_toggle" href="#"><i class="icon-download-alt"></i> ${_('Import Existing Repository ?')}</a>
15 </div>
15 </div>
16 %if not c.rhodecode_user.is_admin:
16 %if not c.rhodecode_user.is_admin:
17 ${h.hidden('user_created',True)}
17 ${h.hidden('user_created',True)}
18 %endif
18 %endif
19 </div>
19 </div>
20 </div>
20 </div>
21 <div id="remote_clone" class="field" style="display: none;">
21 <div id="remote_clone" class="field" style="display: none;">
22 <div class="label">
22 <div class="label">
23 <label for="clone_uri">${_('Clone from')}:</label>
23 <label for="clone_uri">${_('Clone from')}:</label>
24 </div>
24 </div>
25 <div class="input">
25 <div class="input">
26 ${h.text('clone_uri', class_="medium")}
26 ${h.text('clone_uri', class_="medium")}
27 <span class="help-block">
27 <span class="help-block">
28 <pre>
28 <pre>
29 - The repository must be accessible over http:// or https://
29 - The repository must be accessible over http:// or https://
30 - For Git projects it's recommended appending .git to the end of clone url.
30 - For Git projects it's recommended appending .git to the end of clone url.
31 - Make sure to select proper repository type from the below selector before importing it.
31 - Make sure to select proper repository type from the below selector before importing it.
32 - If your HTTP[S] repository is not publicly accessible,
32 - If your HTTP[S] repository is not publicly accessible,
33 add authentication information to the URL: https://username:password@server.company.com/repo-name.
33 add authentication information to the URL: https://username:password@server.company.com/repo-name.
34 - The Git LFS/Mercurial Largefiles objects will not be imported.
34 - The Git LFS/Mercurial Largefiles objects will not be imported.
35 - For very large repositories, it's recommended to manually copy them into the
35 - For very large repositories, it's recommended to manually copy them into the
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>.
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 </pre>
37 </pre>
38 </span>
38 </span>
39 </div>
39 </div>
40 </div>
40 </div>
41 <div class="field">
41 <div class="field">
42 <div class="label">
42 <div class="label">
43 <label for="repo_description">${_('Description')}:</label>
43 <label for="repo_description">${_('Description')}:</label>
44 </div>
44 </div>
45 <div class="textarea editor">
45 <div class="textarea editor">
46 ${h.textarea('repo_description')}
46 ${h.textarea('repo_description')}
47 <% metatags_url = h.literal('''<a href="#metatagsShow" onclick="$('#meta-tags-desc').toggle();return false">meta-tags</a>''') %>
47 <% metatags_url = h.literal('''<a href="#metatagsShow" onclick="$('#meta-tags-desc').toggle();return false">meta-tags</a>''') %>
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>
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 <span id="meta-tags-desc" style="display: none">
49 <span id="meta-tags-desc" style="display: none">
50 <%namespace name="dt" file="/data_table/_dt_elements.mako"/>
50 <%namespace name="dt" file="/data_table/_dt_elements.mako"/>
51 ${dt.metatags_help()}
51 ${dt.metatags_help()}
52 </span>
52 </span>
53 </div>
53 </div>
54 </div>
54 </div>
55 <div class="field">
55 <div class="field">
56 <div class="label">
56 <div class="label">
57 <label for="repo_group">${_('Repository Group')}:</label>
57 <label for="repo_group">${_('Repository Group')}:</label>
58 </div>
58 </div>
59 <div class="select">
59 <div class="select">
60 ${h.select('repo_group',request.GET.get('parent_group'),c.repo_groups,class_="medium")}
60 ${h.select('repo_group',request.GET.get('parent_group'),c.repo_groups,class_="medium")}
61 % if c.personal_repo_group:
61 % if c.personal_repo_group:
62 <a class="btn" href="#" id="select_my_group" data-personal-group-id="${c.personal_repo_group.group_id}">
62 <a class="btn" href="#" id="select_my_group" data-personal-group-id="${c.personal_repo_group.group_id}">
63 ${_('Select my personal group (%(repo_group_name)s)') % {'repo_group_name': c.personal_repo_group.group_name}}
63 ${_('Select my personal group (%(repo_group_name)s)') % {'repo_group_name': c.personal_repo_group.group_name}}
64 </a>
64 </a>
65 % endif
65 % endif
66 <span class="help-block">${_('Optionally select a group to put this repository into.')}</span>
66 <span class="help-block">${_('Optionally select a group to put this repository into.')}</span>
67 </div>
67 </div>
68 </div>
68 </div>
69 <div id="copy_perms" class="field">
69 <div id="copy_perms" class="field">
70 <div class="label label-checkbox">
70 <div class="label label-checkbox">
71 <label for="repo_copy_permissions">${_('Copy Parent Group Permissions')}:</label>
71 <label for="repo_copy_permissions">${_('Copy Parent Group Permissions')}:</label>
72 </div>
72 </div>
73 <div class="checkboxes">
73 <div class="checkboxes">
74 ${h.checkbox('repo_copy_permissions', value="True", checked="checked")}
74 ${h.checkbox('repo_copy_permissions', value="True", checked="checked")}
75 <span class="help-block">${_('Copy permission set from the parent repository group.')}</span>
75 <span class="help-block">${_('Copy permission set from the parent repository group.')}</span>
76 </div>
76 </div>
77 </div>
77 </div>
78 <div class="field">
78 <div class="field">
79 <div class="label">
79 <div class="label">
80 <label for="repo_type">${_('Type')}:</label>
80 <label for="repo_type">${_('Type')}:</label>
81 </div>
81 </div>
82 <div class="select">
82 <div class="select">
83 ${h.select('repo_type','hg',c.backends)}
83 ${h.select('repo_type','hg',c.backends)}
84 <span class="help-block">${_('Set the type of repository to create.')}</span>
84 <span class="help-block">${_('Set the type of repository to create.')}</span>
85 </div>
85 </div>
86 </div>
86 </div>
87 <div class="field">
87 <div class="field">
88 <div class="label">
88 <div class="label">
89 <label for="repo_landing_rev">${_('Landing commit')}:</label>
89 <label for="repo_landing_rev">${_('Landing commit')}:</label>
90 </div>
90 </div>
91 <div class="select">
91 <div class="select">
92 ${h.select('repo_landing_rev','',c.landing_revs,class_="medium")}
92 ${h.select('repo_landing_rev','',c.landing_revs,class_="medium")}
93 <span class="help-block">${_('The default commit for file pages, downloads, full text search index, and README generation.')}</span>
93 <span class="help-block">${_('The default commit for file pages, downloads, full text search index, and README generation.')}</span>
94 </div>
94 </div>
95 </div>
95 </div>
96 <div class="field">
96 <div class="field">
97 <div class="label label-checkbox">
97 <div class="label label-checkbox">
98 <label for="repo_private">${_('Private Repository')}:</label>
98 <label for="repo_private">${_('Private Repository')}:</label>
99 </div>
99 </div>
100 <div class="checkboxes">
100 <div class="checkboxes">
101 ${h.checkbox('repo_private',value="True")}
101 ${h.checkbox('repo_private',value="True")}
102 <span class="help-block">${_('Private repositories are only visible to people explicitly added as collaborators.')}</span>
102 <span class="help-block">${_('Private repositories are only visible to people explicitly added as collaborators.')}</span>
103 </div>
103 </div>
104 </div>
104 </div>
105 <div class="buttons">
105 <div class="buttons">
106 ${h.submit('save',_('Save'),class_="btn")}
106 ${h.submit('save',_('Save'),class_="btn")}
107 </div>
107 </div>
108 </div>
108 </div>
109 </div>
109 </div>
110 <script>
110 <script>
111 $(document).ready(function(){
111 $(document).ready(function(){
112 var setCopyPermsOption = function(group_val){
112 var setCopyPermsOption = function(group_val){
113 if(group_val != "-1"){
113 if(group_val != "-1"){
114 $('#copy_perms').show()
114 $('#copy_perms').show()
115 }
115 }
116 else{
116 else{
117 $('#copy_perms').hide();
117 $('#copy_perms').hide();
118 }
118 }
119 };
119 };
120
120
121 $('#remote_clone_toggle').on('click', function(e){
121 $('#remote_clone_toggle').on('click', function(e){
122 $('#remote_clone').show();
122 $('#remote_clone').show();
123 e.preventDefault();
123 e.preventDefault();
124 });
124 });
125
125
126 if($('#remote_clone input').hasClass('error')){
126 if($('#remote_clone input').hasClass('error')){
127 $('#remote_clone').show();
127 $('#remote_clone').show();
128 }
128 }
129 if($('#remote_clone input').val()){
129 if($('#remote_clone input').val()){
130 $('#remote_clone').show();
130 $('#remote_clone').show();
131 }
131 }
132
132
133 $("#repo_group").select2({
133 $("#repo_group").select2({
134 'containerCssClass': "drop-menu",
134 'containerCssClass': "drop-menu",
135 'dropdownCssClass': "drop-menu-dropdown",
135 'dropdownCssClass': "drop-menu-dropdown",
136 'dropdownAutoWidth': true,
136 'dropdownAutoWidth': true,
137 'width': "resolve"
137 'width': "resolve"
138 });
138 });
139
139
140 setCopyPermsOption($('#repo_group').val());
140 setCopyPermsOption($('#repo_group').val());
141 $("#repo_group").on("change", function(e) {
141 $("#repo_group").on("change", function(e) {
142 setCopyPermsOption(e.val)
142 setCopyPermsOption(e.val)
143 });
143 });
144
144
145 $("#repo_type").select2({
145 $("#repo_type").select2({
146 'containerCssClass': "drop-menu",
146 'containerCssClass': "drop-menu",
147 'dropdownCssClass': "drop-menu-dropdown",
147 'dropdownCssClass': "drop-menu-dropdown",
148 'minimumResultsForSearch': -1,
148 'minimumResultsForSearch': -1,
149 });
149 });
150 $("#repo_landing_rev").select2({
150 $("#repo_landing_rev").select2({
151 'containerCssClass': "drop-menu",
151 'containerCssClass': "drop-menu",
152 'dropdownCssClass': "drop-menu-dropdown",
152 'dropdownCssClass': "drop-menu-dropdown",
153 'minimumResultsForSearch': -1,
153 'minimumResultsForSearch': -1,
154 });
154 });
155 $('#repo_name').focus();
155 $('#repo_name').focus();
156
156
157 $('#select_my_group').on('click', function(e){
157 $('#select_my_group').on('click', function(e){
158 e.preventDefault();
158 e.preventDefault();
159 $("#repo_group").val($(this).data('personalGroupId')).trigger("change");
159 $("#repo_group").val($(this).data('personalGroupId')).trigger("change");
160 })
160 })
161
161
162 })
162 })
163 </script>
163 </script>
164 ${h.end_form()}
164 ${h.end_form()}
@@ -1,210 +1,210 b''
1 <%namespace name="base" file="/base/base.mako"/>
1 <%namespace name="base" file="/base/base.mako"/>
2
2
3 <%
3 <%
4 elems = [
4 elems = [
5 (_('Owner'), lambda:base.gravatar_with_user(c.rhodecode_db_repo.user.email), '', ''),
5 (_('Owner'), lambda:base.gravatar_with_user(c.rhodecode_db_repo.user.email), '', ''),
6 (_('Created on'), h.format_date(c.rhodecode_db_repo.created_on), '', ''),
6 (_('Created on'), h.format_date(c.rhodecode_db_repo.created_on), '', ''),
7 (_('Updated on'), h.format_date(c.rhodecode_db_repo.updated_on), '', ''),
7 (_('Updated on'), h.format_date(c.rhodecode_db_repo.updated_on), '', ''),
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'))), '', ''),
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 <div class="panel panel-default">
12 <div class="panel panel-default">
13 <div class="panel-heading" id="advanced-info" >
13 <div class="panel-heading" id="advanced-info" >
14 <h3 class="panel-title">${_('Repository: %s') % c.rhodecode_db_repo.repo_name} <a class="permalink" href="#advanced-info"> ¶</a></h3>
14 <h3 class="panel-title">${_('Repository: %s') % c.rhodecode_db_repo.repo_name} <a class="permalink" href="#advanced-info"> ¶</a></h3>
15 </div>
15 </div>
16 <div class="panel-body">
16 <div class="panel-body">
17 ${base.dt_info_panel(elems)}
17 ${base.dt_info_panel(elems)}
18 </div>
18 </div>
19 </div>
19 </div>
20
20
21
21
22 <div class="panel panel-default">
22 <div class="panel panel-default">
23 <div class="panel-heading" id="advanced-fork">
23 <div class="panel-heading" id="advanced-fork">
24 <h3 class="panel-title">${_('Fork Reference')} <a class="permalink" href="#advanced-fork"> ¶</a></h3>
24 <h3 class="panel-title">${_('Fork Reference')} <a class="permalink" href="#advanced-fork"> ¶</a></h3>
25 </div>
25 </div>
26 <div class="panel-body">
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 % if c.rhodecode_db_repo.fork:
29 % if c.rhodecode_db_repo.fork:
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))})}
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 | <button class="btn btn-link btn-danger" type="submit">Remove fork reference</button></div>
31 | <button class="btn btn-link btn-danger" type="submit">Remove fork reference</button></div>
32 % endif
32 % endif
33
33
34 <div class="field">
34 <div class="field">
35 ${h.hidden('id_fork_of')}
35 ${h.hidden('id_fork_of')}
36 ${h.submit('set_as_fork_%s' % c.rhodecode_db_repo.repo_name,_('Set'),class_="btn btn-small",)}
36 ${h.submit('set_as_fork_%s' % c.rhodecode_db_repo.repo_name,_('Set'),class_="btn btn-small",)}
37 </div>
37 </div>
38 <div class="field">
38 <div class="field">
39 <span class="help-block">${_('Manually set this repository as a fork of another from the list')}</span>
39 <span class="help-block">${_('Manually set this repository as a fork of another from the list')}</span>
40 </div>
40 </div>
41 ${h.end_form()}
41 ${h.end_form()}
42 </div>
42 </div>
43 </div>
43 </div>
44
44
45
45
46 <div class="panel panel-default">
46 <div class="panel panel-default">
47 <div class="panel-heading" id="advanced-journal">
47 <div class="panel-heading" id="advanced-journal">
48 <h3 class="panel-title">${_('Public Journal Visibility')} <a class="permalink" href="#advanced-journal"> ¶</a></h3>
48 <h3 class="panel-title">${_('Public Journal Visibility')} <a class="permalink" href="#advanced-journal"> ¶</a></h3>
49 </div>
49 </div>
50 <div class="panel-body">
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 <div class="field">
52 <div class="field">
53 %if c.in_public_journal:
53 %if c.in_public_journal:
54 <button class="btn btn-small" type="submit">
54 <button class="btn btn-small" type="submit">
55 ${_('Remove from Public Journal')}
55 ${_('Remove from Public Journal')}
56 </button>
56 </button>
57 %else:
57 %else:
58 <button class="btn btn-small" type="submit">
58 <button class="btn btn-small" type="submit">
59 ${_('Add to Public Journal')}
59 ${_('Add to Public Journal')}
60 </button>
60 </button>
61 %endif
61 %endif
62 </div>
62 </div>
63 <div class="field" >
63 <div class="field" >
64 <span class="help-block">${_('All actions made on this repository will be visible to everyone following the public journal.')}</span>
64 <span class="help-block">${_('All actions made on this repository will be visible to everyone following the public journal.')}</span>
65 </div>
65 </div>
66 ${h.end_form()}
66 ${h.end_form()}
67 </div>
67 </div>
68 </div>
68 </div>
69
69
70
70
71 <div class="panel panel-default">
71 <div class="panel panel-default">
72 <div class="panel-heading" id="advanced-locking">
72 <div class="panel-heading" id="advanced-locking">
73 <h3 class="panel-title">${_('Locking state')} <a class="permalink" href="#advanced-locking"> ¶</a></h3>
73 <h3 class="panel-title">${_('Locking state')} <a class="permalink" href="#advanced-locking"> ¶</a></h3>
74 </div>
74 </div>
75 <div class="panel-body">
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 %if c.rhodecode_db_repo.locked[0]:
78 %if c.rhodecode_db_repo.locked[0]:
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]),
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 h.format_date(h. time_to_datetime(c.rhodecode_db_repo.locked[1])), c.rhodecode_db_repo.locked[2])}</div>
80 h.format_date(h. time_to_datetime(c.rhodecode_db_repo.locked[1])), c.rhodecode_db_repo.locked[2])}</div>
81 %else:
81 %else:
82 <div class="panel-body-title-text">${_('This Repository is not currently locked.')}</div>
82 <div class="panel-body-title-text">${_('This Repository is not currently locked.')}</div>
83 %endif
83 %endif
84
84
85 <div class="field" >
85 <div class="field" >
86 %if c.rhodecode_db_repo.locked[0]:
86 %if c.rhodecode_db_repo.locked[0]:
87 ${h.hidden('set_unlock', '1')}
87 ${h.hidden('set_unlock', '1')}
88 <button class="btn btn-small" type="submit"
88 <button class="btn btn-small" type="submit"
89 onclick="return confirm('${_('Confirm to unlock repository.')}');">
89 onclick="return confirm('${_('Confirm to unlock repository.')}');">
90 <i class="icon-unlock"></i>
90 <i class="icon-unlock"></i>
91 ${_('Unlock repository')}
91 ${_('Unlock repository')}
92 </button>
92 </button>
93 %else:
93 %else:
94 ${h.hidden('set_lock', '1')}
94 ${h.hidden('set_lock', '1')}
95 <button class="btn btn-small" type="submit"
95 <button class="btn btn-small" type="submit"
96 onclick="return confirm('${_('Confirm to lock repository.')}');">
96 onclick="return confirm('${_('Confirm to lock repository.')}');">
97 <i class="icon-lock"></i>
97 <i class="icon-lock"></i>
98 ${_('Lock Repository')}
98 ${_('Lock Repository')}
99 </button>
99 </button>
100 %endif
100 %endif
101 </div>
101 </div>
102 <div class="field" >
102 <div class="field" >
103 <span class="help-block">
103 <span class="help-block">
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.')}
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 </span>
105 </span>
106 </div>
106 </div>
107 ${h.end_form()}
107 ${h.end_form()}
108 </div>
108 </div>
109 </div>
109 </div>
110
110
111 <div class="panel panel-danger">
111 <div class="panel panel-danger">
112 <div class="panel-heading" id="advanced-delete">
112 <div class="panel-heading" id="advanced-delete">
113 <h3 class="panel-title">${_('Delete repository')} <a class="permalink" href="#advanced-delete"> ¶</a></h3>
113 <h3 class="panel-title">${_('Delete repository')} <a class="permalink" href="#advanced-delete"> ¶</a></h3>
114 </div>
114 </div>
115 <div class="panel-body">
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 <table class="display">
117 <table class="display">
118 <tr>
118 <tr>
119 <td>
119 <td>
120 ${_ungettext('This repository has %s fork.', 'This repository has %s forks.', c.rhodecode_db_repo.forks.count()) % c.rhodecode_db_repo.forks.count()}
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 </td>
121 </td>
122 <td>
122 <td>
123 %if c.rhodecode_db_repo.forks.count():
123 %if c.rhodecode_db_repo.forks.count():
124 <input type="radio" name="forks" value="detach_forks" checked="checked"/> <label for="forks">${_('Detach forks')}</label>
124 <input type="radio" name="forks" value="detach_forks" checked="checked"/> <label for="forks">${_('Detach forks')}</label>
125 %endif
125 %endif
126 </td>
126 </td>
127 <td>
127 <td>
128 %if c.rhodecode_db_repo.forks.count():
128 %if c.rhodecode_db_repo.forks.count():
129 <input type="radio" name="forks" value="delete_forks"/> <label for="forks">${_('Delete forks')}</label>
129 <input type="radio" name="forks" value="delete_forks"/> <label for="forks">${_('Delete forks')}</label>
130 %endif
130 %endif
131 </td>
131 </td>
132 </tr>
132 </tr>
133 </table>
133 </table>
134 <div style="margin: 0 0 20px 0" class="fake-space"></div>
134 <div style="margin: 0 0 20px 0" class="fake-space"></div>
135
135
136 <div class="field">
136 <div class="field">
137 <button class="btn btn-small btn-danger" type="submit"
137 <button class="btn btn-small btn-danger" type="submit"
138 onclick="return confirm('${_('Confirm to delete this repository: %s') % c.repo_name}');">
138 onclick="return confirm('${_('Confirm to delete this repository: %s') % c.repo_name}');">
139 <i class="icon-remove-sign"></i>
139 <i class="icon-remove-sign"></i>
140 ${_('Delete This Repository')}
140 ${_('Delete This Repository')}
141 </button>
141 </button>
142 </div>
142 </div>
143 <div class="field">
143 <div class="field">
144 <span class="help-block">
144 <span class="help-block">
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.')}
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 </span>
146 </span>
147 </div>
147 </div>
148
148
149 ${h.end_form()}
149 ${h.end_form()}
150 </div>
150 </div>
151 </div>
151 </div>
152
152
153
153
154 <script>
154 <script>
155
155
156 var currentRepoId = ${c.rhodecode_db_repo.repo_id};
156 var currentRepoId = ${c.rhodecode_db_repo.repo_id};
157
157
158 var repoTypeFilter = function(data) {
158 var repoTypeFilter = function(data) {
159 var results = [];
159 var results = [];
160
160
161 if (!data.results[0]) {
161 if (!data.results[0]) {
162 return data
162 return data
163 }
163 }
164
164
165 $.each(data.results[0].children, function() {
165 $.each(data.results[0].children, function() {
166 // filter out the SAME repo, it cannot be used as fork of itself
166 // filter out the SAME repo, it cannot be used as fork of itself
167 if (this.obj.repo_id != currentRepoId) {
167 if (this.obj.repo_id != currentRepoId) {
168 this.id = this.obj.repo_id;
168 this.id = this.obj.repo_id;
169 results.push(this)
169 results.push(this)
170 }
170 }
171 });
171 });
172 data.results[0].children = results;
172 data.results[0].children = results;
173 return data;
173 return data;
174 };
174 };
175
175
176 $("#id_fork_of").select2({
176 $("#id_fork_of").select2({
177 cachedDataSource: {},
177 cachedDataSource: {},
178 minimumInputLength: 2,
178 minimumInputLength: 2,
179 placeholder: "${_('Change repository') if c.rhodecode_db_repo.fork else _('Pick repository')}",
179 placeholder: "${_('Change repository') if c.rhodecode_db_repo.fork else _('Pick repository')}",
180 dropdownAutoWidth: true,
180 dropdownAutoWidth: true,
181 containerCssClass: "drop-menu",
181 containerCssClass: "drop-menu",
182 dropdownCssClass: "drop-menu-dropdown",
182 dropdownCssClass: "drop-menu-dropdown",
183 formatResult: formatResult,
183 formatResult: formatResult,
184 query: $.debounce(250, function(query){
184 query: $.debounce(250, function(query){
185 self = this;
185 self = this;
186 var cacheKey = query.term;
186 var cacheKey = query.term;
187 var cachedData = self.cachedDataSource[cacheKey];
187 var cachedData = self.cachedDataSource[cacheKey];
188
188
189 if (cachedData) {
189 if (cachedData) {
190 query.callback({results: cachedData.results});
190 query.callback({results: cachedData.results});
191 } else {
191 } else {
192 $.ajax({
192 $.ajax({
193 url: pyroutes.url('repo_list_data'),
193 url: pyroutes.url('repo_list_data'),
194 data: {'query': query.term, repo_type: '${c.rhodecode_db_repo.repo_type}'},
194 data: {'query': query.term, repo_type: '${c.rhodecode_db_repo.repo_type}'},
195 dataType: 'json',
195 dataType: 'json',
196 type: 'GET',
196 type: 'GET',
197 success: function(data) {
197 success: function(data) {
198 data = repoTypeFilter(data);
198 data = repoTypeFilter(data);
199 self.cachedDataSource[cacheKey] = data;
199 self.cachedDataSource[cacheKey] = data;
200 query.callback({results: data.results});
200 query.callback({results: data.results});
201 },
201 },
202 error: function(data, textStatus, errorThrown) {
202 error: function(data, textStatus, errorThrown) {
203 alert("Error while fetching entries.\nError code {0} ({1}).".format(data.status, data.statusText));
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 </script>
209 </script>
210
210
@@ -1,53 +1,53 b''
1 <div class="panel panel-default">
1 <div class="panel panel-default">
2 <div class="panel-heading">
2 <div class="panel-heading">
3 <h3 class="panel-title">${_('Invalidate Cache for Repository')}</h3>
3 <h3 class="panel-title">${_('Invalidate Cache for Repository')}</h3>
4 </div>
4 </div>
5 <div class="panel-body">
5 <div class="panel-body">
6
6
7 <h4>${_('Manually invalidate the repository cache. On the next access a repository cache will be recreated.')}</h4>
7 <h4>${_('Manually invalidate the repository cache. On the next access a repository cache will be recreated.')}</h4>
8
8
9 <p>
9 <p>
10 ${_('Cache purge can be automated by such api call. Can be called periodically in crontab etc.')}
10 ${_('Cache purge can be automated by such api call. Can be called periodically in crontab etc.')}
11 <br/>
11 <br/>
12 <code>
12 <code>
13 ${h.api_call_example(method='invalidate_cache', args={"repoid": c.rhodecode_db_repo.repo_name})}
13 ${h.api_call_example(method='invalidate_cache', args={"repoid": c.rhodecode_db_repo.repo_name})}
14 </code>
14 </code>
15 </p>
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 <div class="form">
18 <div class="form">
19 <div class="fields">
19 <div class="fields">
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')+"');")}
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 </div>
21 </div>
22 </div>
22 </div>
23 ${h.end_form()}
23 ${h.end_form()}
24
24
25 </div>
25 </div>
26 </div>
26 </div>
27
27
28
28
29 <div class="panel panel-default">
29 <div class="panel panel-default">
30 <div class="panel-heading">
30 <div class="panel-heading">
31 <h3 class="panel-title">
31 <h3 class="panel-title">
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)})}
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 </h3>
33 </h3>
34 </div>
34 </div>
35 <div class="panel-body">
35 <div class="panel-body">
36 <div class="field" >
36 <div class="field" >
37 <table class="rctable edit_cache">
37 <table class="rctable edit_cache">
38 <tr>
38 <tr>
39 <th>${_('Prefix')}</th>
39 <th>${_('Prefix')}</th>
40 <th>${_('Key')}</th>
40 <th>${_('Key')}</th>
41 <th>${_('Active')}</th>
41 <th>${_('Active')}</th>
42 </tr>
42 </tr>
43 %for cache in c.rhodecode_db_repo.cache_keys:
43 %for cache in c.rhodecode_db_repo.cache_keys:
44 <tr>
44 <tr>
45 <td class="td-prefix">${cache.get_prefix() or '-'}</td>
45 <td class="td-prefix">${cache.get_prefix() or '-'}</td>
46 <td class="td-cachekey">${cache.cache_key}</td>
46 <td class="td-cachekey">${cache.cache_key}</td>
47 <td class="td-active">${h.bool2icon(cache.cache_active)}</td>
47 <td class="td-active">${h.bool2icon(cache.cache_active)}</td>
48 </tr>
48 </tr>
49 %endfor
49 %endfor
50 </table>
50 </table>
51 </div>
51 </div>
52 </div>
52 </div>
53 </div>
53 </div>
@@ -1,79 +1,79 b''
1 <div class="panel panel-default">
1 <div class="panel panel-default">
2 <div class="panel-heading">
2 <div class="panel-heading">
3 <h3 class="panel-title">${_('Custom extra fields for this repository')}</h3>
3 <h3 class="panel-title">${_('Custom extra fields for this repository')}</h3>
4 </div>
4 </div>
5 <div class="panel-body">
5 <div class="panel-body">
6 %if c.visual.repository_fields:
6 %if c.visual.repository_fields:
7 %if c.repo_fields:
7 %if c.repo_fields:
8 <div class="emails_wrap">
8 <div class="emails_wrap">
9 <table class="rctable edit_fields">
9 <table class="rctable edit_fields">
10 <th>${_('Label')}</th>
10 <th>${_('Label')}</th>
11 <th>${_('Key')}</th>
11 <th>${_('Key')}</th>
12 <th>${_('Type')}</th>
12 <th>${_('Type')}</th>
13 <th>${_('Action')}</th>
13 <th>${_('Action')}</th>
14
14
15 %for field in c.repo_fields:
15 %for field in c.repo_fields:
16 <tr>
16 <tr>
17 <td class="td-tags">${field.field_label}</td>
17 <td class="td-tags">${field.field_label}</td>
18 <td class="td-hash">${field.field_key}</td>
18 <td class="td-hash">${field.field_key}</td>
19 <td class="td-type">${field.field_type}</td>
19 <td class="td-type">${field.field_type}</td>
20 <td class="td-action">
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 ${h.hidden('del_repo_field',field.repo_field_id)}
22 ${h.hidden('del_repo_field',field.repo_field_id)}
23 <button class="btn btn-link btn-danger" type="submit"
23 <button class="btn btn-link btn-danger" type="submit"
24 onclick="return confirm('${_('Confirm to delete this field: %s') % field.field_key}');">
24 onclick="return confirm('${_('Confirm to delete this field: %s') % field.field_key}');">
25 ${_('Delete')}
25 ${_('Delete')}
26 </button>
26 </button>
27 ${h.end_form()}
27 ${h.end_form()}
28 </td>
28 </td>
29 </tr>
29 </tr>
30 %endfor
30 %endfor
31 </table>
31 </table>
32 </div>
32 </div>
33 %endif
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 <div class="form">
35 <div class="form">
36 <!-- fields -->
36 <!-- fields -->
37 <div class="fields">
37 <div class="fields">
38 <div class="field">
38 <div class="field">
39 <div class="label">
39 <div class="label">
40 <label for="new_field_key">${_('New Field Key')}:</label>
40 <label for="new_field_key">${_('New Field Key')}:</label>
41 </div>
41 </div>
42 <div class="input">
42 <div class="input">
43 ${h.text('new_field_key', class_='medium')}
43 ${h.text('new_field_key', class_='medium')}
44 </div>
44 </div>
45 </div>
45 </div>
46 <div class="field">
46 <div class="field">
47 <div class="label">
47 <div class="label">
48 <label for="new_field_label">${_('New Field Label')}:</label>
48 <label for="new_field_label">${_('New Field Label')}:</label>
49 </div>
49 </div>
50 <div class="input">
50 <div class="input">
51 ${h.text('new_field_label', class_='medium', placeholder=_('Enter short label'))}
51 ${h.text('new_field_label', class_='medium', placeholder=_('Enter short label'))}
52 </div>
52 </div>
53 </div>
53 </div>
54
54
55 <div class="field">
55 <div class="field">
56 <div class="label">
56 <div class="label">
57 <label for="new_field_desc">${_('New Field Description')}:</label>
57 <label for="new_field_desc">${_('New Field Description')}:</label>
58 </div>
58 </div>
59 <div class="input">
59 <div class="input">
60 ${h.text('new_field_desc', class_='medium', placeholder=_('Enter a full description for the field'))}
60 ${h.text('new_field_desc', class_='medium', placeholder=_('Enter a full description for the field'))}
61 </div>
61 </div>
62 </div>
62 </div>
63
63
64 <div class="buttons">
64 <div class="buttons">
65 ${h.submit('save',_('Add'),class_="btn")}
65 ${h.submit('save',_('Add'),class_="btn")}
66 ${h.reset('reset',_('Reset'),class_="btn")}
66 ${h.reset('reset',_('Reset'),class_="btn")}
67 </div>
67 </div>
68 </div>
68 </div>
69 </div>
69 </div>
70 ${h.end_form()}
70 ${h.end_form()}
71 %else:
71 %else:
72 <h2>
72 <h2>
73 ${_('Extra fields are disabled. You can enable them from the Admin/Settings/Visual page.')}
73 ${_('Extra fields are disabled. You can enable them from the Admin/Settings/Visual page.')}
74 </h2>
74 </h2>
75 %endif
75 %endif
76 </div>
76 </div>
77 </div>
77 </div>
78
78
79
79
@@ -1,109 +1,109 b''
1 <%namespace name="its" file="/base/issue_tracker_settings.mako"/>
1 <%namespace name="its" file="/base/issue_tracker_settings.mako"/>
2
2
3 <div id="repo_issue_tracker" class="${'inherited' if c.settings_model.inherit_global_settings else ''}">
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 <div class="panel panel-default panel-body">
5 <div class="panel panel-default panel-body">
6 <div class="fields">
6 <div class="fields">
7 <div class="field">
7 <div class="field">
8 <div class="label label-checkbox">
8 <div class="label label-checkbox">
9 <label for="inherit_default_permissions">${_('Inherit from global settings')}:</label>
9 <label for="inherit_default_permissions">${_('Inherit from global settings')}:</label>
10 </div>
10 </div>
11 <div class="checkboxes">
11 <div class="checkboxes">
12 ${h.checkbox('inherit_global_issuetracker', value='inherited', checked=c.settings_model.inherit_global_settings)}
12 ${h.checkbox('inherit_global_issuetracker', value='inherited', checked=c.settings_model.inherit_global_settings)}
13 <span class="help-block">
13 <span class="help-block">
14 ${h.literal(_('Select to inherit global patterns for issue tracker.'))}
14 ${h.literal(_('Select to inherit global patterns for issue tracker.'))}
15 </span>
15 </span>
16 </div>
16 </div>
17 </div>
17 </div>
18 </div>
18 </div>
19 </div>
19 </div>
20
20
21 <div id="inherit_overlay">
21 <div id="inherit_overlay">
22 <div class="panel panel-default">
22 <div class="panel panel-default">
23 <div class="panel-heading">
23 <div class="panel-heading">
24 <h3 class="panel-title">${_('Inherited Issue Tracker Patterns')}</h3>
24 <h3 class="panel-title">${_('Inherited Issue Tracker Patterns')}</h3>
25 </div>
25 </div>
26 <div class="panel-body">
26 <div class="panel-body">
27 <table class="rctable issuetracker readonly">
27 <table class="rctable issuetracker readonly">
28 <tr>
28 <tr>
29 <th>${_('Description')}</th>
29 <th>${_('Description')}</th>
30 <th>${_('Pattern')}</th>
30 <th>${_('Pattern')}</th>
31 <th>${_('Url')}</th>
31 <th>${_('Url')}</th>
32 <th>${_('Prefix')}</th>
32 <th>${_('Prefix')}</th>
33 <th ></th>
33 <th ></th>
34 </tr>
34 </tr>
35 %for uid, entry in c.global_patterns.items():
35 %for uid, entry in c.global_patterns.items():
36 <tr id="${uid}">
36 <tr id="${uid}">
37 <td class="td-description issuetracker_desc">
37 <td class="td-description issuetracker_desc">
38 <span class="entry">
38 <span class="entry">
39 ${entry.desc}
39 ${entry.desc}
40 </span>
40 </span>
41 </td>
41 </td>
42 <td class="td-regex issuetracker_pat">
42 <td class="td-regex issuetracker_pat">
43 <span class="entry">
43 <span class="entry">
44 ${entry.pat}
44 ${entry.pat}
45 </span>
45 </span>
46 </td>
46 </td>
47 <td class="td-url issuetracker_url">
47 <td class="td-url issuetracker_url">
48 <span class="entry">
48 <span class="entry">
49 ${entry.url}
49 ${entry.url}
50 </span>
50 </span>
51 </td>
51 </td>
52 <td class="td-prefix issuetracker_pref">
52 <td class="td-prefix issuetracker_pref">
53 <span class="entry">
53 <span class="entry">
54 ${entry.pref}
54 ${entry.pref}
55 </span>
55 </span>
56 </td>
56 </td>
57 <td class="td-action">
57 <td class="td-action">
58 </td>
58 </td>
59 </tr>
59 </tr>
60 %endfor
60 %endfor
61
61
62 </table>
62 </table>
63 </div>
63 </div>
64 </div>
64 </div>
65 </div>
65 </div>
66
66
67 <div id="custom_overlay">
67 <div id="custom_overlay">
68 <div class="panel panel-default">
68 <div class="panel panel-default">
69 <div class="panel-heading">
69 <div class="panel-heading">
70 <h3 class="panel-title">${_('Issue Tracker / Wiki Patterns')}</h3>
70 <h3 class="panel-title">${_('Issue Tracker / Wiki Patterns')}</h3>
71 </div>
71 </div>
72 <div class="panel-body">
72 <div class="panel-body">
73 ${its.issue_tracker_settings_table(
73 ${its.issue_tracker_settings_table(
74 patterns=c.repo_patterns.items(),
74 patterns=c.repo_patterns.items(),
75 form_url=h.route_path('edit_repo_issuetracker', repo_name=c.rhodecode_db_repo.repo_name),
75 form_url=h.route_path('edit_repo_issuetracker', repo_name=c.rhodecode_db_repo.repo_name),
76 delete_url=h.route_path('edit_repo_issuetracker_delete', repo_name=c.rhodecode_db_repo.repo_name)
76 delete_url=h.route_path('edit_repo_issuetracker_delete', repo_name=c.rhodecode_db_repo.repo_name)
77 )}
77 )}
78 <div class="buttons">
78 <div class="buttons">
79 <button type="submit" class="btn btn-primary save-inheritance" id="save">${_('Save')}</button>
79 <button type="submit" class="btn btn-primary save-inheritance" id="save">${_('Save')}</button>
80 <button type="reset" class="btn reset-inheritance">${_('Reset')}</button>
80 <button type="reset" class="btn reset-inheritance">${_('Reset')}</button>
81 </div>
81 </div>
82 </div>
82 </div>
83 </div>
83 </div>
84 </div>
84 </div>
85
85
86
86
87 ${h.end_form()}
87 ${h.end_form()}
88
88
89 <div class="panel panel-default">
89 <div class="panel panel-default">
90 <div class="panel-heading">
90 <div class="panel-heading">
91 <h3 class="panel-title">${_('Test Patterns')}</h3>
91 <h3 class="panel-title">${_('Test Patterns')}</h3>
92 </div>
92 </div>
93 <div class="panel-body">
93 <div class="panel-body">
94 ${its.issue_tracker_new_row()}
94 ${its.issue_tracker_new_row()}
95 ${its.issue_tracker_settings_test(test_url=h.route_path('edit_repo_issuetracker_test', repo_name=c.rhodecode_db_repo.repo_name))}
95 ${its.issue_tracker_settings_test(test_url=h.route_path('edit_repo_issuetracker_test', repo_name=c.rhodecode_db_repo.repo_name))}
96 </div>
96 </div>
97 </div>
97 </div>
98
98
99 </div>
99 </div>
100
100
101 <script>
101 <script>
102 $('#inherit_global_issuetracker').on('change', function(e){
102 $('#inherit_global_issuetracker').on('change', function(e){
103 $('#repo_issue_tracker').toggleClass('inherited',this.checked);
103 $('#repo_issue_tracker').toggleClass('inherited',this.checked);
104 });
104 });
105
105
106 $('.reset-inheritance').on('click', function(e){
106 $('.reset-inheritance').on('click', function(e){
107 $('#inherit_global_issuetracker').prop('checked', false).change();
107 $('#inherit_global_issuetracker').prop('checked', false).change();
108 });
108 });
109 </script>
109 </script>
@@ -1,123 +1,123 b''
1 <%namespace name="base" file="/base/base.mako"/>
1 <%namespace name="base" file="/base/base.mako"/>
2
2
3 <div class="panel panel-default">
3 <div class="panel panel-default">
4 <div class="panel-heading">
4 <div class="panel-heading">
5 <h3 class="panel-title">${_('Repository Permissions')}</h3>
5 <h3 class="panel-title">${_('Repository Permissions')}</h3>
6 </div>
6 </div>
7 <div class="panel-body">
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 <table id="permissions_manage" class="rctable permissions">
9 <table id="permissions_manage" class="rctable permissions">
10 <tr>
10 <tr>
11 <th class="td-radio">${_('None')}</th>
11 <th class="td-radio">${_('None')}</th>
12 <th class="td-radio">${_('Read')}</th>
12 <th class="td-radio">${_('Read')}</th>
13 <th class="td-radio">${_('Write')}</th>
13 <th class="td-radio">${_('Write')}</th>
14 <th class="td-radio">${_('Admin')}</th>
14 <th class="td-radio">${_('Admin')}</th>
15 <th class="td-owner">${_('User/User Group')}</th>
15 <th class="td-owner">${_('User/User Group')}</th>
16 <th></th>
16 <th></th>
17 </tr>
17 </tr>
18 ## USERS
18 ## USERS
19 %for _user in c.rhodecode_db_repo.permissions():
19 %for _user in c.rhodecode_db_repo.permissions():
20 %if getattr(_user, 'admin_row', None) or getattr(_user, 'owner_row', None):
20 %if getattr(_user, 'admin_row', None) or getattr(_user, 'owner_row', None):
21 <tr class="perm_admin_row">
21 <tr class="perm_admin_row">
22 <td class="td-radio">${h.radio('admin_perm_%s' % _user.user_id,'repository.none', disabled="disabled")}</td>
22 <td class="td-radio">${h.radio('admin_perm_%s' % _user.user_id,'repository.none', disabled="disabled")}</td>
23 <td class="td-radio">${h.radio('admin_perm_%s' % _user.user_id,'repository.read', disabled="disabled")}</td>
23 <td class="td-radio">${h.radio('admin_perm_%s' % _user.user_id,'repository.read', disabled="disabled")}</td>
24 <td class="td-radio">${h.radio('admin_perm_%s' % _user.user_id,'repository.write', disabled="disabled")}</td>
24 <td class="td-radio">${h.radio('admin_perm_%s' % _user.user_id,'repository.write', disabled="disabled")}</td>
25 <td class="td-radio">${h.radio('admin_perm_%s' % _user.user_id,'repository.admin', 'repository.admin', disabled="disabled")}</td>
25 <td class="td-radio">${h.radio('admin_perm_%s' % _user.user_id,'repository.admin', 'repository.admin', disabled="disabled")}</td>
26 <td class="td-user">
26 <td class="td-user">
27 ${base.gravatar(_user.email, 16)}
27 ${base.gravatar(_user.email, 16)}
28 ${h.link_to_user(_user.username)}
28 ${h.link_to_user(_user.username)}
29 %if getattr(_user, 'admin_row', None):
29 %if getattr(_user, 'admin_row', None):
30 (${_('super admin')})
30 (${_('super admin')})
31 %endif
31 %endif
32 %if getattr(_user, 'owner_row', None):
32 %if getattr(_user, 'owner_row', None):
33 (${_('owner')})
33 (${_('owner')})
34 %endif
34 %endif
35 </td>
35 </td>
36 <td></td>
36 <td></td>
37 </tr>
37 </tr>
38 %elif _user.username == h.DEFAULT_USER and c.rhodecode_db_repo.private:
38 %elif _user.username == h.DEFAULT_USER and c.rhodecode_db_repo.private:
39 <tr>
39 <tr>
40 <td colspan="4">
40 <td colspan="4">
41 <span class="private_repo_msg">
41 <span class="private_repo_msg">
42 <strong title="${h.tooltip(_user.permission)}">${_('private repository')}</strong>
42 <strong title="${h.tooltip(_user.permission)}">${_('private repository')}</strong>
43 </span>
43 </span>
44 </td>
44 </td>
45 <td class="private_repo_msg">
45 <td class="private_repo_msg">
46 ${base.gravatar(h.DEFAULT_USER_EMAIL, 16)}
46 ${base.gravatar(h.DEFAULT_USER_EMAIL, 16)}
47 ${h.DEFAULT_USER} - ${_('only users/user groups explicitly added here will have access')}</td>
47 ${h.DEFAULT_USER} - ${_('only users/user groups explicitly added here will have access')}</td>
48 <td></td>
48 <td></td>
49 </tr>
49 </tr>
50 %else:
50 %else:
51 <tr>
51 <tr>
52 <td class="td-radio">${h.radio('u_perm_%s' % _user.user_id,'repository.none', checked=_user.permission=='repository.none')}</td>
52 <td class="td-radio">${h.radio('u_perm_%s' % _user.user_id,'repository.none', checked=_user.permission=='repository.none')}</td>
53 <td class="td-radio">${h.radio('u_perm_%s' % _user.user_id,'repository.read', checked=_user.permission=='repository.read')}</td>
53 <td class="td-radio">${h.radio('u_perm_%s' % _user.user_id,'repository.read', checked=_user.permission=='repository.read')}</td>
54 <td class="td-radio">${h.radio('u_perm_%s' % _user.user_id,'repository.write', checked=_user.permission=='repository.write')}</td>
54 <td class="td-radio">${h.radio('u_perm_%s' % _user.user_id,'repository.write', checked=_user.permission=='repository.write')}</td>
55 <td class="td-radio">${h.radio('u_perm_%s' % _user.user_id,'repository.admin', checked=_user.permission=='repository.admin')}</td>
55 <td class="td-radio">${h.radio('u_perm_%s' % _user.user_id,'repository.admin', checked=_user.permission=='repository.admin')}</td>
56 <td class="td-user">
56 <td class="td-user">
57 ${base.gravatar(_user.email, 16)}
57 ${base.gravatar(_user.email, 16)}
58 <span class="user">
58 <span class="user">
59 % if _user.username == h.DEFAULT_USER:
59 % if _user.username == h.DEFAULT_USER:
60 ${h.DEFAULT_USER} <span class="user-perm-help-text"> - ${_('permission for all other users')}</span>
60 ${h.DEFAULT_USER} <span class="user-perm-help-text"> - ${_('permission for all other users')}</span>
61 % else:
61 % else:
62 ${h.link_to_user(_user.username)}
62 ${h.link_to_user(_user.username)}
63 % endif
63 % endif
64 </span>
64 </span>
65 </td>
65 </td>
66 <td class="td-action">
66 <td class="td-action">
67 %if _user.username != h.DEFAULT_USER:
67 %if _user.username != h.DEFAULT_USER:
68 <span class="btn btn-link btn-danger revoke_perm"
68 <span class="btn btn-link btn-danger revoke_perm"
69 member="${_user.user_id}" member_type="user">
69 member="${_user.user_id}" member_type="user">
70 <i class="icon-remove"></i> ${_('Revoke')}
70 <i class="icon-remove"></i> ${_('Revoke')}
71 </span>
71 </span>
72 %endif
72 %endif
73 </td>
73 </td>
74 </tr>
74 </tr>
75 %endif
75 %endif
76 %endfor
76 %endfor
77
77
78 ## USER GROUPS
78 ## USER GROUPS
79 %for _user_group in c.rhodecode_db_repo.permission_user_groups():
79 %for _user_group in c.rhodecode_db_repo.permission_user_groups():
80 <tr>
80 <tr>
81 <td class="td-radio">${h.radio('g_perm_%s' % _user_group.users_group_id,'repository.none', checked=_user_group.permission=='repository.none')}</td>
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 <td class="td-radio">${h.radio('g_perm_%s' % _user_group.users_group_id,'repository.read', checked=_user_group.permission=='repository.read')}</td>
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 <td class="td-radio">${h.radio('g_perm_%s' % _user_group.users_group_id,'repository.write', checked=_user_group.permission=='repository.write')}</td>
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 <td class="td-radio">${h.radio('g_perm_%s' % _user_group.users_group_id,'repository.admin', checked=_user_group.permission=='repository.admin')}</td>
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 <td class="td-componentname">
85 <td class="td-componentname">
86 <i class="icon-group" ></i>
86 <i class="icon-group" ></i>
87 %if h.HasPermissionAny('hg.admin')():
87 %if h.HasPermissionAny('hg.admin')():
88 <a href="${h.route_path('edit_user_group',user_group_id=_user_group.users_group_id)}">
88 <a href="${h.route_path('edit_user_group',user_group_id=_user_group.users_group_id)}">
89 ${_user_group.users_group_name}
89 ${_user_group.users_group_name}
90 </a>
90 </a>
91 %else:
91 %else:
92 ${_user_group.users_group_name}
92 ${_user_group.users_group_name}
93 %endif
93 %endif
94 </td>
94 </td>
95 <td class="td-action">
95 <td class="td-action">
96 <span class="btn btn-link btn-danger revoke_perm"
96 <span class="btn btn-link btn-danger revoke_perm"
97 member="${_user_group.users_group_id}" member_type="user_group">
97 member="${_user_group.users_group_id}" member_type="user_group">
98 <i class="icon-remove"></i> ${_('Revoke')}
98 <i class="icon-remove"></i> ${_('Revoke')}
99 </span>
99 </span>
100 </td>
100 </td>
101 </tr>
101 </tr>
102 %endfor
102 %endfor
103 <tr class="new_members" id="add_perm_input"></tr>
103 <tr class="new_members" id="add_perm_input"></tr>
104 </table>
104 </table>
105 <div id="add_perm" class="link">
105 <div id="add_perm" class="link">
106 ${_('Add new')}
106 ${_('Add new')}
107 </div>
107 </div>
108 <div class="buttons">
108 <div class="buttons">
109 ${h.submit('save',_('Save'),class_="btn btn-primary")}
109 ${h.submit('save',_('Save'),class_="btn btn-primary")}
110 ${h.reset('reset',_('Reset'),class_="btn btn-danger")}
110 ${h.reset('reset',_('Reset'),class_="btn btn-danger")}
111 </div>
111 </div>
112 ${h.end_form()}
112 ${h.end_form()}
113 </div>
113 </div>
114 </div>
114 </div>
115
115
116 <script type="text/javascript">
116 <script type="text/javascript">
117 $('#add_perm').on('click', function(e){
117 $('#add_perm').on('click', function(e){
118 addNewPermInput($(this), 'repository');
118 addNewPermInput($(this), 'repository');
119 });
119 });
120 $('.revoke_perm').on('click', function(e){
120 $('.revoke_perm').on('click', function(e){
121 markRevokePermInput($(this), 'repository');
121 markRevokePermInput($(this), 'repository');
122 });
122 });
123 </script>
123 </script>
@@ -1,40 +1,40 b''
1 <div class="panel panel-default">
1 <div class="panel panel-default">
2 <div class="panel-heading">
2 <div class="panel-heading">
3 <h3 class="panel-title">${_('Remote url')}</h3>
3 <h3 class="panel-title">${_('Remote url')}</h3>
4 </div>
4 </div>
5 <div class="panel-body">
5 <div class="panel-body">
6
6
7 <h4>${_('Manually pull changes from external repository.')}</h4>
7 <h4>${_('Manually pull changes from external repository.')}</h4>
8
8
9 %if c.rhodecode_db_repo.clone_uri:
9 %if c.rhodecode_db_repo.clone_uri:
10
10
11 ${_('Remote mirror url')}:
11 ${_('Remote mirror url')}:
12 <a href="${c.rhodecode_db_repo.clone_uri}">${c.rhodecode_db_repo.clone_uri_hidden}</a>
12 <a href="${c.rhodecode_db_repo.clone_uri}">${c.rhodecode_db_repo.clone_uri_hidden}</a>
13
13
14 <p>
14 <p>
15 ${_('Pull can be automated by such api call. Can be called periodically in crontab etc.')}
15 ${_('Pull can be automated by such api call. Can be called periodically in crontab etc.')}
16 <br/>
16 <br/>
17 <code>
17 <code>
18 ${h.api_call_example(method='pull', args={"repoid": c.rhodecode_db_repo.repo_name})}
18 ${h.api_call_example(method='pull', args={"repoid": c.rhodecode_db_repo.repo_name})}
19 </code>
19 </code>
20 </p>
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 <div class="form">
23 <div class="form">
24 <div class="fields">
24 <div class="fields">
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')+"');")}
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 </div>
26 </div>
27 </div>
27 </div>
28 ${h.end_form()}
28 ${h.end_form()}
29 %else:
29 %else:
30
30
31 ${_('This repository does not have any remote mirror url set.')}
31 ${_('This repository does not have any remote mirror url set.')}
32 <a href="${h.route_path('edit_repo', repo_name=c.rhodecode_db_repo.repo_name)}">${_('Set remote url.')}</a>
32 <a href="${h.route_path('edit_repo', repo_name=c.rhodecode_db_repo.repo_name)}">${_('Set remote url.')}</a>
33 <br/>
33 <br/>
34 <br/>
34 <br/>
35 <button class="btn disabled" type="submit" disabled="disabled">
35 <button class="btn disabled" type="submit" disabled="disabled">
36 ${_('Pull changes from remote location')}
36 ${_('Pull changes from remote location')}
37 </button>
37 </button>
38 %endif
38 %endif
39 </div>
39 </div>
40 </div>
40 </div>
@@ -1,266 +1,266 b''
1 ## -*- coding: utf-8 -*-
1 ## -*- coding: utf-8 -*-
2 <%namespace name="base" file="/base/base.mako"/>
2 <%namespace name="base" file="/base/base.mako"/>
3
3
4 <div class="panel panel-default">
4 <div class="panel panel-default">
5 <div class="panel-heading">
5 <div class="panel-heading">
6 <h3 class="panel-title">${_('Settings for Repository: %s') % c.rhodecode_db_repo.repo_name}</h3>
6 <h3 class="panel-title">${_('Settings for Repository: %s') % c.rhodecode_db_repo.repo_name}</h3>
7 </div>
7 </div>
8 <div class="panel-body">
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 <div class="form">
10 <div class="form">
11 <!-- fields -->
11 <!-- fields -->
12 <div class="fields">
12 <div class="fields">
13
13
14 <div class="field">
14 <div class="field">
15 <div class="label">
15 <div class="label">
16 <label for="repo_name">${_('Name')}:</label>
16 <label for="repo_name">${_('Name')}:</label>
17 </div>
17 </div>
18 <div class="input">
18 <div class="input">
19 ${c.form['repo_name'].render(css_class='medium', oid='repo_name')|n}
19 ${c.form['repo_name'].render(css_class='medium', oid='repo_name')|n}
20 ${c.form.render_error(request, c.form['repo_name'])|n}
20 ${c.form.render_error(request, c.form['repo_name'])|n}
21
21
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>
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 <p id="clone_id" style="display:none;">
23 <p id="clone_id" style="display:none;">
24 ${_('URL by id')}: `${c.rhodecode_db_repo.clone_url(with_id=True)}` <br/>
24 ${_('URL by id')}: `${c.rhodecode_db_repo.clone_url(with_id=True)}` <br/>
25 ${_('''In case this repository is renamed or moved into another group the repository url changes.
25 ${_('''In case this repository is renamed or moved into another group the repository url changes.
26 Using above url guarantees that this repository will always be accessible under such url.
26 Using above url guarantees that this repository will always be accessible under such url.
27 Useful for CI systems, or any other cases that you need to hardcode the url into 3rd party service.''')}</p>
27 Useful for CI systems, or any other cases that you need to hardcode the url into 3rd party service.''')}</p>
28 </div>
28 </div>
29 </div>
29 </div>
30
30
31 <div class="field">
31 <div class="field">
32 <div class="label">
32 <div class="label">
33 <label for="repo_group">${_('Repository group')}:</label>
33 <label for="repo_group">${_('Repository group')}:</label>
34 </div>
34 </div>
35 <div class="select">
35 <div class="select">
36 ${c.form['repo_group'].render(css_class='medium', oid='repo_group')|n}
36 ${c.form['repo_group'].render(css_class='medium', oid='repo_group')|n}
37 ${c.form.render_error(request, c.form['repo_group'])|n}
37 ${c.form.render_error(request, c.form['repo_group'])|n}
38
38
39 % if c.personal_repo_group:
39 % if c.personal_repo_group:
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">
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 ${_('Select my personal group (`%(repo_group_name)s`)') % {'repo_group_name': c.personal_repo_group.group_name}}
41 ${_('Select my personal group (`%(repo_group_name)s`)') % {'repo_group_name': c.personal_repo_group.group_name}}
42 </a>
42 </a>
43 % endif
43 % endif
44 <p class="help-block">${_('Optional select a group to put this repository into.')}</p>
44 <p class="help-block">${_('Optional select a group to put this repository into.')}</p>
45 </div>
45 </div>
46 </div>
46 </div>
47
47
48 % if c.rhodecode_db_repo.repo_type != 'svn':
48 % if c.rhodecode_db_repo.repo_type != 'svn':
49 <div class="field">
49 <div class="field">
50 <div class="label">
50 <div class="label">
51 <label for="clone_uri">${_('Remote uri')}:</label>
51 <label for="clone_uri">${_('Remote uri')}:</label>
52 </div>
52 </div>
53 <div class="input">
53 <div class="input">
54 %if c.rhodecode_db_repo.clone_uri:
54 %if c.rhodecode_db_repo.clone_uri:
55 ## display, if we don't have any errors
55 ## display, if we don't have any errors
56 % if not c.form['repo_clone_uri'].error:
56 % if not c.form['repo_clone_uri'].error:
57 <div id="clone_uri_hidden" class='text-as-placeholder'>
57 <div id="clone_uri_hidden" class='text-as-placeholder'>
58 <span id="clone_uri_hidden_value">${c.rhodecode_db_repo.clone_uri_hidden}</span>
58 <span id="clone_uri_hidden_value">${c.rhodecode_db_repo.clone_uri_hidden}</span>
59 <span class="link" id="edit_clone_uri"><i class="icon-edit"></i>${_('edit')}</span>
59 <span class="link" id="edit_clone_uri"><i class="icon-edit"></i>${_('edit')}</span>
60 </div>
60 </div>
61 % endif
61 % endif
62
62
63 ## alter field
63 ## alter field
64 <div id="alter_clone_uri" style="${'' if c.form['repo_clone_uri'].error else 'display: none'}">
64 <div id="alter_clone_uri" style="${'' if c.form['repo_clone_uri'].error else 'display: none'}">
65 ${c.form['repo_clone_uri'].render(css_class='medium', oid='clone_uri', placeholder=_('enter new value, or leave empty to remove'))|n}
65 ${c.form['repo_clone_uri'].render(css_class='medium', oid='clone_uri', placeholder=_('enter new value, or leave empty to remove'))|n}
66 ${c.form.render_error(request, c.form['repo_clone_uri'])|n}
66 ${c.form.render_error(request, c.form['repo_clone_uri'])|n}
67 % if c.form['repo_clone_uri'].error:
67 % if c.form['repo_clone_uri'].error:
68 ## we got error from form subit, means we modify the url
68 ## we got error from form subit, means we modify the url
69 ${h.hidden('repo_clone_uri_change', 'MOD')}
69 ${h.hidden('repo_clone_uri_change', 'MOD')}
70 % else:
70 % else:
71 ${h.hidden('repo_clone_uri_change', 'OLD')}
71 ${h.hidden('repo_clone_uri_change', 'OLD')}
72 % endif
72 % endif
73
73
74 % if not c.form['repo_clone_uri'].error:
74 % if not c.form['repo_clone_uri'].error:
75 <span class="link" id="cancel_edit_clone_uri">${_('cancel')}</span>
75 <span class="link" id="cancel_edit_clone_uri">${_('cancel')}</span>
76 % endif
76 % endif
77
77
78 </div>
78 </div>
79 %else:
79 %else:
80 ## not set yet, display form to set it
80 ## not set yet, display form to set it
81 ${c.form['repo_clone_uri'].render(css_class='medium', oid='clone_uri')|n}
81 ${c.form['repo_clone_uri'].render(css_class='medium', oid='clone_uri')|n}
82 ${c.form.render_error(request, c.form['repo_clone_uri'])|n}
82 ${c.form.render_error(request, c.form['repo_clone_uri'])|n}
83 ${h.hidden('repo_clone_uri_change', 'NEW')}
83 ${h.hidden('repo_clone_uri_change', 'NEW')}
84 %endif
84 %endif
85 <p id="alter_clone_uri_help_block" class="help-block">
85 <p id="alter_clone_uri_help_block" class="help-block">
86 <% pull_link = h.literal(h.link_to('remote sync', h.route_path('edit_repo_remote', repo_name=c.repo_name))) %>
86 <% pull_link = h.literal(h.link_to('remote sync', h.route_path('edit_repo_remote', repo_name=c.repo_name))) %>
87 ${_('http[s] url where from repository was imported, this field can used for doing {pull_link}.').format(pull_link=pull_link)|n} <br/>
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 ${_('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.')}
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 </p>
89 </p>
90 </div>
90 </div>
91 </div>
91 </div>
92 % else:
92 % else:
93 ${h.hidden('repo_clone_uri', '')}
93 ${h.hidden('repo_clone_uri', '')}
94 % endif
94 % endif
95
95
96 <div class="field">
96 <div class="field">
97 <div class="label">
97 <div class="label">
98 <label for="repo_landing_commit_ref">${_('Landing commit')}:</label>
98 <label for="repo_landing_commit_ref">${_('Landing commit')}:</label>
99 </div>
99 </div>
100 <div class="select">
100 <div class="select">
101 ${c.form['repo_landing_commit_ref'].render(css_class='medium', oid='repo_landing_commit_ref')|n}
101 ${c.form['repo_landing_commit_ref'].render(css_class='medium', oid='repo_landing_commit_ref')|n}
102 ${c.form.render_error(request, c.form['repo_landing_commit_ref'])|n}
102 ${c.form.render_error(request, c.form['repo_landing_commit_ref'])|n}
103 <p class="help-block">${_('Default commit for files page, downloads, full text search index and readme')}</p>
103 <p class="help-block">${_('Default commit for files page, downloads, full text search index and readme')}</p>
104 </div>
104 </div>
105 </div>
105 </div>
106
106
107 <div class="field badged-field">
107 <div class="field badged-field">
108 <div class="label">
108 <div class="label">
109 <label for="repo_owner">${_('Owner')}:</label>
109 <label for="repo_owner">${_('Owner')}:</label>
110 </div>
110 </div>
111 <div class="input">
111 <div class="input">
112 <div class="badge-input-container">
112 <div class="badge-input-container">
113 <div class="user-badge">
113 <div class="user-badge">
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)}
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 </div>
115 </div>
116 <div class="badge-input-wrap">
116 <div class="badge-input-wrap">
117 ${c.form['repo_owner'].render(css_class='medium', oid='repo_owner')|n}
117 ${c.form['repo_owner'].render(css_class='medium', oid='repo_owner')|n}
118 </div>
118 </div>
119 </div>
119 </div>
120 ${c.form.render_error(request, c.form['repo_owner'])|n}
120 ${c.form.render_error(request, c.form['repo_owner'])|n}
121 <p class="help-block">${_('Change owner of this repository.')}</p>
121 <p class="help-block">${_('Change owner of this repository.')}</p>
122 </div>
122 </div>
123 </div>
123 </div>
124
124
125 <div class="field">
125 <div class="field">
126 <div class="label label-textarea">
126 <div class="label label-textarea">
127 <label for="repo_description">${_('Description')}:</label>
127 <label for="repo_description">${_('Description')}:</label>
128 </div>
128 </div>
129 <div class="textarea text-area editor">
129 <div class="textarea text-area editor">
130 ${c.form['repo_description'].render(css_class='medium', oid='repo_description')|n}
130 ${c.form['repo_description'].render(css_class='medium', oid='repo_description')|n}
131 ${c.form.render_error(request, c.form['repo_description'])|n}
131 ${c.form.render_error(request, c.form['repo_description'])|n}
132
132
133 <% metatags_url = h.literal('''<a href="#metatagsShow" onclick="$('#meta-tags-desc').toggle();return false">meta-tags</a>''') %>
133 <% metatags_url = h.literal('''<a href="#metatagsShow" onclick="$('#meta-tags-desc').toggle();return false">meta-tags</a>''') %>
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>
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 <span id="meta-tags-desc" style="display: none">
135 <span id="meta-tags-desc" style="display: none">
136 <%namespace name="dt" file="/data_table/_dt_elements.mako"/>
136 <%namespace name="dt" file="/data_table/_dt_elements.mako"/>
137 ${dt.metatags_help()}
137 ${dt.metatags_help()}
138 </span>
138 </span>
139 </div>
139 </div>
140 </div>
140 </div>
141
141
142 <div class="field">
142 <div class="field">
143 <div class="label label-checkbox">
143 <div class="label label-checkbox">
144 <label for="${c.form['repo_private'].oid}">${_('Private repository')}:</label>
144 <label for="${c.form['repo_private'].oid}">${_('Private repository')}:</label>
145 </div>
145 </div>
146 <div class="checkboxes">
146 <div class="checkboxes">
147 ${c.form['repo_private'].render(css_class='medium')|n}
147 ${c.form['repo_private'].render(css_class='medium')|n}
148 ${c.form.render_error(request, c.form['repo_private'])|n}
148 ${c.form.render_error(request, c.form['repo_private'])|n}
149 <span class="help-block">${_('Private repositories are only visible to people explicitly added as collaborators.')}</span>
149 <span class="help-block">${_('Private repositories are only visible to people explicitly added as collaborators.')}</span>
150 </div>
150 </div>
151 </div>
151 </div>
152 <div class="field">
152 <div class="field">
153 <div class="label label-checkbox">
153 <div class="label label-checkbox">
154 <label for="${c.form['repo_enable_statistics'].oid}">${_('Enable statistics')}:</label>
154 <label for="${c.form['repo_enable_statistics'].oid}">${_('Enable statistics')}:</label>
155 </div>
155 </div>
156 <div class="checkboxes">
156 <div class="checkboxes">
157 ${c.form['repo_enable_statistics'].render(css_class='medium')|n}
157 ${c.form['repo_enable_statistics'].render(css_class='medium')|n}
158 ${c.form.render_error(request, c.form['repo_enable_statistics'])|n}
158 ${c.form.render_error(request, c.form['repo_enable_statistics'])|n}
159 <span class="help-block">${_('Enable statistics window on summary page.')}</span>
159 <span class="help-block">${_('Enable statistics window on summary page.')}</span>
160 </div>
160 </div>
161 </div>
161 </div>
162 <div class="field">
162 <div class="field">
163 <div class="label label-checkbox">
163 <div class="label label-checkbox">
164 <label for="${c.form['repo_enable_downloads'].oid}">${_('Enable downloads')}:</label>
164 <label for="${c.form['repo_enable_downloads'].oid}">${_('Enable downloads')}:</label>
165 </div>
165 </div>
166 <div class="checkboxes">
166 <div class="checkboxes">
167 ${c.form['repo_enable_downloads'].render(css_class='medium')|n}
167 ${c.form['repo_enable_downloads'].render(css_class='medium')|n}
168 ${c.form.render_error(request, c.form['repo_enable_downloads'])|n}
168 ${c.form.render_error(request, c.form['repo_enable_downloads'])|n}
169 <span class="help-block">${_('Enable download menu on summary page.')}</span>
169 <span class="help-block">${_('Enable download menu on summary page.')}</span>
170 </div>
170 </div>
171 </div>
171 </div>
172 <div class="field">
172 <div class="field">
173 <div class="label label-checkbox">
173 <div class="label label-checkbox">
174 <label for="${c.form['repo_enable_locking'].oid}">${_('Enable automatic locking')}:</label>
174 <label for="${c.form['repo_enable_locking'].oid}">${_('Enable automatic locking')}:</label>
175 </div>
175 </div>
176 <div class="checkboxes">
176 <div class="checkboxes">
177 ${c.form['repo_enable_locking'].render(css_class='medium')|n}
177 ${c.form['repo_enable_locking'].render(css_class='medium')|n}
178 ${c.form.render_error(request, c.form['repo_enable_locking'])|n}
178 ${c.form.render_error(request, c.form['repo_enable_locking'])|n}
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>
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 </div>
180 </div>
181 </div>
181 </div>
182
182
183 %if c.visual.repository_fields:
183 %if c.visual.repository_fields:
184 ## EXTRA FIELDS
184 ## EXTRA FIELDS
185 %for field in c.repo_fields:
185 %for field in c.repo_fields:
186 <div class="field">
186 <div class="field">
187 <div class="label">
187 <div class="label">
188 <label for="${field.field_key_prefixed}">${field.field_label} (${field.field_key}):</label>
188 <label for="${field.field_key_prefixed}">${field.field_label} (${field.field_key}):</label>
189 </div>
189 </div>
190 <div class="input input-medium">
190 <div class="input input-medium">
191 ${h.text(field.field_key_prefixed, field.field_value, class_='medium')}
191 ${h.text(field.field_key_prefixed, field.field_value, class_='medium')}
192 %if field.field_desc:
192 %if field.field_desc:
193 <span class="help-block">${field.field_desc}</span>
193 <span class="help-block">${field.field_desc}</span>
194 %endif
194 %endif
195 </div>
195 </div>
196 </div>
196 </div>
197 %endfor
197 %endfor
198 %endif
198 %endif
199 <div class="buttons">
199 <div class="buttons">
200 ${h.submit('save',_('Save'),class_="btn")}
200 ${h.submit('save',_('Save'),class_="btn")}
201 ${h.reset('reset',_('Reset'),class_="btn")}
201 ${h.reset('reset',_('Reset'),class_="btn")}
202 </div>
202 </div>
203 </div>
203 </div>
204 </div>
204 </div>
205 ${h.end_form()}
205 ${h.end_form()}
206 </div>
206 </div>
207 </div>
207 </div>
208
208
209 <script>
209 <script>
210 $(document).ready(function(){
210 $(document).ready(function(){
211 var cloneUrl = function() {
211 var cloneUrl = function() {
212 var alterButton = $('#alter_clone_uri');
212 var alterButton = $('#alter_clone_uri');
213 var editButton = $('#edit_clone_uri');
213 var editButton = $('#edit_clone_uri');
214 var cancelEditButton = $('#cancel_edit_clone_uri');
214 var cancelEditButton = $('#cancel_edit_clone_uri');
215 var hiddenUrl = $('#clone_uri_hidden');
215 var hiddenUrl = $('#clone_uri_hidden');
216 var hiddenUrlValue = $('#clone_uri_hidden_value');
216 var hiddenUrlValue = $('#clone_uri_hidden_value');
217 var input = $('#clone_uri');
217 var input = $('#clone_uri');
218 var helpBlock = $('#alter_clone_uri_help_block');
218 var helpBlock = $('#alter_clone_uri_help_block');
219 var changedFlag = $('#repo_clone_uri_change');
219 var changedFlag = $('#repo_clone_uri_change');
220 var originalText = helpBlock.html();
220 var originalText = helpBlock.html();
221 var obfuscatedUrl = hiddenUrlValue.html();
221 var obfuscatedUrl = hiddenUrlValue.html();
222
222
223 var edit = function(e) {
223 var edit = function(e) {
224 alterButton.show();
224 alterButton.show();
225 editButton.hide();
225 editButton.hide();
226 hiddenUrl.hide();
226 hiddenUrl.hide();
227
227
228 //add the old value next to input for verification
228 //add the old value next to input for verification
229 helpBlock.html("(" + obfuscatedUrl + ")" + "<br\>" + originalText);
229 helpBlock.html("(" + obfuscatedUrl + ")" + "<br\>" + originalText);
230 changedFlag.val('MOD');
230 changedFlag.val('MOD');
231 };
231 };
232
232
233 var cancelEdit = function(e) {
233 var cancelEdit = function(e) {
234 alterButton.hide();
234 alterButton.hide();
235 editButton.show();
235 editButton.show();
236 hiddenUrl.show();
236 hiddenUrl.show();
237
237
238 helpBlock.html(originalText);
238 helpBlock.html(originalText);
239 changedFlag.val('OLD');
239 changedFlag.val('OLD');
240 input.val('');
240 input.val('');
241 };
241 };
242
242
243 var initEvents = function() {
243 var initEvents = function() {
244 editButton.on('click', edit);
244 editButton.on('click', edit);
245 cancelEditButton.on('click', cancelEdit);
245 cancelEditButton.on('click', cancelEdit);
246 };
246 };
247
247
248 var setInitialState = function() {
248 var setInitialState = function() {
249 if (input.hasClass('error')) {
249 if (input.hasClass('error')) {
250 alterButton.show();
250 alterButton.show();
251 editButton.hide();
251 editButton.hide();
252 hiddenUrl.hide();
252 hiddenUrl.hide();
253 }
253 }
254 };
254 };
255
255
256 setInitialState();
256 setInitialState();
257 initEvents();
257 initEvents();
258 }();
258 }();
259
259
260 selectMyGroup = function(element) {
260 selectMyGroup = function(element) {
261 $("#repo_group").val($(element).data('personalGroupId')).trigger("change");
261 $("#repo_group").val($(element).data('personalGroupId')).trigger("change");
262 };
262 };
263
263
264 UsersAutoComplete('repo_owner', '${c.rhodecode_user.user_id}');
264 UsersAutoComplete('repo_owner', '${c.rhodecode_user.user_id}');
265 });
265 });
266 </script>
266 </script>
@@ -1,22 +1,22 b''
1 <div class="panel panel-default">
1 <div class="panel panel-default">
2 <div class="panel-heading">
2 <div class="panel-heading">
3 <h3 class="panel-title">${_('Repository statistics')}</h3>
3 <h3 class="panel-title">${_('Repository statistics')}</h3>
4 </div>
4 </div>
5 <div class="panel-body">
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 <div class="form">
7 <div class="form">
8 <div class="fields">
8 <div class="fields">
9 <div class="field" >
9 <div class="field" >
10 <dl class="dl-horizontal settings">
10 <dl class="dl-horizontal settings">
11 <dt>${_('Processed commits')}:</dt><dd>${c.stats_revision}/${c.repo_last_rev}</dd>
11 <dt>${_('Processed commits')}:</dt><dd>${c.stats_revision}/${c.repo_last_rev}</dd>
12 <dt>${_('Processed progress')}:</dt><dd>${c.stats_percentage}%</dd>
12 <dt>${_('Processed progress')}:</dt><dd>${c.stats_percentage}%</dd>
13 </dl>
13 </dl>
14 </div>
14 </div>
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')+"');")}
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 </div>
16 </div>
17 </div>
17 </div>
18 ${h.end_form()}
18 ${h.end_form()}
19 </div>
19 </div>
20 </div>
20 </div>
21
21
22
22
@@ -1,197 +1,197 b''
1 <div class="panel panel-default">
1 <div class="panel panel-default">
2 <div class="panel-heading">
2 <div class="panel-heading">
3 <h3 class="panel-title">${_('Strip commits from repository')}</h3>
3 <h3 class="panel-title">${_('Strip commits from repository')}</h3>
4 </div>
4 </div>
5 <div class="panel-body">
5 <div class="panel-body">
6 %if c.rhodecode_db_repo.repo_type != 'svn':
6 %if c.rhodecode_db_repo.repo_type != 'svn':
7 <h4>${_('Please provide up to %d commits commits to strip') % c.strip_limit}</h4>
7 <h4>${_('Please provide up to %d commits commits to strip') % c.strip_limit}</h4>
8 <p>
8 <p>
9 ${_('In the first step commits will be verified for existance in the repository')}. </br>
9 ${_('In the first step commits will be verified for existance in the repository')}. </br>
10 ${_('In the second step, correct commits will be available for stripping')}.
10 ${_('In the second step, correct commits will be available for stripping')}.
11 </p>
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 <div id="change_body" class="field">
13 <div id="change_body" class="field">
14 <div id="box-1" class="inputx locked_input">
14 <div id="box-1" class="inputx locked_input">
15 <input class="text" id="changeset_id-1" name="changeset_id-1" size="59"
15 <input class="text" id="changeset_id-1" name="changeset_id-1" size="59"
16 placeholder="${_('Enter full 40 character commit sha')}" type="text" value="">
16 placeholder="${_('Enter full 40 character commit sha')}" type="text" value="">
17 <div id="plus_icon-1" class="btn btn-default plus_input_button" onclick="addNew(1);return false">
17 <div id="plus_icon-1" class="btn btn-default plus_input_button" onclick="addNew(1);return false">
18 <i class="icon-plus">${_('Add another commit')}</i>
18 <i class="icon-plus">${_('Add another commit')}</i>
19 </div>
19 </div>
20 </div>
20 </div>
21 </div>
21 </div>
22
22
23 <div id="results" style="display:none; padding: 10px 0px;"></div>
23 <div id="results" style="display:none; padding: 10px 0px;"></div>
24
24
25 <div class="buttons">
25 <div class="buttons">
26 <button id="strip_action" class="btn btn-small btn-primary" onclick="checkCommits();return false">
26 <button id="strip_action" class="btn btn-small btn-primary" onclick="checkCommits();return false">
27 ${_('Check commits')}
27 ${_('Check commits')}
28 </button>
28 </button>
29 </div>
29 </div>
30
30
31 ${h.end_form()}
31 ${h.end_form()}
32 %else:
32 %else:
33 <h4>${_('Sorry this functionality is not available for SVN repository')}</h4>
33 <h4>${_('Sorry this functionality is not available for SVN repository')}</h4>
34 %endif
34 %endif
35 </div>
35 </div>
36 </div>
36 </div>
37
37
38
38
39 <script>
39 <script>
40 var plus_leaf = 1;
40 var plus_leaf = 1;
41
41
42 addNew = function(number){
42 addNew = function(number){
43 if (number >= ${c.strip_limit}){
43 if (number >= ${c.strip_limit}){
44 return;
44 return;
45 }
45 }
46 var minus = '<i class="icon-minus">${_('Remove')}</i>';
46 var minus = '<i class="icon-minus">${_('Remove')}</i>';
47 $('#plus_icon-'+number).detach();
47 $('#plus_icon-'+number).detach();
48 number++;
48 number++;
49
49
50 var input = '<div id="box-'+number+'" class="inputx locked_input">'+
50 var input = '<div id="box-'+number+'" class="inputx locked_input">'+
51 '<input class="text" id="changeset_id-'+number+'" name="changeset_id-'+number+'" size="59" type="text" value=""' +
51 '<input class="text" id="changeset_id-'+number+'" name="changeset_id-'+number+'" size="59" type="text" value=""' +
52 'placeholder="${_('Enter full 40 character commit sha')}">'+
52 'placeholder="${_('Enter full 40 character commit sha')}">'+
53 '<div id="plus_icon-'+number+'" class="btn btn-default plus_input_button" onclick="addNew('+number+');return false">'+
53 '<div id="plus_icon-'+number+'" class="btn btn-default plus_input_button" onclick="addNew('+number+');return false">'+
54 '<i class="icon-plus">${_('Add another commit')}</i>'+
54 '<i class="icon-plus">${_('Add another commit')}</i>'+
55 '</div>'+
55 '</div>'+
56 '<div id="minus_icon-'+number+'" class="btn btn-default minus_input_button" onclick="delOld('+(number)+');return false">'+
56 '<div id="minus_icon-'+number+'" class="btn btn-default minus_input_button" onclick="delOld('+(number)+');return false">'+
57 minus +
57 minus +
58 '</div>' +
58 '</div>' +
59 '</div>';
59 '</div>';
60 $('#change_body').append(input);
60 $('#change_body').append(input);
61 plus_leaf++;
61 plus_leaf++;
62 };
62 };
63
63
64 reIndex = function(number){
64 reIndex = function(number){
65 for(var i=number;i<=plus_leaf;i++){
65 for(var i=number;i<=plus_leaf;i++){
66 var check = $('#box-'+i);
66 var check = $('#box-'+i);
67 if (check.length == 0){
67 if (check.length == 0){
68 var change = $('#box-'+(i+1));
68 var change = $('#box-'+(i+1));
69 change.attr('id','box-'+i);
69 change.attr('id','box-'+i);
70 var plus = $('#plus_icon-'+(i+1));
70 var plus = $('#plus_icon-'+(i+1));
71
71
72 if (plus.length != 0){
72 if (plus.length != 0){
73 plus.attr('id','plus_icon-'+i);
73 plus.attr('id','plus_icon-'+i);
74 plus.attr('onclick','addNew('+i+');return false');
74 plus.attr('onclick','addNew('+i+');return false');
75 plus_leaf--;
75 plus_leaf--;
76 }
76 }
77 var minus = $('#minus_icon-'+(i+1));
77 var minus = $('#minus_icon-'+(i+1));
78
78
79 minus.attr('id','minus_icon-'+i);
79 minus.attr('id','minus_icon-'+i);
80
80
81 minus.attr('onclick','delOld('+i+');re' +
81 minus.attr('onclick','delOld('+i+');re' +
82 'turn false');
82 'turn false');
83 var input = $('input#changeset_id-'+(i+1));
83 var input = $('input#changeset_id-'+(i+1));
84 input.attr('name','changeset_id-'+i);
84 input.attr('name','changeset_id-'+i);
85 input.attr('id','changeset_id-'+i);
85 input.attr('id','changeset_id-'+i);
86 }
86 }
87 }
87 }
88 };
88 };
89
89
90 delOld = function(number){
90 delOld = function(number){
91 $('#box-'+number).remove();
91 $('#box-'+number).remove();
92 number = number - 1;
92 number = number - 1;
93 var box = $('#box-'+number);
93 var box = $('#box-'+number);
94 var plus = '<div id="plus_icon-'+number+'" class="btn btn-default plus_input_button" onclick="addNew('+number +');return false">'+
94 var plus = '<div id="plus_icon-'+number+'" class="btn btn-default plus_input_button" onclick="addNew('+number +');return false">'+
95 '<i id="i_plus_icon-'+number+'" class="icon-plus">${_('Add another commit')}</i></div>';
95 '<i id="i_plus_icon-'+number+'" class="icon-plus">${_('Add another commit')}</i></div>';
96 var minus = $('#minus_icon-'+number);
96 var minus = $('#minus_icon-'+number);
97 if(number +1 == plus_leaf){
97 if(number +1 == plus_leaf){
98 minus.detach();
98 minus.detach();
99 box.append(plus);
99 box.append(plus);
100 box.append(minus);
100 box.append(minus);
101 plus_leaf --;
101 plus_leaf --;
102 }
102 }
103 reIndex(number+1);
103 reIndex(number+1);
104
104
105 };
105 };
106
106
107 var resultData = {
107 var resultData = {
108 'csrf_token': CSRF_TOKEN
108 'csrf_token': CSRF_TOKEN
109 };
109 };
110
110
111 checkCommits = function() {
111 checkCommits = function() {
112 var postData = $('form').serialize();
112 var postData = $('form').serialize();
113 $('#results').show();
113 $('#results').show();
114 $('#results').html('<h4>${_('Checking commits')}...</h4>');
114 $('#results').html('<h4>${_('Checking commits')}...</h4>');
115 var url = "${h.route_path('strip_check', repo_name=c.rhodecode_db_repo.repo_name)}";
115 var url = "${h.route_path('strip_check', repo_name=c.rhodecode_db_repo.repo_name)}";
116 var btn = $('#strip_action');
116 var btn = $('#strip_action');
117 btn.attr('disabled', 'disabled');
117 btn.attr('disabled', 'disabled');
118 btn.addClass('disabled');
118 btn.addClass('disabled');
119
119
120 var success = function (data) {
120 var success = function (data) {
121 resultData = {
121 resultData = {
122 'csrf_token': CSRF_TOKEN
122 'csrf_token': CSRF_TOKEN
123 };
123 };
124 var i = 0;
124 var i = 0;
125 var result = '<ol>';
125 var result = '<ol>';
126 $.each(data, function(index, value){
126 $.each(data, function(index, value){
127 i= index;
127 i= index;
128 var box = $('#box-'+index);
128 var box = $('#box-'+index);
129 if (value.rev){
129 if (value.rev){
130 resultData[index] = JSON.stringify(value);
130 resultData[index] = JSON.stringify(value);
131
131
132 var verifiedHtml = (
132 var verifiedHtml = (
133 '<li style="line-height:1.2em">' +
133 '<li style="line-height:1.2em">' +
134 '<code>{0}</code>' +
134 '<code>{0}</code>' +
135 '{1}' +
135 '{1}' +
136 '<div style="white-space:pre">' +
136 '<div style="white-space:pre">' +
137 'author: {2}\n' +
137 'author: {2}\n' +
138 'description: {3}' +
138 'description: {3}' +
139 '</div>' +
139 '</div>' +
140 '</li>').format(
140 '</li>').format(
141 value.rev,
141 value.rev,
142 "${_(' commit verified positive')}",
142 "${_(' commit verified positive')}",
143 value.author, value.comment
143 value.author, value.comment
144 );
144 );
145 result += verifiedHtml;
145 result += verifiedHtml;
146 }
146 }
147 else {
147 else {
148 var verifiedHtml = (
148 var verifiedHtml = (
149 '<li style="line-height:1.2em">' +
149 '<li style="line-height:1.2em">' +
150 '<code><strike>{0}</strike></code>' +
150 '<code><strike>{0}</strike></code>' +
151 '{1}' +
151 '{1}' +
152 '</li>').format(
152 '</li>').format(
153 value.commit,
153 value.commit,
154 "${_(' commit verified negative')}"
154 "${_(' commit verified negative')}"
155 );
155 );
156 result += verifiedHtml;
156 result += verifiedHtml;
157 }
157 }
158 box.remove();
158 box.remove();
159 });
159 });
160 result += '</ol>';
160 result += '</ol>';
161 var box = $('#box-'+(parseInt(i)+1));
161 var box = $('#box-'+(parseInt(i)+1));
162 box.remove();
162 box.remove();
163 $('#results').html(result);
163 $('#results').html(result);
164 };
164 };
165
165
166 btn.html('Strip');
166 btn.html('Strip');
167 btn.removeAttr('disabled');
167 btn.removeAttr('disabled');
168 btn.removeClass('disabled');
168 btn.removeClass('disabled');
169 btn.attr('onclick','strip();return false;');
169 btn.attr('onclick','strip();return false;');
170 ajaxPOST(url, postData, success, null);
170 ajaxPOST(url, postData, success, null);
171 };
171 };
172
172
173 strip = function() {
173 strip = function() {
174 var url = "${h.route_path('strip_execute', repo_name=c.rhodecode_db_repo.repo_name)}";
174 var url = "${h.route_path('strip_execute', repo_name=c.rhodecode_db_repo.repo_name)}";
175 var success = function(data) {
175 var success = function(data) {
176 var result = '<h4>Strip executed</h4><ol>';
176 var result = '<h4>Strip executed</h4><ol>';
177 $.each(data, function(index, value){
177 $.each(data, function(index, value){
178 if(data[index]) {
178 if(data[index]) {
179 result += '<li><code>' +index+ '</code> ${_(' commit striped successfully')}' + '</li>';
179 result += '<li><code>' +index+ '</code> ${_(' commit striped successfully')}' + '</li>';
180 }
180 }
181 else {
181 else {
182 result += '<li><code>' +index+ '</code> ${_(' commit strip failed')}' + '</li>';
182 result += '<li><code>' +index+ '</code> ${_(' commit strip failed')}' + '</li>';
183 }
183 }
184 });
184 });
185 if ($.isEmptyObject(data)) {
185 if ($.isEmptyObject(data)) {
186 result += '<li>Nothing done...</li>'
186 result += '<li>Nothing done...</li>'
187 }
187 }
188 result += '</ol>';
188 result += '</ol>';
189 $('#results').html(result);
189 $('#results').html(result);
190
190
191 };
191 };
192 ajaxPOST(url, resultData, success, null);
192 ajaxPOST(url, resultData, success, null);
193 var btn = $('#strip_action');
193 var btn = $('#strip_action');
194 btn.remove();
194 btn.remove();
195
195
196 };
196 };
197 </script>
197 </script>
@@ -1,73 +1,73 b''
1 <%namespace name="vcss" file="/base/vcs_settings.mako"/>
1 <%namespace name="vcss" file="/base/vcs_settings.mako"/>
2
2
3 <div id="repo_vcs_settings" class="${'inherited' if c.inherit_global_settings else ''}">
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 <div class="form panel panel-default">
5 <div class="form panel panel-default">
6 <div class="fields panel-body">
6 <div class="fields panel-body">
7 <div class="field">
7 <div class="field">
8 <div class="label label-checkbox">
8 <div class="label label-checkbox">
9 <label for="inherit_global_settings">${_('Inherit from global settings')}:</label>
9 <label for="inherit_global_settings">${_('Inherit from global settings')}:</label>
10 </div>
10 </div>
11 <div class="checkboxes">
11 <div class="checkboxes">
12 ${h.checkbox('inherit_global_settings',value=True)}
12 ${h.checkbox('inherit_global_settings',value=True)}
13 <span class="help-block">${h.literal(_('Select to inherit global vcs settings.'))}</span>
13 <span class="help-block">${h.literal(_('Select to inherit global vcs settings.'))}</span>
14 </div>
14 </div>
15 </div>
15 </div>
16 </div>
16 </div>
17 </div>
17 </div>
18
18
19 <div id="inherit_overlay_vcs_default">
19 <div id="inherit_overlay_vcs_default">
20 <div>
20 <div>
21 ${vcss.vcs_settings_fields(
21 ${vcss.vcs_settings_fields(
22 suffix='_inherited',
22 suffix='_inherited',
23 svn_tag_patterns=c.global_svn_tag_patterns,
23 svn_tag_patterns=c.global_svn_tag_patterns,
24 svn_branch_patterns=c.global_svn_branch_patterns,
24 svn_branch_patterns=c.global_svn_branch_patterns,
25 repo_type=c.rhodecode_db_repo.repo_type,
25 repo_type=c.rhodecode_db_repo.repo_type,
26 disabled='disabled'
26 disabled='disabled'
27 )}
27 )}
28 </div>
28 </div>
29 </div>
29 </div>
30
30
31 <div id="inherit_overlay_vcs_custom">
31 <div id="inherit_overlay_vcs_custom">
32 <div>
32 <div>
33 ${vcss.vcs_settings_fields(
33 ${vcss.vcs_settings_fields(
34 suffix='',
34 suffix='',
35 svn_tag_patterns=c.svn_tag_patterns,
35 svn_tag_patterns=c.svn_tag_patterns,
36 svn_branch_patterns=c.svn_branch_patterns,
36 svn_branch_patterns=c.svn_branch_patterns,
37 repo_type=c.rhodecode_db_repo.repo_type
37 repo_type=c.rhodecode_db_repo.repo_type
38 )}
38 )}
39 </div>
39 </div>
40 </div>
40 </div>
41
41
42 <div class="buttons">
42 <div class="buttons">
43 ${h.submit('save',_('Save settings'),class_="btn")}
43 ${h.submit('save',_('Save settings'),class_="btn")}
44 ${h.reset('reset',_('Reset'),class_="btn")}
44 ${h.reset('reset',_('Reset'),class_="btn")}
45 </div>
45 </div>
46
46
47 ${h.end_form()}
47 ${h.end_form()}
48 </div>
48 </div>
49
49
50 <script type="text/javascript">
50 <script type="text/javascript">
51
51
52 function ajaxDeletePattern(pattern_id, field_id) {
52 function ajaxDeletePattern(pattern_id, field_id) {
53 var sUrl = "${h.route_path('edit_repo_vcs_svn_pattern_delete', repo_name=c.rhodecode_db_repo.repo_name)}";
53 var sUrl = "${h.route_path('edit_repo_vcs_svn_pattern_delete', repo_name=c.rhodecode_db_repo.repo_name)}";
54 var callback = function (o) {
54 var callback = function (o) {
55 var elem = $("#"+field_id);
55 var elem = $("#"+field_id);
56 elem.remove();
56 elem.remove();
57 };
57 };
58 var postData = {
58 var postData = {
59 'delete_svn_pattern': pattern_id,
59 'delete_svn_pattern': pattern_id,
60 'csrf_token': CSRF_TOKEN
60 'csrf_token': CSRF_TOKEN
61 };
61 };
62 var request = $.post(sUrl, postData)
62 var request = $.post(sUrl, postData)
63 .done(callback)
63 .done(callback)
64 .fail(function (data, textStatus, errorThrown) {
64 .fail(function (data, textStatus, errorThrown) {
65 alert("Error while deleting hooks.\nError code {0} ({1}). URL: {2}".format(data.status,data.statusText,$(this)[0].url));
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 $('#inherit_global_settings').on('change', function(e){
69 $('#inherit_global_settings').on('change', function(e){
70 $('#repo_vcs_settings').toggleClass('inherited', this.checked);
70 $('#repo_vcs_settings').toggleClass('inherited', this.checked);
71 });
71 });
72
72
73 </script>
73 </script>
@@ -1,56 +1,56 b''
1 <div class="panel panel-default">
1 <div class="panel panel-default">
2 <div class="panel-heading">
2 <div class="panel-heading">
3 <h3 class="panel-title">${_('Email Configuration')}</h3>
3 <h3 class="panel-title">${_('Email Configuration')}</h3>
4 </div>
4 </div>
5 <div class="panel-body">
5 <div class="panel-body">
6 <%
6 <%
7 elems = [
7 elems = [
8 (_('Email prefix'), c.rhodecode_ini.get('email_prefix'), ''),
8 (_('Email prefix'), c.rhodecode_ini.get('email_prefix'), ''),
9 (_('RhodeCode email from'), c.rhodecode_ini.get('app_email_from'), ''),
9 (_('RhodeCode email from'), c.rhodecode_ini.get('app_email_from'), ''),
10 (_('Error email from'), c.rhodecode_ini.get('error_email_from'), ''),
10 (_('Error email from'), c.rhodecode_ini.get('error_email_from'), ''),
11 (_('Error email recipients'), c.rhodecode_ini.get('email_to'), ''),
11 (_('Error email recipients'), c.rhodecode_ini.get('email_to'), ''),
12
12
13 (_('SMTP server'), c.rhodecode_ini.get('smtp_server'), ''),
13 (_('SMTP server'), c.rhodecode_ini.get('smtp_server'), ''),
14 (_('SMTP username'), c.rhodecode_ini.get('smtp_username'), ''),
14 (_('SMTP username'), c.rhodecode_ini.get('smtp_username'), ''),
15 (_('SMTP password'), '%s chars' % len(c.rhodecode_ini.get('smtp_password', '')), ''),
15 (_('SMTP password'), '%s chars' % len(c.rhodecode_ini.get('smtp_password', '')), ''),
16 (_('SMTP port'), c.rhodecode_ini.get('smtp_port'), ''),
16 (_('SMTP port'), c.rhodecode_ini.get('smtp_port'), ''),
17
17
18 (_('SMTP use TLS'), c.rhodecode_ini.get('smtp_use_tls'), ''),
18 (_('SMTP use TLS'), c.rhodecode_ini.get('smtp_use_tls'), ''),
19 (_('SMTP use SSL'), c.rhodecode_ini.get('smtp_use_ssl'), ''),
19 (_('SMTP use SSL'), c.rhodecode_ini.get('smtp_use_ssl'), ''),
20 (_('SMTP auth'), c.rhodecode_ini.get('smtp_auth'), ''),
20 (_('SMTP auth'), c.rhodecode_ini.get('smtp_auth'), ''),
21 ]
21 ]
22 %>
22 %>
23 <dl class="dl-horizontal settings">
23 <dl class="dl-horizontal settings">
24 %for dt, dd, tt in elems:
24 %for dt, dd, tt in elems:
25 <dt >${dt}:</dt>
25 <dt >${dt}:</dt>
26 <dd title="${h.tooltip(tt)}">${dd}</dd>
26 <dd title="${h.tooltip(tt)}">${dd}</dd>
27 %endfor
27 %endfor
28 </dl>
28 </dl>
29 </div>
29 </div>
30 </div>
30 </div>
31
31
32 <div class="panel panel-default">
32 <div class="panel panel-default">
33 <div class="panel-heading">
33 <div class="panel-heading">
34 <h3 class="panel-title">${_('Test Email')}</h3>
34 <h3 class="panel-title">${_('Test Email')}</h3>
35 </div>
35 </div>
36 <div class="panel-body">
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 <div class="field input">
39 <div class="field input">
40 ${h.text('test_email', size=60, placeholder=_('enter valid email'))}
40 ${h.text('test_email', size=60, placeholder=_('enter valid email'))}
41 </div>
41 </div>
42 <div class="field">
42 <div class="field">
43 <span class="help-block">
43 <span class="help-block">
44 ${_('Send an auto-generated email from this server to above email...')}
44 ${_('Send an auto-generated email from this server to above email...')}
45 </span>
45 </span>
46 </div>
46 </div>
47 <div class="buttons">
47 <div class="buttons">
48 ${h.submit('send',_('Send'),class_="btn")}
48 ${h.submit('send',_('Send'),class_="btn")}
49 </div>
49 </div>
50 ${h.end_form()}
50 ${h.end_form()}
51 </div>
51 </div>
52 </div>
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 <div class="panel panel-default">
3 <div class="panel panel-default">
4 <div class="panel-heading" id="branding-options">
4 <div class="panel-heading" id="branding-options">
5 <h3 class="panel-title">${_('Branding')} <a class="permalink" href="#branding-options"> ¶</a></h3>
5 <h3 class="panel-title">${_('Branding')} <a class="permalink" href="#branding-options"> ¶</a></h3>
6 </div>
6 </div>
7 <div class="panel-body">
7 <div class="panel-body">
8 <div class="label">
8 <div class="label">
9 <label for="rhodecode_title">${_('Title')}</label>
9 <label for="rhodecode_title">${_('Title')}</label>
10 </div>
10 </div>
11 <div class="field input">
11 <div class="field input">
12 ${h.text('rhodecode_title',size=60)}
12 ${h.text('rhodecode_title',size=60)}
13 </div>
13 </div>
14 <div class="field">
14 <div class="field">
15 <span class="help-block">
15 <span class="help-block">
16 ${_('Set a custom title for your RhodeCode instance (limited to 40 characters).')}
16 ${_('Set a custom title for your RhodeCode instance (limited to 40 characters).')}
17 </span>
17 </span>
18 </div>
18 </div>
19 <div class="label">
19 <div class="label">
20 <label for="rhodecode_realm">${_('HTTP[S] authentication realm')}</label>
20 <label for="rhodecode_realm">${_('HTTP[S] authentication realm')}</label>
21 </div>
21 </div>
22 <div class="field input">
22 <div class="field input">
23 ${h.text('rhodecode_realm',size=60)}
23 ${h.text('rhodecode_realm',size=60)}
24 </div>
24 </div>
25 <div class="field">
25 <div class="field">
26 <span class="help-block">
26 <span class="help-block">
27 ${_('Set a custom text that is shown as authentication message to clients trying to connect.')}
27 ${_('Set a custom text that is shown as authentication message to clients trying to connect.')}
28 </span>
28 </span>
29 </div>
29 </div>
30 </div>
30 </div>
31 </div>
31 </div>
32
32
33
33
34 <div class="panel panel-default">
34 <div class="panel panel-default">
35 <div class="panel-heading" id="personal-group-options">
35 <div class="panel-heading" id="personal-group-options">
36 <h3 class="panel-title">${_('Personal Repository Group')} <a class="permalink" href="#personal-group-options"> ¶</a></h3>
36 <h3 class="panel-title">${_('Personal Repository Group')} <a class="permalink" href="#personal-group-options"> ¶</a></h3>
37 </div>
37 </div>
38 <div class="panel-body">
38 <div class="panel-body">
39 <div class="checkbox">
39 <div class="checkbox">
40 ${h.checkbox('rhodecode_create_personal_repo_group','True')}
40 ${h.checkbox('rhodecode_create_personal_repo_group','True')}
41 <label for="rhodecode_create_personal_repo_group">${_('Create Personal Repository Group')}</label>
41 <label for="rhodecode_create_personal_repo_group">${_('Create Personal Repository Group')}</label>
42 </div>
42 </div>
43 <span class="help-block">
43 <span class="help-block">
44 ${_('Always create Personal Repository Groups for new users.')} <br/>
44 ${_('Always create Personal Repository Groups for new users.')} <br/>
45 ${_('When creating new users from add user form or API you can still turn this off via a checkbox or flag')}
45 ${_('When creating new users from add user form or API you can still turn this off via a checkbox or flag')}
46 </span>
46 </span>
47
47
48 <div class="label">
48 <div class="label">
49 <label for="rhodecode_personal_repo_group_pattern">${_('Personal Repo Group Pattern')}</label>
49 <label for="rhodecode_personal_repo_group_pattern">${_('Personal Repo Group Pattern')}</label>
50 </div>
50 </div>
51 <div class="field input">
51 <div class="field input">
52 ${h.text('rhodecode_personal_repo_group_pattern',size=60, placeholder=c.personal_repo_group_default_pattern)}
52 ${h.text('rhodecode_personal_repo_group_pattern',size=60, placeholder=c.personal_repo_group_default_pattern)}
53 </div>
53 </div>
54 <span class="help-block">
54 <span class="help-block">
55 ${_('Pattern used to create Personal Repository Groups. Prefix can be other existing repository group path[s], eg. /u/${username}')} <br/>
55 ${_('Pattern used to create Personal Repository Groups. Prefix can be other existing repository group path[s], eg. /u/${username}')} <br/>
56 ${_('Available variables are currently ${username} and ${user_id}')}
56 ${_('Available variables are currently ${username} and ${user_id}')}
57 </span>
57 </span>
58 </div>
58 </div>
59 </div>
59 </div>
60
60
61
61
62 <div class="panel panel-default">
62 <div class="panel panel-default">
63 <div class="panel-heading" id="captcha-options">
63 <div class="panel-heading" id="captcha-options">
64 <h3 class="panel-title">${_('Registration Captcha')} <a class="permalink" href="#captcha-options"> ¶</a></h3>
64 <h3 class="panel-title">${_('Registration Captcha')} <a class="permalink" href="#captcha-options"> ¶</a></h3>
65 </div>
65 </div>
66 <div class="panel-body">
66 <div class="panel-body">
67 <div class="label">
67 <div class="label">
68 <label for="rhodecode_captcha_public_key">${_('Google ReCaptcha public key')}</label>
68 <label for="rhodecode_captcha_public_key">${_('Google ReCaptcha public key')}</label>
69 </div>
69 </div>
70 <div class="field input">
70 <div class="field input">
71 ${h.text('rhodecode_captcha_public_key',size=60)}
71 ${h.text('rhodecode_captcha_public_key',size=60)}
72 </div>
72 </div>
73 <div class="field">
73 <div class="field">
74 <span class="help-block">
74 <span class="help-block">
75 ${_('Public key for reCaptcha system.')}
75 ${_('Public key for reCaptcha system.')}
76 </span>
76 </span>
77 </div>
77 </div>
78
78
79 <div class="label">
79 <div class="label">
80 <label for="rhodecode_captcha_private_key">${_('Google ReCaptcha private key')}</label>
80 <label for="rhodecode_captcha_private_key">${_('Google ReCaptcha private key')}</label>
81 </div>
81 </div>
82 <div class="field input">
82 <div class="field input">
83 ${h.text('rhodecode_captcha_private_key',size=60)}
83 ${h.text('rhodecode_captcha_private_key',size=60)}
84 </div>
84 </div>
85 <div class="field">
85 <div class="field">
86 <span class="help-block">
86 <span class="help-block">
87 ${_('Private key for reCaptcha system. Setting this value will enable captcha on registration')}
87 ${_('Private key for reCaptcha system. Setting this value will enable captcha on registration')}
88 </span>
88 </span>
89 </div>
89 </div>
90 </div>
90 </div>
91 </div>
91 </div>
92
92
93 <div class="panel panel-default">
93 <div class="panel panel-default">
94 <div class="panel-heading" id="header-code-options">
94 <div class="panel-heading" id="header-code-options">
95 <h3 class="panel-title">${_('Custom Header Code')} <a class="permalink" href="#header-code-options"> ¶</a></h3>
95 <h3 class="panel-title">${_('Custom Header Code')} <a class="permalink" href="#header-code-options"> ¶</a></h3>
96 </div>
96 </div>
97 <div class="panel-body">
97 <div class="panel-body">
98 <div class="select">
98 <div class="select">
99 <select id="pre_template" >
99 <select id="pre_template" >
100 <option value="#">${_('Templates...')}</option>
100 <option value="#">${_('Templates...')}</option>
101 <option value="ga">Google Analytics</option>
101 <option value="ga">Google Analytics</option>
102 <option value="clicky">Clicky</option>
102 <option value="clicky">Clicky</option>
103 <option value="server_announce">${_('Server Announcement')}</option>
103 <option value="server_announce">${_('Server Announcement')}</option>
104 <option value="flash_filtering">${_('Flash message filtering')}</option>
104 <option value="flash_filtering">${_('Flash message filtering')}</option>
105 </select>
105 </select>
106 </div>
106 </div>
107 <div style="padding: 10px 0px"></div>
107 <div style="padding: 10px 0px"></div>
108 <div class="textarea text-area">
108 <div class="textarea text-area">
109 ${h.textarea('rhodecode_pre_code',cols=23,rows=5,class_="medium")}
109 ${h.textarea('rhodecode_pre_code',cols=23,rows=5,class_="medium")}
110 <span class="help-block">${_('Custom js/css code added at the end of the <header/> tag.')}
110 <span class="help-block">${_('Custom js/css code added at the end of the <header/> tag.')}
111 ${_('Use <script/> or <css/> tags to define custom styling or scripting')}</span>
111 ${_('Use <script/> or <css/> tags to define custom styling or scripting')}</span>
112 </div>
112 </div>
113 </div>
113 </div>
114 </div>
114 </div>
115
115
116 <div class="panel panel-default">
116 <div class="panel panel-default">
117 <div class="panel-heading" id="footer-code-options">
117 <div class="panel-heading" id="footer-code-options">
118 <h3 class="panel-title">${_('Custom Footer Code')} <a class="permalink" href="#footer-code-options"> ¶</a></h3>
118 <h3 class="panel-title">${_('Custom Footer Code')} <a class="permalink" href="#footer-code-options"> ¶</a></h3>
119 </div>
119 </div>
120 <div class="panel-body">
120 <div class="panel-body">
121 <div class="select">
121 <div class="select">
122 <select id="post_template" >
122 <select id="post_template" >
123 <option value="#">${_('Templates...')}</option>
123 <option value="#">${_('Templates...')}</option>
124 <option value="ga">Google Analytics</option>
124 <option value="ga">Google Analytics</option>
125 <option value="clicky">Clicky</option>
125 <option value="clicky">Clicky</option>
126 <option value="server_announce">${_('Server Announcement')}</option>
126 <option value="server_announce">${_('Server Announcement')}</option>
127 </select>
127 </select>
128 </div>
128 </div>
129 <div style="padding: 10px 0px"></div>
129 <div style="padding: 10px 0px"></div>
130 <div class="textarea text-area">
130 <div class="textarea text-area">
131 ${h.textarea('rhodecode_post_code',cols=23,rows=5, class_="medium")}
131 ${h.textarea('rhodecode_post_code',cols=23,rows=5, class_="medium")}
132 <span class="help-block">${_('Custom js/css code added at the end of the <body> tag.')}
132 <span class="help-block">${_('Custom js/css code added at the end of the <body> tag.')}
133 ${_('Use <script> or <css> tags to define custom styling or scripting')}</span>
133 ${_('Use <script> or <css> tags to define custom styling or scripting')}</span>
134 </div>
134 </div>
135 </div>
135 </div>
136 </div>
136 </div>
137
137
138 <div class="buttons">
138 <div class="buttons">
139 ${h.submit('save',_('Save settings'),class_="btn")}
139 ${h.submit('save',_('Save settings'),class_="btn")}
140 ${h.reset('reset',_('Reset'),class_="btn")}
140 ${h.reset('reset',_('Reset'),class_="btn")}
141 </div>
141 </div>
142 ${h.end_form()}
142 ${h.end_form()}
143
143
144
144
145
145
146 ## TEMPLATES ##
146 ## TEMPLATES ##
147 ###############
147 ###############
148
148
149 <script id="ga_tmpl" type="text/x-template">
149 <script id="ga_tmpl" type="text/x-template">
150 <%text filter="h">
150 <%text filter="h">
151 <script>
151 <script>
152 // Google Analytics
152 // Google Analytics
153 // Put your Google Analytics code instead of _GACODE_
153 // Put your Google Analytics code instead of _GACODE_
154 var _gaq_code = '_GACODE_';
154 var _gaq_code = '_GACODE_';
155 var _gaq = _gaq || [];
155 var _gaq = _gaq || [];
156 _gaq.push(['_setAccount', _gaq_code]);
156 _gaq.push(['_setAccount', _gaq_code]);
157 _gaq.push(['_trackPageview']);
157 _gaq.push(['_trackPageview']);
158
158
159 (function() {
159 (function() {
160 var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
160 var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
161 ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
161 ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
162 var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
162 var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
163 })();
163 })();
164
164
165 rhodecode_statechange_callback = function(url, data){
165 rhodecode_statechange_callback = function(url, data){
166 // ANALYTICS callback on html5 history state changed
166 // ANALYTICS callback on html5 history state changed
167 // triggered by file browser, url is the new url,
167 // triggered by file browser, url is the new url,
168 // data is extra info passed from the State object
168 // data is extra info passed from the State object
169 if (typeof window._gaq !== 'undefined') {
169 if (typeof window._gaq !== 'undefined') {
170 _gaq.push(['_trackPageview', url]);
170 _gaq.push(['_trackPageview', url]);
171 }
171 }
172 };
172 };
173 </script>
173 </script>
174 </%text>
174 </%text>
175 </script>
175 </script>
176
176
177
177
178
178
179 <script id="clicky_tmpl" type="text/x-template">
179 <script id="clicky_tmpl" type="text/x-template">
180 <%text filter="h">
180 <%text filter="h">
181 <script src="//static.getclicky.com/js" type="text/javascript"></script>
181 <script src="//static.getclicky.com/js" type="text/javascript"></script>
182 <script type="text/javascript">
182 <script type="text/javascript">
183 // Clicky Analytics - should be used in the footer code section.
183 // Clicky Analytics - should be used in the footer code section.
184 // Put your Clicky code instead of _CLICKYCODE_ here,
184 // Put your Clicky code instead of _CLICKYCODE_ here,
185 // and below in the <img> tag.
185 // and below in the <img> tag.
186 var _cl_code = _CLICKYCODE_;
186 var _cl_code = _CLICKYCODE_;
187 try{clicky.init(_cl_code);}catch(e){}
187 try{clicky.init(_cl_code);}catch(e){}
188
188
189 rhodecode_statechange_callback = function(url, data){
189 rhodecode_statechange_callback = function(url, data){
190 // ANALYTICS callback on html5 history state changed
190 // ANALYTICS callback on html5 history state changed
191 // triggered by file browser, url is the new url,
191 // triggered by file browser, url is the new url,
192 // data is extra info passed from the State object
192 // data is extra info passed from the State object
193 if (typeof window.clicky !== 'undefined') {
193 if (typeof window.clicky !== 'undefined') {
194 clicky.log(url);
194 clicky.log(url);
195 }
195 }
196 }
196 }
197 </script>
197 </script>
198 <noscript>
198 <noscript>
199 // Put your clicky code in the src file.
199 // Put your clicky code in the src file.
200 <p><img alt="Clicky" width="1" height="1"
200 <p><img alt="Clicky" width="1" height="1"
201 src="//in.getclicky.com/_CLICKYCODE_ns.gif" /></p>
201 src="//in.getclicky.com/_CLICKYCODE_ns.gif" /></p>
202 </noscript>
202 </noscript>
203 </%text>
203 </%text>
204 </script>
204 </script>
205
205
206
206
207
207
208 <script id="server_announce_tmpl" type='text/x-template'>
208 <script id="server_announce_tmpl" type='text/x-template'>
209 <%text filter="h">
209 <%text filter="h">
210 <script>
210 <script>
211 // Server announcement displayed on the top of the page.
211 // Server announcement displayed on the top of the page.
212 // This can be used to send a global maintenance messages or other
212 // This can be used to send a global maintenance messages or other
213 // important messages to all users of the RhodeCode Enterprise system.
213 // important messages to all users of the RhodeCode Enterprise system.
214
214
215 $(document).ready(function(e){
215 $(document).ready(function(e){
216
216
217 // EDIT - put your message below
217 // EDIT - put your message below
218 var message = "TYPE YOUR MESSAGE HERE";
218 var message = "TYPE YOUR MESSAGE HERE";
219
219
220 // EDIT - choose "info"/"warning"/"error"/"success"/"neutral" as appropriate
220 // EDIT - choose "info"/"warning"/"error"/"success"/"neutral" as appropriate
221 var alert_level = "info";
221 var alert_level = "info";
222
222
223 $("#body").prepend(
223 $("#body").prepend(
224 ("<div id='server-announcement' class='"+alert_level+"'>_MSG_"+"</div>").replace("_MSG_", message)
224 ("<div id='server-announcement' class='"+alert_level+"'>_MSG_"+"</div>").replace("_MSG_", message)
225 )
225 )
226 })
226 })
227 </script>
227 </script>
228 </%text>
228 </%text>
229 </script>
229 </script>
230
230
231 <script id="flash_filtering_tmpl" type='text/x-template'>
231 <script id="flash_filtering_tmpl" type='text/x-template'>
232 <%text filter="h">
232 <%text filter="h">
233 <script>
233 <script>
234 // This filters out some flash messages before they are presented to user
234 // This filters out some flash messages before they are presented to user
235 // based on their contents. Could be used to filter out warnings/errors
235 // based on their contents. Could be used to filter out warnings/errors
236 // of license messages
236 // of license messages
237
237
238 var filteredMessages = [];
238 var filteredMessages = [];
239 for(var i =0; i< alertMessagePayloads.length; i++){
239 for(var i =0; i< alertMessagePayloads.length; i++){
240 if (typeof alertMessagePayloads[i].message.subdata.subtype !== 'undefined' &&
240 if (typeof alertMessagePayloads[i].message.subdata.subtype !== 'undefined' &&
241 alertMessagePayloads[i].message.subdata.subtype.indexOf('rc_license') !== -1){
241 alertMessagePayloads[i].message.subdata.subtype.indexOf('rc_license') !== -1){
242 continue
242 continue
243 }
243 }
244 filteredMessages.push(alertMessagePayloads[i]);
244 filteredMessages.push(alertMessagePayloads[i]);
245 }
245 }
246 alertMessagePayloads = filteredMessages;
246 alertMessagePayloads = filteredMessages;
247 </script>
247 </script>
248 </%text>
248 </%text>
249 </script>
249 </script>
250
250
251 <script>
251 <script>
252 var pre_cm = initCodeMirror('rhodecode_pre_code', '', false);
252 var pre_cm = initCodeMirror('rhodecode_pre_code', '', false);
253 var pre_old = pre_cm.getValue();
253 var pre_old = pre_cm.getValue();
254
254
255 var post_cm = initCodeMirror('rhodecode_post_code', '', false);
255 var post_cm = initCodeMirror('rhodecode_post_code', '', false);
256 var post_old = post_cm.getValue();
256 var post_old = post_cm.getValue();
257
257
258 var get_data = function(type, old){
258 var get_data = function(type, old){
259 var get_tmpl = function(tmpl_name){
259 var get_tmpl = function(tmpl_name){
260 // unescape some stuff
260 // unescape some stuff
261 return htmlEnDeCode.htmlDecode($('#'+tmpl_name+'_tmpl').html());
261 return htmlEnDeCode.htmlDecode($('#'+tmpl_name+'_tmpl').html());
262 };
262 };
263 return {
263 return {
264 '#': old,
264 '#': old,
265 'ga': get_tmpl('ga'),
265 'ga': get_tmpl('ga'),
266 'clicky': get_tmpl('clicky'),
266 'clicky': get_tmpl('clicky'),
267 'server_announce': get_tmpl('server_announce'),
267 'server_announce': get_tmpl('server_announce'),
268 'flash_filtering': get_tmpl('flash_filtering')
268 'flash_filtering': get_tmpl('flash_filtering')
269 }[type]
269 }[type]
270 };
270 };
271
271
272 $('#pre_template').select2({
272 $('#pre_template').select2({
273 containerCssClass: 'drop-menu',
273 containerCssClass: 'drop-menu',
274 dropdownCssClass: 'drop-menu-dropdown',
274 dropdownCssClass: 'drop-menu-dropdown',
275 dropdownAutoWidth: true,
275 dropdownAutoWidth: true,
276 minimumResultsForSearch: -1
276 minimumResultsForSearch: -1
277 });
277 });
278
278
279 $('#post_template').select2({
279 $('#post_template').select2({
280 containerCssClass: 'drop-menu',
280 containerCssClass: 'drop-menu',
281 dropdownCssClass: 'drop-menu-dropdown',
281 dropdownCssClass: 'drop-menu-dropdown',
282 dropdownAutoWidth: true,
282 dropdownAutoWidth: true,
283 minimumResultsForSearch: -1
283 minimumResultsForSearch: -1
284 });
284 });
285
285
286 $('#post_template').on('change', function(e){
286 $('#post_template').on('change', function(e){
287 var sel = this.value;
287 var sel = this.value;
288 post_cm.setValue(get_data(sel, post_old))
288 post_cm.setValue(get_data(sel, post_old))
289 });
289 });
290
290
291 $('#pre_template').on('change', function(e){
291 $('#pre_template').on('change', function(e){
292 var sel = this.value;
292 var sel = this.value;
293 pre_cm.setValue(get_data(sel, pre_old))
293 pre_cm.setValue(get_data(sel, pre_old))
294 })
294 })
295 </script>
295 </script>
@@ -1,93 +1,93 b''
1 <div class="panel panel-default">
1 <div class="panel panel-default">
2 <div class="panel-heading">
2 <div class="panel-heading">
3 <h3 class="panel-title">${_('Built in Mercurial hooks - read only')}</h3>
3 <h3 class="panel-title">${_('Built in Mercurial hooks - read only')}</h3>
4 </div>
4 </div>
5 <div class="panel-body">
5 <div class="panel-body">
6 <div class="form">
6 <div class="form">
7 <div class="fields">
7 <div class="fields">
8 % for hook in c.hooks:
8 % for hook in c.hooks:
9 <div class="field">
9 <div class="field">
10 <div class="label label">
10 <div class="label label">
11 <label for="${hook.ui_key}">${hook.ui_key}</label>
11 <label for="${hook.ui_key}">${hook.ui_key}</label>
12 </div>
12 </div>
13 <div class="input" >
13 <div class="input" >
14 ${h.text(hook.ui_key,hook.ui_value,size=59,readonly="readonly")}
14 ${h.text(hook.ui_key,hook.ui_value,size=59,readonly="readonly")}
15 </div>
15 </div>
16 </div>
16 </div>
17 % endfor
17 % endfor
18 </div>
18 </div>
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>
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 </div>
20 </div>
21 </div>
21 </div>
22 </div>
22 </div>
23
23
24
24
25 <div class="panel panel-default">
25 <div class="panel panel-default">
26 <div class="panel-heading">
26 <div class="panel-heading">
27 <h3 class="panel-title">${_('Custom hooks')}</h3>
27 <h3 class="panel-title">${_('Custom hooks')}</h3>
28 </div>
28 </div>
29 <div class="panel-body">
29 <div class="panel-body">
30 % if c.visual.allow_custom_hooks_settings:
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 <div class="form">
32 <div class="form">
33 <div class="fields">
33 <div class="fields">
34
34
35 % for hook in c.custom_hooks:
35 % for hook in c.custom_hooks:
36 <div class="field" id="${'id%s' % hook.ui_id }">
36 <div class="field" id="${'id%s' % hook.ui_id }">
37 <div class="label label">
37 <div class="label label">
38 <label for="${hook.ui_key}">${hook.ui_key}</label>
38 <label for="${hook.ui_key}">${hook.ui_key}</label>
39 </div>
39 </div>
40 <div class="input" >
40 <div class="input" >
41 ${h.hidden('hook_ui_key',hook.ui_key)}
41 ${h.hidden('hook_ui_key',hook.ui_key)}
42 ${h.hidden('hook_ui_value',hook.ui_value)}
42 ${h.hidden('hook_ui_value',hook.ui_value)}
43 ${h.text('hook_ui_value_new',hook.ui_value,size=59)}
43 ${h.text('hook_ui_value_new',hook.ui_value,size=59)}
44 <span class="btn btn-danger"
44 <span class="btn btn-danger"
45 onclick="ajaxActionHook(${hook.ui_id},'${'id%s' % hook.ui_id }')">
45 onclick="ajaxActionHook(${hook.ui_id},'${'id%s' % hook.ui_id }')">
46 ${_('Delete')}
46 ${_('Delete')}
47 </span>
47 </span>
48 </div>
48 </div>
49 </div>
49 </div>
50 % endfor
50 % endfor
51
51
52 <div class="field customhooks">
52 <div class="field customhooks">
53 <div class="label">
53 <div class="label">
54 <div class="input-wrapper">
54 <div class="input-wrapper">
55 ${h.text('new_hook_ui_key',size=30)}
55 ${h.text('new_hook_ui_key',size=30)}
56 </div>
56 </div>
57 </div>
57 </div>
58 <div class="input">
58 <div class="input">
59 ${h.text('new_hook_ui_value',size=59)}
59 ${h.text('new_hook_ui_value',size=59)}
60 </div>
60 </div>
61 </div>
61 </div>
62 <div class="buttons">
62 <div class="buttons">
63 ${h.submit('save',_('Save'),class_="btn")}
63 ${h.submit('save',_('Save'),class_="btn")}
64 </div>
64 </div>
65 </div>
65 </div>
66 </div>
66 </div>
67 ${h.end_form()}
67 ${h.end_form()}
68 %else:
68 %else:
69 DISABLED
69 DISABLED
70 % endif
70 % endif
71 </div>
71 </div>
72 </div>
72 </div>
73
73
74
74
75 <script type="text/javascript">
75 <script type="text/javascript">
76 function ajaxActionHook(hook_id,field_id) {
76 function ajaxActionHook(hook_id,field_id) {
77 var sUrl = "${h.url('admin_settings_hooks')}";
77 var sUrl = "${h.url('admin_settings_hooks')}";
78 var callback = function (o) {
78 var callback = function (o) {
79 var elem = $("#"+field_id);
79 var elem = $("#"+field_id);
80 elem.remove();
80 elem.remove();
81 };
81 };
82 var postData = {
82 var postData = {
83 '_method': 'delete',
83 '_method': 'delete',
84 'hook_id': hook_id,
84 'hook_id': hook_id,
85 'csrf_token': CSRF_TOKEN
85 'csrf_token': CSRF_TOKEN
86 };
86 };
87 var request = $.post(sUrl, postData)
87 var request = $.post(sUrl, postData)
88 .done(callback)
88 .done(callback)
89 .fail(function (data, textStatus, errorThrown) {
89 .fail(function (data, textStatus, errorThrown) {
90 alert("Error while deleting hooks.\nError code {0} ({1}). URL: {2}".format(data.status,data.statusText,$(this)[0].url));
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 </script>
93 </script>
@@ -1,34 +1,34 b''
1 <%namespace name="its" file="/base/issue_tracker_settings.mako"/>
1 <%namespace name="its" file="/base/issue_tracker_settings.mako"/>
2
2
3 <div class="panel panel-default">
3 <div class="panel panel-default">
4 <div class="panel-heading">
4 <div class="panel-heading">
5 <h3 class="panel-title">${_('Issue Tracker / Wiki Patterns')}</h3>
5 <h3 class="panel-title">${_('Issue Tracker / Wiki Patterns')}</h3>
6 </div>
6 </div>
7 <div class="panel-body">
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 ${its.issue_tracker_settings_table(
9 ${its.issue_tracker_settings_table(
10 patterns=c.issuetracker_entries.items(),
10 patterns=c.issuetracker_entries.items(),
11 form_url=h.url('admin_settings_issuetracker'),
11 form_url=h.url('admin_settings_issuetracker'),
12 delete_url=h.url('admin_issuetracker_delete')
12 delete_url=h.url('admin_issuetracker_delete')
13 )}
13 )}
14 <div class="buttons">
14 <div class="buttons">
15 <button type="submit" class="btn btn-primary" id="save">${_('Save')}</button>
15 <button type="submit" class="btn btn-primary" id="save">${_('Save')}</button>
16 <button type="reset" class="btn">${_('Reset')}</button>
16 <button type="reset" class="btn">${_('Reset')}</button>
17 </div>
17 </div>
18 ${h.end_form()}
18 ${h.end_form()}
19 </div>
19 </div>
20 </div>
20 </div>
21
21
22 <div class="panel panel-default">
22 <div class="panel panel-default">
23 <div class="panel-heading">
23 <div class="panel-heading">
24 <h3 class="panel-title">${_('Test Patterns')}</h3>
24 <h3 class="panel-title">${_('Test Patterns')}</h3>
25 </div>
25 </div>
26 <div class="panel-body">
26 <div class="panel-body">
27 ${its.issue_tracker_new_row()}
27 ${its.issue_tracker_new_row()}
28 ${its.issue_tracker_settings_test(test_url=h.url('admin_issuetracker_test'))}
28 ${its.issue_tracker_settings_test(test_url=h.url('admin_issuetracker_test'))}
29 </div>
29 </div>
30 </div>
30 </div>
31
31
32
32
33
33
34
34
@@ -1,58 +1,58 b''
1 <div class="panel panel-default">
1 <div class="panel panel-default">
2 <div class="panel-heading">
2 <div class="panel-heading">
3 <h3 class="panel-title">${_('Labs Settings')}</h3>
3 <h3 class="panel-title">${_('Labs Settings')}</h3>
4 </div>
4 </div>
5 <div class="panel-body">
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 <div class="form">
7 <div class="form">
8 <div class="fields">
8 <div class="fields">
9 % if not c.lab_settings:
9 % if not c.lab_settings:
10 ${_('There are no Labs settings currently')}
10 ${_('There are no Labs settings currently')}
11 % else:
11 % else:
12 % for lab_setting in c.lab_settings:
12 % for lab_setting in c.lab_settings:
13 <div class="field">
13 <div class="field">
14 <div class="label">
14 <div class="label">
15 <label>${lab_setting.group}:</label>
15 <label>${lab_setting.group}:</label>
16 </div>
16 </div>
17 % if lab_setting.type == 'bool':
17 % if lab_setting.type == 'bool':
18 <div class="checkboxes">
18 <div class="checkboxes">
19 <div class="checkbox">
19 <div class="checkbox">
20 ${h.checkbox(lab_setting.key, 'True')}
20 ${h.checkbox(lab_setting.key, 'True')}
21 % if lab_setting.label:
21 % if lab_setting.label:
22 <label for="${lab_setting.key}">${lab_setting.label}</label>
22 <label for="${lab_setting.key}">${lab_setting.label}</label>
23 % endif
23 % endif
24 </div>
24 </div>
25 % if lab_setting.help:
25 % if lab_setting.help:
26 <p class="help-block">${lab_setting.help}</p>
26 <p class="help-block">${lab_setting.help}</p>
27 % endif
27 % endif
28 </div>
28 </div>
29 % else:
29 % else:
30 <div class="input">
30 <div class="input">
31 ${h.text(lab_setting.key, size=60)}
31 ${h.text(lab_setting.key, size=60)}
32
32
33 ## TODO: johbo: This style does not yet exist for our forms,
33 ## TODO: johbo: This style does not yet exist for our forms,
34 ## the lab settings seem not to adhere to the structure which
34 ## the lab settings seem not to adhere to the structure which
35 ## we use in other places.
35 ## we use in other places.
36 % if lab_setting.label:
36 % if lab_setting.label:
37 <label for="${lab_setting.key}">${lab_setting.label}</label>
37 <label for="${lab_setting.key}">${lab_setting.label}</label>
38 % endif
38 % endif
39
39
40 % if lab_setting.help:
40 % if lab_setting.help:
41 <p class="help-block">${lab_setting.help}</p>
41 <p class="help-block">${lab_setting.help}</p>
42 % endif
42 % endif
43 </div>
43 </div>
44 % endif
44 % endif
45 </div>
45 </div>
46 % endfor
46 % endfor
47 <div class="buttons">
47 <div class="buttons">
48 ${h.submit('save', _('Save settings'), class_='btn')}
48 ${h.submit('save', _('Save settings'), class_='btn')}
49 ${h.reset('reset', _('Reset'), class_='btn')}
49 ${h.reset('reset', _('Reset'), class_='btn')}
50 </div>
50 </div>
51 % endif
51 % endif
52 </div>
52 </div>
53 </div>
53 </div>
54 ${h.end_form()}
54 ${h.end_form()}
55 </div>
55 </div>
56 </div>
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 <div class="panel panel-default">
3 <div class="panel panel-default">
4 <div class="panel-heading">
4 <div class="panel-heading">
5 <h3 class="panel-title">${_('Import New Groups or Repositories')}</h3>
5 <h3 class="panel-title">${_('Import New Groups or Repositories')}</h3>
6 </div>
6 </div>
7 <div class="panel-body">
7 <div class="panel-body">
8 <div class="checkbox">
8 <div class="checkbox">
9 ${h.checkbox('destroy',True)}
9 ${h.checkbox('destroy',True)}
10 <label for="destroy">${_('Destroy old data')}</label>
10 <label for="destroy">${_('Destroy old data')}</label>
11 </div>
11 </div>
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>
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 <div class="checkbox">
14 <div class="checkbox">
15 ${h.checkbox('invalidate',True)}
15 ${h.checkbox('invalidate',True)}
16 <label for="invalidate"> ${_('Invalidate cache for all repositories')}</label>
16 <label for="invalidate"> ${_('Invalidate cache for all repositories')}</label>
17 </div>
17 </div>
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>
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 <div class="buttons">
20 <div class="buttons">
21 ${h.submit('rescan',_('Rescan Filesystem'),class_="btn")}
21 ${h.submit('rescan',_('Rescan Filesystem'),class_="btn")}
22 </div>
22 </div>
23
23
24 </div>
24 </div>
25 </div>
25 </div>
26
26
27
27
28 ${h.end_form()}
28 ${h.end_form()}
@@ -1,62 +1,62 b''
1 <div class="panel panel-default">
1 <div class="panel panel-default">
2 <div class="panel-heading">
2 <div class="panel-heading">
3 <h3 class="panel-title">${_('User Sessions Configuration')}</h3>
3 <h3 class="panel-title">${_('User Sessions Configuration')}</h3>
4 </div>
4 </div>
5 <div class="panel-body">
5 <div class="panel-body">
6 <%
6 <%
7 elems = [
7 elems = [
8 (_('Session type'), c.session_model.SESSION_TYPE, ''),
8 (_('Session type'), c.session_model.SESSION_TYPE, ''),
9 (_('Session expiration period'), '{} seconds'.format(c.session_conf.get('beaker.session.timeout', 0)), ''),
9 (_('Session expiration period'), '{} seconds'.format(c.session_conf.get('beaker.session.timeout', 0)), ''),
10
10
11 (_('Total sessions'), c.session_count, ''),
11 (_('Total sessions'), c.session_count, ''),
12 (_('Expired sessions ({} days)').format(c.cleanup_older_days ), c.session_expired_count, ''),
12 (_('Expired sessions ({} days)').format(c.cleanup_older_days ), c.session_expired_count, ''),
13
13
14 ]
14 ]
15 %>
15 %>
16 <dl class="dl-horizontal settings">
16 <dl class="dl-horizontal settings">
17 %for dt, dd, tt in elems:
17 %for dt, dd, tt in elems:
18 <dt>${dt}:</dt>
18 <dt>${dt}:</dt>
19 <dd title="${h.tooltip(tt)}">${dd}</dd>
19 <dd title="${h.tooltip(tt)}">${dd}</dd>
20 %endfor
20 %endfor
21 </dl>
21 </dl>
22 </div>
22 </div>
23 </div>
23 </div>
24
24
25
25
26 <div class="panel panel-warning">
26 <div class="panel panel-warning">
27 <div class="panel-heading">
27 <div class="panel-heading">
28 <h3 class="panel-title">${_('Cleanup Old Sessions')}</h3>
28 <h3 class="panel-title">${_('Cleanup Old Sessions')}</h3>
29 </div>
29 </div>
30 <div class="panel-body">
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 <p>
33 <p>
34 ${_('Cleanup user sessions that were not active during chosen time frame.')} <br/>
34 ${_('Cleanup user sessions that were not active during chosen time frame.')} <br/>
35 ${_('After performing this action users whose session will be removed will be required to log in again.')} <br/>
35 ${_('After performing this action users whose session will be removed will be required to log in again.')} <br/>
36 <strong>${_('Picking `All` will log-out you, and all users in the system.')}</strong>
36 <strong>${_('Picking `All` will log-out you, and all users in the system.')}</strong>
37 </p>
37 </p>
38
38
39 <script type="text/javascript">
39 <script type="text/javascript">
40 $(document).ready(function() {
40 $(document).ready(function() {
41 $('#expire_days').select2({
41 $('#expire_days').select2({
42 containerCssClass: 'drop-menu',
42 containerCssClass: 'drop-menu',
43 dropdownCssClass: 'drop-menu-dropdown',
43 dropdownCssClass: 'drop-menu-dropdown',
44 dropdownAutoWidth: true,
44 dropdownAutoWidth: true,
45 minimumResultsForSearch: -1
45 minimumResultsForSearch: -1
46 });
46 });
47 });
47 });
48 </script>
48 </script>
49 <select id="expire_days" name="expire_days">
49 <select id="expire_days" name="expire_days">
50 % for n in [60, 90, 30, 7, 0]:
50 % for n in [60, 90, 30, 7, 0]:
51 <option value="${n}">${'{} days'.format(n) if n != 0 else 'All'}</option>
51 <option value="${n}">${'{} days'.format(n) if n != 0 else 'All'}</option>
52 % endfor
52 % endfor
53 </select>
53 </select>
54 <button class="btn btn-small" type="submit"
54 <button class="btn btn-small" type="submit"
55 onclick="return confirm('${_('Confirm to cleanup user sessions')}');">
55 onclick="return confirm('${_('Confirm to cleanup user sessions')}');">
56 ${_('Cleanup sessions')}
56 ${_('Cleanup sessions')}
57 </button>
57 </button>
58 ${h.end_form()}
58 ${h.end_form()}
59 </div>
59 </div>
60 </div>
60 </div>
61
61
62
62
@@ -1,66 +1,66 b''
1 <%namespace name="vcss" file="/base/vcs_settings.mako"/>
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 <div>
4 <div>
5 ${vcss.vcs_settings_fields(
5 ${vcss.vcs_settings_fields(
6 suffix='',
6 suffix='',
7 svn_tag_patterns=c.svn_tag_patterns,
7 svn_tag_patterns=c.svn_tag_patterns,
8 svn_branch_patterns=c.svn_branch_patterns,
8 svn_branch_patterns=c.svn_branch_patterns,
9 display_globals=True,
9 display_globals=True,
10 allow_repo_location_change=c.visual.allow_repo_location_change
10 allow_repo_location_change=c.visual.allow_repo_location_change
11 )}
11 )}
12 <div class="buttons">
12 <div class="buttons">
13 ${h.submit('save',_('Save settings'),class_="btn")}
13 ${h.submit('save',_('Save settings'),class_="btn")}
14 ${h.reset('reset',_('Reset'),class_="btn")}
14 ${h.reset('reset',_('Reset'),class_="btn")}
15 </div>
15 </div>
16 </div>
16 </div>
17 ${h.end_form()}
17 ${h.end_form()}
18
18
19 <script type="text/javascript">
19 <script type="text/javascript">
20
20
21 function ajaxDeletePattern(pattern_id, field_id) {
21 function ajaxDeletePattern(pattern_id, field_id) {
22 var sUrl = "${h.url('admin_settings_vcs')}";
22 var sUrl = "${h.url('admin_settings_vcs')}";
23 var callback = function (o) {
23 var callback = function (o) {
24 var elem = $("#"+field_id);
24 var elem = $("#"+field_id);
25 elem.remove();
25 elem.remove();
26 };
26 };
27 var postData = {
27 var postData = {
28 '_method': 'delete',
28 '_method': 'delete',
29 'delete_svn_pattern': pattern_id,
29 'delete_svn_pattern': pattern_id,
30 'csrf_token': CSRF_TOKEN
30 'csrf_token': CSRF_TOKEN
31 };
31 };
32 var request = $.post(sUrl, postData)
32 var request = $.post(sUrl, postData)
33 .done(callback)
33 .done(callback)
34 .fail(function (data, textStatus, errorThrown) {
34 .fail(function (data, textStatus, errorThrown) {
35 alert("Error while deleting hooks.\nError code {0} ({1}). URL: {2}".format(data.status,data.statusText,$(this)[0].url));
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 $(document).ready(function() {
39 $(document).ready(function() {
40
40
41 var unlockpath = function() {
41 var unlockpath = function() {
42 $('#path_unlock_icon').removeClass('icon-lock').addClass('icon-unlock');
42 $('#path_unlock_icon').removeClass('icon-lock').addClass('icon-unlock');
43 $('#paths_root_path').removeAttr('readonly').removeClass('disabled');
43 $('#paths_root_path').removeAttr('readonly').removeClass('disabled');
44 };
44 };
45
45
46 $('#path_unlock').on('click', function(e) {
46 $('#path_unlock').on('click', function(e) {
47 unlockpath();
47 unlockpath();
48 });
48 });
49
49
50 if ($('.locked_input').children().hasClass('error-message')) {
50 if ($('.locked_input').children().hasClass('error-message')) {
51 unlockpath();
51 unlockpath();
52 }
52 }
53
53
54 /* On click handler for the `Generate Apache Config` button. It sends a
54 /* On click handler for the `Generate Apache Config` button. It sends a
55 POST request to trigger the (re)generation of the mod_dav_svn config. */
55 POST request to trigger the (re)generation of the mod_dav_svn config. */
56 $('#vcs_svn_generate_cfg').on('click', function(event) {
56 $('#vcs_svn_generate_cfg').on('click', function(event) {
57 event.preventDefault();
57 event.preventDefault();
58 var url = "${h.route_path('admin_settings_vcs_svn_generate_cfg')}";
58 var url = "${h.route_path('admin_settings_vcs_svn_generate_cfg')}";
59 var jqxhr = $.post(url, {'csrf_token': CSRF_TOKEN});
59 var jqxhr = $.post(url, {'csrf_token': CSRF_TOKEN});
60 jqxhr.done(function(data) {
60 jqxhr.done(function(data) {
61 $.Topic('/notifications').publish(data);
61 $.Topic('/notifications').publish(data);
62 });
62 });
63 });
63 });
64
64
65 });
65 });
66 </script>
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 <div class="panel panel-default">
3 <div class="panel panel-default">
4 <div class="panel-heading" id="general">
4 <div class="panel-heading" id="general">
5 <h3 class="panel-title">${_('General')}</h3>
5 <h3 class="panel-title">${_('General')}</h3>
6 </div>
6 </div>
7 <div class="panel-body">
7 <div class="panel-body">
8 <div class="checkbox">
8 <div class="checkbox">
9 ${h.checkbox('rhodecode_repository_fields','True')}
9 ${h.checkbox('rhodecode_repository_fields','True')}
10 <label for="rhodecode_repository_fields">${_('Use repository extra fields')}</label>
10 <label for="rhodecode_repository_fields">${_('Use repository extra fields')}</label>
11 </div>
11 </div>
12 <span class="help-block">${_('Allows storing additional customized fields per repository.')}</span>
12 <span class="help-block">${_('Allows storing additional customized fields per repository.')}</span>
13
13
14 <div></div>
14 <div></div>
15 <div class="checkbox">
15 <div class="checkbox">
16 ${h.checkbox('rhodecode_show_version','True')}
16 ${h.checkbox('rhodecode_show_version','True')}
17 <label for="rhodecode_show_version">${_('Show RhodeCode version')}</label>
17 <label for="rhodecode_show_version">${_('Show RhodeCode version')}</label>
18 </div>
18 </div>
19 <span class="help-block">${_('Shows or hides a version number of RhodeCode displayed in the footer.')}</span>
19 <span class="help-block">${_('Shows or hides a version number of RhodeCode displayed in the footer.')}</span>
20 </div>
20 </div>
21 </div>
21 </div>
22
22
23
23
24 <div class="panel panel-default">
24 <div class="panel panel-default">
25 <div class="panel-heading" id="gravatars">
25 <div class="panel-heading" id="gravatars">
26 <h3 class="panel-title">${_('Gravatars')}</h3>
26 <h3 class="panel-title">${_('Gravatars')}</h3>
27 </div>
27 </div>
28 <div class="panel-body">
28 <div class="panel-body">
29 <div class="checkbox">
29 <div class="checkbox">
30 ${h.checkbox('rhodecode_use_gravatar','True')}
30 ${h.checkbox('rhodecode_use_gravatar','True')}
31 <label for="rhodecode_use_gravatar">${_('Use Gravatars based avatars')}</label>
31 <label for="rhodecode_use_gravatar">${_('Use Gravatars based avatars')}</label>
32 </div>
32 </div>
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>
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 <div class="label">
35 <div class="label">
36 <label for="rhodecode_gravatar_url">${_('Gravatar URL')}</label>
36 <label for="rhodecode_gravatar_url">${_('Gravatar URL')}</label>
37 </div>
37 </div>
38 <div class="input">
38 <div class="input">
39 <div class="field">
39 <div class="field">
40 ${h.text('rhodecode_gravatar_url', size='100%')}
40 ${h.text('rhodecode_gravatar_url', size='100%')}
41 </div>
41 </div>
42
42
43 <div class="field">
43 <div class="field">
44 <span class="help-block">${_('''Gravatar url allows you to use other avatar server application.
44 <span class="help-block">${_('''Gravatar url allows you to use other avatar server application.
45 Following variables of the URL will be replaced accordingly.
45 Following variables of the URL will be replaced accordingly.
46 {scheme} 'http' or 'https' sent from running RhodeCode server,
46 {scheme} 'http' or 'https' sent from running RhodeCode server,
47 {email} user email,
47 {email} user email,
48 {md5email} md5 hash of the user email (like at gravatar.com),
48 {md5email} md5 hash of the user email (like at gravatar.com),
49 {size} size of the image that is expected from the server application,
49 {size} size of the image that is expected from the server application,
50 {netloc} network location/server host of running RhodeCode server''')}</span>
50 {netloc} network location/server host of running RhodeCode server''')}</span>
51 </div>
51 </div>
52 </div>
52 </div>
53 </div>
53 </div>
54 </div>
54 </div>
55
55
56
56
57 <div class="panel panel-default">
57 <div class="panel panel-default">
58 <div class="panel-heading" id="meta-tagging">
58 <div class="panel-heading" id="meta-tagging">
59 <h3 class="panel-title">${_('Meta-Tagging')}</h3>
59 <h3 class="panel-title">${_('Meta-Tagging')}</h3>
60 </div>
60 </div>
61 <div class="panel-body">
61 <div class="panel-body">
62 <div class="checkbox">
62 <div class="checkbox">
63 ${h.checkbox('rhodecode_stylify_metatags','True')}
63 ${h.checkbox('rhodecode_stylify_metatags','True')}
64 <label for="rhodecode_stylify_metatags">${_('Stylify recognised meta tags')}</label>
64 <label for="rhodecode_stylify_metatags">${_('Stylify recognised meta tags')}</label>
65 </div>
65 </div>
66 <span class="help-block">${_('Parses meta tags from repository or repository group description fields and turns them into colored tags.')}</span>
66 <span class="help-block">${_('Parses meta tags from repository or repository group description fields and turns them into colored tags.')}</span>
67 <div>
67 <div>
68 <%namespace name="dt" file="/data_table/_dt_elements.mako"/>
68 <%namespace name="dt" file="/data_table/_dt_elements.mako"/>
69 ${dt.metatags_help()}
69 ${dt.metatags_help()}
70 </div>
70 </div>
71 </div>
71 </div>
72 </div>
72 </div>
73
73
74
74
75 <div class="panel panel-default">
75 <div class="panel panel-default">
76 <div class="panel-heading">
76 <div class="panel-heading">
77 <h3 class="panel-title">${_('Dashboard Items')}</h3>
77 <h3 class="panel-title">${_('Dashboard Items')}</h3>
78 </div>
78 </div>
79 <div class="panel-body">
79 <div class="panel-body">
80 <div class="label">
80 <div class="label">
81 <label for="rhodecode_dashboard_items">${_('Main page dashboard items')}</label>
81 <label for="rhodecode_dashboard_items">${_('Main page dashboard items')}</label>
82 </div>
82 </div>
83 <div class="field input">
83 <div class="field input">
84 ${h.text('rhodecode_dashboard_items',size=5)}
84 ${h.text('rhodecode_dashboard_items',size=5)}
85 </div>
85 </div>
86 <div class="field">
86 <div class="field">
87 <span class="help-block">${_('Number of items displayed in the main page dashboard before pagination is shown.')}</span>
87 <span class="help-block">${_('Number of items displayed in the main page dashboard before pagination is shown.')}</span>
88 </div>
88 </div>
89
89
90 <div class="label">
90 <div class="label">
91 <label for="rhodecode_admin_grid_items">${_('Admin pages items')}</label>
91 <label for="rhodecode_admin_grid_items">${_('Admin pages items')}</label>
92 </div>
92 </div>
93 <div class="field input">
93 <div class="field input">
94 ${h.text('rhodecode_admin_grid_items',size=5)}
94 ${h.text('rhodecode_admin_grid_items',size=5)}
95 </div>
95 </div>
96 <div class="field">
96 <div class="field">
97 <span class="help-block">${_('Number of items displayed in the admin pages grids before pagination is shown.')}</span>
97 <span class="help-block">${_('Number of items displayed in the admin pages grids before pagination is shown.')}</span>
98 </div>
98 </div>
99 </div>
99 </div>
100 </div>
100 </div>
101
101
102
102
103
103
104 <div class="panel panel-default">
104 <div class="panel panel-default">
105 <div class="panel-heading" id="commit-id">
105 <div class="panel-heading" id="commit-id">
106 <h3 class="panel-title">${_('Commit ID Style')}</h3>
106 <h3 class="panel-title">${_('Commit ID Style')}</h3>
107 </div>
107 </div>
108 <div class="panel-body">
108 <div class="panel-body">
109 <div class="label">
109 <div class="label">
110 <label for="rhodecode_show_sha_length">${_('Commit sha length')}</label>
110 <label for="rhodecode_show_sha_length">${_('Commit sha length')}</label>
111 </div>
111 </div>
112 <div class="input">
112 <div class="input">
113 <div class="field">
113 <div class="field">
114 ${h.text('rhodecode_show_sha_length',size=5)}
114 ${h.text('rhodecode_show_sha_length',size=5)}
115 </div>
115 </div>
116 <div class="field">
116 <div class="field">
117 <span class="help-block">${_('''Number of chars to show in commit sha displayed in web interface.
117 <span class="help-block">${_('''Number of chars to show in commit sha displayed in web interface.
118 By default it's shown as r123:9043a6a4c226 this value defines the
118 By default it's shown as r123:9043a6a4c226 this value defines the
119 length of the sha after the `r123:` part.''')}</span>
119 length of the sha after the `r123:` part.''')}</span>
120 </div>
120 </div>
121 </div>
121 </div>
122
122
123 <div class="checkbox">
123 <div class="checkbox">
124 ${h.checkbox('rhodecode_show_revision_number','True')}
124 ${h.checkbox('rhodecode_show_revision_number','True')}
125 <label for="rhodecode_show_revision_number">${_('Show commit ID numeric reference')} / ${_('Commit show revision number')}</label>
125 <label for="rhodecode_show_revision_number">${_('Show commit ID numeric reference')} / ${_('Commit show revision number')}</label>
126 </div>
126 </div>
127 <span class="help-block">${_('''Show revision number in commit sha displayed in web interface.
127 <span class="help-block">${_('''Show revision number in commit sha displayed in web interface.
128 By default it's shown as r123:9043a6a4c226 this value defines the
128 By default it's shown as r123:9043a6a4c226 this value defines the
129 if the `r123:` part is shown.''')}</span>
129 if the `r123:` part is shown.''')}</span>
130 </div>
130 </div>
131 </div>
131 </div>
132
132
133
133
134 <div class="panel panel-default">
134 <div class="panel panel-default">
135 <div class="panel-heading" id="icons">
135 <div class="panel-heading" id="icons">
136 <h3 class="panel-title">${_('Icons')}</h3>
136 <h3 class="panel-title">${_('Icons')}</h3>
137 </div>
137 </div>
138 <div class="panel-body">
138 <div class="panel-body">
139 <div class="checkbox">
139 <div class="checkbox">
140 ${h.checkbox('rhodecode_show_public_icon','True')}
140 ${h.checkbox('rhodecode_show_public_icon','True')}
141 <label for="rhodecode_show_public_icon">${_('Show public repo icon on repositories')}</label>
141 <label for="rhodecode_show_public_icon">${_('Show public repo icon on repositories')}</label>
142 </div>
142 </div>
143 <div></div>
143 <div></div>
144
144
145 <div class="checkbox">
145 <div class="checkbox">
146 ${h.checkbox('rhodecode_show_private_icon','True')}
146 ${h.checkbox('rhodecode_show_private_icon','True')}
147 <label for="rhodecode_show_private_icon">${_('Show private repo icon on repositories')}</label>
147 <label for="rhodecode_show_private_icon">${_('Show private repo icon on repositories')}</label>
148 </div>
148 </div>
149 <span class="help-block">${_('Show public/private icons next to repositories names.')}</span>
149 <span class="help-block">${_('Show public/private icons next to repositories names.')}</span>
150 </div>
150 </div>
151 </div>
151 </div>
152
152
153
153
154 <div class="panel panel-default">
154 <div class="panel panel-default">
155 <div class="panel-heading">
155 <div class="panel-heading">
156 <h3 class="panel-title">${_('Markup Renderer')}</h3>
156 <h3 class="panel-title">${_('Markup Renderer')}</h3>
157 </div>
157 </div>
158 <div class="panel-body">
158 <div class="panel-body">
159 <div class="field select">
159 <div class="field select">
160 ${h.select('rhodecode_markup_renderer', '', ['rst', 'markdown'])}
160 ${h.select('rhodecode_markup_renderer', '', ['rst', 'markdown'])}
161 </div>
161 </div>
162 <div class="field">
162 <div class="field">
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>
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 </div>
164 </div>
165 </div>
165 </div>
166 </div>
166 </div>
167
167
168 <div class="panel panel-default">
168 <div class="panel panel-default">
169 <div class="panel-heading">
169 <div class="panel-heading">
170 <h3 class="panel-title">${_('Clone URL')}</h3>
170 <h3 class="panel-title">${_('Clone URL')}</h3>
171 </div>
171 </div>
172 <div class="panel-body">
172 <div class="panel-body">
173 <div class="field">
173 <div class="field">
174 ${h.text('rhodecode_clone_uri_tmpl', size=60)}
174 ${h.text('rhodecode_clone_uri_tmpl', size=60)}
175 </div>
175 </div>
176
176
177 <div class="field">
177 <div class="field">
178 <span class="help-block">
178 <span class="help-block">
179 ${_('''Schema of clone url construction eg. '{scheme}://{user}@{netloc}/{repo}', available vars:
179 ${_('''Schema of clone url construction eg. '{scheme}://{user}@{netloc}/{repo}', available vars:
180 {scheme} 'http' or 'https' sent from running RhodeCode server,
180 {scheme} 'http' or 'https' sent from running RhodeCode server,
181 {user} current user username,
181 {user} current user username,
182 {netloc} network location/server host of running RhodeCode server,
182 {netloc} network location/server host of running RhodeCode server,
183 {repo} full repository name,
183 {repo} full repository name,
184 {repoid} ID of repository, can be used to contruct clone-by-id''')}
184 {repoid} ID of repository, can be used to contruct clone-by-id''')}
185 </span>
185 </span>
186 </div>
186 </div>
187 </div>
187 </div>
188 </div>
188 </div>
189
189
190 <div class="panel panel-default">
190 <div class="panel panel-default">
191 <div class="panel-heading">
191 <div class="panel-heading">
192 <h3 class="panel-title">${_('Custom Support Link')}</h3>
192 <h3 class="panel-title">${_('Custom Support Link')}</h3>
193 </div>
193 </div>
194 <div class="panel-body">
194 <div class="panel-body">
195 <div class="field">
195 <div class="field">
196 ${h.text('rhodecode_support_url', size=60)}
196 ${h.text('rhodecode_support_url', size=60)}
197 </div>
197 </div>
198 <div class="field">
198 <div class="field">
199 <span class="help-block">
199 <span class="help-block">
200 ${_('''Custom url for the support link located at the bottom.
200 ${_('''Custom url for the support link located at the bottom.
201 The default is set to %(default_url)s. In case there's a need
201 The default is set to %(default_url)s. In case there's a need
202 to change the support link to internal issue tracker, it should be done here.
202 to change the support link to internal issue tracker, it should be done here.
203 ''') % {'default_url': h.url('rhodecode_support')}}
203 ''') % {'default_url': h.url('rhodecode_support')}}
204 </span>
204 </span>
205 </div>
205 </div>
206 </div>
206 </div>
207 </div>
207 </div>
208
208
209 <div class="buttons">
209 <div class="buttons">
210 ${h.submit('save',_('Save settings'),class_="btn")}
210 ${h.submit('save',_('Save settings'),class_="btn")}
211 ${h.reset('reset',_('Reset'),class_="btn")}
211 ${h.reset('reset',_('Reset'),class_="btn")}
212 </div>
212 </div>
213
213
214
214
215 ${h.end_form()}
215 ${h.end_form()}
216
216
217 <script>
217 <script>
218 $(document).ready(function() {
218 $(document).ready(function() {
219 $('#rhodecode_markup_renderer').select2({
219 $('#rhodecode_markup_renderer').select2({
220 containerCssClass: 'drop-menu',
220 containerCssClass: 'drop-menu',
221 dropdownCssClass: 'drop-menu-dropdown',
221 dropdownCssClass: 'drop-menu-dropdown',
222 dropdownAutoWidth: true,
222 dropdownAutoWidth: true,
223 minimumResultsForSearch: -1
223 minimumResultsForSearch: -1
224 });
224 });
225 });
225 });
226 </script>
226 </script>
@@ -1,72 +1,72 b''
1 ## -*- coding: utf-8 -*-
1 ## -*- coding: utf-8 -*-
2 <%inherit file="/base/base.mako"/>
2 <%inherit file="/base/base.mako"/>
3
3
4 <%def name="title()">
4 <%def name="title()">
5 ${_('Add user group')}
5 ${_('Add user group')}
6 %if c.rhodecode_name:
6 %if c.rhodecode_name:
7 &middot; ${h.branding(c.rhodecode_name)}
7 &middot; ${h.branding(c.rhodecode_name)}
8 %endif
8 %endif
9 </%def>
9 </%def>
10 <%def name="breadcrumbs_links()">
10 <%def name="breadcrumbs_links()">
11 ${h.link_to(_('Admin'),h.route_path('admin_home'))}
11 ${h.link_to(_('Admin'),h.route_path('admin_home'))}
12 &raquo;
12 &raquo;
13 ${h.link_to(_('User groups'),h.route_path('user_groups'))}
13 ${h.link_to(_('User groups'),h.route_path('user_groups'))}
14 &raquo;
14 &raquo;
15 ${_('Add User Group')}
15 ${_('Add User Group')}
16 </%def>
16 </%def>
17
17
18 <%def name="menu_bar_nav()">
18 <%def name="menu_bar_nav()">
19 ${self.menu_items(active='admin')}
19 ${self.menu_items(active='admin')}
20 </%def>
20 </%def>
21
21
22 <%def name="main()">
22 <%def name="main()">
23 <div class="box main-content">
23 <div class="box main-content">
24 <!-- box / title -->
24 <!-- box / title -->
25 <div class="title">
25 <div class="title">
26 ${self.breadcrumbs()}
26 ${self.breadcrumbs()}
27 </div>
27 </div>
28 <!-- end box / title -->
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 <div class="form">
30 <div class="form">
31 <!-- fields -->
31 <!-- fields -->
32 <div class="fields">
32 <div class="fields">
33 <div class="field">
33 <div class="field">
34 <div class="label">
34 <div class="label">
35 <label for="users_group_name">${_('Group name')}:</label>
35 <label for="users_group_name">${_('Group name')}:</label>
36 </div>
36 </div>
37 <div class="input">
37 <div class="input">
38 ${h.text('users_group_name', class_='medium')}
38 ${h.text('users_group_name', class_='medium')}
39 </div>
39 </div>
40 </div>
40 </div>
41 <div class="field">
41 <div class="field">
42 <div class="label">
42 <div class="label">
43 <label for="user_group_description">${_('Description')}:</label>
43 <label for="user_group_description">${_('Description')}:</label>
44 </div>
44 </div>
45 <div class="textarea editor">
45 <div class="textarea editor">
46 ${h.textarea('user_group_description')}
46 ${h.textarea('user_group_description')}
47 <span class="help-block">${_('Short, optional description for this user group.')}</span>
47 <span class="help-block">${_('Short, optional description for this user group.')}</span>
48 </div>
48 </div>
49 </div>
49 </div>
50 <div class="field">
50 <div class="field">
51 <div class="label">
51 <div class="label">
52 <label for="users_group_active">${_('Active')}:</label>
52 <label for="users_group_active">${_('Active')}:</label>
53 </div>
53 </div>
54 <div class="checkboxes">
54 <div class="checkboxes">
55 ${h.checkbox('users_group_active',value=True, checked='checked')}
55 ${h.checkbox('users_group_active',value=True, checked='checked')}
56 </div>
56 </div>
57 </div>
57 </div>
58
58
59 <div class="buttons">
59 <div class="buttons">
60 ${h.submit('save',_('Save'),class_="btn")}
60 ${h.submit('save',_('Save'),class_="btn")}
61 </div>
61 </div>
62 </div>
62 </div>
63 </div>
63 </div>
64 ${h.end_form()}
64 ${h.end_form()}
65 </div>
65 </div>
66 </%def>
66 </%def>
67
67
68 <script>
68 <script>
69 $(document).ready(function(){
69 $(document).ready(function(){
70 $('#users_group_name').focus();
70 $('#users_group_name').focus();
71 })
71 })
72 </script>
72 </script>
@@ -1,84 +1,84 b''
1 <%namespace name="base" file="/base/base.mako"/>
1 <%namespace name="base" file="/base/base.mako"/>
2
2
3 <%
3 <%
4 elems = [
4 elems = [
5 (_('Owner'), lambda:base.gravatar_with_user(c.user_group.user.email), '', ''),
5 (_('Owner'), lambda:base.gravatar_with_user(c.user_group.user.email), '', ''),
6 (_('Created on'), h.format_date(c.user_group.created_on), '', '',),
6 (_('Created on'), h.format_date(c.user_group.created_on), '', '',),
7
7
8 (_('Members'), len(c.group_members_obj),'', [x for x in c.group_members_obj]),
8 (_('Members'), len(c.group_members_obj),'', [x for x in c.group_members_obj]),
9 (_('Automatic member sync'), 'Yes' if c.user_group.group_data.get('extern_type') else 'No', '', '',),
9 (_('Automatic member sync'), 'Yes' if c.user_group.group_data.get('extern_type') else 'No', '', '',),
10
10
11 (_('Assigned to repositories'), len(c.group_to_repos),'', [x for x in c.group_to_repos]),
11 (_('Assigned to repositories'), len(c.group_to_repos),'', [x for x in c.group_to_repos]),
12 (_('Assigned to repo groups'), len(c.group_to_repo_groups), '', [x for x in c.group_to_repo_groups]),
12 (_('Assigned to repo groups'), len(c.group_to_repo_groups), '', [x for x in c.group_to_repo_groups]),
13
13
14 (_('Assigned to review rules'), len(c.group_to_review_rules), '', [x for x in c.group_to_review_rules]),
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 <div class="panel panel-default">
18 <div class="panel panel-default">
19 <div class="panel-heading">
19 <div class="panel-heading">
20 <h3 class="panel-title">${_('User Group: %s') % c.user_group.users_group_name}</h3>
20 <h3 class="panel-title">${_('User Group: %s') % c.user_group.users_group_name}</h3>
21 </div>
21 </div>
22 <div class="panel-body">
22 <div class="panel-body">
23 ${base.dt_info_panel(elems)}
23 ${base.dt_info_panel(elems)}
24 </div>
24 </div>
25
25
26 </div>
26 </div>
27
27
28 <div class="panel panel-default">
28 <div class="panel panel-default">
29 <div class="panel-heading">
29 <div class="panel-heading">
30 <h3 class="panel-title">${_('Group members sync')}</h3>
30 <h3 class="panel-title">${_('Group members sync')}</h3>
31 </div>
31 </div>
32 <div class="panel-body">
32 <div class="panel-body">
33 <% sync_type = c.user_group.group_data.get('extern_type') %>
33 <% sync_type = c.user_group.group_data.get('extern_type') %>
34
34
35 % if sync_type:
35 % if sync_type:
36 <p>
36 <p>
37 ${_('This group is set to be automatically synchronised.')}<br/>
37 ${_('This group is set to be automatically synchronised.')}<br/>
38 ${_('This group synchronization was set by')}: <strong>${sync_type}</strong>
38 ${_('This group synchronization was set by')}: <strong>${sync_type}</strong>
39 </p>
39 </p>
40 % else:
40 % else:
41 <p>
41 <p>
42 ${_('This group is not set to be automatically synchronised')}
42 ${_('This group is not set to be automatically synchronised')}
43 </p>
43 </p>
44 % endif
44 % endif
45
45
46 <div>
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 <div class="field">
48 <div class="field">
49 <button class="btn btn-default" type="submit">
49 <button class="btn btn-default" type="submit">
50 %if sync_type:
50 %if sync_type:
51 ${_('Disable synchronization')}
51 ${_('Disable synchronization')}
52 %else:
52 %else:
53 ${_('Enable synchronization')}
53 ${_('Enable synchronization')}
54 %endif
54 %endif
55 </button>
55 </button>
56 </div>
56 </div>
57 <div class="field">
57 <div class="field">
58 <span class="help-block">
58 <span class="help-block">
59 ${_('Users will be added or removed from this group when they authenticate with RhodeCode system, based on LDAP group membership. '
59 ${_('Users will be added or removed from this group when they authenticate with RhodeCode system, based on LDAP group membership. '
60 'This requires `LDAP+User group` authentication plugin to be configured and enabled. (EE only feature)')}
60 'This requires `LDAP+User group` authentication plugin to be configured and enabled. (EE only feature)')}
61 </span>
61 </span>
62 </div>
62 </div>
63 ${h.end_form()}
63 ${h.end_form()}
64 </div>
64 </div>
65
65
66 </div>
66 </div>
67 </div>
67 </div>
68
68
69
69
70 <div class="panel panel-danger">
70 <div class="panel panel-danger">
71 <div class="panel-heading">
71 <div class="panel-heading">
72 <h3 class="panel-title">${_('Delete User Group')}</h3>
72 <h3 class="panel-title">${_('Delete User Group')}</h3>
73 </div>
73 </div>
74 <div class="panel-body">
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 ${h.hidden('force', 1)}
76 ${h.hidden('force', 1)}
77 <button class="btn btn-small btn-danger" type="submit"
77 <button class="btn btn-small btn-danger" type="submit"
78 onclick="return confirm('${_('Confirm to delete user group `%(ugroup)s` with all permission assignments') % {'ugroup': c.user_group.users_group_name}}');">
78 onclick="return confirm('${_('Confirm to delete user group `%(ugroup)s` with all permission assignments') % {'ugroup': c.user_group.users_group_name}}');">
79 <i class="icon-remove-sign"></i>
79 <i class="icon-remove-sign"></i>
80 ${_('Delete This User Group')}
80 ${_('Delete This User Group')}
81 </button>
81 </button>
82 ${h.end_form()}
82 ${h.end_form()}
83 </div>
83 </div>
84 </div>
84 </div>
@@ -1,134 +1,134 b''
1 <%namespace name="base" file="/base/base.mako"/>
1 <%namespace name="base" file="/base/base.mako"/>
2
2
3 <div class="panel panel-default">
3 <div class="panel panel-default">
4 <div class="panel-heading">
4 <div class="panel-heading">
5 <h3 class="panel-title">${_('User Group Permissions')}</h3>
5 <h3 class="panel-title">${_('User Group Permissions')}</h3>
6 </div>
6 </div>
7 <div class="panel-body">
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 <table id="permissions_manage" class="rctable permissions">
9 <table id="permissions_manage" class="rctable permissions">
10 <tr>
10 <tr>
11 <th class="td-radio">${_('None')}</th>
11 <th class="td-radio">${_('None')}</th>
12 <th class="td-radio">${_('Read')}</th>
12 <th class="td-radio">${_('Read')}</th>
13 <th class="td-radio">${_('Write')}</th>
13 <th class="td-radio">${_('Write')}</th>
14 <th class="td-radio">${_('Admin')}</th>
14 <th class="td-radio">${_('Admin')}</th>
15 <th>${_('User/User Group')}</th>
15 <th>${_('User/User Group')}</th>
16 <th></th>
16 <th></th>
17 </tr>
17 </tr>
18 ## USERS
18 ## USERS
19 %for _user in c.user_group.permissions():
19 %for _user in c.user_group.permissions():
20 %if getattr(_user, 'admin_row', None) or getattr(_user, 'owner_row', None):
20 %if getattr(_user, 'admin_row', None) or getattr(_user, 'owner_row', None):
21 <tr class="perm_admin_row">
21 <tr class="perm_admin_row">
22 <td class="td-radio">${h.radio('admin_perm_%s' % _user.user_id,'repository.none', disabled="disabled")}</td>
22 <td class="td-radio">${h.radio('admin_perm_%s' % _user.user_id,'repository.none', disabled="disabled")}</td>
23 <td class="td-radio">${h.radio('admin_perm_%s' % _user.user_id,'repository.read', disabled="disabled")}</td>
23 <td class="td-radio">${h.radio('admin_perm_%s' % _user.user_id,'repository.read', disabled="disabled")}</td>
24 <td class="td-radio">${h.radio('admin_perm_%s' % _user.user_id,'repository.write', disabled="disabled")}</td>
24 <td class="td-radio">${h.radio('admin_perm_%s' % _user.user_id,'repository.write', disabled="disabled")}</td>
25 <td class="td-radio">${h.radio('admin_perm_%s' % _user.user_id,'repository.admin', 'repository.admin', disabled="disabled")}</td>
25 <td class="td-radio">${h.radio('admin_perm_%s' % _user.user_id,'repository.admin', 'repository.admin', disabled="disabled")}</td>
26 <td class="td-user">
26 <td class="td-user">
27 ${base.gravatar(_user.email, 16)}
27 ${base.gravatar(_user.email, 16)}
28 <span class="user">
28 <span class="user">
29 ${h.link_to_user(_user.username)}
29 ${h.link_to_user(_user.username)}
30 %if getattr(_user, 'admin_row', None):
30 %if getattr(_user, 'admin_row', None):
31 (${_('super admin')})
31 (${_('super admin')})
32 %endif
32 %endif
33 %if getattr(_user, 'owner_row', None):
33 %if getattr(_user, 'owner_row', None):
34 (${_('owner')})
34 (${_('owner')})
35 %endif
35 %endif
36 </span>
36 </span>
37 </td>
37 </td>
38 <td></td>
38 <td></td>
39 </tr>
39 </tr>
40 %else:
40 %else:
41 ##forbid revoking permission from yourself, except if you're an super admin
41 ##forbid revoking permission from yourself, except if you're an super admin
42 <tr>
42 <tr>
43 %if c.rhodecode_user.user_id != _user.user_id or c.rhodecode_user.is_admin:
43 %if c.rhodecode_user.user_id != _user.user_id or c.rhodecode_user.is_admin:
44 <td class="td-radio">${h.radio('u_perm_%s' % _user.user_id,'usergroup.none')}</td>
44 <td class="td-radio">${h.radio('u_perm_%s' % _user.user_id,'usergroup.none')}</td>
45 <td class="td-radio">${h.radio('u_perm_%s' % _user.user_id,'usergroup.read')}</td>
45 <td class="td-radio">${h.radio('u_perm_%s' % _user.user_id,'usergroup.read')}</td>
46 <td class="td-radio">${h.radio('u_perm_%s' % _user.user_id,'usergroup.write')}</td>
46 <td class="td-radio">${h.radio('u_perm_%s' % _user.user_id,'usergroup.write')}</td>
47 <td class="td-radio">${h.radio('u_perm_%s' % _user.user_id,'usergroup.admin')}</td>
47 <td class="td-radio">${h.radio('u_perm_%s' % _user.user_id,'usergroup.admin')}</td>
48 <td class="td-user">
48 <td class="td-user">
49 ${base.gravatar(_user.email, 16)}
49 ${base.gravatar(_user.email, 16)}
50 <span class="user">
50 <span class="user">
51 % if _user.username == h.DEFAULT_USER:
51 % if _user.username == h.DEFAULT_USER:
52 ${h.DEFAULT_USER} <span class="user-perm-help-text"> - ${_('permission for all other users')}</span>
52 ${h.DEFAULT_USER} <span class="user-perm-help-text"> - ${_('permission for all other users')}</span>
53 % else:
53 % else:
54 ${h.link_to_user(_user.username)}
54 ${h.link_to_user(_user.username)}
55 % endif
55 % endif
56 </span>
56 </span>
57 </td>
57 </td>
58 <td class="td-action">
58 <td class="td-action">
59 %if _user.username != h.DEFAULT_USER:
59 %if _user.username != h.DEFAULT_USER:
60 <span class="btn btn-link btn-danger revoke_perm"
60 <span class="btn btn-link btn-danger revoke_perm"
61 member="${_user.user_id}" member_type="user">
61 member="${_user.user_id}" member_type="user">
62 <i class="icon-remove"></i> ${_('revoke')}
62 <i class="icon-remove"></i> ${_('revoke')}
63 </span>
63 </span>
64 %endif
64 %endif
65 </td>
65 </td>
66 %else:
66 %else:
67 ## special case for current user permissions, we make sure he cannot take his own permissions
67 ## special case for current user permissions, we make sure he cannot take his own permissions
68 <td class="td-radio">${h.radio('u_perm_%s' % _user.user_id,'usergroup.none', disabled="disabled")}</td>
68 <td class="td-radio">${h.radio('u_perm_%s' % _user.user_id,'usergroup.none', disabled="disabled")}</td>
69 <td class="td-radio">${h.radio('u_perm_%s' % _user.user_id,'usergroup.read', disabled="disabled")}</td>
69 <td class="td-radio">${h.radio('u_perm_%s' % _user.user_id,'usergroup.read', disabled="disabled")}</td>
70 <td class="td-radio">${h.radio('u_perm_%s' % _user.user_id,'usergroup.write', disabled="disabled")}</td>
70 <td class="td-radio">${h.radio('u_perm_%s' % _user.user_id,'usergroup.write', disabled="disabled")}</td>
71 <td class="td-radio">${h.radio('u_perm_%s' % _user.user_id,'usergroup.admin', disabled="disabled")}</td>
71 <td class="td-radio">${h.radio('u_perm_%s' % _user.user_id,'usergroup.admin', disabled="disabled")}</td>
72 <td class="td-user">
72 <td class="td-user">
73 ${base.gravatar(_user.email, 16)}
73 ${base.gravatar(_user.email, 16)}
74 <span class="user">
74 <span class="user">
75 % if _user.username == h.DEFAULT_USER:
75 % if _user.username == h.DEFAULT_USER:
76 ${h.DEFAULT_USER} <span class="user-perm-help-text"> - ${_('permission for all other users')}</span>
76 ${h.DEFAULT_USER} <span class="user-perm-help-text"> - ${_('permission for all other users')}</span>
77 % else:
77 % else:
78 ${h.link_to_user(_user.username)}
78 ${h.link_to_user(_user.username)}
79 % endif
79 % endif
80 <span class="user-perm-help-text">(${_('delegated admin')})</span>
80 <span class="user-perm-help-text">(${_('delegated admin')})</span>
81 </span>
81 </span>
82 </td>
82 </td>
83 <td></td>
83 <td></td>
84 %endif
84 %endif
85 </tr>
85 </tr>
86 %endif
86 %endif
87 %endfor
87 %endfor
88
88
89 ## USER GROUPS
89 ## USER GROUPS
90 %for _user_group in c.user_group.permission_user_groups():
90 %for _user_group in c.user_group.permission_user_groups():
91 <tr>
91 <tr>
92 <td class="td-radio">${h.radio('g_perm_%s' % _user_group.users_group_id,'usergroup.none')}</td>
92 <td class="td-radio">${h.radio('g_perm_%s' % _user_group.users_group_id,'usergroup.none')}</td>
93 <td class="td-radio">${h.radio('g_perm_%s' % _user_group.users_group_id,'usergroup.read')}</td>
93 <td class="td-radio">${h.radio('g_perm_%s' % _user_group.users_group_id,'usergroup.read')}</td>
94 <td class="td-radio">${h.radio('g_perm_%s' % _user_group.users_group_id,'usergroup.write')}</td>
94 <td class="td-radio">${h.radio('g_perm_%s' % _user_group.users_group_id,'usergroup.write')}</td>
95 <td class="td-radio">${h.radio('g_perm_%s' % _user_group.users_group_id,'usergroup.admin')}</td>
95 <td class="td-radio">${h.radio('g_perm_%s' % _user_group.users_group_id,'usergroup.admin')}</td>
96 <td class="td-user">
96 <td class="td-user">
97 <i class="icon-group" ></i>
97 <i class="icon-group" ></i>
98 %if h.HasPermissionAny('hg.admin')():
98 %if h.HasPermissionAny('hg.admin')():
99 <a href="${h.route_path('edit_user_group',user_group_id=_user_group.users_group_id)}">
99 <a href="${h.route_path('edit_user_group',user_group_id=_user_group.users_group_id)}">
100 ${_user_group.users_group_name}
100 ${_user_group.users_group_name}
101 </a>
101 </a>
102 %else:
102 %else:
103 ${_user_group.users_group_name}
103 ${_user_group.users_group_name}
104 %endif
104 %endif
105 </td>
105 </td>
106 <td class="td-action">
106 <td class="td-action">
107 <span class="btn btn-link btn-danger revoke_perm"
107 <span class="btn btn-link btn-danger revoke_perm"
108 member="${_user_group.users_group_id}" member_type="user_group">
108 member="${_user_group.users_group_id}" member_type="user_group">
109 <i class="icon-remove"></i> ${_('revoke')}
109 <i class="icon-remove"></i> ${_('revoke')}
110 </span>
110 </span>
111 </td>
111 </td>
112 </tr>
112 </tr>
113 %endfor
113 %endfor
114 <tr class="new_members" id="add_perm_input"></tr>
114 <tr class="new_members" id="add_perm_input"></tr>
115 </table>
115 </table>
116 <div id="add_perm" class="link">
116 <div id="add_perm" class="link">
117 ${_('Add new')}
117 ${_('Add new')}
118 </div>
118 </div>
119 <div class="buttons">
119 <div class="buttons">
120 ${h.submit('save',_('Save'),class_="btn btn-primary")}
120 ${h.submit('save',_('Save'),class_="btn btn-primary")}
121 ${h.reset('reset',_('Reset'),class_="btn btn-danger")}
121 ${h.reset('reset',_('Reset'),class_="btn btn-danger")}
122 </div>
122 </div>
123 ${h.end_form()}
123 ${h.end_form()}
124 </div>
124 </div>
125 </div>
125 </div>
126
126
127 <script type="text/javascript">
127 <script type="text/javascript">
128 $('#add_perm').on('click', function(e){
128 $('#add_perm').on('click', function(e){
129 addNewPermInput($(this), 'usergroup');
129 addNewPermInput($(this), 'usergroup');
130 });
130 });
131 $('.revoke_perm').on('click', function(e){
131 $('.revoke_perm').on('click', function(e){
132 markRevokePermInput($(this), 'usergroup');
132 markRevokePermInput($(this), 'usergroup');
133 });
133 });
134 </script>
134 </script>
@@ -1,186 +1,186 b''
1 ## -*- coding: utf-8 -*-
1 ## -*- coding: utf-8 -*-
2 <%namespace name="base" file="/base/base.mako"/>
2 <%namespace name="base" file="/base/base.mako"/>
3
3
4 <div class="panel panel-default">
4 <div class="panel panel-default">
5 <div class="panel-heading">
5 <div class="panel-heading">
6 <h3 class="panel-title">${_('User Group: %s') % c.user_group.users_group_name}</h3>
6 <h3 class="panel-title">${_('User Group: %s') % c.user_group.users_group_name}</h3>
7 </div>
7 </div>
8 <div class="panel-body">
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 <div class="form">
10 <div class="form">
11 <!-- fields -->
11 <!-- fields -->
12 <div class="fields">
12 <div class="fields">
13 <div class="field">
13 <div class="field">
14 <div class="label">
14 <div class="label">
15 <label for="users_group_name">${_('Group name')}:</label>
15 <label for="users_group_name">${_('Group name')}:</label>
16 </div>
16 </div>
17 <div class="input">
17 <div class="input">
18 ${h.text('users_group_name',class_='medium')}
18 ${h.text('users_group_name',class_='medium')}
19 </div>
19 </div>
20 </div>
20 </div>
21
21
22 <div class="field badged-field">
22 <div class="field badged-field">
23 <div class="label">
23 <div class="label">
24 <label for="user">${_('Owner')}:</label>
24 <label for="user">${_('Owner')}:</label>
25 </div>
25 </div>
26 <div class="input">
26 <div class="input">
27 <div class="badge-input-container">
27 <div class="badge-input-container">
28 <div class="user-badge">
28 <div class="user-badge">
29 ${base.gravatar_with_user(c.user_group.user.email, show_disabled=not c.user_group.user.active)}
29 ${base.gravatar_with_user(c.user_group.user.email, show_disabled=not c.user_group.user.active)}
30 </div>
30 </div>
31 <div class="badge-input-wrap">
31 <div class="badge-input-wrap">
32 ${h.text('user', class_="medium", autocomplete="off")}
32 ${h.text('user', class_="medium", autocomplete="off")}
33 </div>
33 </div>
34 </div>
34 </div>
35 <form:error name="user"/>
35 <form:error name="user"/>
36 <p class="help-block">${_('Change owner of this user group.')}</p>
36 <p class="help-block">${_('Change owner of this user group.')}</p>
37 </div>
37 </div>
38 </div>
38 </div>
39
39
40 <div class="field">
40 <div class="field">
41 <div class="label label-textarea">
41 <div class="label label-textarea">
42 <label for="user_group_description">${_('Description')}:</label>
42 <label for="user_group_description">${_('Description')}:</label>
43 </div>
43 </div>
44 <div class="textarea textarea-small editor">
44 <div class="textarea textarea-small editor">
45 ${h.textarea('user_group_description',cols=23,rows=5,class_="medium")}
45 ${h.textarea('user_group_description',cols=23,rows=5,class_="medium")}
46 <span class="help-block">${_('Short, optional description for this user group.')}</span>
46 <span class="help-block">${_('Short, optional description for this user group.')}</span>
47 </div>
47 </div>
48 </div>
48 </div>
49 <div class="field">
49 <div class="field">
50 <div class="label label-checkbox">
50 <div class="label label-checkbox">
51 <label for="users_group_active">${_('Active')}:</label>
51 <label for="users_group_active">${_('Active')}:</label>
52 </div>
52 </div>
53 <div class="checkboxes">
53 <div class="checkboxes">
54 ${h.checkbox('users_group_active',value=True)}
54 ${h.checkbox('users_group_active',value=True)}
55 </div>
55 </div>
56 </div>
56 </div>
57
57
58 <div class="field">
58 <div class="field">
59 <div class="label label-checkbox">
59 <div class="label label-checkbox">
60 <label for="users_group_active">${_('Add members')}:</label>
60 <label for="users_group_active">${_('Add members')}:</label>
61 </div>
61 </div>
62 <div class="input">
62 <div class="input">
63 ${h.text('user_group_add_members', placeholder="user/usergroup", class_="medium")}
63 ${h.text('user_group_add_members', placeholder="user/usergroup", class_="medium")}
64 </div>
64 </div>
65 </div>
65 </div>
66
66
67 <input type="hidden" name="__start__" value="user_group_members:sequence"/>
67 <input type="hidden" name="__start__" value="user_group_members:sequence"/>
68 <table id="group_members_placeholder" class="rctable group_members">
68 <table id="group_members_placeholder" class="rctable group_members">
69 <tr>
69 <tr>
70 <th>${_('Username')}</th>
70 <th>${_('Username')}</th>
71 <th>${_('Action')}</th>
71 <th>${_('Action')}</th>
72 </tr>
72 </tr>
73
73
74 % if c.group_members_obj:
74 % if c.group_members_obj:
75 % for user in c.group_members_obj:
75 % for user in c.group_members_obj:
76 <tr>
76 <tr>
77 <td id="member_user_${user.user_id}" class="td-author">
77 <td id="member_user_${user.user_id}" class="td-author">
78 <div class="group_member">
78 <div class="group_member">
79 ${base.gravatar(user.email, 16)}
79 ${base.gravatar(user.email, 16)}
80 <span class="username user">${h.link_to(h.person(user), h.url( 'edit_user',user_id=user.user_id))}</span>
80 <span class="username user">${h.link_to(h.person(user), h.url( 'edit_user',user_id=user.user_id))}</span>
81 <input type="hidden" name="__start__" value="member:mapping">
81 <input type="hidden" name="__start__" value="member:mapping">
82 <input type="hidden" name="member_user_id" value="${user.user_id}">
82 <input type="hidden" name="member_user_id" value="${user.user_id}">
83 <input type="hidden" name="type" value="existing" id="member_${user.user_id}">
83 <input type="hidden" name="type" value="existing" id="member_${user.user_id}">
84 <input type="hidden" name="__end__" value="member:mapping">
84 <input type="hidden" name="__end__" value="member:mapping">
85 </div>
85 </div>
86 </td>
86 </td>
87 <td class="">
87 <td class="">
88 <div class="usergroup_member_remove action_button" onclick="removeUserGroupMember(${user.user_id}, true)" style="visibility: visible;">
88 <div class="usergroup_member_remove action_button" onclick="removeUserGroupMember(${user.user_id}, true)" style="visibility: visible;">
89 <i class="icon-remove-sign"></i>
89 <i class="icon-remove-sign"></i>
90 </div>
90 </div>
91 </td>
91 </td>
92 </tr>
92 </tr>
93 % endfor
93 % endfor
94
94
95 % else:
95 % else:
96 <tr><td colspan="2">${_('No members yet')}</td></tr>
96 <tr><td colspan="2">${_('No members yet')}</td></tr>
97 % endif
97 % endif
98 </table>
98 </table>
99 <input type="hidden" name="__end__" value="user_group_members:sequence"/>
99 <input type="hidden" name="__end__" value="user_group_members:sequence"/>
100
100
101 <div class="buttons">
101 <div class="buttons">
102 ${h.submit('Save',_('Save'),class_="btn")}
102 ${h.submit('Save',_('Save'),class_="btn")}
103 </div>
103 </div>
104 </div>
104 </div>
105 </div>
105 </div>
106 ${h.end_form()}
106 ${h.end_form()}
107 </div>
107 </div>
108 </div>
108 </div>
109 <script>
109 <script>
110 $(document).ready(function(){
110 $(document).ready(function(){
111 $("#group_parent_id").select2({
111 $("#group_parent_id").select2({
112 'containerCssClass': "drop-menu",
112 'containerCssClass': "drop-menu",
113 'dropdownCssClass': "drop-menu-dropdown",
113 'dropdownCssClass': "drop-menu-dropdown",
114 'dropdownAutoWidth': true
114 'dropdownAutoWidth': true
115 });
115 });
116
116
117 removeUserGroupMember = function(userId){
117 removeUserGroupMember = function(userId){
118 $('#member_'+userId).val('remove');
118 $('#member_'+userId).val('remove');
119 $('#member_user_'+userId).addClass('to-delete');
119 $('#member_user_'+userId).addClass('to-delete');
120 };
120 };
121
121
122 $('#user_group_add_members').autocomplete({
122 $('#user_group_add_members').autocomplete({
123 serviceUrl: pyroutes.url('user_autocomplete_data'),
123 serviceUrl: pyroutes.url('user_autocomplete_data'),
124 minChars:2,
124 minChars:2,
125 maxHeight:400,
125 maxHeight:400,
126 width:300,
126 width:300,
127 deferRequestBy: 300, //miliseconds
127 deferRequestBy: 300, //miliseconds
128 showNoSuggestionNotice: true,
128 showNoSuggestionNotice: true,
129 params: { user_groups:true },
129 params: { user_groups:true },
130 formatResult: autocompleteFormatResult,
130 formatResult: autocompleteFormatResult,
131 lookupFilter: autocompleteFilterResult,
131 lookupFilter: autocompleteFilterResult,
132 onSelect: function(element, suggestion){
132 onSelect: function(element, suggestion){
133
133
134 function addMember(user, fromUserGroup) {
134 function addMember(user, fromUserGroup) {
135 var gravatar = user.icon_link;
135 var gravatar = user.icon_link;
136 var username = user.value_display;
136 var username = user.value_display;
137 var userLink = pyroutes.url('edit_user', {"user_id": user.id});
137 var userLink = pyroutes.url('edit_user', {"user_id": user.id});
138 var uid = user.id;
138 var uid = user.id;
139
139
140 if (fromUserGroup) {
140 if (fromUserGroup) {
141 username = username +" "+ _gettext('(from usergroup {0})'.format(fromUserGroup))
141 username = username +" "+ _gettext('(from usergroup {0})'.format(fromUserGroup))
142 }
142 }
143
143
144 var elem = $(
144 var elem = $(
145 ('<tr>'+
145 ('<tr>'+
146 '<td id="member_user_{6}" class="td-author td-author-new-entry">'+
146 '<td id="member_user_{6}" class="td-author td-author-new-entry">'+
147 '<div class="group_member">'+
147 '<div class="group_member">'+
148 '<img class="gravatar" src="{0}" height="16" width="16">'+
148 '<img class="gravatar" src="{0}" height="16" width="16">'+
149 '<span class="username user"><a href="{1}">{2}</a></span>'+
149 '<span class="username user"><a href="{1}">{2}</a></span>'+
150 '<input type="hidden" name="__start__" value="member:mapping">'+
150 '<input type="hidden" name="__start__" value="member:mapping">'+
151 '<input type="hidden" name="member_user_id" value="{3}">'+
151 '<input type="hidden" name="member_user_id" value="{3}">'+
152 '<input type="hidden" name="type" value="new" id="member_{4}">'+
152 '<input type="hidden" name="type" value="new" id="member_{4}">'+
153 '<input type="hidden" name="__end__" value="member:mapping">'+
153 '<input type="hidden" name="__end__" value="member:mapping">'+
154 '</div>'+
154 '</div>'+
155 '</td>'+
155 '</td>'+
156 '<td class="td-author-new-entry">'+
156 '<td class="td-author-new-entry">'+
157 '<div class="usergroup_member_remove action_button" onclick="removeUserGroupMember({5}, true)" style="visibility: visible;">'+
157 '<div class="usergroup_member_remove action_button" onclick="removeUserGroupMember({5}, true)" style="visibility: visible;">'+
158 '<i class="icon-remove-sign"></i>'+
158 '<i class="icon-remove-sign"></i>'+
159 '</div>'+
159 '</div>'+
160 '</td>'+
160 '</td>'+
161 '</tr>').format(gravatar, userLink, username,
161 '</tr>').format(gravatar, userLink, username,
162 uid, uid, uid, uid)
162 uid, uid, uid, uid)
163 );
163 );
164 $('#group_members_placeholder').append(elem)
164 $('#group_members_placeholder').append(elem)
165 }
165 }
166
166
167 if (suggestion.value_type == 'user_group') {
167 if (suggestion.value_type == 'user_group') {
168 $.getJSON(
168 $.getJSON(
169 pyroutes.url('user_group_members_data',
169 pyroutes.url('user_group_members_data',
170 {'user_group_id': suggestion.id}),
170 {'user_group_id': suggestion.id}),
171 function(data) {
171 function(data) {
172 $.each(data.members, function(idx, user) {
172 $.each(data.members, function(idx, user) {
173 addMember(user, suggestion.value)
173 addMember(user, suggestion.value)
174 });
174 });
175 }
175 }
176 );
176 );
177 } else if (suggestion.value_type == 'user') {
177 } else if (suggestion.value_type == 'user') {
178 addMember(suggestion, null);
178 addMember(suggestion, null);
179 }
179 }
180 }
180 }
181 });
181 });
182
182
183
183
184 UsersAutoComplete('user', '${c.rhodecode_user.user_id}');
184 UsersAutoComplete('user', '${c.rhodecode_user.user_id}');
185 })
185 })
186 </script>
186 </script>
@@ -1,176 +1,176 b''
1 <div class="panel panel-default">
1 <div class="panel panel-default">
2 <div class="panel-heading">
2 <div class="panel-heading">
3 <h3 class="panel-title">${_('Authentication Tokens')}</h3>
3 <h3 class="panel-title">${_('Authentication Tokens')}</h3>
4 </div>
4 </div>
5 <div class="panel-body">
5 <div class="panel-body">
6 <div class="apikeys_wrap">
6 <div class="apikeys_wrap">
7 <p>
7 <p>
8 ${_('Each token can have a role. Token with a role can be used only in given context, '
8 ${_('Each token can have a role. Token with a role can be used only in given context, '
9 'e.g. VCS tokens can be used together with the authtoken auth plugin for git/hg/svn operations only.')}
9 'e.g. VCS tokens can be used together with the authtoken auth plugin for git/hg/svn operations only.')}
10 </p>
10 </p>
11 <table class="rctable auth_tokens">
11 <table class="rctable auth_tokens">
12 <tr>
12 <tr>
13 <th>${_('Token')}</th>
13 <th>${_('Token')}</th>
14 <th>${_('Scope')}</th>
14 <th>${_('Scope')}</th>
15 <th>${_('Description')}</th>
15 <th>${_('Description')}</th>
16 <th>${_('Role')}</th>
16 <th>${_('Role')}</th>
17 <th>${_('Expiration')}</th>
17 <th>${_('Expiration')}</th>
18 <th>${_('Action')}</th>
18 <th>${_('Action')}</th>
19 </tr>
19 </tr>
20 %if c.user_auth_tokens:
20 %if c.user_auth_tokens:
21 %for auth_token in c.user_auth_tokens:
21 %for auth_token in c.user_auth_tokens:
22 <tr class="${'expired' if auth_token.expired else ''}">
22 <tr class="${'expired' if auth_token.expired else ''}">
23 <td class="truncate-wrap td-authtoken"><div class="user_auth_tokens truncate autoexpand"><code>${auth_token.api_key}</code></div></td>
23 <td class="truncate-wrap td-authtoken"><div class="user_auth_tokens truncate autoexpand"><code>${auth_token.api_key}</code></div></td>
24 <td class="td">${auth_token.scope_humanized}</td>
24 <td class="td">${auth_token.scope_humanized}</td>
25 <td class="td-wrap">${auth_token.description}</td>
25 <td class="td-wrap">${auth_token.description}</td>
26 <td class="td-tags">
26 <td class="td-tags">
27 <span class="tag disabled">${auth_token.role_humanized}</span>
27 <span class="tag disabled">${auth_token.role_humanized}</span>
28 </td>
28 </td>
29 <td class="td-exp">
29 <td class="td-exp">
30 %if auth_token.expires == -1:
30 %if auth_token.expires == -1:
31 ${_('never')}
31 ${_('never')}
32 %else:
32 %else:
33 %if auth_token.expired:
33 %if auth_token.expired:
34 <span style="text-decoration: line-through">${h.age_component(h.time_to_utcdatetime(auth_token.expires))}</span>
34 <span style="text-decoration: line-through">${h.age_component(h.time_to_utcdatetime(auth_token.expires))}</span>
35 %else:
35 %else:
36 ${h.age_component(h.time_to_utcdatetime(auth_token.expires))}
36 ${h.age_component(h.time_to_utcdatetime(auth_token.expires))}
37 %endif
37 %endif
38 %endif
38 %endif
39 </td>
39 </td>
40 <td class="td-action">
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 ${h.hidden('del_auth_token', auth_token.user_api_key_id)}
42 ${h.hidden('del_auth_token', auth_token.user_api_key_id)}
43 <button class="btn btn-link btn-danger" type="submit"
43 <button class="btn btn-link btn-danger" type="submit"
44 onclick="return confirm('${_('Confirm to remove this auth token: %s') % auth_token.token_obfuscated}');">
44 onclick="return confirm('${_('Confirm to remove this auth token: %s') % auth_token.token_obfuscated}');">
45 ${_('Delete')}
45 ${_('Delete')}
46 </button>
46 </button>
47 ${h.end_form()}
47 ${h.end_form()}
48 </td>
48 </td>
49 </tr>
49 </tr>
50 %endfor
50 %endfor
51 %else:
51 %else:
52 <tr><td><div class="ip">${_('No additional auth tokens specified')}</div></td></tr>
52 <tr><td><div class="ip">${_('No additional auth tokens specified')}</div></td></tr>
53 %endif
53 %endif
54 </table>
54 </table>
55 </div>
55 </div>
56
56
57 <div class="user_auth_tokens">
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 <div class="form form-vertical">
59 <div class="form form-vertical">
60 <!-- fields -->
60 <!-- fields -->
61 <div class="fields">
61 <div class="fields">
62 <div class="field">
62 <div class="field">
63 <div class="label">
63 <div class="label">
64 <label for="new_email">${_('New authentication token')}:</label>
64 <label for="new_email">${_('New authentication token')}:</label>
65 </div>
65 </div>
66 <div class="input">
66 <div class="input">
67 ${h.text('description', class_='medium', placeholder=_('Description'))}
67 ${h.text('description', class_='medium', placeholder=_('Description'))}
68 ${h.hidden('lifetime')}
68 ${h.hidden('lifetime')}
69 ${h.select('role', '', c.role_options)}
69 ${h.select('role', '', c.role_options)}
70
70
71 % if c.allow_scoped_tokens:
71 % if c.allow_scoped_tokens:
72 ${h.hidden('scope_repo_id')}
72 ${h.hidden('scope_repo_id')}
73 % else:
73 % else:
74 ${h.select('scope_repo_id_disabled', '', ['Scopes available in EE edition'], disabled='disabled')}
74 ${h.select('scope_repo_id_disabled', '', ['Scopes available in EE edition'], disabled='disabled')}
75 % endif
75 % endif
76 </div>
76 </div>
77 <p class="help-block">
77 <p class="help-block">
78 ${_('Repository scope works only with tokens with VCS type.')}
78 ${_('Repository scope works only with tokens with VCS type.')}
79 </p>
79 </p>
80 </div>
80 </div>
81 <div class="buttons">
81 <div class="buttons">
82 ${h.submit('save',_('Add'),class_="btn")}
82 ${h.submit('save',_('Add'),class_="btn")}
83 ${h.reset('reset',_('Reset'),class_="btn")}
83 ${h.reset('reset',_('Reset'),class_="btn")}
84 </div>
84 </div>
85 </div>
85 </div>
86 </div>
86 </div>
87 ${h.end_form()}
87 ${h.end_form()}
88 </div>
88 </div>
89 </div>
89 </div>
90 </div>
90 </div>
91
91
92 <script>
92 <script>
93
93
94 $(document).ready(function(){
94 $(document).ready(function(){
95 var select2Options = {
95 var select2Options = {
96 'containerCssClass': "drop-menu",
96 'containerCssClass': "drop-menu",
97 'dropdownCssClass': "drop-menu-dropdown",
97 'dropdownCssClass': "drop-menu-dropdown",
98 'dropdownAutoWidth': true
98 'dropdownAutoWidth': true
99 };
99 };
100 $("#role").select2(select2Options);
100 $("#role").select2(select2Options);
101
101
102 var preloadData = {
102 var preloadData = {
103 results: [
103 results: [
104 % for entry in c.lifetime_values:
104 % for entry in c.lifetime_values:
105 {id:${entry[0]}, text:"${entry[1]}"}${'' if loop.last else ','}
105 {id:${entry[0]}, text:"${entry[1]}"}${'' if loop.last else ','}
106 % endfor
106 % endfor
107 ]
107 ]
108 };
108 };
109
109
110 $("#lifetime").select2({
110 $("#lifetime").select2({
111 containerCssClass: "drop-menu",
111 containerCssClass: "drop-menu",
112 dropdownCssClass: "drop-menu-dropdown",
112 dropdownCssClass: "drop-menu-dropdown",
113 dropdownAutoWidth: true,
113 dropdownAutoWidth: true,
114 data: preloadData,
114 data: preloadData,
115 placeholder: "${_('Select or enter expiration date')}",
115 placeholder: "${_('Select or enter expiration date')}",
116 query: function(query) {
116 query: function(query) {
117 feedLifetimeOptions(query, preloadData);
117 feedLifetimeOptions(query, preloadData);
118 }
118 }
119 });
119 });
120
120
121
121
122 var repoFilter = function(data) {
122 var repoFilter = function(data) {
123 var results = [];
123 var results = [];
124
124
125 if (!data.results[0]) {
125 if (!data.results[0]) {
126 return data
126 return data
127 }
127 }
128
128
129 $.each(data.results[0].children, function() {
129 $.each(data.results[0].children, function() {
130 // replace name to ID for submision
130 // replace name to ID for submision
131 this.id = this.obj.repo_id;
131 this.id = this.obj.repo_id;
132 results.push(this);
132 results.push(this);
133 });
133 });
134
134
135 data.results[0].children = results;
135 data.results[0].children = results;
136 return data;
136 return data;
137 };
137 };
138
138
139 $("#scope_repo_id_disabled").select2(select2Options);
139 $("#scope_repo_id_disabled").select2(select2Options);
140
140
141 $("#scope_repo_id").select2({
141 $("#scope_repo_id").select2({
142 cachedDataSource: {},
142 cachedDataSource: {},
143 minimumInputLength: 2,
143 minimumInputLength: 2,
144 placeholder: "${_('repository scope')}",
144 placeholder: "${_('repository scope')}",
145 dropdownAutoWidth: true,
145 dropdownAutoWidth: true,
146 containerCssClass: "drop-menu",
146 containerCssClass: "drop-menu",
147 dropdownCssClass: "drop-menu-dropdown",
147 dropdownCssClass: "drop-menu-dropdown",
148 formatResult: formatResult,
148 formatResult: formatResult,
149 query: $.debounce(250, function(query){
149 query: $.debounce(250, function(query){
150 self = this;
150 self = this;
151 var cacheKey = query.term;
151 var cacheKey = query.term;
152 var cachedData = self.cachedDataSource[cacheKey];
152 var cachedData = self.cachedDataSource[cacheKey];
153
153
154 if (cachedData) {
154 if (cachedData) {
155 query.callback({results: cachedData.results});
155 query.callback({results: cachedData.results});
156 } else {
156 } else {
157 $.ajax({
157 $.ajax({
158 url: pyroutes.url('repo_list_data'),
158 url: pyroutes.url('repo_list_data'),
159 data: {'query': query.term},
159 data: {'query': query.term},
160 dataType: 'json',
160 dataType: 'json',
161 type: 'GET',
161 type: 'GET',
162 success: function(data) {
162 success: function(data) {
163 data = repoFilter(data);
163 data = repoFilter(data);
164 self.cachedDataSource[cacheKey] = data;
164 self.cachedDataSource[cacheKey] = data;
165 query.callback({results: data.results});
165 query.callback({results: data.results});
166 },
166 },
167 error: function(data, textStatus, errorThrown) {
167 error: function(data, textStatus, errorThrown) {
168 alert("Error while fetching entries.\nError code {0} ({1}).".format(data.status, data.statusText));
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 </script>
176 </script>
@@ -1,71 +1,71 b''
1 <%namespace name="base" file="/base/base.mako"/>
1 <%namespace name="base" file="/base/base.mako"/>
2
2
3 <div class="panel panel-default">
3 <div class="panel panel-default">
4 <div class="panel-heading">
4 <div class="panel-heading">
5 <h3 class="panel-title">${_('Additional Email Addresses')}</h3>
5 <h3 class="panel-title">${_('Additional Email Addresses')}</h3>
6 </div>
6 </div>
7 <div class="panel-body">
7 <div class="panel-body">
8 <div class="emails_wrap">
8 <div class="emails_wrap">
9 <table class="rctable account_emails useremails">
9 <table class="rctable account_emails useremails">
10 <tr>
10 <tr>
11 <td class="td-user">
11 <td class="td-user">
12 ${base.gravatar(c.user.email, 16)}
12 ${base.gravatar(c.user.email, 16)}
13 <span class="user email">${c.user.email}</span>
13 <span class="user email">${c.user.email}</span>
14 </td>
14 </td>
15 <td class="td-tags">
15 <td class="td-tags">
16 <span class="tag">${_('Primary')}</span>
16 <span class="tag">${_('Primary')}</span>
17 </td>
17 </td>
18 </tr>
18 </tr>
19 %if c.user_email_map:
19 %if c.user_email_map:
20 %for em in c.user_email_map:
20 %for em in c.user_email_map:
21 <tr>
21 <tr>
22 <td class="td-user">
22 <td class="td-user">
23 ${base.gravatar(em.email, 16)}
23 ${base.gravatar(em.email, 16)}
24 <span class="user email">${em.email}</span>
24 <span class="user email">${em.email}</span>
25 </td>
25 </td>
26 <td class="td-action">
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 ${h.hidden('del_email_id', em.email_id)}
28 ${h.hidden('del_email_id', em.email_id)}
29 <button class="btn btn-link btn-danger" type="submit"
29 <button class="btn btn-link btn-danger" type="submit"
30 onclick="return confirm('${_('Confirm to delete this email: %s') % em.email}');">
30 onclick="return confirm('${_('Confirm to delete this email: %s') % em.email}');">
31 ${_('Delete')}
31 ${_('Delete')}
32 </button>
32 </button>
33 ${h.end_form()}
33 ${h.end_form()}
34 </td>
34 </td>
35 </tr>
35 </tr>
36 %endfor
36 %endfor
37 %else:
37 %else:
38 <tr class="noborder">
38 <tr class="noborder">
39 <td colspan="3">
39 <td colspan="3">
40 <div class="td-email">
40 <div class="td-email">
41 ${_('No additional emails specified')}
41 ${_('No additional emails specified')}
42 </div>
42 </div>
43 </td>
43 </td>
44 </tr>
44 </tr>
45 %endif
45 %endif
46 </table>
46 </table>
47 </div>
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 <div class="form">
50 <div class="form">
51 <!-- fields -->
51 <!-- fields -->
52 <div class="fields">
52 <div class="fields">
53 <div class="field">
53 <div class="field">
54 <div class="label">
54 <div class="label">
55 <label for="new_email">${_('New email address')}:</label>
55 <label for="new_email">${_('New email address')}:</label>
56 </div>
56 </div>
57 <div class="input">
57 <div class="input">
58 ${h.text('new_email', class_='medium')}
58 ${h.text('new_email', class_='medium')}
59 </div>
59 </div>
60 </div>
60 </div>
61 <div class="buttons">
61 <div class="buttons">
62 ${h.submit('save',_('Add'),class_="btn btn-small")}
62 ${h.submit('save',_('Add'),class_="btn btn-small")}
63 ${h.reset('reset',_('Reset'),class_="btn btn-small")}
63 ${h.reset('reset',_('Reset'),class_="btn btn-small")}
64 </div>
64 </div>
65 </div>
65 </div>
66 </div>
66 </div>
67 ${h.end_form()}
67 ${h.end_form()}
68 </div>
68 </div>
69 </div>
69 </div>
70
70
71
71
@@ -1,147 +1,147 b''
1 ## -*- coding: utf-8 -*-
1 ## -*- coding: utf-8 -*-
2
2
3
3
4 <div class="panel panel-default">
4 <div class="panel panel-default">
5 <div class="panel-heading">
5 <div class="panel-heading">
6 <h3 class="panel-title">${_('User groups administration')}</h3>
6 <h3 class="panel-title">${_('User groups administration')}</h3>
7 </div>
7 </div>
8 <div class="panel-body">
8 <div class="panel-body">
9 <div class="fields">
9 <div class="fields">
10 <div class="field">
10 <div class="field">
11 <div class="label label-checkbox">
11 <div class="label label-checkbox">
12 <label for="users_group_active">${_('Add `%s` to user group') % c.user.username}:</label>
12 <label for="users_group_active">${_('Add `%s` to user group') % c.user.username}:</label>
13 </div>
13 </div>
14 <div class="input">
14 <div class="input">
15 ${h.text('add_user_to_group', placeholder="user group name", class_="medium")}
15 ${h.text('add_user_to_group', placeholder="user group name", class_="medium")}
16 </div>
16 </div>
17
17
18 </div>
18 </div>
19 </div>
19 </div>
20
20
21 <div class="groups_management">
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 <div id="repos_list_wrap">
23 <div id="repos_list_wrap">
24 <table id="user_group_list_table" class="display"></table>
24 <table id="user_group_list_table" class="display"></table>
25 </div>
25 </div>
26 <div class="buttons">
26 <div class="buttons">
27 ${h.submit('save',_('Save'),class_="btn")}
27 ${h.submit('save',_('Save'),class_="btn")}
28 </div>
28 </div>
29 ${h.end_form()}
29 ${h.end_form()}
30 </div>
30 </div>
31 </div>
31 </div>
32 </div>
32 </div>
33 <script>
33 <script>
34 var api;
34 var api;
35 $(document).ready(function() {
35 $(document).ready(function() {
36
36
37 var get_datatable_count = function(){
37 var get_datatable_count = function(){
38 $('#user_group_count').text(api.page.info().recordsDisplay);
38 $('#user_group_count').text(api.page.info().recordsDisplay);
39 };
39 };
40
40
41 $('#user_group_list_table').on('click', 'a.editor_remove', function (e) {
41 $('#user_group_list_table').on('click', 'a.editor_remove', function (e) {
42 e.preventDefault();
42 e.preventDefault();
43 var row = api.row($(this).closest('tr'));
43 var row = api.row($(this).closest('tr'));
44 row.remove().draw();
44 row.remove().draw();
45 } );
45 } );
46
46
47 $('#user_group_list_table').DataTable({
47 $('#user_group_list_table').DataTable({
48 data: ${c.groups|n},
48 data: ${c.groups|n},
49 dom: 'rtp',
49 dom: 'rtp',
50 pageLength: ${c.visual.admin_grid_items},
50 pageLength: ${c.visual.admin_grid_items},
51 order: [[ 0, "asc" ]],
51 order: [[ 0, "asc" ]],
52 columns: [
52 columns: [
53 { data: {"_": "group_name",
53 { data: {"_": "group_name",
54 "sort": "group_name"}, title: "${_('Name')}", className: "td-componentname," ,
54 "sort": "group_name"}, title: "${_('Name')}", className: "td-componentname," ,
55 render: function (data,type,full,meta)
55 render: function (data,type,full,meta)
56 {return '<div><i class="icon-group" title="User group">'+data+'</i></div>'}},
56 {return '<div><i class="icon-group" title="User group">'+data+'</i></div>'}},
57
57
58 { data: {"_": "group_description",
58 { data: {"_": "group_description",
59 "sort": "group_description"}, title: "${_('Description')}", className: "td-description" },
59 "sort": "group_description"}, title: "${_('Description')}", className: "td-description" },
60 { data: {"_": "users_group_id"}, className: "td-user",
60 { data: {"_": "users_group_id"}, className: "td-user",
61 render: function (data,type,full,meta)
61 render: function (data,type,full,meta)
62 {return '<input type="hidden" name="users_group_id" value="'+data+'">'}},
62 {return '<input type="hidden" name="users_group_id" value="'+data+'">'}},
63 { data: {"_": "active",
63 { data: {"_": "active",
64 "sort": "active"}, title: "${_('Active')}", className: "td-active", className: "td-number"},
64 "sort": "active"}, title: "${_('Active')}", className: "td-active", className: "td-number"},
65 { data: {"_": "owner_data"}, title: "${_('Owner')}", className: "td-user",
65 { data: {"_": "owner_data"}, title: "${_('Owner')}", className: "td-user",
66 render: function (data,type,full,meta)
66 render: function (data,type,full,meta)
67 {return '<div class="rc-user tooltip">'+
67 {return '<div class="rc-user tooltip">'+
68 '<img class="gravatar" src="'+ data.owner_icon +'" height="16" width="16">'+
68 '<img class="gravatar" src="'+ data.owner_icon +'" height="16" width="16">'+
69 data.owner +'</div>'
69 data.owner +'</div>'
70 }
70 }
71 },
71 },
72 { data: null,
72 { data: null,
73 title: "${_('Action')}",
73 title: "${_('Action')}",
74 className: "td-action",
74 className: "td-action",
75 defaultContent: '<a href="" class="btn btn-link btn-danger">Delete</a>'
75 defaultContent: '<a href="" class="btn btn-link btn-danger">Delete</a>'
76 },
76 },
77 ],
77 ],
78 language: {
78 language: {
79 paginate: DEFAULT_GRID_PAGINATION,
79 paginate: DEFAULT_GRID_PAGINATION,
80 emptyTable: _gettext("No user groups available yet.")
80 emptyTable: _gettext("No user groups available yet.")
81 },
81 },
82 "initComplete": function( settings, json ) {
82 "initComplete": function( settings, json ) {
83 var data_grid = $('#user_group_list_table').dataTable();
83 var data_grid = $('#user_group_list_table').dataTable();
84 api = data_grid.api();
84 api = data_grid.api();
85 get_datatable_count();
85 get_datatable_count();
86 }
86 }
87 });
87 });
88
88
89 // update the counter when doing search
89 // update the counter when doing search
90 $('#user_group_list_table').on( 'search.dt', function (e,settings) {
90 $('#user_group_list_table').on( 'search.dt', function (e,settings) {
91 get_datatable_count();
91 get_datatable_count();
92 });
92 });
93
93
94 // filter, filter both grids
94 // filter, filter both grids
95 $('#q_filter').on( 'keyup', function () {
95 $('#q_filter').on( 'keyup', function () {
96 var user_api = $('#user_group_list_table').dataTable().api();
96 var user_api = $('#user_group_list_table').dataTable().api();
97 user_api
97 user_api
98 .columns(0)
98 .columns(0)
99 .search(this.value)
99 .search(this.value)
100 .draw();
100 .draw();
101 });
101 });
102
102
103 // refilter table if page load via back button
103 // refilter table if page load via back button
104 $("#q_filter").trigger('keyup');
104 $("#q_filter").trigger('keyup');
105
105
106 });
106 });
107
107
108 $('#language').select2({
108 $('#language').select2({
109 'containerCssClass': "drop-menu",
109 'containerCssClass': "drop-menu",
110 'dropdownCssClass': "drop-menu-dropdown",
110 'dropdownCssClass': "drop-menu-dropdown",
111 'dropdownAutoWidth': true
111 'dropdownAutoWidth': true
112 });
112 });
113
113
114
114
115
115
116 $(document).ready(function(){
116 $(document).ready(function(){
117 $("#group_parent_id").select2({
117 $("#group_parent_id").select2({
118 'containerCssClass': "drop-menu",
118 'containerCssClass': "drop-menu",
119 'dropdownCssClass': "drop-menu-dropdown",
119 'dropdownCssClass': "drop-menu-dropdown",
120 'dropdownAutoWidth': true
120 'dropdownAutoWidth': true
121 });
121 });
122
122
123 $('#add_user_to_group').autocomplete({
123 $('#add_user_to_group').autocomplete({
124 serviceUrl: pyroutes.url('user_group_autocomplete_data'),
124 serviceUrl: pyroutes.url('user_group_autocomplete_data'),
125 minChars:2,
125 minChars:2,
126 maxHeight:400,
126 maxHeight:400,
127 width:300,
127 width:300,
128 deferRequestBy: 300, //miliseconds
128 deferRequestBy: 300, //miliseconds
129 showNoSuggestionNotice: true,
129 showNoSuggestionNotice: true,
130 params: { user_groups:true },
130 params: { user_groups:true },
131 formatResult: autocompleteFormatResult,
131 formatResult: autocompleteFormatResult,
132 lookupFilter: autocompleteFilterResult,
132 lookupFilter: autocompleteFilterResult,
133 onSelect: function(element, suggestion){
133 onSelect: function(element, suggestion){
134 var owner = {owner_icon: suggestion.owner_icon, owner:suggestion.owner};
134 var owner = {owner_icon: suggestion.owner_icon, owner:suggestion.owner};
135 api.row.add(
135 api.row.add(
136 {"active": suggestion.active,
136 {"active": suggestion.active,
137 "owner_data": owner,
137 "owner_data": owner,
138 "users_group_id": suggestion.id,
138 "users_group_id": suggestion.id,
139 "group_description": suggestion.description,
139 "group_description": suggestion.description,
140 "group_name": suggestion.value}).draw();
140 "group_name": suggestion.value}).draw();
141 }
141 }
142 });
142 });
143 })
143 })
144
144
145 </script>
145 </script>
146
146
147
147
@@ -1,78 +1,78 b''
1 <div class="panel panel-default">
1 <div class="panel panel-default">
2 <div class="panel-heading">
2 <div class="panel-heading">
3 <h3 class="panel-title">${_('Custom IP Whitelist')}</h3>
3 <h3 class="panel-title">${_('Custom IP Whitelist')}</h3>
4 </div>
4 </div>
5 <div class="panel-body">
5 <div class="panel-body">
6 <div class="ips_wrap">
6 <div class="ips_wrap">
7 <h5>${_('Current IP address')}: <code>${c.rhodecode_user.ip_addr}</code></h5>
7 <h5>${_('Current IP address')}: <code>${c.rhodecode_user.ip_addr}</code></h5>
8 <table class="rctable ip-whitelist">
8 <table class="rctable ip-whitelist">
9 <tr>
9 <tr>
10 <th>${_('IP Address')}</th>
10 <th>${_('IP Address')}</th>
11 <th>${_('IP Range')}</th>
11 <th>${_('IP Range')}</th>
12 <th>${_('Description')}</th>
12 <th>${_('Description')}</th>
13 <th></th>
13 <th></th>
14 </tr>
14 </tr>
15 %if c.default_user_ip_map and c.inherit_default_ips:
15 %if c.default_user_ip_map and c.inherit_default_ips:
16 %for ip in c.default_user_ip_map:
16 %for ip in c.default_user_ip_map:
17 <tr>
17 <tr>
18 <td class="td-ip"><div class="ip">${ip.ip_addr}</div></td>
18 <td class="td-ip"><div class="ip">${ip.ip_addr}</div></td>
19 <td class="td-iprange"><div class="ip">${h.ip_range(ip.ip_addr)}</div></td>
19 <td class="td-iprange"><div class="ip">${h.ip_range(ip.ip_addr)}</div></td>
20 <td class="td-description">${h.literal(_('Inherited from %s') % h.link_to('*default*',h.route_path('admin_permissions_ips')))}</td>
20 <td class="td-description">${h.literal(_('Inherited from %s') % h.link_to('*default*',h.route_path('admin_permissions_ips')))}</td>
21 <td></td>
21 <td></td>
22 </tr>
22 </tr>
23 %endfor
23 %endfor
24 %endif
24 %endif
25
25
26 %if c.user_ip_map:
26 %if c.user_ip_map:
27 %for ip in c.user_ip_map:
27 %for ip in c.user_ip_map:
28 <tr>
28 <tr>
29 <td class="td-ip"><div class="ip">${ip.ip_addr}</div></td>
29 <td class="td-ip"><div class="ip">${ip.ip_addr}</div></td>
30 <td class="td-iprange"><div class="ip">${h.ip_range(ip.ip_addr)}</div></td>
30 <td class="td-iprange"><div class="ip">${h.ip_range(ip.ip_addr)}</div></td>
31 <td class="td-description"><div class="ip">${ip.description}</div></td>
31 <td class="td-description"><div class="ip">${ip.description}</div></td>
32 <td class="td-action">
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 ${h.hidden('del_ip_id', ip.ip_id)}
34 ${h.hidden('del_ip_id', ip.ip_id)}
35 ${h.submit('remove_', _('Delete'),id="remove_ip_%s" % ip.ip_id,
35 ${h.submit('remove_', _('Delete'),id="remove_ip_%s" % ip.ip_id,
36 class_="btn btn-link btn-danger", onclick="return confirm('"+_('Confirm to delete this ip: %s') % ip.ip_addr+"');")}
36 class_="btn btn-link btn-danger", onclick="return confirm('"+_('Confirm to delete this ip: %s') % ip.ip_addr+"');")}
37 ${h.end_form()}
37 ${h.end_form()}
38 </td>
38 </td>
39 </tr>
39 </tr>
40 %endfor
40 %endfor
41 %endif
41 %endif
42 %if not c.default_user_ip_map and not c.user_ip_map:
42 %if not c.default_user_ip_map and not c.user_ip_map:
43 <tr>
43 <tr>
44 <td><h2 class="ip">${_('All IP addresses are allowed')}</h2></td>
44 <td><h2 class="ip">${_('All IP addresses are allowed')}</h2></td>
45 <td></td>
45 <td></td>
46 <td></td>
46 <td></td>
47 <td></td>
47 <td></td>
48 </tr>
48 </tr>
49 %endif
49 %endif
50 </table>
50 </table>
51 </div>
51 </div>
52
52
53 <div>
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 <div class="form">
55 <div class="form">
56 <!-- fields -->
56 <!-- fields -->
57 <div class="fields">
57 <div class="fields">
58 <div class="field">
58 <div class="field">
59 <div class="label">
59 <div class="label">
60 <label for="new_ip">${_('New IP Address')}:</label>
60 <label for="new_ip">${_('New IP Address')}:</label>
61 </div>
61 </div>
62 <div class="input">
62 <div class="input">
63 ${h.text('new_ip')} ${h.text('description', placeholder=_('Description...'))}
63 ${h.text('new_ip')} ${h.text('description', placeholder=_('Description...'))}
64 <span class="help-block">${_('Enter comma separated list of ip addresses like 127.0.0.1,\n'
64 <span class="help-block">${_('Enter comma separated list of ip addresses like 127.0.0.1,\n'
65 'or use a ip address with a mask 127.0.0.1/24, to create a network range.\n'
65 'or use a ip address with a mask 127.0.0.1/24, to create a network range.\n'
66 'To specify multiple address range use 127.0.0.1-127.0.0.10 syntax')}</span>
66 'To specify multiple address range use 127.0.0.1-127.0.0.10 syntax')}</span>
67 </div>
67 </div>
68 </div>
68 </div>
69 <div class="buttons">
69 <div class="buttons">
70 ${h.submit('save',_('Add'),class_="btn btn-small")}
70 ${h.submit('save',_('Add'),class_="btn btn-small")}
71 ${h.reset('reset',_('Reset'),class_="btn btn-small")}
71 ${h.reset('reset',_('Reset'),class_="btn btn-small")}
72 </div>
72 </div>
73 </div>
73 </div>
74 </div>
74 </div>
75 ${h.end_form()}
75 ${h.end_form()}
76 </div>
76 </div>
77 </div>
77 </div>
78 </div>
78 </div>
@@ -1,78 +1,78 b''
1 <div class="panel panel-default">
1 <div class="panel panel-default">
2 <div class="panel-heading">
2 <div class="panel-heading">
3 <h3 class="panel-title">${_('SSH Keys')}</h3>
3 <h3 class="panel-title">${_('SSH Keys')}</h3>
4 </div>
4 </div>
5 <div class="panel-body">
5 <div class="panel-body">
6 <div class="sshkeys_wrap">
6 <div class="sshkeys_wrap">
7 <table class="rctable ssh_keys">
7 <table class="rctable ssh_keys">
8 <tr>
8 <tr>
9 <th>${_('Fingerprint')}</th>
9 <th>${_('Fingerprint')}</th>
10 <th>${_('Description')}</th>
10 <th>${_('Description')}</th>
11 <th>${_('Created')}</th>
11 <th>${_('Created')}</th>
12 <th>${_('Action')}</th>
12 <th>${_('Action')}</th>
13 </tr>
13 </tr>
14 %if c.user_ssh_keys:
14 %if c.user_ssh_keys:
15 %for ssh_key in c.user_ssh_keys:
15 %for ssh_key in c.user_ssh_keys:
16 <tr class="">
16 <tr class="">
17 <td class="">
17 <td class="">
18 <code>${ssh_key.ssh_key_fingerprint}</code>
18 <code>${ssh_key.ssh_key_fingerprint}</code>
19 </td>
19 </td>
20 <td class="td-wrap">${ssh_key.description}</td>
20 <td class="td-wrap">${ssh_key.description}</td>
21 <td class="td-tags">${h.format_date(ssh_key.created_on)}</td>
21 <td class="td-tags">${h.format_date(ssh_key.created_on)}</td>
22
22
23 <td class="td-action">
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 ${h.hidden('del_ssh_key', ssh_key.ssh_key_id)}
25 ${h.hidden('del_ssh_key', ssh_key.ssh_key_id)}
26 <button class="btn btn-link btn-danger" type="submit"
26 <button class="btn btn-link btn-danger" type="submit"
27 onclick="return confirm('${_('Confirm to remove ssh key %s') % ssh_key.ssh_key_fingerprint}');">
27 onclick="return confirm('${_('Confirm to remove ssh key %s') % ssh_key.ssh_key_fingerprint}');">
28 ${_('Delete')}
28 ${_('Delete')}
29 </button>
29 </button>
30 ${h.end_form()}
30 ${h.end_form()}
31 </td>
31 </td>
32 </tr>
32 </tr>
33 %endfor
33 %endfor
34 %else:
34 %else:
35 <tr><td><div class="ip">${_('No additional ssh keys specified')}</div></td></tr>
35 <tr><td><div class="ip">${_('No additional ssh keys specified')}</div></td></tr>
36 %endif
36 %endif
37 </table>
37 </table>
38 </div>
38 </div>
39
39
40 <div class="user_ssh_keys">
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 <div class="form form-vertical">
42 <div class="form form-vertical">
43 <!-- fields -->
43 <!-- fields -->
44 <div class="fields">
44 <div class="fields">
45 <div class="field">
45 <div class="field">
46 <div class="label">
46 <div class="label">
47 <label for="new_email">${_('New ssh key')}:</label>
47 <label for="new_email">${_('New ssh key')}:</label>
48 </div>
48 </div>
49 <div class="input">
49 <div class="input">
50 ${h.text('description', class_='medium', placeholder=_('Description'))}
50 ${h.text('description', class_='medium', placeholder=_('Description'))}
51 <a href="${h.route_path('edit_user_ssh_keys_generate_keypair', user_id=c.user.user_id)}">${_('Generate random RSA key')}</a>
51 <a href="${h.route_path('edit_user_ssh_keys_generate_keypair', user_id=c.user.user_id)}">${_('Generate random RSA key')}</a>
52 </div>
52 </div>
53 </div>
53 </div>
54
54
55 <div class="field">
55 <div class="field">
56 <div class="textarea text-area editor">
56 <div class="textarea text-area editor">
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'"))}
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 </div>
58 </div>
59 </div>
59 </div>
60
60
61 <div class="buttons">
61 <div class="buttons">
62 ${h.submit('save',_('Add'),class_="btn")}
62 ${h.submit('save',_('Add'),class_="btn")}
63 ${h.reset('reset',_('Reset'),class_="btn")}
63 ${h.reset('reset',_('Reset'),class_="btn")}
64 </div>
64 </div>
65 </div>
65 </div>
66 </div>
66 </div>
67 ${h.end_form()}
67 ${h.end_form()}
68 </div>
68 </div>
69 </div>
69 </div>
70 </div>
70 </div>
71
71
72 <script>
72 <script>
73
73
74 $(document).ready(function(){
74 $(document).ready(function(){
75
75
76
76
77 });
77 });
78 </script>
78 </script>
@@ -1,156 +1,156 b''
1 ## snippet for displaying default permission box
1 ## snippet for displaying default permission box
2 ## usage:
2 ## usage:
3 ## <%namespace name="dpb" file="/base/default_perms_box.mako"/>
3 ## <%namespace name="dpb" file="/base/default_perms_box.mako"/>
4 ## ${dpb.default_perms_box(<url_to_form>)}
4 ## ${dpb.default_perms_box(<url_to_form>)}
5 ## ${dpb.default_perms_radios()}
5 ## ${dpb.default_perms_radios()}
6
6
7 <%def name="default_perms_radios(global_permissions_template = False, suffix='', **kwargs)">
7 <%def name="default_perms_radios(global_permissions_template = False, suffix='', **kwargs)">
8 <div class="main-content-full-width">
8 <div class="main-content-full-width">
9 <div class="panel panel-default">
9 <div class="panel panel-default">
10
10
11 ## displayed according to checkbox selection
11 ## displayed according to checkbox selection
12 <div class="panel-heading">
12 <div class="panel-heading">
13 %if not global_permissions_template:
13 %if not global_permissions_template:
14 <h3 class="inherit_overlay_default panel-title">${_('Inherited Permissions')}</h3>
14 <h3 class="inherit_overlay_default panel-title">${_('Inherited Permissions')}</h3>
15 <h3 class="inherit_overlay panel-title">${_('Custom Permissions')}</h3>
15 <h3 class="inherit_overlay panel-title">${_('Custom Permissions')}</h3>
16 %else:
16 %else:
17 <h3 class="panel-title">${_('Default Global Permissions')}</h3>
17 <h3 class="panel-title">${_('Default Global Permissions')}</h3>
18 %endif
18 %endif
19 </div>
19 </div>
20
20
21 <div class="panel-body">
21 <div class="panel-body">
22 %if global_permissions_template:
22 %if global_permissions_template:
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>
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 %endif
24 %endif
25 <div class="field">
25 <div class="field">
26 <div class="label">
26 <div class="label">
27 <label for="default_repo_create${suffix}">${_('Repository Creation')}:</label>
27 <label for="default_repo_create${suffix}">${_('Repository Creation')}:</label>
28 </div>
28 </div>
29 <div class="radios">
29 <div class="radios">
30 ${h.radio('default_repo_create' + suffix, c.repo_create_choices[1][0], label=c.repo_create_choices[1][1], **kwargs)}
30 ${h.radio('default_repo_create' + suffix, c.repo_create_choices[1][0], label=c.repo_create_choices[1][1], **kwargs)}
31 ${h.radio('default_repo_create' + suffix, c.repo_create_choices[0][0], label=c.repo_create_choices[0][1], **kwargs)}
31 ${h.radio('default_repo_create' + suffix, c.repo_create_choices[0][0], label=c.repo_create_choices[0][1], **kwargs)}
32 <span class="help-block">${_('Permission to create root level repositories. When disabled, users can still create repositories inside their own repository groups.')}</span>
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 </div>
33 </div>
34 </div>
34 </div>
35 <div class="field">
35 <div class="field">
36 <div class="label">
36 <div class="label">
37 <label for="default_repo_create_on_write${suffix}">${_('Repository Creation With Group Write Access')}:</label>
37 <label for="default_repo_create_on_write${suffix}">${_('Repository Creation With Group Write Access')}:</label>
38 </div>
38 </div>
39 <div class="radios">
39 <div class="radios">
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)}
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 ${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)}
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 <span class="help-block">${_('Write permission given on a repository group will allow creating repositories inside that group.')}</span>
42 <span class="help-block">${_('Write permission given on a repository group will allow creating repositories inside that group.')}</span>
43 </div>
43 </div>
44 </div>
44 </div>
45 <div class="field">
45 <div class="field">
46 <div class="label">
46 <div class="label">
47 <label for="default_fork_create${suffix}">${_('Repository Forking')}:</label>
47 <label for="default_fork_create${suffix}">${_('Repository Forking')}:</label>
48 </div>
48 </div>
49 <div class="radios">
49 <div class="radios">
50 ${h.radio('default_fork_create' + suffix, c.fork_choices[1][0], label=c.fork_choices[1][1], **kwargs)}
50 ${h.radio('default_fork_create' + suffix, c.fork_choices[1][0], label=c.fork_choices[1][1], **kwargs)}
51 ${h.radio('default_fork_create' + suffix, c.fork_choices[0][0], label=c.fork_choices[0][1], **kwargs)}
51 ${h.radio('default_fork_create' + suffix, c.fork_choices[0][0], label=c.fork_choices[0][1], **kwargs)}
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>
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 </div>
53 </div>
54 </div>
54 </div>
55 <div class="field">
55 <div class="field">
56 <div class="label">
56 <div class="label">
57 <label for="default_repo_group_create${suffix}">${_('Repository Group Creation')}:</label>
57 <label for="default_repo_group_create${suffix}">${_('Repository Group Creation')}:</label>
58 </div>
58 </div>
59 <div class="radios">
59 <div class="radios">
60 ${h.radio('default_repo_group_create' + suffix, c.repo_group_create_choices[1][0], label=c.repo_group_create_choices[1][1], **kwargs)}
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 ${h.radio('default_repo_group_create' + suffix, c.repo_group_create_choices[0][0], label=c.repo_group_create_choices[0][1], **kwargs)}
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 <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>
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 </div>
63 </div>
64 </div>
64 </div>
65 <div class="field">
65 <div class="field">
66 <div class="label">
66 <div class="label">
67 <label for="default_user_group_create${suffix}">${_('User Group Creation')}:</label>
67 <label for="default_user_group_create${suffix}">${_('User Group Creation')}:</label>
68 </div>
68 </div>
69 <div class="radios">
69 <div class="radios">
70 ${h.radio('default_user_group_create' + suffix, c.user_group_create_choices[1][0], label=c.user_group_create_choices[1][1], **kwargs)}
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 ${h.radio('default_user_group_create' + suffix, c.user_group_create_choices[0][0], label=c.user_group_create_choices[0][1], **kwargs)}
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 <span class="help-block">${_('Permission to allow user group creation.')}</span>
72 <span class="help-block">${_('Permission to allow user group creation.')}</span>
73 </div>
73 </div>
74 </div>
74 </div>
75
75
76 <div class="field">
76 <div class="field">
77 <div class="label">
77 <div class="label">
78 <label for="default_inherit_default_permissions${suffix}">${_('Inherit Permissions From The Default User')}:</label>
78 <label for="default_inherit_default_permissions${suffix}">${_('Inherit Permissions From The Default User')}:</label>
79 </div>
79 </div>
80 <div class="radios">
80 <div class="radios">
81 ${h.radio('default_inherit_default_permissions' + suffix, c.inherit_default_permission_choices[1][0], label=c.inherit_default_permission_choices[1][1], **kwargs)}
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 ${h.radio('default_inherit_default_permissions' + suffix, c.inherit_default_permission_choices[0][0], label=c.inherit_default_permission_choices[0][1], **kwargs)}
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 <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>
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 </div>
84 </div>
85 </div>
85 </div>
86
86
87 <div class="buttons">
87 <div class="buttons">
88 ${h.submit('save',_('Save'),class_="btn")}
88 ${h.submit('save',_('Save'),class_="btn")}
89 ${h.reset('reset',_('Reset'),class_="btn")}
89 ${h.reset('reset',_('Reset'),class_="btn")}
90 </div>
90 </div>
91 </div>
91 </div>
92 </div>
92 </div>
93 </div>
93 </div>
94 </%def>
94 </%def>
95
95
96 <%def name="default_perms_box(form_url)">
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 <div class="form">
98 <div class="form">
99 <div class="fields">
99 <div class="fields">
100 <div class="field panel panel-default panel-body">
100 <div class="field panel panel-default panel-body">
101 <div class="label label-checkbox">
101 <div class="label label-checkbox">
102 <label for="inherit_default_permissions">${_('Inherit from default settings')}:</label>
102 <label for="inherit_default_permissions">${_('Inherit from default settings')}:</label>
103 </div>
103 </div>
104 <div class="checkboxes">
104 <div class="checkboxes">
105 ${h.checkbox('inherit_default_permissions',value=True)}
105 ${h.checkbox('inherit_default_permissions',value=True)}
106 <span class="help-block">
106 <span class="help-block">
107 ${h.literal(_('Select to inherit permissions from %s permissions settings, '
107 ${h.literal(_('Select to inherit permissions from %s permissions settings, '
108 'including default IP address whitelist and inheritance of \npermission by members of user groups.')
108 'including default IP address whitelist and inheritance of \npermission by members of user groups.')
109 % h.link_to('default user', h.route_path('admin_permissions_global')))}
109 % h.link_to('default user', h.route_path('admin_permissions_global')))}
110 </span>
110 </span>
111 </div>
111 </div>
112 </div>
112 </div>
113
113
114 ## INHERITED permissions == the user permissions in admin
114 ## INHERITED permissions == the user permissions in admin
115 ## if inherit checkbox is set this is displayed in non-edit mode
115 ## if inherit checkbox is set this is displayed in non-edit mode
116 <div class="inherit_overlay_default">
116 <div class="inherit_overlay_default">
117 ${default_perms_radios(global_permissions_template = False, suffix='_inherited', disabled="disabled")}
117 ${default_perms_radios(global_permissions_template = False, suffix='_inherited', disabled="disabled")}
118 </div>
118 </div>
119
119
120 ## CUSTOM permissions
120 ## CUSTOM permissions
121 <div class="inherit_overlay">
121 <div class="inherit_overlay">
122 ${default_perms_radios(global_permissions_template = False)}
122 ${default_perms_radios(global_permissions_template = False)}
123 </div>
123 </div>
124 </div>
124 </div>
125 </div>
125 </div>
126 ${h.end_form()}
126 ${h.end_form()}
127
127
128
128
129 ## JS
129 ## JS
130 <script>
130 <script>
131 var show_custom_perms = function(inherit_default){
131 var show_custom_perms = function(inherit_default){
132 if(inherit_default) {
132 if(inherit_default) {
133 $('.inherit_overlay_default').show();
133 $('.inherit_overlay_default').show();
134 $('.inherit_overlay').hide();
134 $('.inherit_overlay').hide();
135 }
135 }
136 else {
136 else {
137 $('.inherit_overlay').show();
137 $('.inherit_overlay').show();
138 $('.inherit_overlay_default').hide();
138 $('.inherit_overlay_default').hide();
139 }
139 }
140 };
140 };
141 $(document).ready(function(e){
141 $(document).ready(function(e){
142 var inherit_checkbox = $('#inherit_default_permissions');
142 var inherit_checkbox = $('#inherit_default_permissions');
143 var defaults = inherit_checkbox.prop('checked');
143 var defaults = inherit_checkbox.prop('checked');
144 show_custom_perms(defaults);
144 show_custom_perms(defaults);
145 inherit_checkbox.on('change', function(){
145 inherit_checkbox.on('change', function(){
146 if($(this).prop('checked')){
146 if($(this).prop('checked')){
147 show_custom_perms(true);
147 show_custom_perms(true);
148 }
148 }
149 else{
149 else{
150 show_custom_perms(false);
150 show_custom_perms(false);
151 }
151 }
152 })
152 })
153 })
153 })
154 </script>
154 </script>
155
155
156 </%def>
156 </%def>
@@ -1,377 +1,377 b''
1 ## DATA TABLE RE USABLE ELEMENTS
1 ## DATA TABLE RE USABLE ELEMENTS
2 ## usage:
2 ## usage:
3 ## <%namespace name="dt" file="/data_table/_dt_elements.mako"/>
3 ## <%namespace name="dt" file="/data_table/_dt_elements.mako"/>
4 <%namespace name="base" file="/base/base.mako"/>
4 <%namespace name="base" file="/base/base.mako"/>
5
5
6 <%def name="metatags_help()">
6 <%def name="metatags_help()">
7 <table>
7 <table>
8 <%
8 <%
9 example_tags = [
9 example_tags = [
10 ('state','[stable]'),
10 ('state','[stable]'),
11 ('state','[stale]'),
11 ('state','[stale]'),
12 ('state','[featured]'),
12 ('state','[featured]'),
13 ('state','[dev]'),
13 ('state','[dev]'),
14 ('state','[dead]'),
14 ('state','[dead]'),
15 ('state','[deprecated]'),
15 ('state','[deprecated]'),
16
16
17 ('label','[personal]'),
17 ('label','[personal]'),
18 ('generic','[v2.0.0]'),
18 ('generic','[v2.0.0]'),
19
19
20 ('lang','[lang =&gt; JavaScript]'),
20 ('lang','[lang =&gt; JavaScript]'),
21 ('license','[license =&gt; LicenseName]'),
21 ('license','[license =&gt; LicenseName]'),
22
22
23 ('ref','[requires =&gt; RepoName]'),
23 ('ref','[requires =&gt; RepoName]'),
24 ('ref','[recommends =&gt; GroupName]'),
24 ('ref','[recommends =&gt; GroupName]'),
25 ('ref','[conflicts =&gt; SomeName]'),
25 ('ref','[conflicts =&gt; SomeName]'),
26 ('ref','[base =&gt; SomeName]'),
26 ('ref','[base =&gt; SomeName]'),
27 ('url','[url =&gt; [linkName](https://rhodecode.com)]'),
27 ('url','[url =&gt; [linkName](https://rhodecode.com)]'),
28 ('see','[see =&gt; http://rhodecode.com]'),
28 ('see','[see =&gt; http://rhodecode.com]'),
29 ]
29 ]
30 %>
30 %>
31 % for tag_type, tag in example_tags:
31 % for tag_type, tag in example_tags:
32 <tr>
32 <tr>
33 <td>${tag|n}</td>
33 <td>${tag|n}</td>
34 <td>${h.style_metatag(tag_type, tag)|n}</td>
34 <td>${h.style_metatag(tag_type, tag)|n}</td>
35 </tr>
35 </tr>
36 % endfor
36 % endfor
37 </table>
37 </table>
38 </%def>
38 </%def>
39
39
40 ## REPOSITORY RENDERERS
40 ## REPOSITORY RENDERERS
41 <%def name="quick_menu(repo_name)">
41 <%def name="quick_menu(repo_name)">
42 <i class="icon-more"></i>
42 <i class="icon-more"></i>
43 <div class="menu_items_container hidden">
43 <div class="menu_items_container hidden">
44 <ul class="menu_items">
44 <ul class="menu_items">
45 <li>
45 <li>
46 <a title="${_('Summary')}" href="${h.route_path('repo_summary',repo_name=repo_name)}">
46 <a title="${_('Summary')}" href="${h.route_path('repo_summary',repo_name=repo_name)}">
47 <span>${_('Summary')}</span>
47 <span>${_('Summary')}</span>
48 </a>
48 </a>
49 </li>
49 </li>
50 <li>
50 <li>
51 <a title="${_('Changelog')}" href="${h.route_path('repo_changelog',repo_name=repo_name)}">
51 <a title="${_('Changelog')}" href="${h.route_path('repo_changelog',repo_name=repo_name)}">
52 <span>${_('Changelog')}</span>
52 <span>${_('Changelog')}</span>
53 </a>
53 </a>
54 </li>
54 </li>
55 <li>
55 <li>
56 <a title="${_('Files')}" href="${h.route_path('repo_files:default_commit',repo_name=repo_name)}">
56 <a title="${_('Files')}" href="${h.route_path('repo_files:default_commit',repo_name=repo_name)}">
57 <span>${_('Files')}</span>
57 <span>${_('Files')}</span>
58 </a>
58 </a>
59 </li>
59 </li>
60 <li>
60 <li>
61 <a title="${_('Fork')}" href="${h.route_path('repo_fork_new',repo_name=repo_name)}">
61 <a title="${_('Fork')}" href="${h.route_path('repo_fork_new',repo_name=repo_name)}">
62 <span>${_('Fork')}</span>
62 <span>${_('Fork')}</span>
63 </a>
63 </a>
64 </li>
64 </li>
65 </ul>
65 </ul>
66 </div>
66 </div>
67 </%def>
67 </%def>
68
68
69 <%def name="repo_name(name,rtype,rstate,private,fork_of,short_name=False,admin=False)">
69 <%def name="repo_name(name,rtype,rstate,private,fork_of,short_name=False,admin=False)">
70 <%
70 <%
71 def get_name(name,short_name=short_name):
71 def get_name(name,short_name=short_name):
72 if short_name:
72 if short_name:
73 return name.split('/')[-1]
73 return name.split('/')[-1]
74 else:
74 else:
75 return name
75 return name
76 %>
76 %>
77 <div class="${'repo_state_pending' if rstate == 'repo_state_pending' else ''} truncate">
77 <div class="${'repo_state_pending' if rstate == 'repo_state_pending' else ''} truncate">
78 ##NAME
78 ##NAME
79 <a href="${h.route_path('edit_repo',repo_name=name) if admin else h.route_path('repo_summary',repo_name=name)}">
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 ##TYPE OF REPO
81 ##TYPE OF REPO
82 %if h.is_hg(rtype):
82 %if h.is_hg(rtype):
83 <span title="${_('Mercurial repository')}"><i class="icon-hg" style="font-size: 14px;"></i></span>
83 <span title="${_('Mercurial repository')}"><i class="icon-hg" style="font-size: 14px;"></i></span>
84 %elif h.is_git(rtype):
84 %elif h.is_git(rtype):
85 <span title="${_('Git repository')}"><i class="icon-git" style="font-size: 14px"></i></span>
85 <span title="${_('Git repository')}"><i class="icon-git" style="font-size: 14px"></i></span>
86 %elif h.is_svn(rtype):
86 %elif h.is_svn(rtype):
87 <span title="${_('Subversion repository')}"><i class="icon-svn" style="font-size: 14px"></i></span>
87 <span title="${_('Subversion repository')}"><i class="icon-svn" style="font-size: 14px"></i></span>
88 %endif
88 %endif
89
89
90 ##PRIVATE/PUBLIC
90 ##PRIVATE/PUBLIC
91 %if private and c.visual.show_private_icon:
91 %if private and c.visual.show_private_icon:
92 <i class="icon-lock" title="${_('Private repository')}"></i>
92 <i class="icon-lock" title="${_('Private repository')}"></i>
93 %elif not private and c.visual.show_public_icon:
93 %elif not private and c.visual.show_public_icon:
94 <i class="icon-unlock-alt" title="${_('Public repository')}"></i>
94 <i class="icon-unlock-alt" title="${_('Public repository')}"></i>
95 %else:
95 %else:
96 <span></span>
96 <span></span>
97 %endif
97 %endif
98 ${get_name(name)}
98 ${get_name(name)}
99 </a>
99 </a>
100 %if fork_of:
100 %if fork_of:
101 <a href="${h.route_path('repo_summary',repo_name=fork_of.repo_name)}"><i class="icon-code-fork"></i></a>
101 <a href="${h.route_path('repo_summary',repo_name=fork_of.repo_name)}"><i class="icon-code-fork"></i></a>
102 %endif
102 %endif
103 %if rstate == 'repo_state_pending':
103 %if rstate == 'repo_state_pending':
104 <span class="creation_in_progress tooltip" title="${_('This repository is being created in a background task')}">
104 <span class="creation_in_progress tooltip" title="${_('This repository is being created in a background task')}">
105 (${_('creating...')})
105 (${_('creating...')})
106 </span>
106 </span>
107 %endif
107 %endif
108 </div>
108 </div>
109 </%def>
109 </%def>
110
110
111 <%def name="repo_desc(description, stylify_metatags)">
111 <%def name="repo_desc(description, stylify_metatags)">
112 <%
112 <%
113 tags, description = h.extract_metatags(description)
113 tags, description = h.extract_metatags(description)
114 %>
114 %>
115
115
116 <div class="truncate-wrap">
116 <div class="truncate-wrap">
117 % if stylify_metatags:
117 % if stylify_metatags:
118 % for tag_type, tag in tags:
118 % for tag_type, tag in tags:
119 ${h.style_metatag(tag_type, tag)|n}
119 ${h.style_metatag(tag_type, tag)|n}
120 % endfor
120 % endfor
121 % endif
121 % endif
122 ${description}
122 ${description}
123 </div>
123 </div>
124
124
125 </%def>
125 </%def>
126
126
127 <%def name="last_change(last_change)">
127 <%def name="last_change(last_change)">
128 ${h.age_component(last_change)}
128 ${h.age_component(last_change)}
129 </%def>
129 </%def>
130
130
131 <%def name="revision(name,rev,tip,author,last_msg)">
131 <%def name="revision(name,rev,tip,author,last_msg)">
132 <div>
132 <div>
133 %if rev >= 0:
133 %if rev >= 0:
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>
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 %else:
135 %else:
136 ${_('No commits yet')}
136 ${_('No commits yet')}
137 %endif
137 %endif
138 </div>
138 </div>
139 </%def>
139 </%def>
140
140
141 <%def name="rss(name)">
141 <%def name="rss(name)">
142 %if c.rhodecode_user.username != h.DEFAULT_USER:
142 %if c.rhodecode_user.username != h.DEFAULT_USER:
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>
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 %else:
144 %else:
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>
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 %endif
146 %endif
147 </%def>
147 </%def>
148
148
149 <%def name="atom(name)">
149 <%def name="atom(name)">
150 %if c.rhodecode_user.username != h.DEFAULT_USER:
150 %if c.rhodecode_user.username != h.DEFAULT_USER:
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>
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 %else:
152 %else:
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>
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 %endif
154 %endif
155 </%def>
155 </%def>
156
156
157 <%def name="user_gravatar(email, size=16)">
157 <%def name="user_gravatar(email, size=16)">
158 <div class="rc-user tooltip" title="${h.tooltip(h.author_string(email))}">
158 <div class="rc-user tooltip" title="${h.tooltip(h.author_string(email))}">
159 ${base.gravatar(email, 16)}
159 ${base.gravatar(email, 16)}
160 </div>
160 </div>
161 </%def>
161 </%def>
162
162
163 <%def name="repo_actions(repo_name, super_user=True)">
163 <%def name="repo_actions(repo_name, super_user=True)">
164 <div>
164 <div>
165 <div class="grid_edit">
165 <div class="grid_edit">
166 <a href="${h.route_path('edit_repo',repo_name=repo_name)}" title="${_('Edit')}">
166 <a href="${h.route_path('edit_repo',repo_name=repo_name)}" title="${_('Edit')}">
167 <i class="icon-pencil"></i>Edit</a>
167 <i class="icon-pencil"></i>Edit</a>
168 </div>
168 </div>
169 <div class="grid_delete">
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 ${h.submit('remove_%s' % repo_name,_('Delete'),class_="btn btn-link btn-danger",
171 ${h.submit('remove_%s' % repo_name,_('Delete'),class_="btn btn-link btn-danger",
172 onclick="return confirm('"+_('Confirm to delete this repository: %s') % repo_name+"');")}
172 onclick="return confirm('"+_('Confirm to delete this repository: %s') % repo_name+"');")}
173 ${h.end_form()}
173 ${h.end_form()}
174 </div>
174 </div>
175 </div>
175 </div>
176 </%def>
176 </%def>
177
177
178 <%def name="repo_state(repo_state)">
178 <%def name="repo_state(repo_state)">
179 <div>
179 <div>
180 %if repo_state == 'repo_state_pending':
180 %if repo_state == 'repo_state_pending':
181 <div class="tag tag4">${_('Creating')}</div>
181 <div class="tag tag4">${_('Creating')}</div>
182 %elif repo_state == 'repo_state_created':
182 %elif repo_state == 'repo_state_created':
183 <div class="tag tag1">${_('Created')}</div>
183 <div class="tag tag1">${_('Created')}</div>
184 %else:
184 %else:
185 <div class="tag alert2" title="${h.tooltip(repo_state)}">invalid</div>
185 <div class="tag alert2" title="${h.tooltip(repo_state)}">invalid</div>
186 %endif
186 %endif
187 </div>
187 </div>
188 </%def>
188 </%def>
189
189
190
190
191 ## REPO GROUP RENDERERS
191 ## REPO GROUP RENDERERS
192 <%def name="quick_repo_group_menu(repo_group_name)">
192 <%def name="quick_repo_group_menu(repo_group_name)">
193 <i class="icon-more"></i>
193 <i class="icon-more"></i>
194 <div class="menu_items_container hidden">
194 <div class="menu_items_container hidden">
195 <ul class="menu_items">
195 <ul class="menu_items">
196 <li>
196 <li>
197 <a href="${h.route_path('repo_group_home', repo_group_name=repo_group_name)}">${_('Summary')}</a>
197 <a href="${h.route_path('repo_group_home', repo_group_name=repo_group_name)}">${_('Summary')}</a>
198 </li>
198 </li>
199
199
200 </ul>
200 </ul>
201 </div>
201 </div>
202 </%def>
202 </%def>
203
203
204 <%def name="repo_group_name(repo_group_name, children_groups=None)">
204 <%def name="repo_group_name(repo_group_name, children_groups=None)">
205 <div>
205 <div>
206 <a href="${h.route_path('repo_group_home', repo_group_name=repo_group_name)}">
206 <a href="${h.route_path('repo_group_home', repo_group_name=repo_group_name)}">
207 <i class="icon-folder-close" title="${_('Repository group')}" style="font-size: 16px"></i>
207 <i class="icon-folder-close" title="${_('Repository group')}" style="font-size: 16px"></i>
208 %if children_groups:
208 %if children_groups:
209 ${h.literal(' &raquo; '.join(children_groups))}
209 ${h.literal(' &raquo; '.join(children_groups))}
210 %else:
210 %else:
211 ${repo_group_name}
211 ${repo_group_name}
212 %endif
212 %endif
213 </a>
213 </a>
214 </div>
214 </div>
215 </%def>
215 </%def>
216
216
217 <%def name="repo_group_desc(description, personal, stylify_metatags)">
217 <%def name="repo_group_desc(description, personal, stylify_metatags)">
218
218
219 <%
219 <%
220 tags, description = h.extract_metatags(description)
220 tags, description = h.extract_metatags(description)
221 %>
221 %>
222
222
223 <div class="truncate-wrap">
223 <div class="truncate-wrap">
224 % if personal:
224 % if personal:
225 <div class="metatag" tag="personal">${_('personal')}</div>
225 <div class="metatag" tag="personal">${_('personal')}</div>
226 % endif
226 % endif
227
227
228 % if stylify_metatags:
228 % if stylify_metatags:
229 % for tag_type, tag in tags:
229 % for tag_type, tag in tags:
230 ${h.style_metatag(tag_type, tag)|n}
230 ${h.style_metatag(tag_type, tag)|n}
231 % endfor
231 % endfor
232 % endif
232 % endif
233 ${description}
233 ${description}
234 </div>
234 </div>
235
235
236 </%def>
236 </%def>
237
237
238 <%def name="repo_group_actions(repo_group_id, repo_group_name, gr_count)">
238 <%def name="repo_group_actions(repo_group_id, repo_group_name, gr_count)">
239 <div class="grid_edit">
239 <div class="grid_edit">
240 <a href="${h.url('edit_repo_group',group_name=repo_group_name)}" title="${_('Edit')}">Edit</a>
240 <a href="${h.url('edit_repo_group',group_name=repo_group_name)}" title="${_('Edit')}">Edit</a>
241 </div>
241 </div>
242 <div class="grid_delete">
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 ${h.submit('remove_%s' % repo_group_name,_('Delete'),class_="btn btn-link btn-danger",
244 ${h.submit('remove_%s' % repo_group_name,_('Delete'),class_="btn btn-link btn-danger",
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)+"');")}
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 ${h.end_form()}
246 ${h.end_form()}
247 </div>
247 </div>
248 </%def>
248 </%def>
249
249
250
250
251 <%def name="user_actions(user_id, username)">
251 <%def name="user_actions(user_id, username)">
252 <div class="grid_edit">
252 <div class="grid_edit">
253 <a href="${h.url('edit_user',user_id=user_id)}" title="${_('Edit')}">
253 <a href="${h.url('edit_user',user_id=user_id)}" title="${_('Edit')}">
254 <i class="icon-pencil"></i>Edit</a>
254 <i class="icon-pencil"></i>Edit</a>
255 </div>
255 </div>
256 <div class="grid_delete">
256 <div class="grid_delete">
257 ${h.secure_form(h.url('delete_user', user_id=user_id),method='delete')}
257 ${h.secure_form(h.url('delete_user', user_id=user_id),method='delete')}
258 ${h.submit('remove_',_('Delete'),id="remove_user_%s" % user_id, class_="btn btn-link btn-danger",
258 ${h.submit('remove_',_('Delete'),id="remove_user_%s" % user_id, class_="btn btn-link btn-danger",
259 onclick="return confirm('"+_('Confirm to delete this user: %s') % username+"');")}
259 onclick="return confirm('"+_('Confirm to delete this user: %s') % username+"');")}
260 ${h.end_form()}
260 ${h.end_form()}
261 </div>
261 </div>
262 </%def>
262 </%def>
263
263
264 <%def name="user_group_actions(user_group_id, user_group_name)">
264 <%def name="user_group_actions(user_group_id, user_group_name)">
265 <div class="grid_edit">
265 <div class="grid_edit">
266 <a href="${h.route_path('edit_user_group', user_group_id=user_group_id)}" title="${_('Edit')}">Edit</a>
266 <a href="${h.route_path('edit_user_group', user_group_id=user_group_id)}" title="${_('Edit')}">Edit</a>
267 </div>
267 </div>
268 <div class="grid_delete">
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 ${h.submit('remove_',_('Delete'),id="remove_group_%s" % user_group_id, class_="btn btn-link btn-danger",
270 ${h.submit('remove_',_('Delete'),id="remove_group_%s" % user_group_id, class_="btn btn-link btn-danger",
271 onclick="return confirm('"+_('Confirm to delete this user group: %s') % user_group_name+"');")}
271 onclick="return confirm('"+_('Confirm to delete this user group: %s') % user_group_name+"');")}
272 ${h.end_form()}
272 ${h.end_form()}
273 </div>
273 </div>
274 </%def>
274 </%def>
275
275
276
276
277 <%def name="user_name(user_id, username)">
277 <%def name="user_name(user_id, username)">
278 ${h.link_to(h.person(username, 'username_or_name_or_email'), h.url('edit_user', user_id=user_id))}
278 ${h.link_to(h.person(username, 'username_or_name_or_email'), h.url('edit_user', user_id=user_id))}
279 </%def>
279 </%def>
280
280
281 <%def name="user_profile(username)">
281 <%def name="user_profile(username)">
282 ${base.gravatar_with_user(username, 16)}
282 ${base.gravatar_with_user(username, 16)}
283 </%def>
283 </%def>
284
284
285 <%def name="user_group_name(user_group_id, user_group_name)">
285 <%def name="user_group_name(user_group_id, user_group_name)">
286 <div>
286 <div>
287 <a href="${h.route_path('edit_user_group', user_group_id=user_group_id)}">
287 <a href="${h.route_path('edit_user_group', user_group_id=user_group_id)}">
288 <i class="icon-group" title="${_('User group')}"></i> ${user_group_name}</a>
288 <i class="icon-group" title="${_('User group')}"></i> ${user_group_name}</a>
289 </div>
289 </div>
290 </%def>
290 </%def>
291
291
292
292
293 ## GISTS
293 ## GISTS
294
294
295 <%def name="gist_gravatar(full_contact)">
295 <%def name="gist_gravatar(full_contact)">
296 <div class="gist_gravatar">
296 <div class="gist_gravatar">
297 ${base.gravatar(full_contact, 30)}
297 ${base.gravatar(full_contact, 30)}
298 </div>
298 </div>
299 </%def>
299 </%def>
300
300
301 <%def name="gist_access_id(gist_access_id, full_contact)">
301 <%def name="gist_access_id(gist_access_id, full_contact)">
302 <div>
302 <div>
303 <b>
303 <b>
304 <a href="${h.route_path('gist_show', gist_id=gist_access_id)}">gist: ${gist_access_id}</a>
304 <a href="${h.route_path('gist_show', gist_id=gist_access_id)}">gist: ${gist_access_id}</a>
305 </b>
305 </b>
306 </div>
306 </div>
307 </%def>
307 </%def>
308
308
309 <%def name="gist_author(full_contact, created_on, expires)">
309 <%def name="gist_author(full_contact, created_on, expires)">
310 ${base.gravatar_with_user(full_contact, 16)}
310 ${base.gravatar_with_user(full_contact, 16)}
311 </%def>
311 </%def>
312
312
313
313
314 <%def name="gist_created(created_on)">
314 <%def name="gist_created(created_on)">
315 <div class="created">
315 <div class="created">
316 ${h.age_component(created_on, time_is_local=True)}
316 ${h.age_component(created_on, time_is_local=True)}
317 </div>
317 </div>
318 </%def>
318 </%def>
319
319
320 <%def name="gist_expires(expires)">
320 <%def name="gist_expires(expires)">
321 <div class="created">
321 <div class="created">
322 %if expires == -1:
322 %if expires == -1:
323 ${_('never')}
323 ${_('never')}
324 %else:
324 %else:
325 ${h.age_component(h.time_to_utcdatetime(expires))}
325 ${h.age_component(h.time_to_utcdatetime(expires))}
326 %endif
326 %endif
327 </div>
327 </div>
328 </%def>
328 </%def>
329
329
330 <%def name="gist_type(gist_type)">
330 <%def name="gist_type(gist_type)">
331 %if gist_type != 'public':
331 %if gist_type != 'public':
332 <div class="tag">${_('Private')}</div>
332 <div class="tag">${_('Private')}</div>
333 %endif
333 %endif
334 </%def>
334 </%def>
335
335
336 <%def name="gist_description(gist_description)">
336 <%def name="gist_description(gist_description)">
337 ${gist_description}
337 ${gist_description}
338 </%def>
338 </%def>
339
339
340
340
341 ## PULL REQUESTS GRID RENDERERS
341 ## PULL REQUESTS GRID RENDERERS
342
342
343 <%def name="pullrequest_target_repo(repo_name)">
343 <%def name="pullrequest_target_repo(repo_name)">
344 <div class="truncate">
344 <div class="truncate">
345 ${h.link_to(repo_name,h.route_path('repo_summary',repo_name=repo_name))}
345 ${h.link_to(repo_name,h.route_path('repo_summary',repo_name=repo_name))}
346 </div>
346 </div>
347 </%def>
347 </%def>
348 <%def name="pullrequest_status(status)">
348 <%def name="pullrequest_status(status)">
349 <div class="${'flag_status %s' % status} pull-left"></div>
349 <div class="${'flag_status %s' % status} pull-left"></div>
350 </%def>
350 </%def>
351
351
352 <%def name="pullrequest_title(title, description)">
352 <%def name="pullrequest_title(title, description)">
353 ${title} <br/>
353 ${title} <br/>
354 ${h.shorter(description, 40)}
354 ${h.shorter(description, 40)}
355 </%def>
355 </%def>
356
356
357 <%def name="pullrequest_comments(comments_nr)">
357 <%def name="pullrequest_comments(comments_nr)">
358 <i class="icon-comment"></i> ${comments_nr}
358 <i class="icon-comment"></i> ${comments_nr}
359 </%def>
359 </%def>
360
360
361 <%def name="pullrequest_name(pull_request_id, target_repo_name, short=False)">
361 <%def name="pullrequest_name(pull_request_id, target_repo_name, short=False)">
362 <a href="${h.route_path('pullrequest_show',repo_name=target_repo_name,pull_request_id=pull_request_id)}">
362 <a href="${h.route_path('pullrequest_show',repo_name=target_repo_name,pull_request_id=pull_request_id)}">
363 % if short:
363 % if short:
364 #${pull_request_id}
364 #${pull_request_id}
365 % else:
365 % else:
366 ${_('Pull request #%(pr_number)s') % {'pr_number': pull_request_id,}}
366 ${_('Pull request #%(pr_number)s') % {'pr_number': pull_request_id,}}
367 % endif
367 % endif
368 </a>
368 </a>
369 </%def>
369 </%def>
370
370
371 <%def name="pullrequest_updated_on(updated_on)">
371 <%def name="pullrequest_updated_on(updated_on)">
372 ${h.age_component(h.time_to_utcdatetime(updated_on))}
372 ${h.age_component(h.time_to_utcdatetime(updated_on))}
373 </%def>
373 </%def>
374
374
375 <%def name="pullrequest_author(full_contact)">
375 <%def name="pullrequest_author(full_contact)">
376 ${base.gravatar_with_user(full_contact, 16)}
376 ${base.gravatar_with_user(full_contact, 16)}
377 </%def>
377 </%def>
@@ -1,238 +1,238 b''
1 <%inherit file="/base/base.mako"/>
1 <%inherit file="/base/base.mako"/>
2
2
3 <%def name="title()">
3 <%def name="title()">
4 ${_('%s Files Add') % c.repo_name}
4 ${_('%s Files Add') % c.repo_name}
5 %if c.rhodecode_name:
5 %if c.rhodecode_name:
6 &middot; ${h.branding(c.rhodecode_name)}
6 &middot; ${h.branding(c.rhodecode_name)}
7 %endif
7 %endif
8 </%def>
8 </%def>
9
9
10 <%def name="menu_bar_nav()">
10 <%def name="menu_bar_nav()">
11 ${self.menu_items(active='repositories')}
11 ${self.menu_items(active='repositories')}
12 </%def>
12 </%def>
13
13
14 <%def name="breadcrumbs_links()">
14 <%def name="breadcrumbs_links()">
15 ${_('Add new file')} @ ${h.show_id(c.commit)}
15 ${_('Add new file')} @ ${h.show_id(c.commit)}
16 </%def>
16 </%def>
17
17
18 <%def name="menu_bar_subnav()">
18 <%def name="menu_bar_subnav()">
19 ${self.repo_menu(active='files')}
19 ${self.repo_menu(active='files')}
20 </%def>
20 </%def>
21
21
22 <%def name="main()">
22 <%def name="main()">
23 <div class="box">
23 <div class="box">
24 <div class="title">
24 <div class="title">
25 ${self.repo_page_title(c.rhodecode_db_repo)}
25 ${self.repo_page_title(c.rhodecode_db_repo)}
26 </div>
26 </div>
27 <div class="edit-file-title">
27 <div class="edit-file-title">
28 ${self.breadcrumbs()}
28 ${self.breadcrumbs()}
29 </div>
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 <div class="edit-file-fieldset">
31 <div class="edit-file-fieldset">
32 <div class="fieldset">
32 <div class="fieldset">
33 <div id="destination-label" class="left-label">
33 <div id="destination-label" class="left-label">
34 ${_('Path')}:
34 ${_('Path')}:
35 </div>
35 </div>
36 <div class="right-content">
36 <div class="right-content">
37 <div id="specify-custom-path-container">
37 <div id="specify-custom-path-container">
38 <span id="path-breadcrumbs">${h.files_breadcrumbs(c.repo_name,c.commit.raw_id,c.f_path)}</span>
38 <span id="path-breadcrumbs">${h.files_breadcrumbs(c.repo_name,c.commit.raw_id,c.f_path)}</span>
39 <a class="custom-path-link" id="specify-custom-path" href="#">${_('Specify Custom Path')}</a>
39 <a class="custom-path-link" id="specify-custom-path" href="#">${_('Specify Custom Path')}</a>
40 </div>
40 </div>
41 <div id="remove-custom-path-container" style="display: none;">
41 <div id="remove-custom-path-container" style="display: none;">
42 ${c.repo_name}/
42 ${c.repo_name}/
43 <input type="input-small" value="${c.f_path}" size="46" name="location" id="location">
43 <input type="input-small" value="${c.f_path}" size="46" name="location" id="location">
44 <a class="custom-path-link" id="remove-custom-path" href="#">${_('Remove Custom Path')}</a>
44 <a class="custom-path-link" id="remove-custom-path" href="#">${_('Remove Custom Path')}</a>
45 </div>
45 </div>
46 </div>
46 </div>
47 </div>
47 </div>
48 <div id="filename_container" class="fieldset">
48 <div id="filename_container" class="fieldset">
49 <div class="filename-label left-label">
49 <div class="filename-label left-label">
50 ${_('Filename')}:
50 ${_('Filename')}:
51 </div>
51 </div>
52 <div class="right-content">
52 <div class="right-content">
53 <input class="input-small" type="text" value="" size="46" name="filename" id="filename">
53 <input class="input-small" type="text" value="" size="46" name="filename" id="filename">
54 <p>${_('or')} <a id="upload_file_enable" href="#">${_('Upload File')}</a></p>
54 <p>${_('or')} <a id="upload_file_enable" href="#">${_('Upload File')}</a></p>
55 </div>
55 </div>
56 </div>
56 </div>
57 <div id="upload_file_container" class="fieldset" style="display: none;">
57 <div id="upload_file_container" class="fieldset" style="display: none;">
58 <div class="filename-label left-label">
58 <div class="filename-label left-label">
59 ${_('Filename')}:
59 ${_('Filename')}:
60 </div>
60 </div>
61 <div class="right-content">
61 <div class="right-content">
62 <input class="input-small" type="text" value="" size="46" name="filename_upload" id="filename_upload" placeholder="${_('No file selected')}">
62 <input class="input-small" type="text" value="" size="46" name="filename_upload" id="filename_upload" placeholder="${_('No file selected')}">
63 </div>
63 </div>
64 <div class="filename-label left-label file-upload-label">
64 <div class="filename-label left-label file-upload-label">
65 ${_('Upload file')}:
65 ${_('Upload file')}:
66 </div>
66 </div>
67 <div class="right-content file-upload-input">
67 <div class="right-content file-upload-input">
68 <label for="upload_file" class="btn btn-default">Browse</label>
68 <label for="upload_file" class="btn btn-default">Browse</label>
69
69
70 <input type="file" name="upload_file" id="upload_file">
70 <input type="file" name="upload_file" id="upload_file">
71 <p>${_('or')} <a id="file_enable" href="#">${_('Create New File')}</a></p>
71 <p>${_('or')} <a id="file_enable" href="#">${_('Create New File')}</a></p>
72 </div>
72 </div>
73 </div>
73 </div>
74 </div>
74 </div>
75 <div class="table">
75 <div class="table">
76 <div id="files_data">
76 <div id="files_data">
77 <div id="codeblock" class="codeblock">
77 <div id="codeblock" class="codeblock">
78 <div class="code-header form" id="set_mode_header">
78 <div class="code-header form" id="set_mode_header">
79 <div class="fields">
79 <div class="fields">
80 ${h.dropdownmenu('set_mode','plain',[('plain',_('plain'))],enable_filter=True)}
80 ${h.dropdownmenu('set_mode','plain',[('plain',_('plain'))],enable_filter=True)}
81 <label for="line_wrap">${_('line wraps')}</label>
81 <label for="line_wrap">${_('line wraps')}</label>
82 ${h.dropdownmenu('line_wrap', 'off', [('on', _('on')), ('off', _('off')),])}
82 ${h.dropdownmenu('line_wrap', 'off', [('on', _('on')), ('off', _('off')),])}
83
83
84 <div id="render_preview" class="btn btn-small preview hidden" >${_('Preview')}</div>
84 <div id="render_preview" class="btn btn-small preview hidden" >${_('Preview')}</div>
85 </div>
85 </div>
86 </div>
86 </div>
87 <div id="editor_container">
87 <div id="editor_container">
88 <pre id="editor_pre"></pre>
88 <pre id="editor_pre"></pre>
89 <textarea id="editor" name="content" ></textarea>
89 <textarea id="editor" name="content" ></textarea>
90 <div id="editor_preview"></div>
90 <div id="editor_preview"></div>
91 </div>
91 </div>
92 </div>
92 </div>
93 </div>
93 </div>
94 </div>
94 </div>
95
95
96 <div class="edit-file-fieldset">
96 <div class="edit-file-fieldset">
97 <div class="fieldset">
97 <div class="fieldset">
98 <div id="commit-message-label" class="commit-message-label left-label">
98 <div id="commit-message-label" class="commit-message-label left-label">
99 ${_('Commit Message')}:
99 ${_('Commit Message')}:
100 </div>
100 </div>
101 <div class="right-content">
101 <div class="right-content">
102 <div class="message">
102 <div class="message">
103 <textarea id="commit" name="message" placeholder="${c.default_message}"></textarea>
103 <textarea id="commit" name="message" placeholder="${c.default_message}"></textarea>
104 </div>
104 </div>
105 </div>
105 </div>
106 </div>
106 </div>
107 <div class="pull-right">
107 <div class="pull-right">
108 ${h.reset('reset',_('Cancel'),class_="btn btn-small")}
108 ${h.reset('reset',_('Cancel'),class_="btn btn-small")}
109 ${h.submit('commit_btn',_('Commit changes'),class_="btn btn-small btn-success")}
109 ${h.submit('commit_btn',_('Commit changes'),class_="btn btn-small btn-success")}
110 </div>
110 </div>
111 </div>
111 </div>
112 ${h.end_form()}
112 ${h.end_form()}
113 </div>
113 </div>
114 <script type="text/javascript">
114 <script type="text/javascript">
115
115
116 $('#commit_btn').on('click', function() {
116 $('#commit_btn').on('click', function() {
117 var button = $(this);
117 var button = $(this);
118 if (button.hasClass('clicked')) {
118 if (button.hasClass('clicked')) {
119 button.attr('disabled', true);
119 button.attr('disabled', true);
120 } else {
120 } else {
121 button.addClass('clicked');
121 button.addClass('clicked');
122 }
122 }
123 });
123 });
124
124
125 $('#specify-custom-path').on('click', function(e){
125 $('#specify-custom-path').on('click', function(e){
126 e.preventDefault();
126 e.preventDefault();
127 $('#specify-custom-path-container').hide();
127 $('#specify-custom-path-container').hide();
128 $('#remove-custom-path-container').show();
128 $('#remove-custom-path-container').show();
129 $('#destination-label').css('margin-top', '13px');
129 $('#destination-label').css('margin-top', '13px');
130 });
130 });
131
131
132 $('#remove-custom-path').on('click', function(e){
132 $('#remove-custom-path').on('click', function(e){
133 e.preventDefault();
133 e.preventDefault();
134 $('#specify-custom-path-container').show();
134 $('#specify-custom-path-container').show();
135 $('#remove-custom-path-container').hide();
135 $('#remove-custom-path-container').hide();
136 $('#location').val('${c.f_path}');
136 $('#location').val('${c.f_path}');
137 $('#destination-label').css('margin-top', '0');
137 $('#destination-label').css('margin-top', '0');
138 });
138 });
139
139
140 var hide_upload = function(){
140 var hide_upload = function(){
141 $('#files_data').show();
141 $('#files_data').show();
142 $('#upload_file_container').hide();
142 $('#upload_file_container').hide();
143 $('#filename_container').show();
143 $('#filename_container').show();
144 };
144 };
145
145
146 $('#file_enable').on('click', function(e){
146 $('#file_enable').on('click', function(e){
147 e.preventDefault();
147 e.preventDefault();
148 hide_upload();
148 hide_upload();
149 });
149 });
150
150
151 $('#upload_file_enable').on('click', function(e){
151 $('#upload_file_enable').on('click', function(e){
152 e.preventDefault();
152 e.preventDefault();
153 $('#files_data').hide();
153 $('#files_data').hide();
154 $('#upload_file_container').show();
154 $('#upload_file_container').show();
155 $('#filename_container').hide();
155 $('#filename_container').hide();
156 if (detectIE() && detectIE() <= 9) {
156 if (detectIE() && detectIE() <= 9) {
157 $('#upload_file_container .file-upload-input label').hide();
157 $('#upload_file_container .file-upload-input label').hide();
158 $('#upload_file_container .file-upload-input span').hide();
158 $('#upload_file_container .file-upload-input span').hide();
159 $('#upload_file_container .file-upload-input input').show();
159 $('#upload_file_container .file-upload-input input').show();
160 }
160 }
161 });
161 });
162
162
163 $('#upload_file').on('change', function() {
163 $('#upload_file').on('change', function() {
164 if (this.files && this.files[0]) {
164 if (this.files && this.files[0]) {
165 $('#filename_upload').val(this.files[0].name);
165 $('#filename_upload').val(this.files[0].name);
166 }
166 }
167 });
167 });
168
168
169 hide_upload();
169 hide_upload();
170
170
171 var renderer = "";
171 var renderer = "";
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)}";
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 var myCodeMirror = initCodeMirror('editor', reset_url, false);
173 var myCodeMirror = initCodeMirror('editor', reset_url, false);
174
174
175 var modes_select = $('#set_mode');
175 var modes_select = $('#set_mode');
176 fillCodeMirrorOptions(modes_select);
176 fillCodeMirrorOptions(modes_select);
177
177
178 var filename_selector = '#filename';
178 var filename_selector = '#filename';
179 var callback = function(filename, mimetype, mode){
179 var callback = function(filename, mimetype, mode){
180 CodeMirrorPreviewEnable(mode);
180 CodeMirrorPreviewEnable(mode);
181 };
181 };
182 // on change of select field set mode
182 // on change of select field set mode
183 setCodeMirrorModeFromSelect(
183 setCodeMirrorModeFromSelect(
184 modes_select, filename_selector, myCodeMirror, callback);
184 modes_select, filename_selector, myCodeMirror, callback);
185
185
186 // on entering the new filename set mode, from given extension
186 // on entering the new filename set mode, from given extension
187 setCodeMirrorModeFromInput(
187 setCodeMirrorModeFromInput(
188 modes_select, filename_selector, myCodeMirror, callback);
188 modes_select, filename_selector, myCodeMirror, callback);
189
189
190 // if the file is renderable set line wraps automatically
190 // if the file is renderable set line wraps automatically
191 if (renderer !== ""){
191 if (renderer !== ""){
192 var line_wrap = 'on';
192 var line_wrap = 'on';
193 $($('#line_wrap option[value="'+line_wrap+'"]')[0]).attr("selected", "selected");
193 $($('#line_wrap option[value="'+line_wrap+'"]')[0]).attr("selected", "selected");
194 setCodeMirrorLineWrap(myCodeMirror, true);
194 setCodeMirrorLineWrap(myCodeMirror, true);
195 }
195 }
196
196
197 // on select line wraps change the editor
197 // on select line wraps change the editor
198 $('#line_wrap').on('change', function(e){
198 $('#line_wrap').on('change', function(e){
199 var selected = e.currentTarget;
199 var selected = e.currentTarget;
200 var line_wraps = {'on': true, 'off': false}[selected.value];
200 var line_wraps = {'on': true, 'off': false}[selected.value];
201 setCodeMirrorLineWrap(myCodeMirror, line_wraps)
201 setCodeMirrorLineWrap(myCodeMirror, line_wraps)
202 });
202 });
203
203
204 // render preview/edit button
204 // render preview/edit button
205 $('#render_preview').on('click', function(e){
205 $('#render_preview').on('click', function(e){
206 if($(this).hasClass('preview')){
206 if($(this).hasClass('preview')){
207 $(this).removeClass('preview');
207 $(this).removeClass('preview');
208 $(this).html("${_('Edit')}");
208 $(this).html("${_('Edit')}");
209 $('#editor_preview').show();
209 $('#editor_preview').show();
210 $(myCodeMirror.getWrapperElement()).hide();
210 $(myCodeMirror.getWrapperElement()).hide();
211
211
212 var possible_renderer = {
212 var possible_renderer = {
213 'rst':'rst',
213 'rst':'rst',
214 'markdown':'markdown',
214 'markdown':'markdown',
215 'gfm': 'markdown'}[myCodeMirror.getMode().name];
215 'gfm': 'markdown'}[myCodeMirror.getMode().name];
216 var _text = myCodeMirror.getValue();
216 var _text = myCodeMirror.getValue();
217 var _renderer = possible_renderer || DEFAULT_RENDERER;
217 var _renderer = possible_renderer || DEFAULT_RENDERER;
218 var post_data = {'text': _text, 'renderer': _renderer, 'csrf_token': CSRF_TOKEN};
218 var post_data = {'text': _text, 'renderer': _renderer, 'csrf_token': CSRF_TOKEN};
219 $('#editor_preview').html(_gettext('Loading ...'));
219 $('#editor_preview').html(_gettext('Loading ...'));
220 var url = pyroutes.url('repo_commit_comment_preview',
220 var url = pyroutes.url('repo_commit_comment_preview',
221 {'repo_name': '${c.repo_name}',
221 {'repo_name': '${c.repo_name}',
222 'commit_id': '${c.commit.raw_id}'});
222 'commit_id': '${c.commit.raw_id}'});
223
223
224 ajaxPOST(url, post_data, function(o){
224 ajaxPOST(url, post_data, function(o){
225 $('#editor_preview').html(o);
225 $('#editor_preview').html(o);
226 })
226 })
227 }
227 }
228 else{
228 else{
229 $(this).addClass('preview');
229 $(this).addClass('preview');
230 $(this).html("${_('Preview')}");
230 $(this).html("${_('Preview')}");
231 $('#editor_preview').hide();
231 $('#editor_preview').hide();
232 $(myCodeMirror.getWrapperElement()).show();
232 $(myCodeMirror.getWrapperElement()).show();
233 }
233 }
234 });
234 });
235 $('#filename').focus();
235 $('#filename').focus();
236
236
237 </script>
237 </script>
238 </%def>
238 </%def>
@@ -1,75 +1,75 b''
1 <%inherit file="/base/base.mako"/>
1 <%inherit file="/base/base.mako"/>
2
2
3 <%def name="title()">
3 <%def name="title()">
4 ${_('%s Files Delete') % c.repo_name}
4 ${_('%s Files Delete') % c.repo_name}
5 %if c.rhodecode_name:
5 %if c.rhodecode_name:
6 &middot; ${h.branding(c.rhodecode_name)}
6 &middot; ${h.branding(c.rhodecode_name)}
7 %endif
7 %endif
8 </%def>
8 </%def>
9
9
10 <%def name="menu_bar_nav()">
10 <%def name="menu_bar_nav()">
11 ${self.menu_items(active='repositories')}
11 ${self.menu_items(active='repositories')}
12 </%def>
12 </%def>
13
13
14 <%def name="breadcrumbs_links()">
14 <%def name="breadcrumbs_links()">
15 ${_('Delete file')} @ ${h.show_id(c.commit)}
15 ${_('Delete file')} @ ${h.show_id(c.commit)}
16 </%def>
16 </%def>
17
17
18 <%def name="menu_bar_subnav()">
18 <%def name="menu_bar_subnav()">
19 ${self.repo_menu(active='files')}
19 ${self.repo_menu(active='files')}
20 </%def>
20 </%def>
21
21
22 <%def name="main()">
22 <%def name="main()">
23 <div class="box">
23 <div class="box">
24 <div class="title">
24 <div class="title">
25 ${self.repo_page_title(c.rhodecode_db_repo)}
25 ${self.repo_page_title(c.rhodecode_db_repo)}
26 </div>
26 </div>
27 <div class="edit-file-title">
27 <div class="edit-file-title">
28 ${self.breadcrumbs()}
28 ${self.breadcrumbs()}
29 </div>
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 <div class="edit-file-fieldset">
31 <div class="edit-file-fieldset">
32 <div class="fieldset">
32 <div class="fieldset">
33 <div id="destination-label" class="left-label">
33 <div id="destination-label" class="left-label">
34 ${_('Path')}:
34 ${_('Path')}:
35 </div>
35 </div>
36 <div class="right-content">
36 <div class="right-content">
37 <span id="path-breadcrumbs">${h.files_breadcrumbs(c.repo_name,c.commit.raw_id,c.f_path)}</span>
37 <span id="path-breadcrumbs">${h.files_breadcrumbs(c.repo_name,c.commit.raw_id,c.f_path)}</span>
38 </div>
38 </div>
39 </div>
39 </div>
40 </div>
40 </div>
41
41
42 <div id="codeblock" class="codeblock delete-file-preview">
42 <div id="codeblock" class="codeblock delete-file-preview">
43 <div class="code-body">
43 <div class="code-body">
44 %if c.file.is_binary:
44 %if c.file.is_binary:
45 ${_('Binary file (%s)') % c.file.mimetype}
45 ${_('Binary file (%s)') % c.file.mimetype}
46 %else:
46 %else:
47 %if c.file.size < c.visual.cut_off_limit_file:
47 %if c.file.size < c.visual.cut_off_limit_file:
48 ${h.pygmentize(c.file,linenos=True,anchorlinenos=False,cssclass="code-highlight")}
48 ${h.pygmentize(c.file,linenos=True,anchorlinenos=False,cssclass="code-highlight")}
49 %else:
49 %else:
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'),
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 h.route_path('repo_file_raw',repo_name=c.repo_name,commit_id=c.commit.raw_id,f_path=c.f_path))}
51 h.route_path('repo_file_raw',repo_name=c.repo_name,commit_id=c.commit.raw_id,f_path=c.f_path))}
52 %endif
52 %endif
53 %endif
53 %endif
54 </div>
54 </div>
55 </div>
55 </div>
56
56
57 <div class="edit-file-fieldset">
57 <div class="edit-file-fieldset">
58 <div class="fieldset">
58 <div class="fieldset">
59 <div id="commit-message-label" class="commit-message-label left-label">
59 <div id="commit-message-label" class="commit-message-label left-label">
60 ${_('Commit Message')}:
60 ${_('Commit Message')}:
61 </div>
61 </div>
62 <div class="right-content">
62 <div class="right-content">
63 <div class="message">
63 <div class="message">
64 <textarea id="commit" name="message" placeholder="${c.default_message}"></textarea>
64 <textarea id="commit" name="message" placeholder="${c.default_message}"></textarea>
65 </div>
65 </div>
66 </div>
66 </div>
67 </div>
67 </div>
68 <div class="pull-right">
68 <div class="pull-right">
69 ${h.reset('reset',_('Cancel'),class_="btn btn-small btn-danger")}
69 ${h.reset('reset',_('Cancel'),class_="btn btn-small btn-danger")}
70 ${h.submit('commit',_('Delete File'),class_="btn btn-small btn-danger-action")}
70 ${h.submit('commit',_('Delete File'),class_="btn btn-small btn-danger-action")}
71 </div>
71 </div>
72 </div>
72 </div>
73 ${h.end_form()}
73 ${h.end_form()}
74 </div>
74 </div>
75 </%def>
75 </%def>
@@ -1,197 +1,197 b''
1 <%inherit file="/base/base.mako"/>
1 <%inherit file="/base/base.mako"/>
2
2
3 <%def name="title()">
3 <%def name="title()">
4 ${_('%s File Edit') % c.repo_name}
4 ${_('%s File Edit') % c.repo_name}
5 %if c.rhodecode_name:
5 %if c.rhodecode_name:
6 &middot; ${h.branding(c.rhodecode_name)}
6 &middot; ${h.branding(c.rhodecode_name)}
7 %endif
7 %endif
8 </%def>
8 </%def>
9
9
10 <%def name="menu_bar_nav()">
10 <%def name="menu_bar_nav()">
11 ${self.menu_items(active='repositories')}
11 ${self.menu_items(active='repositories')}
12 </%def>
12 </%def>
13
13
14 <%def name="breadcrumbs_links()">
14 <%def name="breadcrumbs_links()">
15 ${_('Edit file')} @ ${h.show_id(c.commit)}
15 ${_('Edit file')} @ ${h.show_id(c.commit)}
16 </%def>
16 </%def>
17
17
18 <%def name="menu_bar_subnav()">
18 <%def name="menu_bar_subnav()">
19 ${self.repo_menu(active='files')}
19 ${self.repo_menu(active='files')}
20 </%def>
20 </%def>
21
21
22 <%def name="main()">
22 <%def name="main()">
23 <% renderer = h.renderer_from_filename(c.f_path)%>
23 <% renderer = h.renderer_from_filename(c.f_path)%>
24 <div class="box">
24 <div class="box">
25 <div class="title">
25 <div class="title">
26 ${self.repo_page_title(c.rhodecode_db_repo)}
26 ${self.repo_page_title(c.rhodecode_db_repo)}
27 </div>
27 </div>
28 <div class="edit-file-title">
28 <div class="edit-file-title">
29 ${self.breadcrumbs()}
29 ${self.breadcrumbs()}
30 </div>
30 </div>
31 <div class="edit-file-fieldset">
31 <div class="edit-file-fieldset">
32 <div class="fieldset">
32 <div class="fieldset">
33 <div id="destination-label" class="left-label">
33 <div id="destination-label" class="left-label">
34 ${_('Path')}:
34 ${_('Path')}:
35 </div>
35 </div>
36 <div class="right-content">
36 <div class="right-content">
37 <div id="specify-custom-path-container">
37 <div id="specify-custom-path-container">
38 <span id="path-breadcrumbs">${h.files_breadcrumbs(c.repo_name,c.commit.raw_id,c.f_path)}</span>
38 <span id="path-breadcrumbs">${h.files_breadcrumbs(c.repo_name,c.commit.raw_id,c.f_path)}</span>
39 </div>
39 </div>
40 </div>
40 </div>
41 </div>
41 </div>
42 </div>
42 </div>
43
43
44 <div class="table">
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 <div id="codeblock" class="codeblock" >
46 <div id="codeblock" class="codeblock" >
47 <div class="code-header">
47 <div class="code-header">
48 <div class="stats">
48 <div class="stats">
49 <i class="icon-file"></i>
49 <i class="icon-file"></i>
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>
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 <span class="item">${h.format_byte_size_binary(c.file.size)}</span>
51 <span class="item">${h.format_byte_size_binary(c.file.size)}</span>
52 <span class="item last">${c.file.mimetype}</span>
52 <span class="item last">${c.file.mimetype}</span>
53 <div class="buttons">
53 <div class="buttons">
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)}">
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 <i class="icon-time"></i> ${_('history')}
55 <i class="icon-time"></i> ${_('history')}
56 </a>
56 </a>
57
57
58 % if h.HasRepoPermissionAny('repository.write','repository.admin')(c.repo_name):
58 % if h.HasRepoPermissionAny('repository.write','repository.admin')(c.repo_name):
59 % if not c.file.is_binary:
59 % if not c.file.is_binary:
60 %if True:
60 %if True:
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")}
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 %else:
62 %else:
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")}
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 %endif
64 %endif
65
65
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)}">
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 ${_('raw')}
67 ${_('raw')}
68 </a>
68 </a>
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)}">
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 <i class="icon-archive"></i> ${_('download')}
70 <i class="icon-archive"></i> ${_('download')}
71 </a>
71 </a>
72 % endif
72 % endif
73 % endif
73 % endif
74 </div>
74 </div>
75 </div>
75 </div>
76 <div class="form">
76 <div class="form">
77 <label for="set_mode">${_('Editing file')}:</label>
77 <label for="set_mode">${_('Editing file')}:</label>
78 ${'%s /' % c.file.dir_path if c.file.dir_path else c.file.dir_path}
78 ${'%s /' % c.file.dir_path if c.file.dir_path else c.file.dir_path}
79 <input id="filename" type="text" name="filename" value="${c.file.name}">
79 <input id="filename" type="text" name="filename" value="${c.file.name}">
80
80
81 ${h.dropdownmenu('set_mode','plain',[('plain',_('plain'))],enable_filter=True)}
81 ${h.dropdownmenu('set_mode','plain',[('plain',_('plain'))],enable_filter=True)}
82 <label for="line_wrap">${_('line wraps')}</label>
82 <label for="line_wrap">${_('line wraps')}</label>
83 ${h.dropdownmenu('line_wrap', 'off', [('on', _('on')), ('off', _('off')),])}
83 ${h.dropdownmenu('line_wrap', 'off', [('on', _('on')), ('off', _('off')),])}
84
84
85 <div id="render_preview" class="btn btn-small preview hidden">${_('Preview')}</div>
85 <div id="render_preview" class="btn btn-small preview hidden">${_('Preview')}</div>
86 </div>
86 </div>
87 </div>
87 </div>
88 <div id="editor_container">
88 <div id="editor_container">
89 <pre id="editor_pre"></pre>
89 <pre id="editor_pre"></pre>
90 <textarea id="editor" name="content" >${h.escape(c.file.content)|n}</textarea>
90 <textarea id="editor" name="content" >${h.escape(c.file.content)|n}</textarea>
91 <div id="editor_preview" ></div>
91 <div id="editor_preview" ></div>
92 </div>
92 </div>
93 </div>
93 </div>
94 </div>
94 </div>
95
95
96 <div class="edit-file-fieldset">
96 <div class="edit-file-fieldset">
97 <div class="fieldset">
97 <div class="fieldset">
98 <div id="commit-message-label" class="commit-message-label left-label">
98 <div id="commit-message-label" class="commit-message-label left-label">
99 ${_('Commit Message')}:
99 ${_('Commit Message')}:
100 </div>
100 </div>
101 <div class="right-content">
101 <div class="right-content">
102 <div class="message">
102 <div class="message">
103 <textarea id="commit" name="message" placeholder="${c.default_message}"></textarea>
103 <textarea id="commit" name="message" placeholder="${c.default_message}"></textarea>
104 </div>
104 </div>
105 </div>
105 </div>
106 </div>
106 </div>
107 <div class="pull-right">
107 <div class="pull-right">
108 ${h.reset('reset',_('Cancel'),class_="btn btn-small")}
108 ${h.reset('reset',_('Cancel'),class_="btn btn-small")}
109 ${h.submit('commit',_('Commit changes'),class_="btn btn-small btn-success")}
109 ${h.submit('commit',_('Commit changes'),class_="btn btn-small btn-success")}
110 </div>
110 </div>
111 </div>
111 </div>
112 ${h.end_form()}
112 ${h.end_form()}
113 </div>
113 </div>
114
114
115 <script type="text/javascript">
115 <script type="text/javascript">
116 $(document).ready(function(){
116 $(document).ready(function(){
117 var renderer = "${renderer}";
117 var renderer = "${renderer}";
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)}";
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 var myCodeMirror = initCodeMirror('editor', reset_url);
119 var myCodeMirror = initCodeMirror('editor', reset_url);
120
120
121 var modes_select = $('#set_mode');
121 var modes_select = $('#set_mode');
122 fillCodeMirrorOptions(modes_select);
122 fillCodeMirrorOptions(modes_select);
123
123
124 // try to detect the mode based on the file we edit
124 // try to detect the mode based on the file we edit
125 var mimetype = "${c.file.mimetype}";
125 var mimetype = "${c.file.mimetype}";
126 var detected_mode = detectCodeMirrorMode(
126 var detected_mode = detectCodeMirrorMode(
127 "${c.file.name}", mimetype);
127 "${c.file.name}", mimetype);
128
128
129 if(detected_mode){
129 if(detected_mode){
130 setCodeMirrorMode(myCodeMirror, detected_mode);
130 setCodeMirrorMode(myCodeMirror, detected_mode);
131 $(modes_select).select2("val", mimetype);
131 $(modes_select).select2("val", mimetype);
132 $(modes_select).change();
132 $(modes_select).change();
133 setCodeMirrorMode(myCodeMirror, detected_mode);
133 setCodeMirrorMode(myCodeMirror, detected_mode);
134 }
134 }
135
135
136 var filename_selector = '#filename';
136 var filename_selector = '#filename';
137 var callback = function(filename, mimetype, mode){
137 var callback = function(filename, mimetype, mode){
138 CodeMirrorPreviewEnable(mode);
138 CodeMirrorPreviewEnable(mode);
139 };
139 };
140 // on change of select field set mode
140 // on change of select field set mode
141 setCodeMirrorModeFromSelect(
141 setCodeMirrorModeFromSelect(
142 modes_select, filename_selector, myCodeMirror, callback);
142 modes_select, filename_selector, myCodeMirror, callback);
143
143
144 // on entering the new filename set mode, from given extension
144 // on entering the new filename set mode, from given extension
145 setCodeMirrorModeFromInput(
145 setCodeMirrorModeFromInput(
146 modes_select, filename_selector, myCodeMirror, callback);
146 modes_select, filename_selector, myCodeMirror, callback);
147
147
148 // if the file is renderable set line wraps automatically
148 // if the file is renderable set line wraps automatically
149 if (renderer !== ""){
149 if (renderer !== ""){
150 var line_wrap = 'on';
150 var line_wrap = 'on';
151 $($('#line_wrap option[value="'+line_wrap+'"]')[0]).attr("selected", "selected");
151 $($('#line_wrap option[value="'+line_wrap+'"]')[0]).attr("selected", "selected");
152 setCodeMirrorLineWrap(myCodeMirror, true);
152 setCodeMirrorLineWrap(myCodeMirror, true);
153 }
153 }
154 // on select line wraps change the editor
154 // on select line wraps change the editor
155 $('#line_wrap').on('change', function(e){
155 $('#line_wrap').on('change', function(e){
156 var selected = e.currentTarget;
156 var selected = e.currentTarget;
157 var line_wraps = {'on': true, 'off': false}[selected.value];
157 var line_wraps = {'on': true, 'off': false}[selected.value];
158 setCodeMirrorLineWrap(myCodeMirror, line_wraps)
158 setCodeMirrorLineWrap(myCodeMirror, line_wraps)
159 });
159 });
160
160
161 // render preview/edit button
161 // render preview/edit button
162 if (mimetype === 'text/x-rst' || mimetype === 'text/plain') {
162 if (mimetype === 'text/x-rst' || mimetype === 'text/plain') {
163 $('#render_preview').removeClass('hidden');
163 $('#render_preview').removeClass('hidden');
164 }
164 }
165 $('#render_preview').on('click', function(e){
165 $('#render_preview').on('click', function(e){
166 if($(this).hasClass('preview')){
166 if($(this).hasClass('preview')){
167 $(this).removeClass('preview');
167 $(this).removeClass('preview');
168 $(this).html("${_('Edit')}");
168 $(this).html("${_('Edit')}");
169 $('#editor_preview').show();
169 $('#editor_preview').show();
170 $(myCodeMirror.getWrapperElement()).hide();
170 $(myCodeMirror.getWrapperElement()).hide();
171
171
172 var possible_renderer = {
172 var possible_renderer = {
173 'rst':'rst',
173 'rst':'rst',
174 'markdown':'markdown',
174 'markdown':'markdown',
175 'gfm': 'markdown'}[myCodeMirror.getMode().name];
175 'gfm': 'markdown'}[myCodeMirror.getMode().name];
176 var _text = myCodeMirror.getValue();
176 var _text = myCodeMirror.getValue();
177 var _renderer = possible_renderer || DEFAULT_RENDERER;
177 var _renderer = possible_renderer || DEFAULT_RENDERER;
178 var post_data = {'text': _text, 'renderer': _renderer, 'csrf_token': CSRF_TOKEN};
178 var post_data = {'text': _text, 'renderer': _renderer, 'csrf_token': CSRF_TOKEN};
179 $('#editor_preview').html(_gettext('Loading ...'));
179 $('#editor_preview').html(_gettext('Loading ...'));
180 var url = pyroutes.url('repo_commit_comment_preview',
180 var url = pyroutes.url('repo_commit_comment_preview',
181 {'repo_name': '${c.repo_name}',
181 {'repo_name': '${c.repo_name}',
182 'commit_id': '${c.commit.raw_id}'});
182 'commit_id': '${c.commit.raw_id}'});
183 ajaxPOST(url, post_data, function(o){
183 ajaxPOST(url, post_data, function(o){
184 $('#editor_preview').html(o);
184 $('#editor_preview').html(o);
185 })
185 })
186 }
186 }
187 else{
187 else{
188 $(this).addClass('preview');
188 $(this).addClass('preview');
189 $(this).html("${_('Preview')}");
189 $(this).html("${_('Preview')}");
190 $('#editor_preview').hide();
190 $('#editor_preview').hide();
191 $(myCodeMirror.getWrapperElement()).show();
191 $(myCodeMirror.getWrapperElement()).show();
192 }
192 }
193 });
193 });
194
194
195 })
195 })
196 </script>
196 </script>
197 </%def>
197 </%def>
@@ -1,134 +1,134 b''
1 ## -*- coding: utf-8 -*-
1 ## -*- coding: utf-8 -*-
2 <%inherit file="/base/base.mako"/>
2 <%inherit file="/base/base.mako"/>
3
3
4 <%def name="title()">
4 <%def name="title()">
5 ${_('Fork repository %s') % c.repo_name}
5 ${_('Fork repository %s') % c.repo_name}
6 %if c.rhodecode_name:
6 %if c.rhodecode_name:
7 &middot; ${h.branding(c.rhodecode_name)}
7 &middot; ${h.branding(c.rhodecode_name)}
8 %endif
8 %endif
9 </%def>
9 </%def>
10
10
11 <%def name="breadcrumbs_links()">
11 <%def name="breadcrumbs_links()">
12 ${_('New Fork')}
12 ${_('New Fork')}
13 </%def>
13 </%def>
14
14
15 <%def name="menu_bar_nav()">
15 <%def name="menu_bar_nav()">
16 ${self.menu_items(active='repositories')}
16 ${self.menu_items(active='repositories')}
17 </%def>
17 </%def>
18
18
19 <%def name="menu_bar_subnav()">
19 <%def name="menu_bar_subnav()">
20 ${self.repo_menu(active='options')}
20 ${self.repo_menu(active='options')}
21 </%def>
21 </%def>
22
22
23 <%def name="main()">
23 <%def name="main()">
24 <div class="box">
24 <div class="box">
25 <div class="title">
25 <div class="title">
26 ${self.repo_page_title(c.rhodecode_db_repo)}
26 ${self.repo_page_title(c.rhodecode_db_repo)}
27 ${self.breadcrumbs()}
27 ${self.breadcrumbs()}
28 </div>
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 <div class="form">
31 <div class="form">
32 <!-- fields -->
32 <!-- fields -->
33 <div class="fields">
33 <div class="fields">
34
34
35 <div class="field">
35 <div class="field">
36 <div class="label">
36 <div class="label">
37 <label for="repo_name">${_('Fork name')}:</label>
37 <label for="repo_name">${_('Fork name')}:</label>
38 </div>
38 </div>
39 <div class="input">
39 <div class="input">
40 ${h.text('repo_name', class_="medium")}
40 ${h.text('repo_name', class_="medium")}
41 ${h.hidden('repo_type',c.rhodecode_db_repo.repo_type)}
41 ${h.hidden('repo_type',c.rhodecode_db_repo.repo_type)}
42 ${h.hidden('fork_parent_id',c.rhodecode_db_repo.repo_id)}
42 ${h.hidden('fork_parent_id',c.rhodecode_db_repo.repo_id)}
43 </div>
43 </div>
44 </div>
44 </div>
45
45
46 <div class="field">
46 <div class="field">
47 <div class="label label-textarea">
47 <div class="label label-textarea">
48 <label for="description">${_('Description')}:</label>
48 <label for="description">${_('Description')}:</label>
49 </div>
49 </div>
50 <div class="textarea-repo textarea text-area editor">
50 <div class="textarea-repo textarea text-area editor">
51 ${h.textarea('description')}
51 ${h.textarea('description')}
52 <% metatags_url = h.literal('''<a href="#metatagsShow" onclick="$('#meta-tags-desc').toggle();return false">meta-tags</a>''') %>
52 <% metatags_url = h.literal('''<a href="#metatagsShow" onclick="$('#meta-tags-desc').toggle();return false">meta-tags</a>''') %>
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>
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 <span id="meta-tags-desc" style="display: none">
54 <span id="meta-tags-desc" style="display: none">
55 <%namespace name="dt" file="/data_table/_dt_elements.mako"/>
55 <%namespace name="dt" file="/data_table/_dt_elements.mako"/>
56 ${dt.metatags_help()}
56 ${dt.metatags_help()}
57 </span>
57 </span>
58 </div>
58 </div>
59 </div>
59 </div>
60
60
61 <div class="field">
61 <div class="field">
62 <div class="label">
62 <div class="label">
63 <label for="repo_group">${_('Repository group')}:</label>
63 <label for="repo_group">${_('Repository group')}:</label>
64 </div>
64 </div>
65 <div class="select">
65 <div class="select">
66 ${h.select('repo_group','',c.repo_groups,class_="medium")}
66 ${h.select('repo_group','',c.repo_groups,class_="medium")}
67 % if c.personal_repo_group:
67 % if c.personal_repo_group:
68 <a class="btn" href="#" id="select_my_group" data-personal-group-id="${c.personal_repo_group.group_id}">
68 <a class="btn" href="#" id="select_my_group" data-personal-group-id="${c.personal_repo_group.group_id}">
69 ${_('Select my personal group (%(repo_group_name)s)') % {'repo_group_name': c.personal_repo_group.group_name}}
69 ${_('Select my personal group (%(repo_group_name)s)') % {'repo_group_name': c.personal_repo_group.group_name}}
70 </a>
70 </a>
71 % endif
71 % endif
72 <span class="help-block">${_('Optionally select a group to put this repository into.')}</span>
72 <span class="help-block">${_('Optionally select a group to put this repository into.')}</span>
73 </div>
73 </div>
74 </div>
74 </div>
75
75
76 <div class="field">
76 <div class="field">
77 <div class="label">
77 <div class="label">
78 <label for="landing_rev">${_('Landing commit')}:</label>
78 <label for="landing_rev">${_('Landing commit')}:</label>
79 </div>
79 </div>
80 <div class="select">
80 <div class="select">
81 ${h.select('landing_rev','',c.landing_revs,class_="medium")}
81 ${h.select('landing_rev','',c.landing_revs,class_="medium")}
82 <span class="help-block">${_('Default commit for files page, downloads, whoosh and readme')}</span>
82 <span class="help-block">${_('Default commit for files page, downloads, whoosh and readme')}</span>
83 </div>
83 </div>
84 </div>
84 </div>
85
85
86 <div class="field">
86 <div class="field">
87 <div class="label label-checkbox">
87 <div class="label label-checkbox">
88 <label for="private">${_('Private')}:</label>
88 <label for="private">${_('Private')}:</label>
89 </div>
89 </div>
90 <div class="checkboxes">
90 <div class="checkboxes">
91 ${h.checkbox('private',value="True")}
91 ${h.checkbox('private',value="True")}
92 <span class="help-block">${_('Private repositories are only visible to people explicitly added as collaborators.')}</span>
92 <span class="help-block">${_('Private repositories are only visible to people explicitly added as collaborators.')}</span>
93 </div>
93 </div>
94 </div>
94 </div>
95
95
96 <div class="field">
96 <div class="field">
97 <div class="label label-checkbox">
97 <div class="label label-checkbox">
98 <label for="private">${_('Copy permissions')}:</label>
98 <label for="private">${_('Copy permissions')}:</label>
99 </div>
99 </div>
100 <div class="checkboxes">
100 <div class="checkboxes">
101 ${h.checkbox('copy_permissions',value="True", checked="checked")}
101 ${h.checkbox('copy_permissions',value="True", checked="checked")}
102 <span class="help-block">${_('Copy permissions from forked repository')}</span>
102 <span class="help-block">${_('Copy permissions from forked repository')}</span>
103 </div>
103 </div>
104 </div>
104 </div>
105
105
106 <div class="buttons">
106 <div class="buttons">
107 ${h.submit('',_('Fork this Repository'),class_="btn")}
107 ${h.submit('',_('Fork this Repository'),class_="btn")}
108 </div>
108 </div>
109 </div>
109 </div>
110 </div>
110 </div>
111 ${h.end_form()}
111 ${h.end_form()}
112 </div>
112 </div>
113 <script>
113 <script>
114 $(document).ready(function(){
114 $(document).ready(function(){
115 $("#repo_group").select2({
115 $("#repo_group").select2({
116 'dropdownAutoWidth': true,
116 'dropdownAutoWidth': true,
117 'containerCssClass': "drop-menu",
117 'containerCssClass': "drop-menu",
118 'dropdownCssClass': "drop-menu-dropdown",
118 'dropdownCssClass': "drop-menu-dropdown",
119 'width': "resolve"
119 'width': "resolve"
120 });
120 });
121 $("#landing_rev").select2({
121 $("#landing_rev").select2({
122 'containerCssClass': "drop-menu",
122 'containerCssClass': "drop-menu",
123 'dropdownCssClass': "drop-menu-dropdown",
123 'dropdownCssClass': "drop-menu-dropdown",
124 'minimumResultsForSearch': -1
124 'minimumResultsForSearch': -1
125 });
125 });
126 $('#repo_name').focus();
126 $('#repo_name').focus();
127
127
128 $('#select_my_group').on('click', function(e){
128 $('#select_my_group').on('click', function(e){
129 e.preventDefault();
129 e.preventDefault();
130 $("#repo_group").val($(this).data('personalGroupId')).trigger("change");
130 $("#repo_group").val($(this).data('personalGroupId')).trigger("change");
131 })
131 })
132 })
132 })
133 </script>
133 </script>
134 </%def>
134 </%def>
@@ -1,526 +1,526 b''
1 <%inherit file="/base/base.mako"/>
1 <%inherit file="/base/base.mako"/>
2
2
3 <%def name="title()">
3 <%def name="title()">
4 ${c.repo_name} ${_('New pull request')}
4 ${c.repo_name} ${_('New pull request')}
5 </%def>
5 </%def>
6
6
7 <%def name="breadcrumbs_links()">
7 <%def name="breadcrumbs_links()">
8 ${_('New pull request')}
8 ${_('New pull request')}
9 </%def>
9 </%def>
10
10
11 <%def name="menu_bar_nav()">
11 <%def name="menu_bar_nav()">
12 ${self.menu_items(active='repositories')}
12 ${self.menu_items(active='repositories')}
13 </%def>
13 </%def>
14
14
15 <%def name="menu_bar_subnav()">
15 <%def name="menu_bar_subnav()">
16 ${self.repo_menu(active='showpullrequest')}
16 ${self.repo_menu(active='showpullrequest')}
17 </%def>
17 </%def>
18
18
19 <%def name="main()">
19 <%def name="main()">
20 <div class="box">
20 <div class="box">
21 <div class="title">
21 <div class="title">
22 ${self.repo_page_title(c.rhodecode_db_repo)}
22 ${self.repo_page_title(c.rhodecode_db_repo)}
23 </div>
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 ${self.breadcrumbs()}
27 ${self.breadcrumbs()}
28
28
29 <div class="box pr-summary">
29 <div class="box pr-summary">
30
30
31 <div class="summary-details block-left">
31 <div class="summary-details block-left">
32
32
33
33
34 <div class="pr-details-title">
34 <div class="pr-details-title">
35 ${_('Pull request summary')}
35 ${_('Pull request summary')}
36 </div>
36 </div>
37
37
38 <div class="form" style="padding-top: 10px">
38 <div class="form" style="padding-top: 10px">
39 <!-- fields -->
39 <!-- fields -->
40
40
41 <div class="fields" >
41 <div class="fields" >
42
42
43 <div class="field">
43 <div class="field">
44 <div class="label">
44 <div class="label">
45 <label for="pullrequest_title">${_('Title')}:</label>
45 <label for="pullrequest_title">${_('Title')}:</label>
46 </div>
46 </div>
47 <div class="input">
47 <div class="input">
48 ${h.text('pullrequest_title', c.default_title, class_="medium autogenerated-title")}
48 ${h.text('pullrequest_title', c.default_title, class_="medium autogenerated-title")}
49 </div>
49 </div>
50 </div>
50 </div>
51
51
52 <div class="field">
52 <div class="field">
53 <div class="label label-textarea">
53 <div class="label label-textarea">
54 <label for="pullrequest_desc">${_('Description')}:</label>
54 <label for="pullrequest_desc">${_('Description')}:</label>
55 </div>
55 </div>
56 <div class="textarea text-area editor">
56 <div class="textarea text-area editor">
57 ${h.textarea('pullrequest_desc',size=30, )}
57 ${h.textarea('pullrequest_desc',size=30, )}
58 <span class="help-block">${_('Write a short description on this pull request')}</span>
58 <span class="help-block">${_('Write a short description on this pull request')}</span>
59 </div>
59 </div>
60 </div>
60 </div>
61
61
62 <div class="field">
62 <div class="field">
63 <div class="label label-textarea">
63 <div class="label label-textarea">
64 <label for="pullrequest_desc">${_('Commit flow')}:</label>
64 <label for="pullrequest_desc">${_('Commit flow')}:</label>
65 </div>
65 </div>
66
66
67 ## TODO: johbo: Abusing the "content" class here to get the
67 ## TODO: johbo: Abusing the "content" class here to get the
68 ## desired effect. Should be replaced by a proper solution.
68 ## desired effect. Should be replaced by a proper solution.
69
69
70 ##ORG
70 ##ORG
71 <div class="content">
71 <div class="content">
72 <strong>${_('Source repository')}:</strong>
72 <strong>${_('Source repository')}:</strong>
73 ${c.rhodecode_db_repo.description}
73 ${c.rhodecode_db_repo.description}
74 </div>
74 </div>
75 <div class="content">
75 <div class="content">
76 ${h.hidden('source_repo')}
76 ${h.hidden('source_repo')}
77 ${h.hidden('source_ref')}
77 ${h.hidden('source_ref')}
78 </div>
78 </div>
79
79
80 ##OTHER, most Probably the PARENT OF THIS FORK
80 ##OTHER, most Probably the PARENT OF THIS FORK
81 <div class="content">
81 <div class="content">
82 ## filled with JS
82 ## filled with JS
83 <div id="target_repo_desc"></div>
83 <div id="target_repo_desc"></div>
84 </div>
84 </div>
85
85
86 <div class="content">
86 <div class="content">
87 ${h.hidden('target_repo')}
87 ${h.hidden('target_repo')}
88 ${h.hidden('target_ref')}
88 ${h.hidden('target_ref')}
89 <span id="target_ref_loading" style="display: none">
89 <span id="target_ref_loading" style="display: none">
90 ${_('Loading refs...')}
90 ${_('Loading refs...')}
91 </span>
91 </span>
92 </div>
92 </div>
93 </div>
93 </div>
94
94
95 <div class="field">
95 <div class="field">
96 <div class="label label-textarea">
96 <div class="label label-textarea">
97 <label for="pullrequest_submit"></label>
97 <label for="pullrequest_submit"></label>
98 </div>
98 </div>
99 <div class="input">
99 <div class="input">
100 <div class="pr-submit-button">
100 <div class="pr-submit-button">
101 ${h.submit('save',_('Submit Pull Request'),class_="btn")}
101 ${h.submit('save',_('Submit Pull Request'),class_="btn")}
102 </div>
102 </div>
103 <div id="pr_open_message"></div>
103 <div id="pr_open_message"></div>
104 </div>
104 </div>
105 </div>
105 </div>
106
106
107 <div class="pr-spacing-container"></div>
107 <div class="pr-spacing-container"></div>
108 </div>
108 </div>
109 </div>
109 </div>
110 </div>
110 </div>
111 <div>
111 <div>
112 ## AUTHOR
112 ## AUTHOR
113 <div class="reviewers-title block-right">
113 <div class="reviewers-title block-right">
114 <div class="pr-details-title">
114 <div class="pr-details-title">
115 ${_('Author of this pull request')}
115 ${_('Author of this pull request')}
116 </div>
116 </div>
117 </div>
117 </div>
118 <div class="block-right pr-details-content reviewers">
118 <div class="block-right pr-details-content reviewers">
119 <ul class="group_members">
119 <ul class="group_members">
120 <li>
120 <li>
121 ${self.gravatar_with_user(c.rhodecode_user.email, 16)}
121 ${self.gravatar_with_user(c.rhodecode_user.email, 16)}
122 </li>
122 </li>
123 </ul>
123 </ul>
124 </div>
124 </div>
125
125
126 ## REVIEW RULES
126 ## REVIEW RULES
127 <div id="review_rules" style="display: none" class="reviewers-title block-right">
127 <div id="review_rules" style="display: none" class="reviewers-title block-right">
128 <div class="pr-details-title">
128 <div class="pr-details-title">
129 ${_('Reviewer rules')}
129 ${_('Reviewer rules')}
130 </div>
130 </div>
131 <div class="pr-reviewer-rules">
131 <div class="pr-reviewer-rules">
132 ## review rules will be appended here, by default reviewers logic
132 ## review rules will be appended here, by default reviewers logic
133 </div>
133 </div>
134 </div>
134 </div>
135
135
136 ## REVIEWERS
136 ## REVIEWERS
137 <div class="reviewers-title block-right">
137 <div class="reviewers-title block-right">
138 <div class="pr-details-title">
138 <div class="pr-details-title">
139 ${_('Pull request reviewers')}
139 ${_('Pull request reviewers')}
140 <span class="calculate-reviewers"> - ${_('loading...')}</span>
140 <span class="calculate-reviewers"> - ${_('loading...')}</span>
141 </div>
141 </div>
142 </div>
142 </div>
143 <div id="reviewers" class="block-right pr-details-content reviewers">
143 <div id="reviewers" class="block-right pr-details-content reviewers">
144 ## members goes here, filled via JS based on initial selection !
144 ## members goes here, filled via JS based on initial selection !
145 <input type="hidden" name="__start__" value="review_members:sequence">
145 <input type="hidden" name="__start__" value="review_members:sequence">
146 <ul id="review_members" class="group_members"></ul>
146 <ul id="review_members" class="group_members"></ul>
147 <input type="hidden" name="__end__" value="review_members:sequence">
147 <input type="hidden" name="__end__" value="review_members:sequence">
148 <div id="add_reviewer_input" class='ac'>
148 <div id="add_reviewer_input" class='ac'>
149 <div class="reviewer_ac">
149 <div class="reviewer_ac">
150 ${h.text('user', class_='ac-input', placeholder=_('Add reviewer or reviewer group'))}
150 ${h.text('user', class_='ac-input', placeholder=_('Add reviewer or reviewer group'))}
151 <div id="reviewers_container"></div>
151 <div id="reviewers_container"></div>
152 </div>
152 </div>
153 </div>
153 </div>
154 </div>
154 </div>
155 </div>
155 </div>
156 </div>
156 </div>
157 <div class="box">
157 <div class="box">
158 <div>
158 <div>
159 ## overview pulled by ajax
159 ## overview pulled by ajax
160 <div id="pull_request_overview"></div>
160 <div id="pull_request_overview"></div>
161 </div>
161 </div>
162 </div>
162 </div>
163 ${h.end_form()}
163 ${h.end_form()}
164 </div>
164 </div>
165
165
166 <script type="text/javascript">
166 <script type="text/javascript">
167 $(function(){
167 $(function(){
168 var defaultSourceRepo = '${c.default_repo_data['source_repo_name']}';
168 var defaultSourceRepo = '${c.default_repo_data['source_repo_name']}';
169 var defaultSourceRepoData = ${c.default_repo_data['source_refs_json']|n};
169 var defaultSourceRepoData = ${c.default_repo_data['source_refs_json']|n};
170 var defaultTargetRepo = '${c.default_repo_data['target_repo_name']}';
170 var defaultTargetRepo = '${c.default_repo_data['target_repo_name']}';
171 var defaultTargetRepoData = ${c.default_repo_data['target_refs_json']|n};
171 var defaultTargetRepoData = ${c.default_repo_data['target_refs_json']|n};
172
172
173 var $pullRequestForm = $('#pull_request_form');
173 var $pullRequestForm = $('#pull_request_form');
174 var $sourceRepo = $('#source_repo', $pullRequestForm);
174 var $sourceRepo = $('#source_repo', $pullRequestForm);
175 var $targetRepo = $('#target_repo', $pullRequestForm);
175 var $targetRepo = $('#target_repo', $pullRequestForm);
176 var $sourceRef = $('#source_ref', $pullRequestForm);
176 var $sourceRef = $('#source_ref', $pullRequestForm);
177 var $targetRef = $('#target_ref', $pullRequestForm);
177 var $targetRef = $('#target_ref', $pullRequestForm);
178
178
179 var sourceRepo = function() { return $sourceRepo.eq(0).val() };
179 var sourceRepo = function() { return $sourceRepo.eq(0).val() };
180 var sourceRef = function() { return $sourceRef.eq(0).val().split(':') };
180 var sourceRef = function() { return $sourceRef.eq(0).val().split(':') };
181
181
182 var targetRepo = function() { return $targetRepo.eq(0).val() };
182 var targetRepo = function() { return $targetRepo.eq(0).val() };
183 var targetRef = function() { return $targetRef.eq(0).val().split(':') };
183 var targetRef = function() { return $targetRef.eq(0).val().split(':') };
184
184
185 var calculateContainerWidth = function() {
185 var calculateContainerWidth = function() {
186 var maxWidth = 0;
186 var maxWidth = 0;
187 var repoSelect2Containers = ['#source_repo', '#target_repo'];
187 var repoSelect2Containers = ['#source_repo', '#target_repo'];
188 $.each(repoSelect2Containers, function(idx, value) {
188 $.each(repoSelect2Containers, function(idx, value) {
189 $(value).select2('container').width('auto');
189 $(value).select2('container').width('auto');
190 var curWidth = $(value).select2('container').width();
190 var curWidth = $(value).select2('container').width();
191 if (maxWidth <= curWidth) {
191 if (maxWidth <= curWidth) {
192 maxWidth = curWidth;
192 maxWidth = curWidth;
193 }
193 }
194 $.each(repoSelect2Containers, function(idx, value) {
194 $.each(repoSelect2Containers, function(idx, value) {
195 $(value).select2('container').width(maxWidth + 10);
195 $(value).select2('container').width(maxWidth + 10);
196 });
196 });
197 });
197 });
198 };
198 };
199
199
200 var initRefSelection = function(selectedRef) {
200 var initRefSelection = function(selectedRef) {
201 return function(element, callback) {
201 return function(element, callback) {
202 // translate our select2 id into a text, it's a mapping to show
202 // translate our select2 id into a text, it's a mapping to show
203 // simple label when selecting by internal ID.
203 // simple label when selecting by internal ID.
204 var id, refData;
204 var id, refData;
205 if (selectedRef === undefined) {
205 if (selectedRef === undefined) {
206 id = element.val();
206 id = element.val();
207 refData = element.val().split(':');
207 refData = element.val().split(':');
208 } else {
208 } else {
209 id = selectedRef;
209 id = selectedRef;
210 refData = selectedRef.split(':');
210 refData = selectedRef.split(':');
211 }
211 }
212
212
213 var text = refData[1];
213 var text = refData[1];
214 if (refData[0] === 'rev') {
214 if (refData[0] === 'rev') {
215 text = text.substring(0, 12);
215 text = text.substring(0, 12);
216 }
216 }
217
217
218 var data = {id: id, text: text};
218 var data = {id: id, text: text};
219
219
220 callback(data);
220 callback(data);
221 };
221 };
222 };
222 };
223
223
224 var formatRefSelection = function(item) {
224 var formatRefSelection = function(item) {
225 var prefix = '';
225 var prefix = '';
226 var refData = item.id.split(':');
226 var refData = item.id.split(':');
227 if (refData[0] === 'branch') {
227 if (refData[0] === 'branch') {
228 prefix = '<i class="icon-branch"></i>';
228 prefix = '<i class="icon-branch"></i>';
229 }
229 }
230 else if (refData[0] === 'book') {
230 else if (refData[0] === 'book') {
231 prefix = '<i class="icon-bookmark"></i>';
231 prefix = '<i class="icon-bookmark"></i>';
232 }
232 }
233 else if (refData[0] === 'tag') {
233 else if (refData[0] === 'tag') {
234 prefix = '<i class="icon-tag"></i>';
234 prefix = '<i class="icon-tag"></i>';
235 }
235 }
236
236
237 var originalOption = item.element;
237 var originalOption = item.element;
238 return prefix + item.text;
238 return prefix + item.text;
239 };
239 };
240
240
241 // custom code mirror
241 // custom code mirror
242 var codeMirrorInstance = initPullRequestsCodeMirror('#pullrequest_desc');
242 var codeMirrorInstance = initPullRequestsCodeMirror('#pullrequest_desc');
243
243
244 reviewersController = new ReviewersController();
244 reviewersController = new ReviewersController();
245
245
246 var queryTargetRepo = function(self, query) {
246 var queryTargetRepo = function(self, query) {
247 // cache ALL results if query is empty
247 // cache ALL results if query is empty
248 var cacheKey = query.term || '__';
248 var cacheKey = query.term || '__';
249 var cachedData = self.cachedDataSource[cacheKey];
249 var cachedData = self.cachedDataSource[cacheKey];
250
250
251 if (cachedData) {
251 if (cachedData) {
252 query.callback({results: cachedData.results});
252 query.callback({results: cachedData.results});
253 } else {
253 } else {
254 $.ajax({
254 $.ajax({
255 url: pyroutes.url('pullrequest_repo_destinations', {'repo_name': templateContext.repo_name}),
255 url: pyroutes.url('pullrequest_repo_destinations', {'repo_name': templateContext.repo_name}),
256 data: {query: query.term},
256 data: {query: query.term},
257 dataType: 'json',
257 dataType: 'json',
258 type: 'GET',
258 type: 'GET',
259 success: function(data) {
259 success: function(data) {
260 self.cachedDataSource[cacheKey] = data;
260 self.cachedDataSource[cacheKey] = data;
261 query.callback({results: data.results});
261 query.callback({results: data.results});
262 },
262 },
263 error: function(data, textStatus, errorThrown) {
263 error: function(data, textStatus, errorThrown) {
264 alert(
264 alert(
265 "Error while fetching entries.\nError code {0} ({1}).".format(data.status, data.statusText));
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 var queryTargetRefs = function(initialData, query) {
271 var queryTargetRefs = function(initialData, query) {
272 var data = {results: []};
272 var data = {results: []};
273 // filter initialData
273 // filter initialData
274 $.each(initialData, function() {
274 $.each(initialData, function() {
275 var section = this.text;
275 var section = this.text;
276 var children = [];
276 var children = [];
277 $.each(this.children, function() {
277 $.each(this.children, function() {
278 if (query.term.length === 0 ||
278 if (query.term.length === 0 ||
279 this.text.toUpperCase().indexOf(query.term.toUpperCase()) >= 0 ) {
279 this.text.toUpperCase().indexOf(query.term.toUpperCase()) >= 0 ) {
280 children.push({'id': this.id, 'text': this.text})
280 children.push({'id': this.id, 'text': this.text})
281 }
281 }
282 });
282 });
283 data.results.push({'text': section, 'children': children})
283 data.results.push({'text': section, 'children': children})
284 });
284 });
285 query.callback({results: data.results});
285 query.callback({results: data.results});
286 };
286 };
287
287
288 var loadRepoRefDiffPreview = function() {
288 var loadRepoRefDiffPreview = function() {
289
289
290 var url_data = {
290 var url_data = {
291 'repo_name': targetRepo(),
291 'repo_name': targetRepo(),
292 'target_repo': sourceRepo(),
292 'target_repo': sourceRepo(),
293 'source_ref': targetRef()[2],
293 'source_ref': targetRef()[2],
294 'source_ref_type': 'rev',
294 'source_ref_type': 'rev',
295 'target_ref': sourceRef()[2],
295 'target_ref': sourceRef()[2],
296 'target_ref_type': 'rev',
296 'target_ref_type': 'rev',
297 'merge': true,
297 'merge': true,
298 '_': Date.now() // bypass browser caching
298 '_': Date.now() // bypass browser caching
299 }; // gather the source/target ref and repo here
299 }; // gather the source/target ref and repo here
300
300
301 if (sourceRef().length !== 3 || targetRef().length !== 3) {
301 if (sourceRef().length !== 3 || targetRef().length !== 3) {
302 prButtonLock(true, "${_('Please select source and target')}");
302 prButtonLock(true, "${_('Please select source and target')}");
303 return;
303 return;
304 }
304 }
305 var url = pyroutes.url('repo_compare', url_data);
305 var url = pyroutes.url('repo_compare', url_data);
306
306
307 // lock PR button, so we cannot send PR before it's calculated
307 // lock PR button, so we cannot send PR before it's calculated
308 prButtonLock(true, "${_('Loading compare ...')}", 'compare');
308 prButtonLock(true, "${_('Loading compare ...')}", 'compare');
309
309
310 if (loadRepoRefDiffPreview._currentRequest) {
310 if (loadRepoRefDiffPreview._currentRequest) {
311 loadRepoRefDiffPreview._currentRequest.abort();
311 loadRepoRefDiffPreview._currentRequest.abort();
312 }
312 }
313
313
314 loadRepoRefDiffPreview._currentRequest = $.get(url)
314 loadRepoRefDiffPreview._currentRequest = $.get(url)
315 .error(function(data, textStatus, errorThrown) {
315 .error(function(data, textStatus, errorThrown) {
316 alert(
316 alert(
317 "Error while processing request.\nError code {0} ({1}).".format(
317 "Error while processing request.\nError code {0} ({1}).".format(
318 data.status, data.statusText));
318 data.status, data.statusText));
319 })
319 })
320 .done(function(data) {
320 .done(function(data) {
321 loadRepoRefDiffPreview._currentRequest = null;
321 loadRepoRefDiffPreview._currentRequest = null;
322 $('#pull_request_overview').html(data);
322 $('#pull_request_overview').html(data);
323
323
324 var commitElements = $(data).find('tr[commit_id]');
324 var commitElements = $(data).find('tr[commit_id]');
325
325
326 var prTitleAndDesc = getTitleAndDescription(
326 var prTitleAndDesc = getTitleAndDescription(
327 sourceRef()[1], commitElements, 5);
327 sourceRef()[1], commitElements, 5);
328
328
329 var title = prTitleAndDesc[0];
329 var title = prTitleAndDesc[0];
330 var proposedDescription = prTitleAndDesc[1];
330 var proposedDescription = prTitleAndDesc[1];
331
331
332 var useGeneratedTitle = (
332 var useGeneratedTitle = (
333 $('#pullrequest_title').hasClass('autogenerated-title') ||
333 $('#pullrequest_title').hasClass('autogenerated-title') ||
334 $('#pullrequest_title').val() === "");
334 $('#pullrequest_title').val() === "");
335
335
336 if (title && useGeneratedTitle) {
336 if (title && useGeneratedTitle) {
337 // use generated title if we haven't specified our own
337 // use generated title if we haven't specified our own
338 $('#pullrequest_title').val(title);
338 $('#pullrequest_title').val(title);
339 $('#pullrequest_title').addClass('autogenerated-title');
339 $('#pullrequest_title').addClass('autogenerated-title');
340
340
341 }
341 }
342
342
343 var useGeneratedDescription = (
343 var useGeneratedDescription = (
344 !codeMirrorInstance._userDefinedDesc ||
344 !codeMirrorInstance._userDefinedDesc ||
345 codeMirrorInstance.getValue() === "");
345 codeMirrorInstance.getValue() === "");
346
346
347 if (proposedDescription && useGeneratedDescription) {
347 if (proposedDescription && useGeneratedDescription) {
348 // set proposed content, if we haven't defined our own,
348 // set proposed content, if we haven't defined our own,
349 // or we don't have description written
349 // or we don't have description written
350 codeMirrorInstance._userDefinedDesc = false; // reset state
350 codeMirrorInstance._userDefinedDesc = false; // reset state
351 codeMirrorInstance.setValue(proposedDescription);
351 codeMirrorInstance.setValue(proposedDescription);
352 }
352 }
353
353
354 var msg = '';
354 var msg = '';
355 if (commitElements.length === 1) {
355 if (commitElements.length === 1) {
356 msg = "${_ungettext('This pull request will consist of __COMMITS__ commit.', 'This pull request will consist of __COMMITS__ commits.', 1)}";
356 msg = "${_ungettext('This pull request will consist of __COMMITS__ commit.', 'This pull request will consist of __COMMITS__ commits.', 1)}";
357 } else {
357 } else {
358 msg = "${_ungettext('This pull request will consist of __COMMITS__ commit.', 'This pull request will consist of __COMMITS__ commits.', 2)}";
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 msg += ' <a id="pull_request_overview_url" href="{0}" target="_blank">${_('Show detailed compare.')}</a>'.format(url);
361 msg += ' <a id="pull_request_overview_url" href="{0}" target="_blank">${_('Show detailed compare.')}</a>'.format(url);
362
362
363 if (commitElements.length) {
363 if (commitElements.length) {
364 var commitsLink = '<a href="#pull_request_overview"><strong>{0}</strong></a>'.format(commitElements.length);
364 var commitsLink = '<a href="#pull_request_overview"><strong>{0}</strong></a>'.format(commitElements.length);
365 prButtonLock(false, msg.replace('__COMMITS__', commitsLink), 'compare');
365 prButtonLock(false, msg.replace('__COMMITS__', commitsLink), 'compare');
366 }
366 }
367 else {
367 else {
368 prButtonLock(true, "${_('There are no commits to merge.')}", 'compare');
368 prButtonLock(true, "${_('There are no commits to merge.')}", 'compare');
369 }
369 }
370
370
371
371
372 });
372 });
373 };
373 };
374
374
375 var Select2Box = function(element, overrides) {
375 var Select2Box = function(element, overrides) {
376 var globalDefaults = {
376 var globalDefaults = {
377 dropdownAutoWidth: true,
377 dropdownAutoWidth: true,
378 containerCssClass: "drop-menu",
378 containerCssClass: "drop-menu",
379 dropdownCssClass: "drop-menu-dropdown"
379 dropdownCssClass: "drop-menu-dropdown"
380 };
380 };
381
381
382 var initSelect2 = function(defaultOptions) {
382 var initSelect2 = function(defaultOptions) {
383 var options = jQuery.extend(globalDefaults, defaultOptions, overrides);
383 var options = jQuery.extend(globalDefaults, defaultOptions, overrides);
384 element.select2(options);
384 element.select2(options);
385 };
385 };
386
386
387 return {
387 return {
388 initRef: function() {
388 initRef: function() {
389 var defaultOptions = {
389 var defaultOptions = {
390 minimumResultsForSearch: 5,
390 minimumResultsForSearch: 5,
391 formatSelection: formatRefSelection
391 formatSelection: formatRefSelection
392 };
392 };
393
393
394 initSelect2(defaultOptions);
394 initSelect2(defaultOptions);
395 },
395 },
396
396
397 initRepo: function(defaultValue, readOnly) {
397 initRepo: function(defaultValue, readOnly) {
398 var defaultOptions = {
398 var defaultOptions = {
399 initSelection : function (element, callback) {
399 initSelection : function (element, callback) {
400 var data = {id: defaultValue, text: defaultValue};
400 var data = {id: defaultValue, text: defaultValue};
401 callback(data);
401 callback(data);
402 }
402 }
403 };
403 };
404
404
405 initSelect2(defaultOptions);
405 initSelect2(defaultOptions);
406
406
407 element.select2('val', defaultSourceRepo);
407 element.select2('val', defaultSourceRepo);
408 if (readOnly === true) {
408 if (readOnly === true) {
409 element.select2('readonly', true);
409 element.select2('readonly', true);
410 }
410 }
411 }
411 }
412 };
412 };
413 };
413 };
414
414
415 var initTargetRefs = function(refsData, selectedRef){
415 var initTargetRefs = function(refsData, selectedRef){
416 Select2Box($targetRef, {
416 Select2Box($targetRef, {
417 query: function(query) {
417 query: function(query) {
418 queryTargetRefs(refsData, query);
418 queryTargetRefs(refsData, query);
419 },
419 },
420 initSelection : initRefSelection(selectedRef)
420 initSelection : initRefSelection(selectedRef)
421 }).initRef();
421 }).initRef();
422
422
423 if (!(selectedRef === undefined)) {
423 if (!(selectedRef === undefined)) {
424 $targetRef.select2('val', selectedRef);
424 $targetRef.select2('val', selectedRef);
425 }
425 }
426 };
426 };
427
427
428 var targetRepoChanged = function(repoData) {
428 var targetRepoChanged = function(repoData) {
429 // generate new DESC of target repo displayed next to select
429 // generate new DESC of target repo displayed next to select
430 $('#target_repo_desc').html(
430 $('#target_repo_desc').html(
431 "<strong>${_('Target repository')}</strong>: {0}".format(repoData['description'])
431 "<strong>${_('Target repository')}</strong>: {0}".format(repoData['description'])
432 );
432 );
433
433
434 // generate dynamic select2 for refs.
434 // generate dynamic select2 for refs.
435 initTargetRefs(repoData['refs']['select2_refs'],
435 initTargetRefs(repoData['refs']['select2_refs'],
436 repoData['refs']['selected_ref']);
436 repoData['refs']['selected_ref']);
437
437
438 };
438 };
439
439
440 var sourceRefSelect2 = Select2Box($sourceRef, {
440 var sourceRefSelect2 = Select2Box($sourceRef, {
441 placeholder: "${_('Select commit reference')}",
441 placeholder: "${_('Select commit reference')}",
442 query: function(query) {
442 query: function(query) {
443 var initialData = defaultSourceRepoData['refs']['select2_refs'];
443 var initialData = defaultSourceRepoData['refs']['select2_refs'];
444 queryTargetRefs(initialData, query)
444 queryTargetRefs(initialData, query)
445 },
445 },
446 initSelection: initRefSelection()
446 initSelection: initRefSelection()
447 }
447 }
448 );
448 );
449
449
450 var sourceRepoSelect2 = Select2Box($sourceRepo, {
450 var sourceRepoSelect2 = Select2Box($sourceRepo, {
451 query: function(query) {}
451 query: function(query) {}
452 });
452 });
453
453
454 var targetRepoSelect2 = Select2Box($targetRepo, {
454 var targetRepoSelect2 = Select2Box($targetRepo, {
455 cachedDataSource: {},
455 cachedDataSource: {},
456 query: $.debounce(250, function(query) {
456 query: $.debounce(250, function(query) {
457 queryTargetRepo(this, query);
457 queryTargetRepo(this, query);
458 }),
458 }),
459 formatResult: formatResult
459 formatResult: formatResult
460 });
460 });
461
461
462 sourceRefSelect2.initRef();
462 sourceRefSelect2.initRef();
463
463
464 sourceRepoSelect2.initRepo(defaultSourceRepo, true);
464 sourceRepoSelect2.initRepo(defaultSourceRepo, true);
465
465
466 targetRepoSelect2.initRepo(defaultTargetRepo, false);
466 targetRepoSelect2.initRepo(defaultTargetRepo, false);
467
467
468 $sourceRef.on('change', function(e){
468 $sourceRef.on('change', function(e){
469 loadRepoRefDiffPreview();
469 loadRepoRefDiffPreview();
470 reviewersController.loadDefaultReviewers(
470 reviewersController.loadDefaultReviewers(
471 sourceRepo(), sourceRef(), targetRepo(), targetRef());
471 sourceRepo(), sourceRef(), targetRepo(), targetRef());
472 });
472 });
473
473
474 $targetRef.on('change', function(e){
474 $targetRef.on('change', function(e){
475 loadRepoRefDiffPreview();
475 loadRepoRefDiffPreview();
476 reviewersController.loadDefaultReviewers(
476 reviewersController.loadDefaultReviewers(
477 sourceRepo(), sourceRef(), targetRepo(), targetRef());
477 sourceRepo(), sourceRef(), targetRepo(), targetRef());
478 });
478 });
479
479
480 $targetRepo.on('change', function(e){
480 $targetRepo.on('change', function(e){
481 var repoName = $(this).val();
481 var repoName = $(this).val();
482 calculateContainerWidth();
482 calculateContainerWidth();
483 $targetRef.select2('destroy');
483 $targetRef.select2('destroy');
484 $('#target_ref_loading').show();
484 $('#target_ref_loading').show();
485
485
486 $.ajax({
486 $.ajax({
487 url: pyroutes.url('pullrequest_repo_refs',
487 url: pyroutes.url('pullrequest_repo_refs',
488 {'repo_name': templateContext.repo_name, 'target_repo_name':repoName}),
488 {'repo_name': templateContext.repo_name, 'target_repo_name':repoName}),
489 data: {},
489 data: {},
490 dataType: 'json',
490 dataType: 'json',
491 type: 'GET',
491 type: 'GET',
492 success: function(data) {
492 success: function(data) {
493 $('#target_ref_loading').hide();
493 $('#target_ref_loading').hide();
494 targetRepoChanged(data);
494 targetRepoChanged(data);
495 loadRepoRefDiffPreview();
495 loadRepoRefDiffPreview();
496 },
496 },
497 error: function(data, textStatus, errorThrown) {
497 error: function(data, textStatus, errorThrown) {
498 alert("Error while fetching entries.\nError code {0} ({1}).".format(data.status, data.statusText));
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 prButtonLock(true, "${_('Please select source and target')}", 'all');
504 prButtonLock(true, "${_('Please select source and target')}", 'all');
505
505
506 // auto-load on init, the target refs select2
506 // auto-load on init, the target refs select2
507 calculateContainerWidth();
507 calculateContainerWidth();
508 targetRepoChanged(defaultTargetRepoData);
508 targetRepoChanged(defaultTargetRepoData);
509
509
510 $('#pullrequest_title').on('keyup', function(e){
510 $('#pullrequest_title').on('keyup', function(e){
511 $(this).removeClass('autogenerated-title');
511 $(this).removeClass('autogenerated-title');
512 });
512 });
513
513
514 % if c.default_source_ref:
514 % if c.default_source_ref:
515 // in case we have a pre-selected value, use it now
515 // in case we have a pre-selected value, use it now
516 $sourceRef.select2('val', '${c.default_source_ref}');
516 $sourceRef.select2('val', '${c.default_source_ref}');
517 loadRepoRefDiffPreview();
517 loadRepoRefDiffPreview();
518 reviewersController.loadDefaultReviewers(
518 reviewersController.loadDefaultReviewers(
519 sourceRepo(), sourceRef(), targetRepo(), targetRef());
519 sourceRepo(), sourceRef(), targetRepo(), targetRef());
520 % endif
520 % endif
521
521
522 ReviewerAutoComplete('#user');
522 ReviewerAutoComplete('#user');
523 });
523 });
524 </script>
524 </script>
525
525
526 </%def>
526 </%def>
@@ -1,78 +1,78 b''
1
1
2 <div class="pull-request-wrap">
2 <div class="pull-request-wrap">
3
3
4 % if c.pr_merge_possible:
4 % if c.pr_merge_possible:
5 <h2 class="merge-status">
5 <h2 class="merge-status">
6 <span class="merge-icon success"><i class="icon-ok"></i></span>
6 <span class="merge-icon success"><i class="icon-ok"></i></span>
7 ${_('This pull request can be merged automatically.')}
7 ${_('This pull request can be merged automatically.')}
8 </h2>
8 </h2>
9 % else:
9 % else:
10 <h2 class="merge-status">
10 <h2 class="merge-status">
11 <span class="merge-icon warning"><i class="icon-false"></i></span>
11 <span class="merge-icon warning"><i class="icon-false"></i></span>
12 ${_('Merge is not currently possible because of below failed checks.')}
12 ${_('Merge is not currently possible because of below failed checks.')}
13 </h2>
13 </h2>
14 % endif
14 % endif
15
15
16 % if c.pr_merge_errors.items():
16 % if c.pr_merge_errors.items():
17 <ul>
17 <ul>
18 % for pr_check_key, pr_check_details in c.pr_merge_errors.items():
18 % for pr_check_key, pr_check_details in c.pr_merge_errors.items():
19 <% pr_check_type = pr_check_details['error_type'] %>
19 <% pr_check_type = pr_check_details['error_type'] %>
20 <li>
20 <li>
21 <span class="merge-message ${pr_check_type}" data-role="merge-message">
21 <span class="merge-message ${pr_check_type}" data-role="merge-message">
22 - ${pr_check_details['message']}
22 - ${pr_check_details['message']}
23 % if pr_check_key == 'todo':
23 % if pr_check_key == 'todo':
24 % for co in pr_check_details['details']:
24 % for co in pr_check_details['details']:
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 ','}
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 % endfor
26 % endfor
27 % endif
27 % endif
28 </span>
28 </span>
29 </li>
29 </li>
30 % endfor
30 % endfor
31 </ul>
31 </ul>
32 % endif
32 % endif
33
33
34 <div class="pull-request-merge-actions">
34 <div class="pull-request-merge-actions">
35 % if c.allowed_to_merge:
35 % if c.allowed_to_merge:
36 ## Merge info, show only if all errors are taken care of
36 ## Merge info, show only if all errors are taken care of
37 % if not c.pr_merge_errors and c.pr_merge_info:
37 % if not c.pr_merge_errors and c.pr_merge_info:
38 <div class="pull-request-merge-info">
38 <div class="pull-request-merge-info">
39 <ul>
39 <ul>
40 % for pr_merge_key, pr_merge_details in c.pr_merge_info.items():
40 % for pr_merge_key, pr_merge_details in c.pr_merge_info.items():
41 <li>
41 <li>
42 - ${pr_merge_details['message']}
42 - ${pr_merge_details['message']}
43 </li>
43 </li>
44 % endfor
44 % endfor
45 </ul>
45 </ul>
46 </div>
46 </div>
47 % endif
47 % endif
48
48
49 <div>
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 <% merge_disabled = ' disabled' if c.pr_merge_possible is False else '' %>
51 <% merge_disabled = ' disabled' if c.pr_merge_possible is False else '' %>
52 <a class="btn" href="#" onclick="refreshMergeChecks(); return false;">${_('refresh checks')}</a>
52 <a class="btn" href="#" onclick="refreshMergeChecks(); return false;">${_('refresh checks')}</a>
53 <input type="submit" id="merge_pull_request" value="${_('Merge Pull Request')}" class="btn${merge_disabled}"${merge_disabled}>
53 <input type="submit" id="merge_pull_request" value="${_('Merge Pull Request')}" class="btn${merge_disabled}"${merge_disabled}>
54 ${h.end_form()}
54 ${h.end_form()}
55 </div>
55 </div>
56 % elif c.rhodecode_user.username != h.DEFAULT_USER:
56 % elif c.rhodecode_user.username != h.DEFAULT_USER:
57 <a class="btn" href="#" onclick="refreshMergeChecks(); return false;">${_('refresh checks')}</a>
57 <a class="btn" href="#" onclick="refreshMergeChecks(); return false;">${_('refresh checks')}</a>
58 <input type="submit" value="${_('Merge Pull Request')}" class="btn disabled" disabled="disabled" title="${_('You are not allowed to merge this pull request.')}">
58 <input type="submit" value="${_('Merge Pull Request')}" class="btn disabled" disabled="disabled" title="${_('You are not allowed to merge this pull request.')}">
59 % else:
59 % else:
60 <input type="submit" value="${_('Login to Merge this Pull Request')}" class="btn disabled" disabled="disabled">
60 <input type="submit" value="${_('Login to Merge this Pull Request')}" class="btn disabled" disabled="disabled">
61 % endif
61 % endif
62 </div>
62 </div>
63
63
64 % if c.allowed_to_close:
64 % if c.allowed_to_close:
65 ## close PR action, injected later next to COMMENT button
65 ## close PR action, injected later next to COMMENT button
66 <div id="close-pull-request-action" style="display: none">
66 <div id="close-pull-request-action" style="display: none">
67 % if c.pull_request_review_status == c.REVIEW_STATUS_APPROVED:
67 % if c.pull_request_review_status == c.REVIEW_STATUS_APPROVED:
68 <a class="btn btn-approved-status" href="#close-as-approved" onclick="closePullRequest('${c.REVIEW_STATUS_APPROVED}'); return false;">
68 <a class="btn btn-approved-status" href="#close-as-approved" onclick="closePullRequest('${c.REVIEW_STATUS_APPROVED}'); return false;">
69 ${_('Close with status {}').format(h.commit_status_lbl(c.REVIEW_STATUS_APPROVED))}
69 ${_('Close with status {}').format(h.commit_status_lbl(c.REVIEW_STATUS_APPROVED))}
70 </a>
70 </a>
71 % else:
71 % else:
72 <a class="btn btn-rejected-status" href="#close-as-rejected" onclick="closePullRequest('${c.REVIEW_STATUS_REJECTED}'); return false;">
72 <a class="btn btn-rejected-status" href="#close-as-rejected" onclick="closePullRequest('${c.REVIEW_STATUS_REJECTED}'); return false;">
73 ${_('Close with status {}').format(h.commit_status_lbl(c.REVIEW_STATUS_REJECTED))}
73 ${_('Close with status {}').format(h.commit_status_lbl(c.REVIEW_STATUS_REJECTED))}
74 </a>
74 </a>
75 % endif
75 % endif
76 </div>
76 </div>
77 % endif
77 % endif
78 </div>
78 </div>
@@ -1,866 +1,866 b''
1 <%inherit file="/base/base.mako"/>
1 <%inherit file="/base/base.mako"/>
2 <%namespace name="base" file="/base/base.mako"/>
2 <%namespace name="base" file="/base/base.mako"/>
3
3
4 <%def name="title()">
4 <%def name="title()">
5 ${_('%s Pull Request #%s') % (c.repo_name, c.pull_request.pull_request_id)}
5 ${_('%s Pull Request #%s') % (c.repo_name, c.pull_request.pull_request_id)}
6 %if c.rhodecode_name:
6 %if c.rhodecode_name:
7 &middot; ${h.branding(c.rhodecode_name)}
7 &middot; ${h.branding(c.rhodecode_name)}
8 %endif
8 %endif
9 </%def>
9 </%def>
10
10
11 <%def name="breadcrumbs_links()">
11 <%def name="breadcrumbs_links()">
12 <span id="pr-title">
12 <span id="pr-title">
13 ${c.pull_request.title}
13 ${c.pull_request.title}
14 %if c.pull_request.is_closed():
14 %if c.pull_request.is_closed():
15 (${_('Closed')})
15 (${_('Closed')})
16 %endif
16 %endif
17 </span>
17 </span>
18 <div id="pr-title-edit" class="input" style="display: none;">
18 <div id="pr-title-edit" class="input" style="display: none;">
19 ${h.text('pullrequest_title', id_="pr-title-input", class_="large", value=c.pull_request.title)}
19 ${h.text('pullrequest_title', id_="pr-title-input", class_="large", value=c.pull_request.title)}
20 </div>
20 </div>
21 </%def>
21 </%def>
22
22
23 <%def name="menu_bar_nav()">
23 <%def name="menu_bar_nav()">
24 ${self.menu_items(active='repositories')}
24 ${self.menu_items(active='repositories')}
25 </%def>
25 </%def>
26
26
27 <%def name="menu_bar_subnav()">
27 <%def name="menu_bar_subnav()">
28 ${self.repo_menu(active='showpullrequest')}
28 ${self.repo_menu(active='showpullrequest')}
29 </%def>
29 </%def>
30
30
31 <%def name="main()">
31 <%def name="main()">
32
32
33 <script type="text/javascript">
33 <script type="text/javascript">
34 // TODO: marcink switch this to pyroutes
34 // TODO: marcink switch this to pyroutes
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__')}";
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 templateContext.pull_request_data.pull_request_id = ${c.pull_request.pull_request_id};
36 templateContext.pull_request_data.pull_request_id = ${c.pull_request.pull_request_id};
37 </script>
37 </script>
38 <div class="box">
38 <div class="box">
39
39
40 <div class="title">
40 <div class="title">
41 ${self.repo_page_title(c.rhodecode_db_repo)}
41 ${self.repo_page_title(c.rhodecode_db_repo)}
42 </div>
42 </div>
43
43
44 ${self.breadcrumbs()}
44 ${self.breadcrumbs()}
45
45
46 <div class="box pr-summary">
46 <div class="box pr-summary">
47
47
48 <div class="summary-details block-left">
48 <div class="summary-details block-left">
49 <% summary = lambda n:{False:'summary-short'}.get(n) %>
49 <% summary = lambda n:{False:'summary-short'}.get(n) %>
50 <div class="pr-details-title">
50 <div class="pr-details-title">
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)}
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 %if c.allowed_to_update:
52 %if c.allowed_to_update:
53 <div id="delete_pullrequest" class="pull-right action_button ${'' if c.allowed_to_delete else 'disabled' }" style="clear:inherit;padding: 0">
53 <div id="delete_pullrequest" class="pull-right action_button ${'' if c.allowed_to_delete else 'disabled' }" style="clear:inherit;padding: 0">
54 % if c.allowed_to_delete:
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 ${h.submit('remove_%s' % c.pull_request.pull_request_id, _('Delete'),
56 ${h.submit('remove_%s' % c.pull_request.pull_request_id, _('Delete'),
57 class_="btn btn-link btn-danger no-margin",onclick="return confirm('"+_('Confirm to delete this pull request')+"');")}
57 class_="btn btn-link btn-danger no-margin",onclick="return confirm('"+_('Confirm to delete this pull request')+"');")}
58 ${h.end_form()}
58 ${h.end_form()}
59 % else:
59 % else:
60 ${_('Delete')}
60 ${_('Delete')}
61 % endif
61 % endif
62 </div>
62 </div>
63 <div id="open_edit_pullrequest" class="pull-right action_button">${_('Edit')}</div>
63 <div id="open_edit_pullrequest" class="pull-right action_button">${_('Edit')}</div>
64 <div id="close_edit_pullrequest" class="pull-right action_button" style="display: none;padding: 0">${_('Cancel')}</div>
64 <div id="close_edit_pullrequest" class="pull-right action_button" style="display: none;padding: 0">${_('Cancel')}</div>
65 %endif
65 %endif
66 </div>
66 </div>
67
67
68 <div id="summary" class="fields pr-details-content">
68 <div id="summary" class="fields pr-details-content">
69 <div class="field">
69 <div class="field">
70 <div class="label-summary">
70 <div class="label-summary">
71 <label>${_('Source')}:</label>
71 <label>${_('Source')}:</label>
72 </div>
72 </div>
73 <div class="input">
73 <div class="input">
74 <div class="pr-origininfo">
74 <div class="pr-origininfo">
75 ## branch link is only valid if it is a branch
75 ## branch link is only valid if it is a branch
76 <span class="tag">
76 <span class="tag">
77 %if c.pull_request.source_ref_parts.type == 'branch':
77 %if c.pull_request.source_ref_parts.type == 'branch':
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>
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 %else:
79 %else:
80 ${c.pull_request.source_ref_parts.type}: ${c.pull_request.source_ref_parts.name}
80 ${c.pull_request.source_ref_parts.type}: ${c.pull_request.source_ref_parts.name}
81 %endif
81 %endif
82 </span>
82 </span>
83 <span class="clone-url">
83 <span class="clone-url">
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>
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 </span>
85 </span>
86 <br/>
86 <br/>
87 % if c.ancestor_commit:
87 % if c.ancestor_commit:
88 ${_('Common ancestor')}:
88 ${_('Common ancestor')}:
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>
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 % endif
90 % endif
91 </div>
91 </div>
92 %if h.is_hg(c.pull_request.source_repo):
92 %if h.is_hg(c.pull_request.source_repo):
93 <% clone_url = 'hg pull -r {} {}'.format(h.short_id(c.source_ref), c.pull_request.source_repo.clone_url()) %>
93 <% clone_url = 'hg pull -r {} {}'.format(h.short_id(c.source_ref), c.pull_request.source_repo.clone_url()) %>
94 %elif h.is_git(c.pull_request.source_repo):
94 %elif h.is_git(c.pull_request.source_repo):
95 <% clone_url = 'git pull {} {}'.format(c.pull_request.source_repo.clone_url(), c.pull_request.source_ref_parts.name) %>
95 <% clone_url = 'git pull {} {}'.format(c.pull_request.source_repo.clone_url(), c.pull_request.source_ref_parts.name) %>
96 %endif
96 %endif
97
97
98 <div class="">
98 <div class="">
99 <input type="text" class="input-monospace pr-pullinfo" value="${clone_url}" readonly="readonly">
99 <input type="text" class="input-monospace pr-pullinfo" value="${clone_url}" readonly="readonly">
100 <i class="tooltip icon-clipboard clipboard-action pull-right pr-pullinfo-copy" data-clipboard-text="${clone_url}" title="${_('Copy the pull url')}"></i>
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 </div>
101 </div>
102
102
103 </div>
103 </div>
104 </div>
104 </div>
105 <div class="field">
105 <div class="field">
106 <div class="label-summary">
106 <div class="label-summary">
107 <label>${_('Target')}:</label>
107 <label>${_('Target')}:</label>
108 </div>
108 </div>
109 <div class="input">
109 <div class="input">
110 <div class="pr-targetinfo">
110 <div class="pr-targetinfo">
111 ## branch link is only valid if it is a branch
111 ## branch link is only valid if it is a branch
112 <span class="tag">
112 <span class="tag">
113 %if c.pull_request.target_ref_parts.type == 'branch':
113 %if c.pull_request.target_ref_parts.type == 'branch':
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>
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 %else:
115 %else:
116 ${c.pull_request.target_ref_parts.type}: ${c.pull_request.target_ref_parts.name}
116 ${c.pull_request.target_ref_parts.type}: ${c.pull_request.target_ref_parts.name}
117 %endif
117 %endif
118 </span>
118 </span>
119 <span class="clone-url">
119 <span class="clone-url">
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>
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 </span>
121 </span>
122 </div>
122 </div>
123 </div>
123 </div>
124 </div>
124 </div>
125
125
126 ## Link to the shadow repository.
126 ## Link to the shadow repository.
127 <div class="field">
127 <div class="field">
128 <div class="label-summary">
128 <div class="label-summary">
129 <label>${_('Merge')}:</label>
129 <label>${_('Merge')}:</label>
130 </div>
130 </div>
131 <div class="input">
131 <div class="input">
132 % if not c.pull_request.is_closed() and c.pull_request.shadow_merge_ref:
132 % if not c.pull_request.is_closed() and c.pull_request.shadow_merge_ref:
133 %if h.is_hg(c.pull_request.target_repo):
133 %if h.is_hg(c.pull_request.target_repo):
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) %>
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 %elif h.is_git(c.pull_request.target_repo):
135 %elif h.is_git(c.pull_request.target_repo):
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) %>
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 %endif
137 %endif
138 <div class="">
138 <div class="">
139 <input type="text" class="input-monospace pr-mergeinfo" value="${clone_url}" readonly="readonly">
139 <input type="text" class="input-monospace pr-mergeinfo" value="${clone_url}" readonly="readonly">
140 <i class="tooltip icon-clipboard clipboard-action pull-right pr-mergeinfo-copy" data-clipboard-text="${clone_url}" title="${_('Copy the clone url')}"></i>
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 </div>
141 </div>
142 % else:
142 % else:
143 <div class="">
143 <div class="">
144 ${_('Shadow repository data not available')}.
144 ${_('Shadow repository data not available')}.
145 </div>
145 </div>
146 % endif
146 % endif
147 </div>
147 </div>
148 </div>
148 </div>
149
149
150 <div class="field">
150 <div class="field">
151 <div class="label-summary">
151 <div class="label-summary">
152 <label>${_('Review')}:</label>
152 <label>${_('Review')}:</label>
153 </div>
153 </div>
154 <div class="input">
154 <div class="input">
155 %if c.pull_request_review_status:
155 %if c.pull_request_review_status:
156 <div class="${'flag_status %s' % c.pull_request_review_status} tooltip pull-left"></div>
156 <div class="${'flag_status %s' % c.pull_request_review_status} tooltip pull-left"></div>
157 <span class="changeset-status-lbl tooltip">
157 <span class="changeset-status-lbl tooltip">
158 %if c.pull_request.is_closed():
158 %if c.pull_request.is_closed():
159 ${_('Closed')},
159 ${_('Closed')},
160 %endif
160 %endif
161 ${h.commit_status_lbl(c.pull_request_review_status)}
161 ${h.commit_status_lbl(c.pull_request_review_status)}
162 </span>
162 </span>
163 - ${_ungettext('calculated based on %s reviewer vote', 'calculated based on %s reviewers votes', len(c.pull_request_reviewers)) % len(c.pull_request_reviewers)}
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 %endif
164 %endif
165 </div>
165 </div>
166 </div>
166 </div>
167 <div class="field">
167 <div class="field">
168 <div class="pr-description-label label-summary">
168 <div class="pr-description-label label-summary">
169 <label>${_('Description')}:</label>
169 <label>${_('Description')}:</label>
170 </div>
170 </div>
171 <div id="pr-desc" class="input">
171 <div id="pr-desc" class="input">
172 <div class="pr-description">${h.urlify_commit_message(c.pull_request.description, c.repo_name)}</div>
172 <div class="pr-description">${h.urlify_commit_message(c.pull_request.description, c.repo_name)}</div>
173 </div>
173 </div>
174 <div id="pr-desc-edit" class="input textarea editor" style="display: none;">
174 <div id="pr-desc-edit" class="input textarea editor" style="display: none;">
175 <textarea id="pr-description-input" size="30">${c.pull_request.description}</textarea>
175 <textarea id="pr-description-input" size="30">${c.pull_request.description}</textarea>
176 </div>
176 </div>
177 </div>
177 </div>
178
178
179 <div class="field">
179 <div class="field">
180 <div class="label-summary">
180 <div class="label-summary">
181 <label>${_('Versions')}:</label>
181 <label>${_('Versions')}:</label>
182 </div>
182 </div>
183
183
184 <% outdated_comm_count_ver = len(c.inline_versions[None]['outdated']) %>
184 <% outdated_comm_count_ver = len(c.inline_versions[None]['outdated']) %>
185 <% general_outdated_comm_count_ver = len(c.comment_versions[None]['outdated']) %>
185 <% general_outdated_comm_count_ver = len(c.comment_versions[None]['outdated']) %>
186
186
187 <div class="pr-versions">
187 <div class="pr-versions">
188 % if c.show_version_changes:
188 % if c.show_version_changes:
189 <% outdated_comm_count_ver = len(c.inline_versions[c.at_version_num]['outdated']) %>
189 <% outdated_comm_count_ver = len(c.inline_versions[c.at_version_num]['outdated']) %>
190 <% general_outdated_comm_count_ver = len(c.comment_versions[c.at_version_num]['outdated']) %>
190 <% general_outdated_comm_count_ver = len(c.comment_versions[c.at_version_num]['outdated']) %>
191 <a id="show-pr-versions" class="input" onclick="return versionController.toggleVersionView(this)" href="#show-pr-versions"
191 <a id="show-pr-versions" class="input" onclick="return versionController.toggleVersionView(this)" href="#show-pr-versions"
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))}"
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 data-toggle-off="${_('Hide all versions of this pull request')}">
193 data-toggle-off="${_('Hide all versions of this pull request')}">
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))}
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 </a>
195 </a>
196 <table>
196 <table>
197 ## SHOW ALL VERSIONS OF PR
197 ## SHOW ALL VERSIONS OF PR
198 <% ver_pr = None %>
198 <% ver_pr = None %>
199
199
200 % for data in reversed(list(enumerate(c.versions, 1))):
200 % for data in reversed(list(enumerate(c.versions, 1))):
201 <% ver_pos = data[0] %>
201 <% ver_pos = data[0] %>
202 <% ver = data[1] %>
202 <% ver = data[1] %>
203 <% ver_pr = ver.pull_request_version_id %>
203 <% ver_pr = ver.pull_request_version_id %>
204 <% display_row = '' if c.at_version and (c.at_version_num == ver_pr or c.from_version_num == ver_pr) else 'none' %>
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 <tr class="version-pr" style="display: ${display_row}">
206 <tr class="version-pr" style="display: ${display_row}">
207 <td>
207 <td>
208 <code>
208 <code>
209 <a href="${request.current_route_path(_query=dict(version=ver_pr or 'latest'))}">v${ver_pos}</a>
209 <a href="${request.current_route_path(_query=dict(version=ver_pr or 'latest'))}">v${ver_pos}</a>
210 </code>
210 </code>
211 </td>
211 </td>
212 <td>
212 <td>
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}"/>
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 <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}"/>
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 </td>
215 </td>
216 <td>
216 <td>
217 <% review_status = c.review_versions[ver_pr].status if ver_pr in c.review_versions else 'not_reviewed' %>
217 <% review_status = c.review_versions[ver_pr].status if ver_pr in c.review_versions else 'not_reviewed' %>
218 <div class="${'flag_status %s' % review_status} tooltip pull-left" title="${_('Your review status at this version')}">
218 <div class="${'flag_status %s' % review_status} tooltip pull-left" title="${_('Your review status at this version')}">
219 </div>
219 </div>
220 </td>
220 </td>
221 <td>
221 <td>
222 % if c.at_version_num != ver_pr:
222 % if c.at_version_num != ver_pr:
223 <i class="icon-comment"></i>
223 <i class="icon-comment"></i>
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']))}">
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 G:${len(c.comment_versions[ver_pr]['at'])} / I:${len(c.inline_versions[ver_pr]['at'])}
225 G:${len(c.comment_versions[ver_pr]['at'])} / I:${len(c.inline_versions[ver_pr]['at'])}
226 </code>
226 </code>
227 % endif
227 % endif
228 </td>
228 </td>
229 <td>
229 <td>
230 ##<code>${ver.source_ref_parts.commit_id[:6]}</code>
230 ##<code>${ver.source_ref_parts.commit_id[:6]}</code>
231 </td>
231 </td>
232 <td>
232 <td>
233 ${h.age_component(ver.updated_on, time_is_local=True)}
233 ${h.age_component(ver.updated_on, time_is_local=True)}
234 </td>
234 </td>
235 </tr>
235 </tr>
236 % endfor
236 % endfor
237
237
238 <tr>
238 <tr>
239 <td colspan="6">
239 <td colspan="6">
240 <button id="show-version-diff" onclick="return versionController.showVersionDiff()" class="btn btn-sm" style="display: none"
240 <button id="show-version-diff" onclick="return versionController.showVersionDiff()" class="btn btn-sm" style="display: none"
241 data-label-text-locked="${_('select versions to show changes')}"
241 data-label-text-locked="${_('select versions to show changes')}"
242 data-label-text-diff="${_('show changes between versions')}"
242 data-label-text-diff="${_('show changes between versions')}"
243 data-label-text-show="${_('show pull request for this version')}"
243 data-label-text-show="${_('show pull request for this version')}"
244 >
244 >
245 ${_('select versions to show changes')}
245 ${_('select versions to show changes')}
246 </button>
246 </button>
247 </td>
247 </td>
248 </tr>
248 </tr>
249
249
250 ## show comment/inline comments summary
250 ## show comment/inline comments summary
251 <%def name="comments_summary()">
251 <%def name="comments_summary()">
252 <tr>
252 <tr>
253 <td colspan="6" class="comments-summary-td">
253 <td colspan="6" class="comments-summary-td">
254
254
255 % if c.at_version:
255 % if c.at_version:
256 <% inline_comm_count_ver = len(c.inline_versions[c.at_version_num]['display']) %>
256 <% inline_comm_count_ver = len(c.inline_versions[c.at_version_num]['display']) %>
257 <% general_comm_count_ver = len(c.comment_versions[c.at_version_num]['display']) %>
257 <% general_comm_count_ver = len(c.comment_versions[c.at_version_num]['display']) %>
258 ${_('Comments at this version')}:
258 ${_('Comments at this version')}:
259 % else:
259 % else:
260 <% inline_comm_count_ver = len(c.inline_versions[c.at_version_num]['until']) %>
260 <% inline_comm_count_ver = len(c.inline_versions[c.at_version_num]['until']) %>
261 <% general_comm_count_ver = len(c.comment_versions[c.at_version_num]['until']) %>
261 <% general_comm_count_ver = len(c.comment_versions[c.at_version_num]['until']) %>
262 ${_('Comments for this pull request')}:
262 ${_('Comments for this pull request')}:
263 % endif
263 % endif
264
264
265
265
266 %if general_comm_count_ver:
266 %if general_comm_count_ver:
267 <a href="#comments">${_("%d General ") % general_comm_count_ver}</a>
267 <a href="#comments">${_("%d General ") % general_comm_count_ver}</a>
268 %else:
268 %else:
269 ${_("%d General ") % general_comm_count_ver}
269 ${_("%d General ") % general_comm_count_ver}
270 %endif
270 %endif
271
271
272 %if inline_comm_count_ver:
272 %if inline_comm_count_ver:
273 , <a href="#" onclick="return Rhodecode.comments.nextComment();" id="inline-comments-counter">${_("%d Inline") % inline_comm_count_ver}</a>
273 , <a href="#" onclick="return Rhodecode.comments.nextComment();" id="inline-comments-counter">${_("%d Inline") % inline_comm_count_ver}</a>
274 %else:
274 %else:
275 , ${_("%d Inline") % inline_comm_count_ver}
275 , ${_("%d Inline") % inline_comm_count_ver}
276 %endif
276 %endif
277
277
278 %if outdated_comm_count_ver:
278 %if outdated_comm_count_ver:
279 , <a href="#" onclick="showOutdated(); Rhodecode.comments.nextOutdatedComment(); return false;">${_("%d Outdated") % outdated_comm_count_ver}</a>
279 , <a href="#" onclick="showOutdated(); Rhodecode.comments.nextOutdatedComment(); return false;">${_("%d Outdated") % outdated_comm_count_ver}</a>
280 <a href="#" class="showOutdatedComments" onclick="showOutdated(this); return false;"> | ${_('show outdated comments')}</a>
280 <a href="#" class="showOutdatedComments" onclick="showOutdated(this); return false;"> | ${_('show outdated comments')}</a>
281 <a href="#" class="hideOutdatedComments" style="display: none" onclick="hideOutdated(this); return false;"> | ${_('hide outdated comments')}</a>
281 <a href="#" class="hideOutdatedComments" style="display: none" onclick="hideOutdated(this); return false;"> | ${_('hide outdated comments')}</a>
282 %else:
282 %else:
283 , ${_("%d Outdated") % outdated_comm_count_ver}
283 , ${_("%d Outdated") % outdated_comm_count_ver}
284 %endif
284 %endif
285 </td>
285 </td>
286 </tr>
286 </tr>
287 </%def>
287 </%def>
288 ${comments_summary()}
288 ${comments_summary()}
289 </table>
289 </table>
290 % else:
290 % else:
291 <div class="input">
291 <div class="input">
292 ${_('Pull request versions not available')}.
292 ${_('Pull request versions not available')}.
293 </div>
293 </div>
294 <div>
294 <div>
295 <table>
295 <table>
296 ${comments_summary()}
296 ${comments_summary()}
297 </table>
297 </table>
298 </div>
298 </div>
299 % endif
299 % endif
300 </div>
300 </div>
301 </div>
301 </div>
302
302
303 <div id="pr-save" class="field" style="display: none;">
303 <div id="pr-save" class="field" style="display: none;">
304 <div class="label-summary"></div>
304 <div class="label-summary"></div>
305 <div class="input">
305 <div class="input">
306 <span id="edit_pull_request" class="btn btn-small no-margin">${_('Save Changes')}</span>
306 <span id="edit_pull_request" class="btn btn-small no-margin">${_('Save Changes')}</span>
307 </div>
307 </div>
308 </div>
308 </div>
309 </div>
309 </div>
310 </div>
310 </div>
311 <div>
311 <div>
312 ## AUTHOR
312 ## AUTHOR
313 <div class="reviewers-title block-right">
313 <div class="reviewers-title block-right">
314 <div class="pr-details-title">
314 <div class="pr-details-title">
315 ${_('Author of this pull request')}
315 ${_('Author of this pull request')}
316 </div>
316 </div>
317 </div>
317 </div>
318 <div class="block-right pr-details-content reviewers">
318 <div class="block-right pr-details-content reviewers">
319 <ul class="group_members">
319 <ul class="group_members">
320 <li>
320 <li>
321 ${self.gravatar_with_user(c.pull_request.author.email, 16)}
321 ${self.gravatar_with_user(c.pull_request.author.email, 16)}
322 </li>
322 </li>
323 </ul>
323 </ul>
324 </div>
324 </div>
325
325
326 ## REVIEW RULES
326 ## REVIEW RULES
327 <div id="review_rules" style="display: none" class="reviewers-title block-right">
327 <div id="review_rules" style="display: none" class="reviewers-title block-right">
328 <div class="pr-details-title">
328 <div class="pr-details-title">
329 ${_('Reviewer rules')}
329 ${_('Reviewer rules')}
330 %if c.allowed_to_update:
330 %if c.allowed_to_update:
331 <span id="close_edit_reviewers" class="block-right action_button last-item" style="display: none;">${_('Close')}</span>
331 <span id="close_edit_reviewers" class="block-right action_button last-item" style="display: none;">${_('Close')}</span>
332 %endif
332 %endif
333 </div>
333 </div>
334 <div class="pr-reviewer-rules">
334 <div class="pr-reviewer-rules">
335 ## review rules will be appended here, by default reviewers logic
335 ## review rules will be appended here, by default reviewers logic
336 </div>
336 </div>
337 <input id="review_data" type="hidden" name="review_data" value="">
337 <input id="review_data" type="hidden" name="review_data" value="">
338 </div>
338 </div>
339
339
340 ## REVIEWERS
340 ## REVIEWERS
341 <div class="reviewers-title block-right">
341 <div class="reviewers-title block-right">
342 <div class="pr-details-title">
342 <div class="pr-details-title">
343 ${_('Pull request reviewers')}
343 ${_('Pull request reviewers')}
344 %if c.allowed_to_update:
344 %if c.allowed_to_update:
345 <span id="open_edit_reviewers" class="block-right action_button last-item">${_('Edit')}</span>
345 <span id="open_edit_reviewers" class="block-right action_button last-item">${_('Edit')}</span>
346 %endif
346 %endif
347 </div>
347 </div>
348 </div>
348 </div>
349 <div id="reviewers" class="block-right pr-details-content reviewers">
349 <div id="reviewers" class="block-right pr-details-content reviewers">
350 ## members goes here !
350 ## members goes here !
351 <input type="hidden" name="__start__" value="review_members:sequence">
351 <input type="hidden" name="__start__" value="review_members:sequence">
352 <ul id="review_members" class="group_members">
352 <ul id="review_members" class="group_members">
353 %for member,reasons,mandatory,status in c.pull_request_reviewers:
353 %for member,reasons,mandatory,status in c.pull_request_reviewers:
354 <li id="reviewer_${member.user_id}" class="reviewer_entry">
354 <li id="reviewer_${member.user_id}" class="reviewer_entry">
355 <div class="reviewers_member">
355 <div class="reviewers_member">
356 <div class="reviewer_status tooltip" title="${h.tooltip(h.commit_status_lbl(status[0][1].status if status else 'not_reviewed'))}">
356 <div class="reviewer_status tooltip" title="${h.tooltip(h.commit_status_lbl(status[0][1].status if status else 'not_reviewed'))}">
357 <div class="${'flag_status %s' % (status[0][1].status if status else 'not_reviewed')} pull-left reviewer_member_status"></div>
357 <div class="${'flag_status %s' % (status[0][1].status if status else 'not_reviewed')} pull-left reviewer_member_status"></div>
358 </div>
358 </div>
359 <div id="reviewer_${member.user_id}_name" class="reviewer_name">
359 <div id="reviewer_${member.user_id}_name" class="reviewer_name">
360 ${self.gravatar_with_user(member.email, 16)}
360 ${self.gravatar_with_user(member.email, 16)}
361 </div>
361 </div>
362 <input type="hidden" name="__start__" value="reviewer:mapping">
362 <input type="hidden" name="__start__" value="reviewer:mapping">
363 <input type="hidden" name="__start__" value="reasons:sequence">
363 <input type="hidden" name="__start__" value="reasons:sequence">
364 %for reason in reasons:
364 %for reason in reasons:
365 <div class="reviewer_reason">- ${reason}</div>
365 <div class="reviewer_reason">- ${reason}</div>
366 <input type="hidden" name="reason" value="${reason}">
366 <input type="hidden" name="reason" value="${reason}">
367
367
368 %endfor
368 %endfor
369 <input type="hidden" name="__end__" value="reasons:sequence">
369 <input type="hidden" name="__end__" value="reasons:sequence">
370 <input id="reviewer_${member.user_id}_input" type="hidden" value="${member.user_id}" name="user_id" />
370 <input id="reviewer_${member.user_id}_input" type="hidden" value="${member.user_id}" name="user_id" />
371 <input type="hidden" name="mandatory" value="${mandatory}"/>
371 <input type="hidden" name="mandatory" value="${mandatory}"/>
372 <input type="hidden" name="__end__" value="reviewer:mapping">
372 <input type="hidden" name="__end__" value="reviewer:mapping">
373 % if mandatory:
373 % if mandatory:
374 <div class="reviewer_member_mandatory_remove">
374 <div class="reviewer_member_mandatory_remove">
375 <i class="icon-remove-sign"></i>
375 <i class="icon-remove-sign"></i>
376 </div>
376 </div>
377 <div class="reviewer_member_mandatory">
377 <div class="reviewer_member_mandatory">
378 <i class="icon-lock" title="${h.tooltip(_('Mandatory reviewer'))}"></i>
378 <i class="icon-lock" title="${h.tooltip(_('Mandatory reviewer'))}"></i>
379 </div>
379 </div>
380 % else:
380 % else:
381 %if c.allowed_to_update:
381 %if c.allowed_to_update:
382 <div class="reviewer_member_remove action_button" onclick="reviewersController.removeReviewMember(${member.user_id}, true)" style="visibility: hidden;">
382 <div class="reviewer_member_remove action_button" onclick="reviewersController.removeReviewMember(${member.user_id}, true)" style="visibility: hidden;">
383 <i class="icon-remove-sign" ></i>
383 <i class="icon-remove-sign" ></i>
384 </div>
384 </div>
385 %endif
385 %endif
386 % endif
386 % endif
387 </div>
387 </div>
388 </li>
388 </li>
389 %endfor
389 %endfor
390 </ul>
390 </ul>
391 <input type="hidden" name="__end__" value="review_members:sequence">
391 <input type="hidden" name="__end__" value="review_members:sequence">
392
392
393 %if not c.pull_request.is_closed():
393 %if not c.pull_request.is_closed():
394 <div id="add_reviewer" class="ac" style="display: none;">
394 <div id="add_reviewer" class="ac" style="display: none;">
395 %if c.allowed_to_update:
395 %if c.allowed_to_update:
396 % if not c.forbid_adding_reviewers:
396 % if not c.forbid_adding_reviewers:
397 <div id="add_reviewer_input" class="reviewer_ac">
397 <div id="add_reviewer_input" class="reviewer_ac">
398 ${h.text('user', class_='ac-input', placeholder=_('Add reviewer or reviewer group'))}
398 ${h.text('user', class_='ac-input', placeholder=_('Add reviewer or reviewer group'))}
399 <div id="reviewers_container"></div>
399 <div id="reviewers_container"></div>
400 </div>
400 </div>
401 % endif
401 % endif
402 <div class="pull-right">
402 <div class="pull-right">
403 <button id="update_pull_request" class="btn btn-small no-margin">${_('Save Changes')}</button>
403 <button id="update_pull_request" class="btn btn-small no-margin">${_('Save Changes')}</button>
404 </div>
404 </div>
405 %endif
405 %endif
406 </div>
406 </div>
407 %endif
407 %endif
408 </div>
408 </div>
409 </div>
409 </div>
410 </div>
410 </div>
411 <div class="box">
411 <div class="box">
412 ##DIFF
412 ##DIFF
413 <div class="table" >
413 <div class="table" >
414 <div id="changeset_compare_view_content">
414 <div id="changeset_compare_view_content">
415 ##CS
415 ##CS
416 % if c.missing_requirements:
416 % if c.missing_requirements:
417 <div class="box">
417 <div class="box">
418 <div class="alert alert-warning">
418 <div class="alert alert-warning">
419 <div>
419 <div>
420 <strong>${_('Missing requirements:')}</strong>
420 <strong>${_('Missing requirements:')}</strong>
421 ${_('These commits cannot be displayed, because this repository uses the Mercurial largefiles extension, which was not enabled.')}
421 ${_('These commits cannot be displayed, because this repository uses the Mercurial largefiles extension, which was not enabled.')}
422 </div>
422 </div>
423 </div>
423 </div>
424 </div>
424 </div>
425 % elif c.missing_commits:
425 % elif c.missing_commits:
426 <div class="box">
426 <div class="box">
427 <div class="alert alert-warning">
427 <div class="alert alert-warning">
428 <div>
428 <div>
429 <strong>${_('Missing commits')}:</strong>
429 <strong>${_('Missing commits')}:</strong>
430 ${_('This pull request cannot be displayed, because one or more commits no longer exist in the source repository.')}
430 ${_('This pull request cannot be displayed, because one or more commits no longer exist in the source repository.')}
431 ${_('Please update this pull request, push the commits back into the source repository, or consider closing this pull request.')}
431 ${_('Please update this pull request, push the commits back into the source repository, or consider closing this pull request.')}
432 </div>
432 </div>
433 </div>
433 </div>
434 </div>
434 </div>
435 % endif
435 % endif
436
436
437 <div class="compare_view_commits_title">
437 <div class="compare_view_commits_title">
438 % if not c.compare_mode:
438 % if not c.compare_mode:
439
439
440 % if c.at_version_pos:
440 % if c.at_version_pos:
441 <h4>
441 <h4>
442 ${_('Showing changes at v%d, commenting is disabled.') % c.at_version_pos}
442 ${_('Showing changes at v%d, commenting is disabled.') % c.at_version_pos}
443 </h4>
443 </h4>
444 % endif
444 % endif
445
445
446 <div class="pull-left">
446 <div class="pull-left">
447 <div class="btn-group">
447 <div class="btn-group">
448 <a
448 <a
449 class="btn"
449 class="btn"
450 href="#"
450 href="#"
451 onclick="$('.compare_select').show();$('.compare_select_hidden').hide(); return false">
451 onclick="$('.compare_select').show();$('.compare_select_hidden').hide(); return false">
452 ${_ungettext('Expand %s commit','Expand %s commits', len(c.commit_ranges)) % len(c.commit_ranges)}
452 ${_ungettext('Expand %s commit','Expand %s commits', len(c.commit_ranges)) % len(c.commit_ranges)}
453 </a>
453 </a>
454 <a
454 <a
455 class="btn"
455 class="btn"
456 href="#"
456 href="#"
457 onclick="$('.compare_select').hide();$('.compare_select_hidden').show(); return false">
457 onclick="$('.compare_select').hide();$('.compare_select_hidden').show(); return false">
458 ${_ungettext('Collapse %s commit','Collapse %s commits', len(c.commit_ranges)) % len(c.commit_ranges)}
458 ${_ungettext('Collapse %s commit','Collapse %s commits', len(c.commit_ranges)) % len(c.commit_ranges)}
459 </a>
459 </a>
460 </div>
460 </div>
461 </div>
461 </div>
462
462
463 <div class="pull-right">
463 <div class="pull-right">
464 % if c.allowed_to_update and not c.pull_request.is_closed():
464 % if c.allowed_to_update and not c.pull_request.is_closed():
465 <a id="update_commits" class="btn btn-primary no-margin pull-right">${_('Update commits')}</a>
465 <a id="update_commits" class="btn btn-primary no-margin pull-right">${_('Update commits')}</a>
466 % else:
466 % else:
467 <a class="tooltip btn disabled pull-right" disabled="disabled" title="${_('Update is disabled for current view')}">${_('Update commits')}</a>
467 <a class="tooltip btn disabled pull-right" disabled="disabled" title="${_('Update is disabled for current view')}">${_('Update commits')}</a>
468 % endif
468 % endif
469
469
470 </div>
470 </div>
471 % endif
471 % endif
472 </div>
472 </div>
473
473
474 % if not c.missing_commits:
474 % if not c.missing_commits:
475 % if c.compare_mode:
475 % if c.compare_mode:
476 % if c.at_version:
476 % if c.at_version:
477 <h4>
477 <h4>
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')}:
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 </h4>
479 </h4>
480
480
481 <div class="subtitle-compare">
481 <div class="subtitle-compare">
482 ${_('commits added: {}, removed: {}').format(len(c.commit_changes_summary.added), len(c.commit_changes_summary.removed))}
482 ${_('commits added: {}, removed: {}').format(len(c.commit_changes_summary.added), len(c.commit_changes_summary.removed))}
483 </div>
483 </div>
484
484
485 <div class="container">
485 <div class="container">
486 <table class="rctable compare_view_commits">
486 <table class="rctable compare_view_commits">
487 <tr>
487 <tr>
488 <th></th>
488 <th></th>
489 <th>${_('Time')}</th>
489 <th>${_('Time')}</th>
490 <th>${_('Author')}</th>
490 <th>${_('Author')}</th>
491 <th>${_('Commit')}</th>
491 <th>${_('Commit')}</th>
492 <th></th>
492 <th></th>
493 <th>${_('Description')}</th>
493 <th>${_('Description')}</th>
494 </tr>
494 </tr>
495
495
496 % for c_type, commit in c.commit_changes:
496 % for c_type, commit in c.commit_changes:
497 % if c_type in ['a', 'r']:
497 % if c_type in ['a', 'r']:
498 <%
498 <%
499 if c_type == 'a':
499 if c_type == 'a':
500 cc_title = _('Commit added in displayed changes')
500 cc_title = _('Commit added in displayed changes')
501 elif c_type == 'r':
501 elif c_type == 'r':
502 cc_title = _('Commit removed in displayed changes')
502 cc_title = _('Commit removed in displayed changes')
503 else:
503 else:
504 cc_title = ''
504 cc_title = ''
505 %>
505 %>
506 <tr id="row-${commit.raw_id}" commit_id="${commit.raw_id}" class="compare_select">
506 <tr id="row-${commit.raw_id}" commit_id="${commit.raw_id}" class="compare_select">
507 <td>
507 <td>
508 <div class="commit-change-indicator color-${c_type}-border">
508 <div class="commit-change-indicator color-${c_type}-border">
509 <div class="commit-change-content color-${c_type} tooltip" title="${h.tooltip(cc_title)}">
509 <div class="commit-change-content color-${c_type} tooltip" title="${h.tooltip(cc_title)}">
510 ${c_type.upper()}
510 ${c_type.upper()}
511 </div>
511 </div>
512 </div>
512 </div>
513 </td>
513 </td>
514 <td class="td-time">
514 <td class="td-time">
515 ${h.age_component(commit.date)}
515 ${h.age_component(commit.date)}
516 </td>
516 </td>
517 <td class="td-user">
517 <td class="td-user">
518 ${base.gravatar_with_user(commit.author, 16)}
518 ${base.gravatar_with_user(commit.author, 16)}
519 </td>
519 </td>
520 <td class="td-hash">
520 <td class="td-hash">
521 <code>
521 <code>
522 <a href="${h.route_path('repo_commit', repo_name=c.target_repo.repo_name, commit_id=commit.raw_id)}">
522 <a href="${h.route_path('repo_commit', repo_name=c.target_repo.repo_name, commit_id=commit.raw_id)}">
523 r${commit.revision}:${h.short_id(commit.raw_id)}
523 r${commit.revision}:${h.short_id(commit.raw_id)}
524 </a>
524 </a>
525 ${h.hidden('revisions', commit.raw_id)}
525 ${h.hidden('revisions', commit.raw_id)}
526 </code>
526 </code>
527 </td>
527 </td>
528 <td class="expand_commit" data-commit-id="${commit.raw_id}" title="${_( 'Expand commit message')}">
528 <td class="expand_commit" data-commit-id="${commit.raw_id}" title="${_( 'Expand commit message')}">
529 <div class="show_more_col">
529 <div class="show_more_col">
530 <i class="show_more"></i>
530 <i class="show_more"></i>
531 </div>
531 </div>
532 </td>
532 </td>
533 <td class="mid td-description">
533 <td class="mid td-description">
534 <div class="log-container truncate-wrap">
534 <div class="log-container truncate-wrap">
535 <div class="message truncate" id="c-${commit.raw_id}" data-message-raw="${commit.message}">
535 <div class="message truncate" id="c-${commit.raw_id}" data-message-raw="${commit.message}">
536 ${h.urlify_commit_message(commit.message, c.repo_name)}
536 ${h.urlify_commit_message(commit.message, c.repo_name)}
537 </div>
537 </div>
538 </div>
538 </div>
539 </td>
539 </td>
540 </tr>
540 </tr>
541 % endif
541 % endif
542 % endfor
542 % endfor
543 </table>
543 </table>
544 </div>
544 </div>
545
545
546 <script>
546 <script>
547 $('.expand_commit').on('click',function(e){
547 $('.expand_commit').on('click',function(e){
548 var target_expand = $(this);
548 var target_expand = $(this);
549 var cid = target_expand.data('commitId');
549 var cid = target_expand.data('commitId');
550
550
551 if (target_expand.hasClass('open')){
551 if (target_expand.hasClass('open')){
552 $('#c-'+cid).css({
552 $('#c-'+cid).css({
553 'height': '1.5em',
553 'height': '1.5em',
554 'white-space': 'nowrap',
554 'white-space': 'nowrap',
555 'text-overflow': 'ellipsis',
555 'text-overflow': 'ellipsis',
556 'overflow':'hidden'
556 'overflow':'hidden'
557 });
557 });
558 target_expand.removeClass('open');
558 target_expand.removeClass('open');
559 }
559 }
560 else {
560 else {
561 $('#c-'+cid).css({
561 $('#c-'+cid).css({
562 'height': 'auto',
562 'height': 'auto',
563 'white-space': 'pre-line',
563 'white-space': 'pre-line',
564 'text-overflow': 'initial',
564 'text-overflow': 'initial',
565 'overflow':'visible'
565 'overflow':'visible'
566 });
566 });
567 target_expand.addClass('open');
567 target_expand.addClass('open');
568 }
568 }
569 });
569 });
570 </script>
570 </script>
571
571
572 % endif
572 % endif
573
573
574 % else:
574 % else:
575 <%include file="/compare/compare_commits.mako" />
575 <%include file="/compare/compare_commits.mako" />
576 % endif
576 % endif
577
577
578 <div class="cs_files">
578 <div class="cs_files">
579 <%namespace name="cbdiffs" file="/codeblocks/diffs.mako"/>
579 <%namespace name="cbdiffs" file="/codeblocks/diffs.mako"/>
580 ${cbdiffs.render_diffset_menu()}
580 ${cbdiffs.render_diffset_menu()}
581 ${cbdiffs.render_diffset(
581 ${cbdiffs.render_diffset(
582 c.diffset, use_comments=True,
582 c.diffset, use_comments=True,
583 collapse_when_files_over=30,
583 collapse_when_files_over=30,
584 disable_new_comments=not c.allowed_to_comment,
584 disable_new_comments=not c.allowed_to_comment,
585 deleted_files_comments=c.deleted_files_comments)}
585 deleted_files_comments=c.deleted_files_comments)}
586 </div>
586 </div>
587 % else:
587 % else:
588 ## skipping commits we need to clear the view for missing commits
588 ## skipping commits we need to clear the view for missing commits
589 <div style="clear:both;"></div>
589 <div style="clear:both;"></div>
590 % endif
590 % endif
591
591
592 </div>
592 </div>
593 </div>
593 </div>
594
594
595 ## template for inline comment form
595 ## template for inline comment form
596 <%namespace name="comment" file="/changeset/changeset_file_comment.mako"/>
596 <%namespace name="comment" file="/changeset/changeset_file_comment.mako"/>
597
597
598 ## render general comments
598 ## render general comments
599
599
600 <div id="comment-tr-show">
600 <div id="comment-tr-show">
601 <div class="comment">
601 <div class="comment">
602 % if general_outdated_comm_count_ver:
602 % if general_outdated_comm_count_ver:
603 <div class="meta">
603 <div class="meta">
604 % if general_outdated_comm_count_ver == 1:
604 % if general_outdated_comm_count_ver == 1:
605 ${_('there is {num} general comment from older versions').format(num=general_outdated_comm_count_ver)},
605 ${_('there is {num} general comment from older versions').format(num=general_outdated_comm_count_ver)},
606 <a href="#show-hidden-comments" onclick="$('.comment-general.comment-outdated').show(); $(this).parent().hide(); return false;">${_('show it')}</a>
606 <a href="#show-hidden-comments" onclick="$('.comment-general.comment-outdated').show(); $(this).parent().hide(); return false;">${_('show it')}</a>
607 % else:
607 % else:
608 ${_('there are {num} general comments from older versions').format(num=general_outdated_comm_count_ver)},
608 ${_('there are {num} general comments from older versions').format(num=general_outdated_comm_count_ver)},
609 <a href="#show-hidden-comments" onclick="$('.comment-general.comment-outdated').show(); $(this).parent().hide(); return false;">${_('show them')}</a>
609 <a href="#show-hidden-comments" onclick="$('.comment-general.comment-outdated').show(); $(this).parent().hide(); return false;">${_('show them')}</a>
610 % endif
610 % endif
611 </div>
611 </div>
612 % endif
612 % endif
613 </div>
613 </div>
614 </div>
614 </div>
615
615
616 ${comment.generate_comments(c.comments, include_pull_request=True, is_pull_request=True)}
616 ${comment.generate_comments(c.comments, include_pull_request=True, is_pull_request=True)}
617
617
618 % if not c.pull_request.is_closed():
618 % if not c.pull_request.is_closed():
619 ## merge status, and merge action
619 ## merge status, and merge action
620 <div class="pull-request-merge">
620 <div class="pull-request-merge">
621 <%include file="/pullrequests/pullrequest_merge_checks.mako"/>
621 <%include file="/pullrequests/pullrequest_merge_checks.mako"/>
622 </div>
622 </div>
623
623
624 ## main comment form and it status
624 ## main comment form and it status
625 ${comment.comments(h.route_path('pullrequest_comment_create', repo_name=c.repo_name,
625 ${comment.comments(h.route_path('pullrequest_comment_create', repo_name=c.repo_name,
626 pull_request_id=c.pull_request.pull_request_id),
626 pull_request_id=c.pull_request.pull_request_id),
627 c.pull_request_review_status,
627 c.pull_request_review_status,
628 is_pull_request=True, change_status=c.allowed_to_change_status)}
628 is_pull_request=True, change_status=c.allowed_to_change_status)}
629 %endif
629 %endif
630
630
631 <script type="text/javascript">
631 <script type="text/javascript">
632 if (location.hash) {
632 if (location.hash) {
633 var result = splitDelimitedHash(location.hash);
633 var result = splitDelimitedHash(location.hash);
634 var line = $('html').find(result.loc);
634 var line = $('html').find(result.loc);
635 // show hidden comments if we use location.hash
635 // show hidden comments if we use location.hash
636 if (line.hasClass('comment-general')) {
636 if (line.hasClass('comment-general')) {
637 $(line).show();
637 $(line).show();
638 } else if (line.hasClass('comment-inline')) {
638 } else if (line.hasClass('comment-inline')) {
639 $(line).show();
639 $(line).show();
640 var $cb = $(line).closest('.cb');
640 var $cb = $(line).closest('.cb');
641 $cb.removeClass('cb-collapsed')
641 $cb.removeClass('cb-collapsed')
642 }
642 }
643 if (line.length > 0){
643 if (line.length > 0){
644 offsetScroll(line, 70);
644 offsetScroll(line, 70);
645 }
645 }
646 }
646 }
647
647
648 versionController = new VersionController();
648 versionController = new VersionController();
649 versionController.init();
649 versionController.init();
650
650
651 reviewersController = new ReviewersController();
651 reviewersController = new ReviewersController();
652
652
653 $(function(){
653 $(function(){
654
654
655 // custom code mirror
655 // custom code mirror
656 var codeMirrorInstance = initPullRequestsCodeMirror('#pr-description-input');
656 var codeMirrorInstance = initPullRequestsCodeMirror('#pr-description-input');
657
657
658 var PRDetails = {
658 var PRDetails = {
659 editButton: $('#open_edit_pullrequest'),
659 editButton: $('#open_edit_pullrequest'),
660 closeButton: $('#close_edit_pullrequest'),
660 closeButton: $('#close_edit_pullrequest'),
661 deleteButton: $('#delete_pullrequest'),
661 deleteButton: $('#delete_pullrequest'),
662 viewFields: $('#pr-desc, #pr-title'),
662 viewFields: $('#pr-desc, #pr-title'),
663 editFields: $('#pr-desc-edit, #pr-title-edit, #pr-save'),
663 editFields: $('#pr-desc-edit, #pr-title-edit, #pr-save'),
664
664
665 init: function() {
665 init: function() {
666 var that = this;
666 var that = this;
667 this.editButton.on('click', function(e) { that.edit(); });
667 this.editButton.on('click', function(e) { that.edit(); });
668 this.closeButton.on('click', function(e) { that.view(); });
668 this.closeButton.on('click', function(e) { that.view(); });
669 },
669 },
670
670
671 edit: function(event) {
671 edit: function(event) {
672 this.viewFields.hide();
672 this.viewFields.hide();
673 this.editButton.hide();
673 this.editButton.hide();
674 this.deleteButton.hide();
674 this.deleteButton.hide();
675 this.closeButton.show();
675 this.closeButton.show();
676 this.editFields.show();
676 this.editFields.show();
677 codeMirrorInstance.refresh();
677 codeMirrorInstance.refresh();
678 },
678 },
679
679
680 view: function(event) {
680 view: function(event) {
681 this.editButton.show();
681 this.editButton.show();
682 this.deleteButton.show();
682 this.deleteButton.show();
683 this.editFields.hide();
683 this.editFields.hide();
684 this.closeButton.hide();
684 this.closeButton.hide();
685 this.viewFields.show();
685 this.viewFields.show();
686 }
686 }
687 };
687 };
688
688
689 var ReviewersPanel = {
689 var ReviewersPanel = {
690 editButton: $('#open_edit_reviewers'),
690 editButton: $('#open_edit_reviewers'),
691 closeButton: $('#close_edit_reviewers'),
691 closeButton: $('#close_edit_reviewers'),
692 addButton: $('#add_reviewer'),
692 addButton: $('#add_reviewer'),
693 removeButtons: $('.reviewer_member_remove,.reviewer_member_mandatory_remove,.reviewer_member_mandatory'),
693 removeButtons: $('.reviewer_member_remove,.reviewer_member_mandatory_remove,.reviewer_member_mandatory'),
694
694
695 init: function() {
695 init: function() {
696 var self = this;
696 var self = this;
697 this.editButton.on('click', function(e) { self.edit(); });
697 this.editButton.on('click', function(e) { self.edit(); });
698 this.closeButton.on('click', function(e) { self.close(); });
698 this.closeButton.on('click', function(e) { self.close(); });
699 },
699 },
700
700
701 edit: function(event) {
701 edit: function(event) {
702 this.editButton.hide();
702 this.editButton.hide();
703 this.closeButton.show();
703 this.closeButton.show();
704 this.addButton.show();
704 this.addButton.show();
705 this.removeButtons.css('visibility', 'visible');
705 this.removeButtons.css('visibility', 'visible');
706 // review rules
706 // review rules
707 reviewersController.loadReviewRules(
707 reviewersController.loadReviewRules(
708 ${c.pull_request.reviewer_data_json | n});
708 ${c.pull_request.reviewer_data_json | n});
709 },
709 },
710
710
711 close: function(event) {
711 close: function(event) {
712 this.editButton.show();
712 this.editButton.show();
713 this.closeButton.hide();
713 this.closeButton.hide();
714 this.addButton.hide();
714 this.addButton.hide();
715 this.removeButtons.css('visibility', 'hidden');
715 this.removeButtons.css('visibility', 'hidden');
716 // hide review rules
716 // hide review rules
717 reviewersController.hideReviewRules()
717 reviewersController.hideReviewRules()
718 }
718 }
719 };
719 };
720
720
721 PRDetails.init();
721 PRDetails.init();
722 ReviewersPanel.init();
722 ReviewersPanel.init();
723
723
724 showOutdated = function(self){
724 showOutdated = function(self){
725 $('.comment-inline.comment-outdated').show();
725 $('.comment-inline.comment-outdated').show();
726 $('.filediff-outdated').show();
726 $('.filediff-outdated').show();
727 $('.showOutdatedComments').hide();
727 $('.showOutdatedComments').hide();
728 $('.hideOutdatedComments').show();
728 $('.hideOutdatedComments').show();
729 };
729 };
730
730
731 hideOutdated = function(self){
731 hideOutdated = function(self){
732 $('.comment-inline.comment-outdated').hide();
732 $('.comment-inline.comment-outdated').hide();
733 $('.filediff-outdated').hide();
733 $('.filediff-outdated').hide();
734 $('.hideOutdatedComments').hide();
734 $('.hideOutdatedComments').hide();
735 $('.showOutdatedComments').show();
735 $('.showOutdatedComments').show();
736 };
736 };
737
737
738 refreshMergeChecks = function(){
738 refreshMergeChecks = function(){
739 var loadUrl = "${request.current_route_path(_query=dict(merge_checks=1))}";
739 var loadUrl = "${request.current_route_path(_query=dict(merge_checks=1))}";
740 $('.pull-request-merge').css('opacity', 0.3);
740 $('.pull-request-merge').css('opacity', 0.3);
741 $('.action-buttons-extra').css('opacity', 0.3);
741 $('.action-buttons-extra').css('opacity', 0.3);
742
742
743 $('.pull-request-merge').load(
743 $('.pull-request-merge').load(
744 loadUrl, function() {
744 loadUrl, function() {
745 $('.pull-request-merge').css('opacity', 1);
745 $('.pull-request-merge').css('opacity', 1);
746
746
747 $('.action-buttons-extra').css('opacity', 1);
747 $('.action-buttons-extra').css('opacity', 1);
748 injectCloseAction();
748 injectCloseAction();
749 }
749 }
750 );
750 );
751 };
751 };
752
752
753 injectCloseAction = function() {
753 injectCloseAction = function() {
754 var closeAction = $('#close-pull-request-action').html();
754 var closeAction = $('#close-pull-request-action').html();
755 var $actionButtons = $('.action-buttons-extra');
755 var $actionButtons = $('.action-buttons-extra');
756 // clear the action before
756 // clear the action before
757 $actionButtons.html("");
757 $actionButtons.html("");
758 $actionButtons.html(closeAction);
758 $actionButtons.html(closeAction);
759 };
759 };
760
760
761 closePullRequest = function (status) {
761 closePullRequest = function (status) {
762 // inject closing flag
762 // inject closing flag
763 $('.action-buttons-extra').append('<input type="hidden" class="close-pr-input" id="close_pull_request" value="1">');
763 $('.action-buttons-extra').append('<input type="hidden" class="close-pr-input" id="close_pull_request" value="1">');
764 $(generalCommentForm.statusChange).select2("val", status).trigger('change');
764 $(generalCommentForm.statusChange).select2("val", status).trigger('change');
765 $(generalCommentForm.submitForm).submit();
765 $(generalCommentForm.submitForm).submit();
766 };
766 };
767
767
768 $('#show-outdated-comments').on('click', function(e){
768 $('#show-outdated-comments').on('click', function(e){
769 var button = $(this);
769 var button = $(this);
770 var outdated = $('.comment-outdated');
770 var outdated = $('.comment-outdated');
771
771
772 if (button.html() === "(Show)") {
772 if (button.html() === "(Show)") {
773 button.html("(Hide)");
773 button.html("(Hide)");
774 outdated.show();
774 outdated.show();
775 } else {
775 } else {
776 button.html("(Show)");
776 button.html("(Show)");
777 outdated.hide();
777 outdated.hide();
778 }
778 }
779 });
779 });
780
780
781 $('.show-inline-comments').on('change', function(e){
781 $('.show-inline-comments').on('change', function(e){
782 var show = 'none';
782 var show = 'none';
783 var target = e.currentTarget;
783 var target = e.currentTarget;
784 if(target.checked){
784 if(target.checked){
785 show = ''
785 show = ''
786 }
786 }
787 var boxid = $(target).attr('id_for');
787 var boxid = $(target).attr('id_for');
788 var comments = $('#{0} .inline-comments'.format(boxid));
788 var comments = $('#{0} .inline-comments'.format(boxid));
789 var fn_display = function(idx){
789 var fn_display = function(idx){
790 $(this).css('display', show);
790 $(this).css('display', show);
791 };
791 };
792 $(comments).each(fn_display);
792 $(comments).each(fn_display);
793 var btns = $('#{0} .inline-comments-button'.format(boxid));
793 var btns = $('#{0} .inline-comments-button'.format(boxid));
794 $(btns).each(fn_display);
794 $(btns).each(fn_display);
795 });
795 });
796
796
797 $('#merge_pull_request_form').submit(function() {
797 $('#merge_pull_request_form').submit(function() {
798 if (!$('#merge_pull_request').attr('disabled')) {
798 if (!$('#merge_pull_request').attr('disabled')) {
799 $('#merge_pull_request').attr('disabled', 'disabled');
799 $('#merge_pull_request').attr('disabled', 'disabled');
800 }
800 }
801 return true;
801 return true;
802 });
802 });
803
803
804 $('#edit_pull_request').on('click', function(e){
804 $('#edit_pull_request').on('click', function(e){
805 var title = $('#pr-title-input').val();
805 var title = $('#pr-title-input').val();
806 var description = codeMirrorInstance.getValue();
806 var description = codeMirrorInstance.getValue();
807 editPullRequest(
807 editPullRequest(
808 "${c.repo_name}", "${c.pull_request.pull_request_id}",
808 "${c.repo_name}", "${c.pull_request.pull_request_id}",
809 title, description);
809 title, description);
810 });
810 });
811
811
812 $('#update_pull_request').on('click', function(e){
812 $('#update_pull_request').on('click', function(e){
813 $(this).attr('disabled', 'disabled');
813 $(this).attr('disabled', 'disabled');
814 $(this).addClass('disabled');
814 $(this).addClass('disabled');
815 $(this).html(_gettext('Saving...'));
815 $(this).html(_gettext('Saving...'));
816 reviewersController.updateReviewers(
816 reviewersController.updateReviewers(
817 "${c.repo_name}", "${c.pull_request.pull_request_id}");
817 "${c.repo_name}", "${c.pull_request.pull_request_id}");
818 });
818 });
819
819
820 $('#update_commits').on('click', function(e){
820 $('#update_commits').on('click', function(e){
821 var isDisabled = !$(e.currentTarget).attr('disabled');
821 var isDisabled = !$(e.currentTarget).attr('disabled');
822 $(e.currentTarget).attr('disabled', 'disabled');
822 $(e.currentTarget).attr('disabled', 'disabled');
823 $(e.currentTarget).addClass('disabled');
823 $(e.currentTarget).addClass('disabled');
824 $(e.currentTarget).removeClass('btn-primary');
824 $(e.currentTarget).removeClass('btn-primary');
825 $(e.currentTarget).text(_gettext('Updating...'));
825 $(e.currentTarget).text(_gettext('Updating...'));
826 if(isDisabled){
826 if(isDisabled){
827 updateCommits(
827 updateCommits(
828 "${c.repo_name}", "${c.pull_request.pull_request_id}");
828 "${c.repo_name}", "${c.pull_request.pull_request_id}");
829 }
829 }
830 });
830 });
831 // fixing issue with caches on firefox
831 // fixing issue with caches on firefox
832 $('#update_commits').removeAttr("disabled");
832 $('#update_commits').removeAttr("disabled");
833
833
834 $('.show-inline-comments').on('click', function(e){
834 $('.show-inline-comments').on('click', function(e){
835 var boxid = $(this).attr('data-comment-id');
835 var boxid = $(this).attr('data-comment-id');
836 var button = $(this);
836 var button = $(this);
837
837
838 if(button.hasClass("comments-visible")) {
838 if(button.hasClass("comments-visible")) {
839 $('#{0} .inline-comments'.format(boxid)).each(function(index){
839 $('#{0} .inline-comments'.format(boxid)).each(function(index){
840 $(this).hide();
840 $(this).hide();
841 });
841 });
842 button.removeClass("comments-visible");
842 button.removeClass("comments-visible");
843 } else {
843 } else {
844 $('#{0} .inline-comments'.format(boxid)).each(function(index){
844 $('#{0} .inline-comments'.format(boxid)).each(function(index){
845 $(this).show();
845 $(this).show();
846 });
846 });
847 button.addClass("comments-visible");
847 button.addClass("comments-visible");
848 }
848 }
849 });
849 });
850
850
851 // register submit callback on commentForm form to track TODOs
851 // register submit callback on commentForm form to track TODOs
852 window.commentFormGlobalSubmitSuccessCallback = function(){
852 window.commentFormGlobalSubmitSuccessCallback = function(){
853 refreshMergeChecks();
853 refreshMergeChecks();
854 };
854 };
855 // initial injection
855 // initial injection
856 injectCloseAction();
856 injectCloseAction();
857
857
858 ReviewerAutoComplete('#user');
858 ReviewerAutoComplete('#user');
859
859
860 })
860 })
861 </script>
861 </script>
862
862
863 </div>
863 </div>
864 </div>
864 </div>
865
865
866 </%def>
866 </%def>
General Comments 0
You need to be logged in to leave comments. Login now