Show More
@@ -1,64 +1,81 | |||||
1 | ## -*- coding: utf-8 -*- |
|
1 | ## -*- coding: utf-8 -*- | |
2 | <%inherit file="/base/base.html"/> |
|
2 | <%inherit file="/base/base.html"/> | |
3 |
|
3 | |||
4 | <%def name="title()"> |
|
4 | <%def name="title()"> | |
5 | ${_('New gist')} · ${c.rhodecode_name} |
|
5 | ${_('New gist')} · ${c.rhodecode_name} | |
6 | </%def> |
|
6 | </%def> | |
7 |
|
7 | |||
8 | <%def name="js_extra()"> |
|
8 | <%def name="js_extra()"> | |
9 | <script type="text/javascript" src="${h.url('/js/codemirror.js')}"></script> |
|
9 | <script type="text/javascript" src="${h.url('/js/codemirror.js')}"></script> | |
|
10 | <script type="text/javascript" src="${h.url('/js/codemirror_loadmode.js')}"></script> | |||
|
11 | <script type="text/javascript" src="${h.url('/js/mode/meta.js')}"></script> | |||
10 | </%def> |
|
12 | </%def> | |
11 | <%def name="css_extra()"> |
|
13 | <%def name="css_extra()"> | |
12 | <link rel="stylesheet" type="text/css" href="${h.url('/css/codemirror.css')}"/> |
|
14 | <link rel="stylesheet" type="text/css" href="${h.url('/css/codemirror.css')}"/> | |
13 | </%def> |
|
15 | </%def> | |
14 |
|
16 | |||
15 | <%def name="breadcrumbs_links()"> |
|
17 | <%def name="breadcrumbs_links()"> | |
16 | ${_('New gist')} |
|
18 | ${_('New gist')} | |
17 | </%def> |
|
19 | </%def> | |
18 |
|
20 | |||
19 | <%def name="page_nav()"> |
|
21 | <%def name="page_nav()"> | |
20 | ${self.menu('gists')} |
|
22 | ${self.menu('gists')} | |
21 | </%def> |
|
23 | </%def> | |
22 |
|
24 | |||
23 | <%def name="main()"> |
|
25 | <%def name="main()"> | |
24 | <div class="box"> |
|
26 | <div class="box"> | |
25 | <!-- box / title --> |
|
27 | <!-- box / title --> | |
26 | <div class="title"> |
|
28 | <div class="title"> | |
27 | ${self.breadcrumbs()} |
|
29 | ${self.breadcrumbs()} | |
28 | </div> |
|
30 | </div> | |
29 |
|
31 | |||
30 | <div class="table"> |
|
32 | <div class="table"> | |
31 | <div id="files_data"> |
|
33 | <div id="files_data"> | |
32 | ${h.form(h.url('gists'), method='post',id='eform')} |
|
34 | ${h.form(h.url('gists'), method='post',id='eform')} | |
33 | <div> |
|
35 | <div> | |
34 | <div class="gravatar"> |
|
36 | <div class="gravatar"> | |
35 | <img alt="gravatar" src="${h.gravatar_url(h.email_or_none(c.rhodecode_user.full_contact),32)}"/> |
|
37 | <img alt="gravatar" src="${h.gravatar_url(h.email_or_none(c.rhodecode_user.full_contact),32)}"/> | |
36 | </div> |
|
38 | </div> | |
37 | <textarea style="resize:vertical; width:400px;border: 1px solid #ccc;border-radius: 3px;" id="description" name="description" placeholder="${_('Gist description ...')}"></textarea> |
|
39 | <textarea style="resize:vertical; width:400px;border: 1px solid #ccc;border-radius: 3px;" id="description" name="description" placeholder="${_('Gist description ...')}"></textarea> | |
38 | </div> |
|
40 | </div> | |
39 | <div id="body" class="codeblock"> |
|
41 | <div id="body" class="codeblock"> | |
40 |
<div style="padding: 10px 10px 10px 2 |
|
42 | <div style="padding: 10px 10px 10px 26px;color:#666666"> | |
41 | ##<input type="text" value="" size="30" name="filename" id="filename" placeholder="gistfile1.txt"> |
|
43 | ##<input type="text" value="" size="30" name="filename" id="filename" placeholder="gistfile1.txt"> | |
42 | ${h.text('filename', size=30, placeholder='gistfile1.txt')} |
|
44 | ${h.text('filename', size=30, placeholder='gistfile1.txt')} | |
43 | ##<input type="text" value="" size="30" name="filename" id="filename" placeholder="gistfile1.txt"> |
|
45 | ##<input type="text" value="" size="30" name="filename" id="filename" placeholder="gistfile1.txt"> | |
44 | ${h.select('lifetime', '', c.lifetime_options)} |
|
46 | ${h.select('lifetime', '', c.lifetime_options)} | |
|
47 | ${h.select('set_mode','plain',[('plain',_('plain'))])} | |||
45 | </div> |
|
48 | </div> | |
46 | <div id="editor_container"> |
|
49 | <div id="editor_container"> | |
47 | <pre id="editor_pre"></pre> |
|
50 | <pre id="editor_pre"></pre> | |
48 | <textarea id="editor" name="content" style="display:none"></textarea> |
|
51 | <textarea id="editor" name="content" style="display:none"></textarea> | |
49 | </div> |
|
52 | </div> | |
50 | </div> |
|
53 | </div> | |
51 | <div style="padding-top: 5px"> |
|
54 | <div style="padding-top: 5px"> | |
52 | ${h.submit('private',_('Create private gist'),class_="ui-btn yellow")} |
|
55 | ${h.submit('private',_('Create private gist'),class_="ui-btn yellow")} | |
53 | ${h.submit('public',_('Create public gist'),class_="ui-btn")} |
|
56 | ${h.submit('public',_('Create public gist'),class_="ui-btn")} | |
54 | ${h.reset('reset',_('Reset'),class_="ui-btn")} |
|
57 | ${h.reset('reset',_('Reset'),class_="ui-btn")} | |
55 | </div> |
|
58 | </div> | |
56 | ${h.end_form()} |
|
59 | ${h.end_form()} | |
57 | <script type="text/javascript"> |
|
60 | <script type="text/javascript"> | |
58 | initCodeMirror('editor',''); |
|
61 | var myCodeMirror = initCodeMirror('editor', ''); | |
|
62 | CodeMirror.modeURL = "${h.url('/js/mode/%N/%N.js')}"; | |||
|
63 | ||||
|
64 | //inject new modes | |||
|
65 | var modes_select = YUD.get('set_mode'); | |||
|
66 | for(var i=0;i<CodeMirror.modeInfo.length;i++){ | |||
|
67 | var m = CodeMirror.modeInfo[i]; | |||
|
68 | var opt = new Option(m.name, m.mode); | |||
|
69 | modes_select.options[i+1] = opt | |||
|
70 | } | |||
|
71 | YUE.on(modes_select, 'change', function(e){ | |||
|
72 | var selected = e.currentTarget; | |||
|
73 | var new_mode = selected.options[selected.selectedIndex].value; | |||
|
74 | setCodeMirrorMode(myCodeMirror, new_mode); | |||
|
75 | }) | |||
59 | </script> |
|
76 | </script> | |
60 | </div> |
|
77 | </div> | |
61 | </div> |
|
78 | </div> | |
62 |
|
79 | |||
63 | </div> |
|
80 | </div> | |
64 | </%def> |
|
81 | </%def> |
General Comments 0
You need to be logged in to leave comments.
Login now