Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

We’re showing branches in this repository, but you can also compare across forks.

base fork: davorg/politicalweb
base: 35ccd79ff3
...
head fork: davorg/politicalweb
compare: a24bc78ebb
  • 3 commits
  • 8 files changed
  • 0 commit comments
  • 1 contributor
1  PoliticalWeb/MANIFEST
View
@@ -7,7 +7,6 @@ views/index.tt
views/layouts/main.tt
MANIFEST.SKIP
lib/PoliticalWeb.pm
-public/css/style.css
public/css/error.css
public/images/perldancer-bg.jpg
public/images/perldancer.jpg
2  PoliticalWeb/bin/app.pl
View
@@ -1,4 +1,4 @@
#!/usr/bin/env perl
-use Dancer;
+use Dancer2;
use PoliticalWeb;
dance;
5 PoliticalWeb/config.yml
View
@@ -21,6 +21,7 @@ charset: "UTF-8"
#template: "simple"
template: "template_toolkit"
+layout: main.tt
engines:
template_toolkit:
WRAPPER: layouts/main.tt
@@ -37,8 +38,6 @@ plugins:
servers: [ '127.0.0.1:11211' ]
DBIC:
- politicalweb:
+ default:
schema_class: PoliticalWeb::Schema
dsn: dbi:mysql:database=politicalweb
- user: politicalweb
- pass: p0l171c4lw3b
18 PoliticalWeb/lib/PoliticalWeb.pm
View
@@ -1,14 +1,22 @@
package PoliticalWeb;
-use Dancer ':syntax';
-use Dancer::Plugin::DBIC;
-use Dancer::Plugin::Cache::CHI;
+
+use Dancer2;
+use Dancer2::Plugin::DBIC;
+use Dancer2::Plugin::Cache::CHI;
use Data::Dumper;
use PoliticalWeb::Constituency;
our $VERSION = '0.1';
-check_page_cache;
+# check_page_cache;
+
+$ENV{PW_USER} && $ENV{PW_PASS}
+ or die 'Must set PW_USER and PW_PASS';
+
+my $cfg = dancer_app->config;
+$cfg->{plugins}{DBIC}{default}{user} = $ENV{PW_USER};
+$cfg->{plugins}{DBIC}{default}{pass} = $ENV{PW_PASS};
get '/' => sub {
return template 'index' unless keys %{ +params };
@@ -60,7 +68,7 @@ get '/constituencies/' => sub {
my $page = template 'constituencies/index', {
constits => [ $con_rs->search({}, { order_by => 'name'} )->all ]
};
- cache_page $page;
+ # cache_page $page;
return $page;
};
6 PoliticalWeb/lib/PoliticalWeb/Constituency.pm
View
@@ -6,9 +6,9 @@ use 5.010;
use Moose;
use WebService::TWFY::API;
-use Dancer ':syntax';
-use Dancer::Plugin::DBIC;
-use Dancer::Plugin::Cache::CHI;
+use Dancer2;
+use Dancer2::Plugin::DBIC;
+use Dancer2::Plugin::Cache::CHI;
use Encode qw[encode decode];
use PoliticalWeb::Schema::Result::Constituency;
6 PoliticalWeb/lib/PoliticalWeb/Mp.pm
View
@@ -6,9 +6,9 @@ use 5.010;
use Moose;
use WebService::TWFY::API;
-use Dancer ':syntax';
-use Dancer::Plugin::DBIC;
-use Dancer::Plugin::Cache::CHI;
+use Dancer2;
+use Dancer2::Plugin::DBIC;
+use Dancer2::Plugin::Cache::CHI;
use Encode qw[encode decode];
my $twfy_query = WebService::TWFY::API->new({
2  PoliticalWeb/t/002_index_route.t
View
@@ -4,7 +4,7 @@ use warnings;
# the order is important
use PoliticalWeb;
-use Dancer::Test;
+use Dancer2::Test apps => [ 'PoliticalWeb' ];
route_exists [GET => '/'], 'a route handler is defined for /';
response_status_is ['GET' => '/'], 200, 'response status is 200 for /';
2  PoliticalWeb/views/layouts/main.tt
View
@@ -28,10 +28,8 @@
</ul>
<ul class="nav navbar-nav navbar-right">
-<!--
<li><a href="/register">Register</a></li>
<li><a href="/login">Log in</a></li>
--->
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
Share

No commit comments for this range

Something went wrong with that request. Please try again.