mirror of
https://github.com/perlbot/perlbuut-pastebin
synced 2025-06-08 14:46:47 -04:00
Basic look is there, needs more backend
This commit is contained in:
parent
895254083f
commit
7eb52e2f8c
1 changed files with 53 additions and 28 deletions
81
app.pl
81
app.pl
|
@ -8,9 +8,16 @@ use Data::Dumper;
|
||||||
|
|
||||||
use Mojolicious::Lite;
|
use Mojolicious::Lite;
|
||||||
|
|
||||||
|
# hardcode some channels first
|
||||||
|
my %channels = (
|
||||||
|
"freenode#perlbot" => "#perlbot (freenode)",
|
||||||
|
"freenode#perl" => "#perl (freenode)",
|
||||||
|
);
|
||||||
|
|
||||||
get '/' => sub {
|
get '/' => sub {
|
||||||
my $c = shift;
|
my $c = shift;
|
||||||
$c->render(text => "Make a new paste");
|
$c->stash({pastedata => q{}, channels => \%channels});
|
||||||
|
$c->render(template => "editor");
|
||||||
};
|
};
|
||||||
|
|
||||||
get '/pastebin' => sub {
|
get '/pastebin' => sub {
|
||||||
|
@ -21,7 +28,15 @@ get '/pastebin' => sub {
|
||||||
get '/pastebin/:pasteid' => sub {
|
get '/pastebin/:pasteid' => sub {
|
||||||
my $c = shift;
|
my $c = shift;
|
||||||
my $pasteid = $c->param('pasteid');
|
my $pasteid = $c->param('pasteid');
|
||||||
$c->stash({pasteid => $pasteid});
|
$c->stash({pastedata => q{
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
|
||||||
|
use Data::Dumper;
|
||||||
|
use v5.24;
|
||||||
|
|
||||||
|
say "Hello Perlbot";
|
||||||
|
}, channels => \%channels});
|
||||||
|
|
||||||
$c->render(template => "editor");
|
$c->render(template => "editor");
|
||||||
};
|
};
|
||||||
|
@ -46,7 +61,6 @@ __DATA__
|
||||||
<!-- Latest compiled and minified JavaScript -->
|
<!-- Latest compiled and minified JavaScript -->
|
||||||
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" crossorigin="anonymous"></script>
|
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" crossorigin="anonymous"></script>
|
||||||
|
|
||||||
|
|
||||||
<title>Editor</title>
|
<title>Editor</title>
|
||||||
<style type="text/css" media="screen">
|
<style type="text/css" media="screen">
|
||||||
#editor {
|
#editor {
|
||||||
|
@ -57,7 +71,6 @@ __DATA__
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#pastebin {
|
#pastebin {
|
||||||
font-family: 'mono'
|
font-family: 'mono'
|
||||||
}
|
}
|
||||||
|
@ -69,31 +82,43 @@ __DATA__
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<div id="content" class="container">
|
<form action="/paste" method="POST">
|
||||||
<div class="panel">
|
<div id="content" class="container">
|
||||||
<div class="panel-heading">
|
<div class="panel">
|
||||||
<h3 class="panel-title">Editor</h3>
|
<div class="panel-heading">
|
||||||
|
<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>
|
||||||
|
% for my $i (keys %$channels) {
|
||||||
|
<option value="<%= $i %>"><%= $channels->{$i} %></option>
|
||||||
|
% }
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<label for="desc">What: </label>
|
||||||
|
<input size="40" name="desc" placeholder="I broke this" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="panel-body">
|
||||||
|
<div class="editors">
|
||||||
|
<textarea name="paste" id="pastebin" cols="80" rows="25"><%= $pastedata %></textarea>
|
||||||
|
<pre id="editor">
|
||||||
|
</pre>
|
||||||
|
</div>
|
||||||
|
<div class="panel-footer">
|
||||||
|
<input value="Submit" type="submit" />
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
<div class="panel-body">
|
|
||||||
<div class="editors">
|
|
||||||
<textarea name="pastebin" id="pastebin" cols="80" rows="25">
|
|
||||||
use strict;
|
|
||||||
use warnings;
|
|
||||||
|
|
||||||
use Data::Dumper;
|
|
||||||
use v5.24;
|
|
||||||
|
|
||||||
say "Hello Perlbot";
|
|
||||||
</textarea>
|
|
||||||
<pre id="editor">
|
|
||||||
</pre>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="panel-footer">
|
</form>
|
||||||
Footer <button value="Submit">Submit</button> <!-- todo make this a submit, and handle the form in javascript -->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<script src="/static/ace/ace.js" type="text/javascript" charset="utf-8"></script>
|
<script src="/static/ace/ace.js" type="text/javascript" charset="utf-8"></script>
|
||||||
<script>
|
<script>
|
||||||
|
@ -107,7 +132,7 @@ say "Hello Perlbot";
|
||||||
function resizeAce() {
|
function resizeAce() {
|
||||||
var h = window.innerHeight;
|
var h = window.innerHeight;
|
||||||
if (h > 360) {
|
if (h > 360) {
|
||||||
$('#editor').css('height', (h - 290).toString() + 'px');
|
$('#editor').css('height', (h - 175).toString() + 'px');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
$(window).on('resize', function () {
|
$(window).on('resize', function () {
|
||||||
|
|
Loading…
Add table
Reference in a new issue