##// END OF EJS Templates
forms: unified usage of h.secure_form. Make sure we ALWAYS pass in...
marcink -
r2105:4ad1a937 default
parent child
Show More
@@ -1,81 +1,81
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
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
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
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
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