Mercurial > kallithea
annotate rhodecode/templates/admin/gists/new.html @ 4116:ffd45b185016 rhodecode-2.2.5-gpl
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
This imports changes between changesets 21af6c4eab3d and 6177597791c2 in
RhodeCode's original repository, including only changes to Python files and HTML.
RhodeCode clearly licensed its changes to these files under GPLv3
in their /LICENSE file, which states the following:
The Python code and integrated HTML are licensed under the GPLv3 license.
(See:
https://code.rhodecode.com/rhodecode/files/v2.2.5/LICENSE
or
http://web.archive.org/web/20140512193334/https://code.rhodecode.com/rhodecode/files/f3b123159901f15426d18e3dc395e8369f70ebe0/LICENSE
for an online copy of that LICENSE file)
Conservancy reviewed these changes and confirmed that they can be licensed as
a whole to the Kallithea project under GPLv3-only.
While some of the contents committed herein are clearly licensed
GPLv3-or-later, on the whole we must assume the are GPLv3-only, since the
statement above from RhodeCode indicates that they intend GPLv3-only as their
license, per GPLv3ยง14 and other relevant sections of GPLv3.
author | Bradley M. Kuhn <bkuhn@sfconservancy.org> |
---|---|
date | Wed, 02 Jul 2014 19:03:13 -0400 |
parents | 35fcc232f652 |
children |
rev | line source |
---|---|
3840
dc4644865e8b
Implemented simple gist functionality ref #530.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
1 ## -*- coding: utf-8 -*- |
dc4644865e8b
Implemented simple gist functionality ref #530.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
2 <%inherit file="/base/base.html"/> |
dc4644865e8b
Implemented simple gist functionality ref #530.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
3 |
dc4644865e8b
Implemented simple gist functionality ref #530.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
4 <%def name="title()"> |
4116
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4071
diff
changeset
|
5 ${_('New Gist')} |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4071
diff
changeset
|
6 %if c.rhodecode_name: |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4071
diff
changeset
|
7 · ${c.rhodecode_name} |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4071
diff
changeset
|
8 %endif |
3840
dc4644865e8b
Implemented simple gist functionality ref #530.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
9 </%def> |
dc4644865e8b
Implemented simple gist functionality ref #530.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
10 |
dc4644865e8b
Implemented simple gist functionality ref #530.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
11 <%def name="js_extra()"> |
dc4644865e8b
Implemented simple gist functionality ref #530.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
12 <script type="text/javascript" src="${h.url('/js/codemirror.js')}"></script> |
4027
4eaeae84f474
set edit mode on gists
Marcin Kuzminski <marcin@python-works.com>
parents:
3840
diff
changeset
|
13 <script type="text/javascript" src="${h.url('/js/codemirror_loadmode.js')}"></script> |
4eaeae84f474
set edit mode on gists
Marcin Kuzminski <marcin@python-works.com>
parents:
3840
diff
changeset
|
14 <script type="text/javascript" src="${h.url('/js/mode/meta.js')}"></script> |
4071
35fcc232f652
Use META_TO_EXT in separate file and import it only in gists template
Marcin Kuzminski <marcin@python-works.com>
parents:
4030
diff
changeset
|
15 <script type="text/javascript" src="${h.url('/js/mode/meta_ext.js')}"></script> |
3840
dc4644865e8b
Implemented simple gist functionality ref #530.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
16 </%def> |
dc4644865e8b
Implemented simple gist functionality ref #530.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
17 <%def name="css_extra()"> |
dc4644865e8b
Implemented simple gist functionality ref #530.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
18 <link rel="stylesheet" type="text/css" href="${h.url('/css/codemirror.css')}"/> |
dc4644865e8b
Implemented simple gist functionality ref #530.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
19 </%def> |
dc4644865e8b
Implemented simple gist functionality ref #530.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
20 |
dc4644865e8b
Implemented simple gist functionality ref #530.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
21 <%def name="breadcrumbs_links()"> |
4116
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4071
diff
changeset
|
22 ${_('New Gist')} |
3840
dc4644865e8b
Implemented simple gist functionality ref #530.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
23 </%def> |
dc4644865e8b
Implemented simple gist functionality ref #530.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
24 |
dc4644865e8b
Implemented simple gist functionality ref #530.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
25 <%def name="page_nav()"> |
dc4644865e8b
Implemented simple gist functionality ref #530.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
26 ${self.menu('gists')} |
dc4644865e8b
Implemented simple gist functionality ref #530.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
27 </%def> |
dc4644865e8b
Implemented simple gist functionality ref #530.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
28 |
dc4644865e8b
Implemented simple gist functionality ref #530.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
29 <%def name="main()"> |
dc4644865e8b
Implemented simple gist functionality ref #530.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
30 <div class="box"> |
dc4644865e8b
Implemented simple gist functionality ref #530.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
31 <!-- box / title --> |
dc4644865e8b
Implemented simple gist functionality ref #530.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
32 <div class="title"> |
dc4644865e8b
Implemented simple gist functionality ref #530.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
33 ${self.breadcrumbs()} |
dc4644865e8b
Implemented simple gist functionality ref #530.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
34 </div> |
dc4644865e8b
Implemented simple gist functionality ref #530.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
35 |
dc4644865e8b
Implemented simple gist functionality ref #530.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
36 <div class="table"> |
dc4644865e8b
Implemented simple gist functionality ref #530.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
37 <div id="files_data"> |
dc4644865e8b
Implemented simple gist functionality ref #530.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
38 ${h.form(h.url('gists'), method='post',id='eform')} |
dc4644865e8b
Implemented simple gist functionality ref #530.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
39 <div> |
dc4644865e8b
Implemented simple gist functionality ref #530.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
40 <div class="gravatar"> |
dc4644865e8b
Implemented simple gist functionality ref #530.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
41 <img alt="gravatar" src="${h.gravatar_url(h.email_or_none(c.rhodecode_user.full_contact),32)}"/> |
dc4644865e8b
Implemented simple gist functionality ref #530.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
42 </div> |
dc4644865e8b
Implemented simple gist functionality ref #530.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
43 <textarea style="resize:vertical; width:400px;border: 1px solid #ccc;border-radius: 3px;" id="description" name="description" placeholder="${_('Gist description ...')}"></textarea> |
4030
647308db13ff
Added codemirror syntax mode in gists.
Marcin Kuzminski <marcin@python-works.com>
parents:
4027
diff
changeset
|
44 <div style="padding:0px 0px 0px 42px"> |
647308db13ff
Added codemirror syntax mode in gists.
Marcin Kuzminski <marcin@python-works.com>
parents:
4027
diff
changeset
|
45 <label for='lifetime'>${_('Gist lifetime')}</label> |
647308db13ff
Added codemirror syntax mode in gists.
Marcin Kuzminski <marcin@python-works.com>
parents:
4027
diff
changeset
|
46 ${h.select('lifetime', '', c.lifetime_options)} |
647308db13ff
Added codemirror syntax mode in gists.
Marcin Kuzminski <marcin@python-works.com>
parents:
4027
diff
changeset
|
47 </div> |
3840
dc4644865e8b
Implemented simple gist functionality ref #530.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
48 </div> |
dc4644865e8b
Implemented simple gist functionality ref #530.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
49 <div id="body" class="codeblock"> |
4027
4eaeae84f474
set edit mode on gists
Marcin Kuzminski <marcin@python-works.com>
parents:
3840
diff
changeset
|
50 <div style="padding: 10px 10px 10px 26px;color:#666666"> |
4116
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4071
diff
changeset
|
51 ${h.text('filename', size=30, placeholder=_('name this file...'))} |
4030
647308db13ff
Added codemirror syntax mode in gists.
Marcin Kuzminski <marcin@python-works.com>
parents:
4027
diff
changeset
|
52 ${h.select('mimetype','plain',[('plain',_('plain'))])} |
3840
dc4644865e8b
Implemented simple gist functionality ref #530.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
53 </div> |
dc4644865e8b
Implemented simple gist functionality ref #530.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
54 <div id="editor_container"> |
dc4644865e8b
Implemented simple gist functionality ref #530.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
55 <pre id="editor_pre"></pre> |
dc4644865e8b
Implemented simple gist functionality ref #530.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
56 <textarea id="editor" name="content" style="display:none"></textarea> |
dc4644865e8b
Implemented simple gist functionality ref #530.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
57 </div> |
dc4644865e8b
Implemented simple gist functionality ref #530.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
58 </div> |
dc4644865e8b
Implemented simple gist functionality ref #530.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
59 <div style="padding-top: 5px"> |
4116
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4071
diff
changeset
|
60 ${h.submit('private',_('Create Private Gist'),class_="btn btn-mini btn-success")} |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4071
diff
changeset
|
61 ${h.submit('public',_('Create Public Gist'),class_="btn btn-mini")} |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4071
diff
changeset
|
62 ${h.reset('reset',_('Reset'),class_="btn btn-mini")} |
3840
dc4644865e8b
Implemented simple gist functionality ref #530.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
63 </div> |
dc4644865e8b
Implemented simple gist functionality ref #530.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
64 ${h.end_form()} |
dc4644865e8b
Implemented simple gist functionality ref #530.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
65 <script type="text/javascript"> |
4027
4eaeae84f474
set edit mode on gists
Marcin Kuzminski <marcin@python-works.com>
parents:
3840
diff
changeset
|
66 var myCodeMirror = initCodeMirror('editor', ''); |
4eaeae84f474
set edit mode on gists
Marcin Kuzminski <marcin@python-works.com>
parents:
3840
diff
changeset
|
67 CodeMirror.modeURL = "${h.url('/js/mode/%N/%N.js')}"; |
4eaeae84f474
set edit mode on gists
Marcin Kuzminski <marcin@python-works.com>
parents:
3840
diff
changeset
|
68 |
4eaeae84f474
set edit mode on gists
Marcin Kuzminski <marcin@python-works.com>
parents:
3840
diff
changeset
|
69 //inject new modes |
4116
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4071
diff
changeset
|
70 var modes_select = $('#mimetype'); |
4027
4eaeae84f474
set edit mode on gists
Marcin Kuzminski <marcin@python-works.com>
parents:
3840
diff
changeset
|
71 for(var i=0;i<CodeMirror.modeInfo.length;i++){ |
4eaeae84f474
set edit mode on gists
Marcin Kuzminski <marcin@python-works.com>
parents:
3840
diff
changeset
|
72 var m = CodeMirror.modeInfo[i]; |
4030
647308db13ff
Added codemirror syntax mode in gists.
Marcin Kuzminski <marcin@python-works.com>
parents:
4027
diff
changeset
|
73 var opt = new Option(m.name, m.mime); |
647308db13ff
Added codemirror syntax mode in gists.
Marcin Kuzminski <marcin@python-works.com>
parents:
4027
diff
changeset
|
74 YUD.setAttribute(opt, 'mode', m.mode) |
4116
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4071
diff
changeset
|
75 modes_select[0].options[i+1] = opt; |
4027
4eaeae84f474
set edit mode on gists
Marcin Kuzminski <marcin@python-works.com>
parents:
3840
diff
changeset
|
76 } |
4116
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4071
diff
changeset
|
77 |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4071
diff
changeset
|
78 var filename_selector = '#filename'; |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4071
diff
changeset
|
79 // on select change set new mode |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4071
diff
changeset
|
80 modes_select.on('change', function(e){ |
4027
4eaeae84f474
set edit mode on gists
Marcin Kuzminski <marcin@python-works.com>
parents:
3840
diff
changeset
|
81 var selected = e.currentTarget; |
4030
647308db13ff
Added codemirror syntax mode in gists.
Marcin Kuzminski <marcin@python-works.com>
parents:
4027
diff
changeset
|
82 var node = selected.options[selected.selectedIndex]; |
647308db13ff
Added codemirror syntax mode in gists.
Marcin Kuzminski <marcin@python-works.com>
parents:
4027
diff
changeset
|
83 var mimetype = node.value; |
647308db13ff
Added codemirror syntax mode in gists.
Marcin Kuzminski <marcin@python-works.com>
parents:
4027
diff
changeset
|
84 var new_mode = YUD.getAttribute(node, 'mode') |
4027
4eaeae84f474
set edit mode on gists
Marcin Kuzminski <marcin@python-works.com>
parents:
3840
diff
changeset
|
85 setCodeMirrorMode(myCodeMirror, new_mode); |
4030
647308db13ff
Added codemirror syntax mode in gists.
Marcin Kuzminski <marcin@python-works.com>
parents:
4027
diff
changeset
|
86 |
4116
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4071
diff
changeset
|
87 var proposed_ext = getExtFromMimeType(mimetype); |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4071
diff
changeset
|
88 var file_data = getFilenameAndExt($(filename_selector).val()); |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4071
diff
changeset
|
89 var filename = file_data['filename'] || 'filename1'; |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4071
diff
changeset
|
90 $(filename_selector).val(filename + proposed_ext); |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4071
diff
changeset
|
91 }) |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4071
diff
changeset
|
92 |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4071
diff
changeset
|
93 // on type the new filename set mode |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4071
diff
changeset
|
94 $(filename_selector).on('keyup', function(e){ |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4071
diff
changeset
|
95 var file_data = getFilenameAndExt(this.value); |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4071
diff
changeset
|
96 if(file_data['ext'] != null){ |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4071
diff
changeset
|
97 var mimetype = getMimeTypeFromExt(file_data['ext']); |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4071
diff
changeset
|
98 var detected_mode = detectCodeMirrorMode(this.value, mimetype); |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4071
diff
changeset
|
99 if (detected_mode){ |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4071
diff
changeset
|
100 setCodeMirrorMode(myCodeMirror, detected_mode); |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4071
diff
changeset
|
101 modes_select.val(mimetype) |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4071
diff
changeset
|
102 } |
4030
647308db13ff
Added codemirror syntax mode in gists.
Marcin Kuzminski <marcin@python-works.com>
parents:
4027
diff
changeset
|
103 } |
4027
4eaeae84f474
set edit mode on gists
Marcin Kuzminski <marcin@python-works.com>
parents:
3840
diff
changeset
|
104 }) |
3840
dc4644865e8b
Implemented simple gist functionality ref #530.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
105 </script> |
dc4644865e8b
Implemented simple gist functionality ref #530.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
106 </div> |
dc4644865e8b
Implemented simple gist functionality ref #530.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
107 </div> |
dc4644865e8b
Implemented simple gist functionality ref #530.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
108 |
dc4644865e8b
Implemented simple gist functionality ref #530.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
109 </div> |
dc4644865e8b
Implemented simple gist functionality ref #530.
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
110 </%def> |