From 55dbf51f98b523f41c83959875295853e1457dcf Mon Sep 17 00:00:00 2001
From: Matthew Somerville
Date: Fri, 7 Nov 2014 15:29:25 +0000
Subject: [FiksGataMi] Add two testing scripts for roads.
---
bin/fiksgatami/showroadinfo | 35 ++++++++++++++++++++++++++++
bin/fiksgatami/showroadstats | 54 ++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 89 insertions(+)
create mode 100755 bin/fiksgatami/showroadinfo
create mode 100755 bin/fiksgatami/showroadstats
diff --git a/bin/fiksgatami/showroadinfo b/bin/fiksgatami/showroadinfo
new file mode 100755
index 000000000..658fca01c
--- /dev/null
+++ b/bin/fiksgatami/showroadinfo
@@ -0,0 +1,35 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use FixMyStreet::App;
+use FixMyStreet::Geocode::OSM;
+use Data::Dumper;
+
+FixMyStreet::App->model('DB::Problem')->send_reports();
+
+my $cobrand = FixMyStreet::Cobrand->get_class_for_moniker('fiksgatami')->new();
+
+sub isRoadOperator {
+ my ($latitude, $longitude, $operatorname) = @_;
+ my $osmtags = FixMyStreet::Geocode::OSM::get_nearest_road_tags(
+ $cobrand, $latitude, $longitude);
+ print STDERR Dumper($osmtags);
+ my $operator = $osmtags->{operator} || $osmtags->{operatorguess};
+ if ($operator) {
+ my ($name, $ref) = ('','');
+ $name = " named $osmtags->{name}" if exists $osmtags->{name};
+ $ref = " ($osmtags->{ref})" if exists $osmtags->{ref};
+ print STDERR "Claiming operator $operator for way$name$ref\n";
+ return ($operator eq $operatorname);
+ }
+ return undef;
+}
+
+my $latitude = $ARGV[0] || 63.37638;
+my $longitude = $ARGV[1] || 10.37595;
+
+unless (isRoadOperator($latitude, $longitude, "Statens vegvesen")) {
+ print STDERR "Operator is not Statens vegvesen\n";
+}
diff --git a/bin/fiksgatami/showroadstats b/bin/fiksgatami/showroadstats
new file mode 100755
index 000000000..83c3c4310
--- /dev/null
+++ b/bin/fiksgatami/showroadstats
@@ -0,0 +1,54 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use FixMyStreet::App;
+use FixMyStreet::Geocode::OSM;
+
+my @reports = FixMyStreet::App->model('DB::Problem')->search({
+ state => [ FixMyStreet::DB::Result::Problem->visible_states() ],
+}, {
+ rows => 40,
+})->all;
+
+my (%namecount, %refcount, %operatorcount);
+my $cobrand;
+my $cobrand_data;
+my $total = 0;
+$| = 1;
+foreach my $row (@reports) {
+ print ".";
+ $total++;
+ my $cobrand = FixMyStreet::Cobrand->get_class_for_moniker($row->cobrand)->new();
+ my $osmtags = FixMyStreet::Geocode::OSM::get_nearest_road_tags($cobrand, $row->latitude, $row->longitude);
+ if (exists $osmtags->{name}) {
+ $namecount{$osmtags->{name}}++;
+ }
+ if (exists $osmtags->{ref}) {
+ $refcount{$osmtags->{ref}}++;
+ }
+ my $operator = $osmtags->{operator} || $osmtags->{operatorguess};
+ if ($operator) {
+ $operatorcount{$operator}++;
+ }
+ sleep 5;
+}
+print "\n";
+print_stats();
+
+sub print_stats {
+ print "Names:\n";
+ for my $name (sort keys %namecount) {
+ printf("%3d %s\n", $namecount{$name}, $name) if $namecount{$name} > 1;
+ }
+ print "Refs:\n";
+ for my $ref (sort keys %refcount) {
+ printf("%3d %s\n", $refcount{$ref}, $ref) if $refcount{$ref} > 1;
+ }
+ print "Operators:\n";
+ for my $operator (sort keys %operatorcount) {
+ printf("%3d %s\n", $operatorcount{$operator}, $operator);
+ }
+ print "Total $total\n";
+}
--
cgit v1.2.3
From 3b8258aefc9cff59b6be47e471af553612fe5652 Mon Sep 17 00:00:00 2001
From: Matthew Somerville
Date: Wed, 12 Nov 2014 17:23:09 +0000
Subject: [FiksGataMi] Update cobrand to current design.
---
perllib/FixMyStreet/Cobrand/FiksGataMi.pm | 16 -----
templates/web/base/index.html | 2 -
templates/web/fiksgatami/footer.html | 48 +++++++++-----
.../web/fiksgatami/front/footer-marketing.html | 19 ++++++
templates/web/fiksgatami/front/news.html | 12 ----
templates/web/fiksgatami/header.html | 71 +++++++++++++++------
templates/web/fiksgatami/nn/contact/address.html | 0
templates/web/fiksgatami/nn/footer.html | 48 +++++++++-----
templates/web/fiksgatami/nn/front/news.html | 12 ----
templates/web/fiksgatami/nn/header.html | 30 ---------
templates/web/fiksgatami/nn/reports/index.html | 34 ----------
templates/web/fiksgatami/reports/index.html | 33 ----------
templates/web/fixmystreet/front/news.html | 11 ----
templates/web/fixmystreet/index.html | 4 --
web/cobrands/fiksgatami/_colours.scss | 24 +++++++
web/cobrands/fiksgatami/base.scss | 7 ++
web/cobrands/fiksgatami/config.rb | 25 ++++++++
web/cobrands/fiksgatami/css.scss | 41 ------------
web/cobrands/fiksgatami/layout.scss | 2 +
web/cobrands/fiksgatami/sprite.png | Bin 0 -> 30796 bytes
20 files changed, 189 insertions(+), 250 deletions(-)
create mode 100644 templates/web/fiksgatami/front/footer-marketing.html
delete mode 100644 templates/web/fiksgatami/front/news.html
delete mode 100644 templates/web/fiksgatami/nn/contact/address.html
delete mode 100644 templates/web/fiksgatami/nn/front/news.html
delete mode 100644 templates/web/fiksgatami/nn/header.html
delete mode 100755 templates/web/fiksgatami/nn/reports/index.html
delete mode 100755 templates/web/fiksgatami/reports/index.html
delete mode 100644 templates/web/fixmystreet/front/news.html
create mode 100644 web/cobrands/fiksgatami/_colours.scss
create mode 100644 web/cobrands/fiksgatami/base.scss
create mode 100644 web/cobrands/fiksgatami/config.rb
delete mode 100644 web/cobrands/fiksgatami/css.scss
create mode 100644 web/cobrands/fiksgatami/layout.scss
create mode 100644 web/cobrands/fiksgatami/sprite.png
diff --git a/perllib/FixMyStreet/Cobrand/FiksGataMi.pm b/perllib/FixMyStreet/Cobrand/FiksGataMi.pm
index 461018639..822a0c43b 100644
--- a/perllib/FixMyStreet/Cobrand/FiksGataMi.pm
+++ b/perllib/FixMyStreet/Cobrand/FiksGataMi.pm
@@ -8,11 +8,6 @@ use Carp;
use mySociety::MaPit;
use FixMyStreet::Geocode::OSM;
-sub path_to_web_templates {
- my $self = shift;
- return [ FixMyStreet->path_to( 'templates/web', $self->moniker )->stringify ];
-}
-
sub country {
return 'NO';
}
@@ -41,17 +36,6 @@ sub admin_base_url {
return 'http://www.fiksgatami.no/admin';
}
-# If lat/lon are present in the URL, OpenLayers will use that to centre the map.
-# Need to specify a zoom to stop it defaulting to null/0.
-sub uri {
- my ( $self, $uri ) = @_;
-
- $uri->query_param( zoom => 3 )
- if $uri->query_param('lat') && !$uri->query_param('zoom');
-
- return $uri;
-}
-
sub geocode_postcode {
my ( $self, $s ) = @_;
diff --git a/templates/web/base/index.html b/templates/web/base/index.html
index 5b2b73cfe..cea0f832a 100644
--- a/templates/web/base/index.html
+++ b/templates/web/base/index.html
@@ -14,8 +14,6 @@
[% END %]
-[% TRY %][% INCLUDE 'front/news.html' %][% CATCH file %][% END %]
-
[% PROCESS 'around/postcode_form.html' %]
diff --git a/templates/web/fiksgatami/footer.html b/templates/web/fiksgatami/footer.html
index 986db3967..bd0921e0b 100644
--- a/templates/web/fiksgatami/footer.html
+++ b/templates/web/fiksgatami/footer.html
@@ -1,22 +1,36 @@
-
+ [% IF pagefooter %]
+
+ [% END %]
+
+
+
-[% loc('Navigation') %]
-
+
+
+
+
-
-
-
-
-[% INCLUDE 'debug_footer.html' %]
+
+ - <[% IF c.req.uri.path == '/' %]span[% ELSE %]a href="/"[% END %] class="report-a-problem-btn"
+ >[% loc("Report a problem") %][% c.req.uri.path == '/' ? 'span' : 'a' %]>
[%
+ %]- <[% IF c.req.uri.path == '/my' %]span[% ELSE %]a href="/my"[% END
+ %]>[% loc("Your reports") %][% c.req.uri.path == '/my' ? 'span' : 'a' %]>
[%
+ %]- <[% IF c.req.uri.path == '/reports' %]span[% ELSE %]a href="/reports"[% END
+ %]>[% loc("All reports") %][% c.req.uri.path == '/reports' ? 'span' : 'a' %]>
[%
+ %]- <[% IF c.req.uri.path == '/alert' %]span[% ELSE %]a href="/alert[% pc ? '/list?pc=' : '' %][% pc | uri %]"[% END
+ %]>[% loc("Local alerts") %][% c.req.uri.path == '/alert' ? 'span' : 'a' %]>
[%
+ %]- <[% IF c.req.uri.path == '/faq' %]span[% ELSE %]a href="/faq"[% END
+ %]>[% loc("Help") %][% c.req.uri.path == '/faq' ? 'span' : 'a' %]>
+
+
+
+
+
+