theme selector (js part)
This commit is contained in:
@@ -74,6 +74,26 @@ jQuery(document).on('click', 'a.editor_filelink', function (e) {
|
|||||||
load_file(url);
|
load_file(url);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// change the codemirror theme
|
||||||
|
jQuery(document).on('click', '#themes a', function (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
var href = jQuery(this).attr('href');
|
||||||
|
var name = jQuery(this).text().replace('.css', '');
|
||||||
|
var link = jQuery("<link>");
|
||||||
|
link.attr({
|
||||||
|
type: 'text/css',
|
||||||
|
rel: 'stylesheet',
|
||||||
|
href: href
|
||||||
|
});
|
||||||
|
jQuery("head").append( link );
|
||||||
|
jQuery('textarea[name="data"]') .each(function(id, ta) {
|
||||||
|
editor = jQuery(ta).data('editor');
|
||||||
|
editor.setOption("theme", name);
|
||||||
|
});
|
||||||
|
jQuery('#themeName').html(name);
|
||||||
|
//#TODO save on session
|
||||||
|
});
|
||||||
|
|
||||||
function isFullScreen(instance) {
|
function isFullScreen(instance) {
|
||||||
return /\bCodeMirror-fullscreen\b/.test(instance.getWrapperElement().className);
|
return /\bCodeMirror-fullscreen\b/.test(instance.getWrapperElement().className);
|
||||||
}
|
}
|
||||||
@@ -121,13 +141,22 @@ jQuery(document).on('click', 'a.editor_filelink', function (e) {
|
|||||||
|
|
||||||
|
|
||||||
<div class='row-fluid'>
|
<div class='row-fluid'>
|
||||||
<p class="right controls pull-right">
|
<div class="right controls pull-right">
|
||||||
|
<div class="dropdown pull-left">
|
||||||
|
<a class="dropdown-toggle button btn" data-target="themes" data-toggle="dropdown" href="#" >Theme: <span id="themeName" style="color: #E8953C">Web2py</span> <span class="caret"></span></a>
|
||||||
|
<ul class="dropdown-menu" role="menu" id="themes">
|
||||||
|
{{for f in listfiles('admin', "static/codemirror/theme", regexp='.*\.css$' ):}}
|
||||||
|
<li class=""><a href="{{=URL('static/codemirror/theme', f, host=True)}}">{{=f[:-4]}}</a></li>
|
||||||
|
{{pass}}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
{{=button(URL('design',args=request.vars.app if request.vars.app else request.args[0], anchor=request.vars.id), T('back'))}}
|
{{=button(URL('design',args=request.vars.app if request.vars.app else request.args[0], anchor=request.vars.id), T('back'))}}
|
||||||
{{#if request.args[1]=='models':}}
|
{{#if request.args[1]=='models':}}
|
||||||
<a class="button btn" href="http://www.web2py.com/sqldesigner" target="_blank"><span>{{=T('online designer')}}</span></a>
|
<a class="button btn" href="http://www.web2py.com/sqldesigner" target="_blank"><span>{{=T('online designer')}}</span></a>
|
||||||
{{#pass}}
|
{{#pass}}
|
||||||
<a class="button btn" href="http://www.web2py.com/examples/static/epydoc/index.html" target="_blank"><span>{{=T('docs')}}</span></a>
|
<a class="button btn" href="http://www.web2py.com/examples/static/epydoc/index.html" target="_blank"><span>{{=T('docs')}}</span></a>
|
||||||
</p>
|
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="editor_area" class="row-fluid">
|
<div id="editor_area" class="row-fluid">
|
||||||
<ul class="nav nav-list span2 well" rel="pagebookmark" id="filelist">
|
<ul class="nav nav-list span2 well" rel="pagebookmark" id="filelist">
|
||||||
|
|||||||
Reference in New Issue
Block a user