##// END OF EJS Templates
set edit mode on gists
marcink -
r4027:4eaeae84 default
parent child Browse files
Show More
@@ -1,64 +1,81
1 1 ## -*- coding: utf-8 -*-
2 2 <%inherit file="/base/base.html"/>
3 3
4 4 <%def name="title()">
5 5 ${_('New gist')} &middot; ${c.rhodecode_name}
6 6 </%def>
7 7
8 8 <%def name="js_extra()">
9 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 12 </%def>
11 13 <%def name="css_extra()">
12 14 <link rel="stylesheet" type="text/css" href="${h.url('/css/codemirror.css')}"/>
13 15 </%def>
14 16
15 17 <%def name="breadcrumbs_links()">
16 18 ${_('New gist')}
17 19 </%def>
18 20
19 21 <%def name="page_nav()">
20 22 ${self.menu('gists')}
21 23 </%def>
22 24
23 25 <%def name="main()">
24 26 <div class="box">
25 27 <!-- box / title -->
26 28 <div class="title">
27 29 ${self.breadcrumbs()}
28 30 </div>
29 31
30 32 <div class="table">
31 33 <div id="files_data">
32 34 ${h.form(h.url('gists'), method='post',id='eform')}
33 35 <div>
34 36 <div class="gravatar">
35 37 <img alt="gravatar" src="${h.gravatar_url(h.email_or_none(c.rhodecode_user.full_contact),32)}"/>
36 38 </div>
37 39 <textarea style="resize:vertical; width:400px;border: 1px solid #ccc;border-radius: 3px;" id="description" name="description" placeholder="${_('Gist description ...')}"></textarea>
38 40 </div>
39 41 <div id="body" class="codeblock">
40 <div style="padding: 10px 10px 10px 22px;color:#666666">
42 <div style="padding: 10px 10px 10px 26px;color:#666666">
41 43 ##<input type="text" value="" size="30" name="filename" id="filename" placeholder="gistfile1.txt">
42 44 ${h.text('filename', size=30, placeholder='gistfile1.txt')}
43 45 ##<input type="text" value="" size="30" name="filename" id="filename" placeholder="gistfile1.txt">
44 46 ${h.select('lifetime', '', c.lifetime_options)}
47 ${h.select('set_mode','plain',[('plain',_('plain'))])}
45 48 </div>
46 49 <div id="editor_container">
47 50 <pre id="editor_pre"></pre>
48 51 <textarea id="editor" name="content" style="display:none"></textarea>
49 52 </div>
50 53 </div>
51 54 <div style="padding-top: 5px">
52 55 ${h.submit('private',_('Create private gist'),class_="ui-btn yellow")}
53 56 ${h.submit('public',_('Create public gist'),class_="ui-btn")}
54 57 ${h.reset('reset',_('Reset'),class_="ui-btn")}
55 58 </div>
56 59 ${h.end_form()}
57 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 76 </script>
60 77 </div>
61 78 </div>
62 79
63 80 </div>
64 81 </%def>
General Comments 0
You need to be logged in to leave comments. Login now