Skip to content

Instantly share code, notes, and snippets.

@ayucat
Created September 16, 2013 08:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ayucat/6577867 to your computer and use it in GitHub Desktop.
Save ayucat/6577867 to your computer and use it in GitHub Desktop.
a patch for kazeburo-growthforecast to https://github.com/kazeburo/GrowthForecast.git
diff --git a/growthforecast.pl b/growthforecast.pl
index 9a32a1d..7babee9 100755
--- a/growthforecast.pl
+++ b/growthforecast.pl
@@ -9,7 +9,7 @@ use File::Basename;
use Getopt::Long;
use Plack::Loader;
use Plack::Builder;
-use Plack::Builder::Conditionals;
+use Plack::Middleware::Conditional;
use Plack::Util;
use GrowthForecast;
use GrowthForecast::Web;
diff --git a/views/base.tx b/views/base.tx
index e4c37a3..bd493bb 100644
--- a/views/base.tx
+++ b/views/base.tx
@@ -2,7 +2,8 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html" charset="utf-8">
-<link rel="stylesheet" href="<: $c.req.uri_for('/css/bootstrap.min.css') :>">
+<!-- link rel="stylesheet" href="/css/bootstrap.min.css" -->
+<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css?3.0.0">
<style type='text/css'>
body {
background-color: #fff;
@@ -50,17 +51,17 @@ GrowthForecast
</head>
<body>
-<div class="topbar">
-<div class="topbar-inner">
+<header class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
-<a class="brand" href="<: $c.req.uri_for('/') :>">GrowthForecast</a>
-<ul class="nav">
+<div class="navbar-header"><a class="navbar-brand" href="<: $c.req.uri_for('/') :>">GrowthForecast</a></div>
+<nav class="collapse navbar-collapse bs-navbar-collapse">
+<ul class="nav navbar-nav">
<li><a href="<: $c.req.uri_for('/') :>">Home</a></li>
<li><a href="<: $c.req.uri_for('/docs') :>">Docs</a></li>
</ul>
+</nav>
</div>
-</div>
-</div>
+</header>
<div class="container">
@@ -70,7 +71,7 @@ GrowthForecast
</div>
<div class="row">
-<div class="span16">
+<div class="col-md-12 col-sm-6 col-xs-12">
: block content -> { }
</div>
</div>
@@ -84,9 +85,9 @@ GrowthForecast
</div>
</footer>
-<script type="text/javascript" src="<: $c.req.uri_for('/js/jquery-1.5.2.min.js') :>"></script>
-<script type="text/javascript" src="<: $c.req.uri_for('/js/bootstrap-modal.js') :>"></script>
-<script type="text/javascript" src="<: $c.req.uri_for('/js/bootstrap-alerts.js') :>"></script>
+<script type="text/javascript" src="//code.jquery.com/jquery-1.10.2.min.js"></script>
+<script type="text/javascript" src="//raw.github.com/jschr/bootstrap-modal/master/js/bootstrap-modal.js"></script>
+<script type="text/javascript" src="//raw.github.com/twbs/bootstrap/master/js/alert.js"></script>
<script type="text/javascript">
$(function(){
$('form.hxrpost').each(setHxrpost);
@@ -140,7 +141,7 @@ function setHxrConfirmBtn() {
'<form method="post" action="#">'+
'<div class="modal-header"><h3>confirm</h3></div>'+
'<div class="modal-body"><div class="alert-message error hide">System Error!</div><p>confirm</p></div>'+
-'<div class="modal-footer"><input type="submit" class="btn danger" value="confirm" /></div>'+
+'<div class="modal-footer"><input type="submit" class="btn btn-danger" value="confirm" /></div>'+
'</form></div>');
modal.find('h3').text($(mybtn).text());
modal.find('input[type=submit]').attr('value',$(mybtn).text());
diff --git a/views/edit.tx b/views/edit.tx
index 19e3d77..8bd1521 100644
--- a/views/edit.tx
+++ b/views/edit.tx
@@ -140,9 +140,9 @@ unit
</fieldset>
<div class="actions">
-<input type="submit" class="btn primary" value="Submit" />
+<input type="submit" class="btn btn-primary" value="Submit" />
<a href="<: $c.req.uri_for('/list/'~uri_escape($graph.service_name)~'/'~uri_escape($graph.section_name)) :>" class="btn">Cancel</a>
-<button type="button" class="btn danger hxr_confirm_button" data-confirm="remove '<: $graph.graph_name :>'?" data-uri="<: $c.req.uri_for('/delete/'~uri_escape($graph.service_name)~'/'~uri_escape($graph.section_name)~'/'~uri_escape($graph.graph_name)) :>">remove</button>
+<button type="button" class="btn btn-danger hxr_confirm_button" data-confirm="remove '<: $graph.graph_name :>'?" data-uri="<: $c.req.uri_for('/delete/'~uri_escape($graph.service_name)~'/'~uri_escape($graph.section_name)~'/'~uri_escape($graph.graph_name)) :>">remove</button>
</div>
</form>
diff --git a/views/edit_complex.tx b/views/edit_complex.tx
index f17b2e6..4bd11f2 100644
--- a/views/edit_complex.tx
+++ b/views/edit_complex.tx
@@ -143,7 +143,7 @@
<option value="0">disable</option>
</select>
</td>
-<td style="text-align:center;"><button id="add-new-row" class="btn" style="padding: 3px 14px 4px;">追加</button></td>
+<td style="text-align:center;"><button id="add-new-row" class="btn btn-default" style="padding: 3px 14px 4px;">追加</button></td>
</tr>
: my $type_hash = { 'AREA' => 'AREA', 'LINE1' => 'LINE', 'LINE2' => 'LINE(Bold)' }
@@ -177,9 +177,9 @@
</fieldset>
<div class="actions">
-<input type="submit" class="btn primary" value="Submit" />
-<a href="<: $c.req.uri_for('/list/'~uri_escape($c.stash.complex.service_name)~'/'~uri_escape($c.stash.complex.section_name)) :>" class="btn">Cancel</a>
-<button type="button" class="btn danger hxr_confirm_button" data-confirm="Remove '<: $c.stash.complex.graph_name :>'?" data-uri="<: $c.req.uri_for('/delete_complex/'~$c.stash.complex.id) :>">Remove</button>
+<input type="submit" class="btn btn-default primary" value="Submit" />
+<a href="<: $c.req.uri_for('/list/'~uri_escape($c.stash.complex.service_name)~'/'~uri_escape($c.stash.complex.section_name)) :>" class="btn btn-default">Cancel</a>
+<button type="button" class="btn btn-danger hxr_confirm_button" data-confirm="Remove '<: $c.stash.complex.graph_name :>'?" data-uri="<: $c.req.uri_for('/delete_complex/'~$c.stash.complex.id) :>">Remove</button>
</div>
</form>
diff --git a/views/index.tx b/views/index.tx
index 0495941..29413bf 100644
--- a/views/index.tx
+++ b/views/index.tx
@@ -15,7 +15,7 @@
<span><a href="<: $c.req.uri_for('/list/'~uri_escape($service.name)) :>"><: $service.name :></a></span>
<span class="pull-right"><small style="vertical-align: text-middle;font-size: 0.5em"><a href="<: $c.req.uri_for('/add_complex',[service_name=>$service.name]) :>">add complex graph</a></small></span>
</h2>
-<table class="zebra-striped">
+<table class="table table-striped">
: for $service.sections -> $section {
<tr>
<td style="vertical-align: middle"><a href="<: $c.req.uri_for('/list/'~uri_escape($service.name)~'/'~uri_escape($section)) :>"><: $section :></a></td>
diff --git a/views/list.tx b/views/list.tx
index 04ca6db..0240375 100644
--- a/views/list.tx
+++ b/views/list.tx
@@ -11,9 +11,9 @@
: around content -> {
-<div class="pagination" style="margin: 1px 0;">
<div class="pull-right">
-<ul>
+<div class="pagination" style="margin: 1px 0;">
+<ul class="list-inline">
: if ( $c.stash.enable_short ) {
<li class="prev <: ( $c.req.param('t') == 'sh' ) ? "active" : "" :>"><a href="<: $c.req.uri_for('/list/'~uri_escape($c.args.service_name)~'/'~uri_escape($c.args.section_name), [t=>'sh']) :>">hour・8hours(1min)</a></li>
<li class="prev <: ( $c.req.param('t') == 'sd' ) ? "active" : "" :>"><a href="<: $c.req.uri_for('/list/'~uri_escape($c.args.service_name)~'/'~uri_escape($c.args.section_name), [t=>'sd']) :>">day・3days(1min)</a></li>
@@ -32,7 +32,7 @@
: } # for graphs
<div class="pull-right">
-<button type="button" class="btn danger hxr_confirm_button" data-confirm="remove all graphs in '<: $c.args.section_name :>' section?" data-uri="<: $c.req.uri_for('/delete/'~uri_escape($c.args.service_name)~'/'~uri_escape($c.args.section_name)) :>">remove all graphs in this section</button>
+<button type="button" class="btn btn-danger hxr_confirm_button" data-confirm="remove all graphs in '<: $c.args.section_name :>' section?" data-uri="<: $c.req.uri_for('/delete/'~uri_escape($c.args.service_name)~'/'~uri_escape($c.args.section_name)) :>">remove all graphs in this section</button>
</div>
: } # arround
diff --git a/views/view.tx b/views/view.tx
index 5d896ff..7691b2b 100644
--- a/views/view.tx
+++ b/views/view.tx
@@ -8,18 +8,18 @@
<small><: $graph.description :></small></h2>
<p>
: if $graph.complex_graph {
-<a class="label success" style="cursor: pointer" href="<: $c.req.uri_for('/edit_complex/'~$graph.id) :>">Setting</a>
-<span class="label important">Complex Graph</span>
+<a class="label label-success" style="cursor: pointer" href="<: $c.req.uri_for('/edit_complex/'~$graph.id) :>">Setting</a>
+<span class="label label-warning">Complex Graph</span>
: } else {
-<a class="label success" style="cursor: pointer" href="<: $c.req.uri_for('/edit/'~uri_escape($graph.service_name)~'/'~uri_escape($graph.section_name)~'/'~uri_escape($graph.graph_name)) :>">Setting</a>
-<span class="label">current</span> <: $graph.number | format_number :>
-<span class="label">mode</span> <: $graph.mode :>
+<a class="label label-success" style="cursor: pointer" href="<: $c.req.uri_for('/edit/'~uri_escape($graph.service_name)~'/'~uri_escape($graph.section_name)~'/'~uri_escape($graph.graph_name)) :>">Setting</a>
+<span class="label label-default">current</span> <: $graph.number | format_number :>
+<span class="label label-default">mode</span> <: $graph.mode :>
: }
-<span class="label">created_at</span> <: $graph.created_at :>
-<span class="label">updated_at</span> <: $graph.updated_at :>
+<span class="label label-default">created_at</span> <: $graph.created_at :>
+<span class="label label-default">updated_at</span> <: $graph.updated_at :>
</p>
-<div style="margin-bottom: 13px; text-align: center">
+<div style="margin-bottom: 13px; text-align: center;">
: if ! $graph.complex_graph {
: my $gmodes = ( $graph.gmode == 'both' ) ? ['gauge','subtract'] : ( $graph.gmode == 'gauge') ? ['gauge'] : ['subtract']
: for $gmodes -> $gmode {
diff --git a/views/view_graph.tx b/views/view_graph.tx
index a63fe25..e3de4d7 100644
--- a/views/view_graph.tx
+++ b/views/view_graph.tx
@@ -13,9 +13,9 @@
: around content -> {
: my $base = $view_complex ? 'view_complex' : 'view_graph';
-<div class="pagination" style="margin: 1px 0;">
<div class="pull-right">
-<ul>
+<div class="pagination" style="margin: 1px 0;">
+<ul class="list-inline">
: if ( $c.stash.enable_short ) {
<li class="prev <: ( $c.req.param('t') == 'sh' ) ? "active" : "" :>"><a href="<: $c.req.uri_for('/'~$base~'/'~uri_escape($c.args.service_name)~'/'~uri_escape($c.args.section_name)~'/'~uri_escape($c.args.graph_name), [t=>'sh']) :>">hour・8hours(1min)</a></li>
<li class="prev <: ( $c.req.param('t') == 'sd' ) ? "active" : "" :>"><a href="<: $c.req.uri_for('/'~$base~'/'~uri_escape($c.args.service_name)~'/'~uri_escape($c.args.section_name)~'/'~uri_escape($c.args.graph_name), [t=>'sd']) :>">day・3days(1min)</a></li>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment