##// END OF EJS Templates
old style: fix the contextbar location
old style: fix the contextbar location

File last commit:

r4116:ffd45b18 rhodecode-2.2.5-gpl
r4141:fe4e9a7d rhodecode-2.2.5-gpl
Show More
new.html
110 lines | 4.3 KiB | text/html | HtmlLexer
Implemented simple gist functionality ref #530....
r3840 ## -*- coding: utf-8 -*-
<%inherit file="/base/base.html"/>
<%def name="title()">
Bradley M. Kuhn
Imported some of the GPLv3'd changes from RhodeCode v2.2.5....
r4116 ${_('New Gist')}
%if c.rhodecode_name:
&middot; ${c.rhodecode_name}
%endif
Implemented simple gist functionality ref #530....
r3840 </%def>
<%def name="js_extra()">
<script type="text/javascript" src="${h.url('/js/codemirror.js')}"></script>
set edit mode on gists
r4027 <script type="text/javascript" src="${h.url('/js/codemirror_loadmode.js')}"></script>
<script type="text/javascript" src="${h.url('/js/mode/meta.js')}"></script>
Use META_TO_EXT in separate file and import it only in gists template
r4071 <script type="text/javascript" src="${h.url('/js/mode/meta_ext.js')}"></script>
Implemented simple gist functionality ref #530....
r3840 </%def>
<%def name="css_extra()">
<link rel="stylesheet" type="text/css" href="${h.url('/css/codemirror.css')}"/>
</%def>
<%def name="breadcrumbs_links()">
Bradley M. Kuhn
Imported some of the GPLv3'd changes from RhodeCode v2.2.5....
r4116 ${_('New Gist')}
Implemented simple gist functionality ref #530....
r3840 </%def>
<%def name="page_nav()">
${self.menu('gists')}
</%def>
<%def name="main()">
<div class="box">
<!-- box / title -->
<div class="title">
${self.breadcrumbs()}
</div>
<div class="table">
<div id="files_data">
${h.form(h.url('gists'), method='post',id='eform')}
<div>
<div class="gravatar">
<img alt="gravatar" src="${h.gravatar_url(h.email_or_none(c.rhodecode_user.full_contact),32)}"/>
</div>
<textarea style="resize:vertical; width:400px;border: 1px solid #ccc;border-radius: 3px;" id="description" name="description" placeholder="${_('Gist description ...')}"></textarea>
Added codemirror syntax mode in gists....
r4030 <div style="padding:0px 0px 0px 42px">
<label for='lifetime'>${_('Gist lifetime')}</label>
${h.select('lifetime', '', c.lifetime_options)}
</div>
Implemented simple gist functionality ref #530....
r3840 </div>
<div id="body" class="codeblock">
set edit mode on gists
r4027 <div style="padding: 10px 10px 10px 26px;color:#666666">
Bradley M. Kuhn
Imported some of the GPLv3'd changes from RhodeCode v2.2.5....
r4116 ${h.text('filename', size=30, placeholder=_('name this file...'))}
Added codemirror syntax mode in gists....
r4030 ${h.select('mimetype','plain',[('plain',_('plain'))])}
Implemented simple gist functionality ref #530....
r3840 </div>
<div id="editor_container">
<pre id="editor_pre"></pre>
<textarea id="editor" name="content" style="display:none"></textarea>
</div>
</div>
<div style="padding-top: 5px">
Bradley M. Kuhn
Imported some of the GPLv3'd changes from RhodeCode v2.2.5....
r4116 ${h.submit('private',_('Create Private Gist'),class_="btn btn-mini btn-success")}
${h.submit('public',_('Create Public Gist'),class_="btn btn-mini")}
${h.reset('reset',_('Reset'),class_="btn btn-mini")}
Implemented simple gist functionality ref #530....
r3840 </div>
${h.end_form()}
<script type="text/javascript">
set edit mode on gists
r4027 var myCodeMirror = initCodeMirror('editor', '');
CodeMirror.modeURL = "${h.url('/js/mode/%N/%N.js')}";
//inject new modes
Bradley M. Kuhn
Imported some of the GPLv3'd changes from RhodeCode v2.2.5....
r4116 var modes_select = $('#mimetype');
set edit mode on gists
r4027 for(var i=0;i<CodeMirror.modeInfo.length;i++){
var m = CodeMirror.modeInfo[i];
Added codemirror syntax mode in gists....
r4030 var opt = new Option(m.name, m.mime);
YUD.setAttribute(opt, 'mode', m.mode)
Bradley M. Kuhn
Imported some of the GPLv3'd changes from RhodeCode v2.2.5....
r4116 modes_select[0].options[i+1] = opt;
set edit mode on gists
r4027 }
Bradley M. Kuhn
Imported some of the GPLv3'd changes from RhodeCode v2.2.5....
r4116
var filename_selector = '#filename';
// on select change set new mode
modes_select.on('change', function(e){
set edit mode on gists
r4027 var selected = e.currentTarget;
Added codemirror syntax mode in gists....
r4030 var node = selected.options[selected.selectedIndex];
var mimetype = node.value;
var new_mode = YUD.getAttribute(node, 'mode')
set edit mode on gists
r4027 setCodeMirrorMode(myCodeMirror, new_mode);
Added codemirror syntax mode in gists....
r4030
Bradley M. Kuhn
Imported some of the GPLv3'd changes from RhodeCode v2.2.5....
r4116 var proposed_ext = getExtFromMimeType(mimetype);
var file_data = getFilenameAndExt($(filename_selector).val());
var filename = file_data['filename'] || 'filename1';
$(filename_selector).val(filename + proposed_ext);
})
// on type the new filename set mode
$(filename_selector).on('keyup', function(e){
var file_data = getFilenameAndExt(this.value);
if(file_data['ext'] != null){
var mimetype = getMimeTypeFromExt(file_data['ext']);
var detected_mode = detectCodeMirrorMode(this.value, mimetype);
if (detected_mode){
setCodeMirrorMode(myCodeMirror, detected_mode);
modes_select.val(mimetype)
}
Added codemirror syntax mode in gists....
r4030 }
set edit mode on gists
r4027 })
Implemented simple gist functionality ref #530....
r3840 </script>
</div>
</div>
</div>
</%def>