Refactored skin editor

This commit is contained in:
Tobi Schäfer 2015-01-01 21:12:25 +01:00
parent 5241817470
commit a65a9d9a10
3 changed files with 39 additions and 47 deletions

View file

@ -14,7 +14,8 @@
<% #edit %> <% #edit %>
<form class='uk-form' method="post" action="<% response.action %>"> <form class='uk-form' method="post" action="<% response.action %>">
<h1 class='uk-margin-right' style='float: left;'><% response.title %></h1> <div class='uk-margin-top uk-margin-left'>
<h1 class='uk-margin-large-right' style='float: left;'><% response.title %></h1>
<span style='line-height: 42px;'> <span style='line-height: 42px;'>
<% if <% skin.name %> is '' then <% if <% skin.name %> is '' then
<% skin.select prototype suffix=<% skin.input name class='uk-width-1-4' %> %> <% skin.select prototype suffix=<% skin.input name class='uk-width-1-4' %> %>
@ -29,6 +30,7 @@
</button> </button>
<a href="" class='cancel uk-button uk-button-link'><% gettext Cancel %></a> <a href="" class='cancel uk-button uk-button-link'><% gettext Cancel %></a>
</span> </span>
</div>
<div style='clear: both;'> <div style='clear: both;'>
<% response.message prefix="<div class='uk-alert' data-uk-alert>" suffix=</div> %> <% response.message prefix="<div class='uk-alert' data-uk-alert>" suffix=</div> %>
<% skin.textarea source %> <% skin.textarea source %>
@ -45,25 +47,29 @@ $(function() {
mode = 'application/x-helma-skin'; mode = 'application/x-helma-skin';
} }
var editor = CodeMirror.fromTextArea($('#source').get(0), { var editor = CodeMirror.fromTextArea($('#source').get(0), {
autofocus: true,
enterMode: 'keep',
indentUnit: 3,
indentWithTabs: false,
lineNumbers: true, lineNumbers: true,
matchBrackets: true, matchBrackets: true,
mode: mode, mode: mode,
indentUnit: 2, tabMode: 'shift',
indentWithTabs: false, viewportMargin: Infinity
enterMode: 'keep',
tabMode: 'shift'
}); });
}); });
</script> </script>
<% #compare %> <% #compare %>
<form> <form>
<div class='uk-margin-top uk-margin-left'>
<h1 class='uk-margin-large-right' style='float: left;'><% response.title %></h1> <h1 class='uk-margin-large-right' style='float: left;'><% response.title %></h1>
<span style='line-height: 42px;'> <span style='line-height: 42px;'>
<% skin.link edit <% gettext Edit %> class='uk-button uk-button-primary' style='color: #fff;' %> <% skin.link edit <% gettext Edit %> class='uk-button uk-button-primary' style='color: #fff;' %>
<% skin.link reset <% gettext Reset %> class='uk-button' %> <% skin.link reset <% gettext Reset %> class='uk-button' %>
<a href='' class='cancel uk-button uk-button-link'><% gettext Cancel %></a> <a href='' class='cancel uk-button uk-button-link'><% gettext Cancel %></a>
</span> </span>
</div>
<div style='clear: both;'> <div style='clear: both;'>
<% response.message prefix="<div class='uk-alert' data-uk-alert>" suffix=</div> %> <% response.message prefix="<div class='uk-alert' data-uk-alert>" suffix=</div> %>
<table class="diff"> <table class="diff">

View file

@ -114,8 +114,10 @@ Skin.prototype.getPermission = function(action) {
switch (action) { switch (action) {
case '.': case '.':
case 'main': case 'main':
case 'edit':
return true; return true;
case 'edit':
return res.handlers.layout.getPermission('main');
} }
return this.isPersistent() && res.handlers.skins.getPermission('main'); return this.isPersistent() && res.handlers.skins.getPermission('main');
} }

View file

@ -5,22 +5,19 @@
<meta charset='utf-8'> <meta charset='utf-8'>
<title><% response.title %></title> <title><% response.title %></title>
<link rel="stylesheet" type="text/css" title="CSS Stylesheet" href="<% site.href main.css %>" /> <link rel="stylesheet" type="text/css" title="CSS Stylesheet" href="<% site.href main.css %>" />
<link rel='stylesheet' href='<% root.static codemirror.css %>'> <link rel='stylesheet' type='text/css' href='<% root.static ../../styles/main.min.css %>'>
<link rel='stylesheet' type='text/css' href='<% root.static uikit-2.11.0/css/uikit.almost-flat.css %>'>
<style type="text/css"> <style type="text/css">
body { body {
margin: 10px; margin: 0;
padding: 0; padding: 0;
} }
.cm-helma-macro { .cm-helma-macro {
color: #000; color: #000;
} }
.CodeMirror-scroll { .CodeMirror {
height: auto; height: auto;
min-height: 500px; border-top: 1px solid #eee;
background: #fff;
border: 1px solid #eee;
} }
/* classes for skin diff */ /* classes for skin diff */
.diff { .diff {
@ -51,23 +48,10 @@
} }
</style> </style>
<script type='text/javascript' src='//code.jquery.com/jquery-1.11.0.min.js'></script>
<script type='text/javascript' src='<% site.href main.js %>'></script> <script type='text/javascript' src='<% site.href main.js %>'></script>
<script type='text/javascript' src='<% root.static uikit-2.11.0/js/uikit.js %>'></script>
<script type='text/javascript' src='<% root.static codemirror-custom.min.js %>'></script>
<!-- Individual includes for testing purposes
<link rel='stylesheet' href='<% root.static codemirror2/mode/helma/skin.css %>'>
<script type='text/javascript' src='<% root.static codemirror2/lib/codemirror.js %>'></script>
<script type='text/javascript' src='<% root.static codemirror2/mode/javascript/javascript.js %>'></script>
<script type='text/javascript' src='<% root.static codemirror2/mode/css/css.js %>'></script>
<script type='text/javascript' src='<% root.static codemirror2/mode/xml/xml.js %>'></script>
<script type='text/javascript' src='<% root.static codemirror2/mode/htmlmixed/htmlmixed.js %>'></script>
<script type='text/javascript' src='<% root.static codemirror2/mode/helma/skin.js %>'></script>
-->
</head> </head>
<body> <body>
<span style='float: right;'><% image /smallchaos.gif | link <% layout.skins.href %> %></span> <span style='float: right; margin: 10px;'><% image /smallchaos.gif | link <% layout.skins.href %> %></span>
<% response.body %> <% response.body %>
</body> </body>
</html> </html>