1
0
Fork 0
mirror of https://github.com/perlbot/perlbuut-pastebin synced 2025-06-09 07:06:25 -04:00
perlbuut-pastebin/templates/editor.html
2016-06-18 15:25:34 -04:00

89 lines
2.2 KiB
HTML
Executable file

[% BLOCK body_style %]
<style type="text/css" media="screen">
#editor {
margin: auto;
position: relative !important;
width: 100%;
height: 500px;
display: none;
}
#paste {
font-family: 'mono'
}
html, body, #content {
width: 100%;
}
</style>
[% END %]
[% BLOCK page_header %]
<div class="row">
<div class="col-md-3">
<label for="name">Who: </label>
<input size="20" name="name" placeholder="Anonymous" />
</div>
<div class="col-md-3">
<label for="chan">Where: </label>
<select name="chan" id="chan">
<option value="">-- IRC Channel --</option>
[% FOREACH channel = channels %]
<option value="[% channel.key %]">[% channel.value %]</option>
[% END %]
</select>
</div>
<div class="col-md-6">
<label for="desc">What: </label>
<input size="40" name="desc" placeholder="I broke this" />
</div>
</div>
[% END %]
[% BLOCK body %]
<form action="/paste" method="POST" id="form">
<div id="content" class="container">
<div class="panel">
<div class="panel-heading">
[% PROCESS page_header %]
</div>
</div>
<div class="panel-body">
<div class="editors">
<textarea name="paste" id="paste" cols="80" rows="25">[% pastedata | html %]</textarea>
<pre id="editor">
</pre>
</div>
<div class="panel-footer">
<input value="Submit" type="submit" id="submit" />
</div>
</div>
</div>
</form>
<script src="/static/ace/ace.js" type="text/javascript" charset="utf-8"></script>
<script>
$("#paste").hide();
$("#editor").show();
$("#editor").text($("#paste").text());
var editor = ace.edit("editor");
//editor.setTheme("ace/theme/twilight");
editor.session.setMode("ace/mode/perl");
function resizeAce() {
var h = window.innerHeight;
if (h > 360) {
$('#editor').css('height', (h - 175).toString() + 'px');
}
};
$(window).on('resize', function () {
resizeAce();
});
resizeAce();
$("#submit").on('click', function () {
$("#paste").text(editor.getValue()); // copy to the textarea
});
</script>
[% END %]