Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Hylte] Add cobrand #5048

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 33 additions & 1 deletion perllib/FixMyStreet/Cobrand/FixaMinGata.pm
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
use mySociety::MaPit;
use DateTime;

sub site_key { 'fixamingata' }

Check warning on line 12 in perllib/FixMyStreet/Cobrand/FixaMinGata.pm

View check run for this annotation

Codecov / codecov/patch

perllib/FixMyStreet/Cobrand/FixaMinGata.pm#L12

Added line #L12 was not covered by tests

sub country {
return 'SE';
}
Expand All @@ -18,6 +20,7 @@

sub enter_postcode_text {
my ( $self ) = @_;

return _('Enter a nearby postcode, or street name and area');
}

Expand Down Expand Up @@ -87,43 +90,54 @@

sub area_types {
my $self = shift;

return $self->next::method() if FixMyStreet->staging_flag('skip_checks');

[ 'KOM' ];
}

sub geocode_postcode {
my ( $self, $s ) = @_;

# Most people write Swedish postcodes like this:
# XXX XX, so let's remove the space
$s =~ s/\ //g;

if ($s =~ /^\d{5}$/) {
my $location = mySociety::MaPit::call('postcode', $s);

if ($location->{error}) {
return {
error => $location->{code} =~ /^4/
? _('That postcode was not recognised, sorry.')
: $location->{error}
};
}

return {
latitude => $location->{wgs84_lat},
longitude => $location->{wgs84_lon},
};
}

return {};
}

# Vad gör den här funktionen? Är "Sverige" rätt här?
sub geocoded_string_check {
my ( $self, $s ) = @_;

return 1 if $s =~ /, Sverige/;

return 0;
}

sub find_closest {
my ( $self, $problem ) = @_;

$problem = $problem->{problem} if ref $problem eq 'HASH';
return FixMyStreet::Geocode::OSM->closest_road_text( $self, $problem->latitude, $problem->longitude );

return FixMyStreet::Geocode::OSM::closest_road_text( $self, $problem->latitude, $problem->longitude );

Check warning on line 140 in perllib/FixMyStreet/Cobrand/FixaMinGata.pm

View check run for this annotation

Codecov / codecov/patch

perllib/FixMyStreet/Cobrand/FixaMinGata.pm#L140

Added line #L140 was not covered by tests
}

# Used by send-reports, calling find_closest, calling OSM geocoding
Expand All @@ -132,13 +146,15 @@

my $highway = $inforef->{highway} || "unknown";
my $refs = $inforef->{ref} || "unknown";

return "Trafikverket"
if $highway eq "trunk" || $highway eq "primary";

for my $ref (split(/;/, $refs)) {
return "Trafikverket"
if $ref =~ m/E ?\d+/ || $ref =~ m/Fv\d+/i;
}

return '';
}

Expand Down Expand Up @@ -167,9 +183,13 @@
# confirmed state), and red otherwise.
sub pin_colour {
my ( $self, $p, $context ) = @_;

return 'green' if $p->is_closed;

return 'green' if $p->is_fixed;

return 'yellow' if $p->is_in_progress;

return 'red';
}

Expand All @@ -183,6 +203,7 @@

sub always_view_body_contribute_details {
my ( $self, $contributed_as ) = @_;

return $contributed_as eq '';
}

Expand All @@ -197,4 +218,15 @@

sub default_show_name { 1 }

sub path_to_email_templates {
my ( $self, $lang_code ) = @_;

Check warning on line 222 in perllib/FixMyStreet/Cobrand/FixaMinGata.pm

View check run for this annotation

Codecov / codecov/patch

perllib/FixMyStreet/Cobrand/FixaMinGata.pm#L222

Added line #L222 was not covered by tests

my $paths = [

Check warning on line 224 in perllib/FixMyStreet/Cobrand/FixaMinGata.pm

View check run for this annotation

Codecov / codecov/patch

perllib/FixMyStreet/Cobrand/FixaMinGata.pm#L224

Added line #L224 was not covered by tests
FixMyStreet->path_to( 'templates', 'email', $self->moniker ),
FixMyStreet->path_to( 'templates', 'email', 'fixamingata'),
];

return $paths;

Check warning on line 229 in perllib/FixMyStreet/Cobrand/FixaMinGata.pm

View check run for this annotation

Codecov / codecov/patch

perllib/FixMyStreet/Cobrand/FixaMinGata.pm#L229

Added line #L229 was not covered by tests
}

1;
89 changes: 89 additions & 0 deletions perllib/FixMyStreet/Cobrand/Hylte.pm
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
package FixMyStreet::Cobrand::Hylte;
use base 'FixMyStreet::Cobrand::FixaMinGata';

use strict;
use warnings;
use utf8;

use Carp;
use mySociety::MaPit;
use DateTime;

sub council_area_id { return 68; }
sub council_area { return 'Hylte'; }
sub council_name { return 'Hylte kommun'; }
sub council_url { return 'hylte'; }

Check warning on line 15 in perllib/FixMyStreet/Cobrand/Hylte.pm

View check run for this annotation

Codecov / codecov/patch

perllib/FixMyStreet/Cobrand/Hylte.pm#L12-L15

Added lines #L12 - L15 were not covered by tests

sub base_url { return 'https://hylte.fixamingata.se' }

Check warning on line 17 in perllib/FixMyStreet/Cobrand/Hylte.pm

View check run for this annotation

Codecov / codecov/patch

perllib/FixMyStreet/Cobrand/Hylte.pm#L17

Added line #L17 was not covered by tests

sub site_key { 'hylte' }

Check warning on line 19 in perllib/FixMyStreet/Cobrand/Hylte.pm

View check run for this annotation

Codecov / codecov/patch

perllib/FixMyStreet/Cobrand/Hylte.pm#L19

Added line #L19 was not covered by tests

sub areas_on_around { [68]; }

Check warning on line 21 in perllib/FixMyStreet/Cobrand/Hylte.pm

View check run for this annotation

Codecov / codecov/patch

perllib/FixMyStreet/Cobrand/Hylte.pm#L21

Added line #L21 was not covered by tests

sub body {
return FixMyStreet::DB->resultset("Body")->find({

Check warning on line 24 in perllib/FixMyStreet/Cobrand/Hylte.pm

View check run for this annotation

Codecov / codecov/patch

perllib/FixMyStreet/Cobrand/Hylte.pm#L24

Added line #L24 was not covered by tests
name => 'Hylte kommun'
})
}

sub extra_reports_bodies {
return FixMyStreet::DB->resultset("Body")->find({

Check warning on line 30 in perllib/FixMyStreet/Cobrand/Hylte.pm

View check run for this annotation

Codecov / codecov/patch

perllib/FixMyStreet/Cobrand/Hylte.pm#L30

Added line #L30 was not covered by tests
name => 'Trafikverket'
})
}

sub problems_on_map_restriction {
my ($self, $rs) = @_;

Check warning on line 36 in perllib/FixMyStreet/Cobrand/Hylte.pm

View check run for this annotation

Codecov / codecov/patch

perllib/FixMyStreet/Cobrand/Hylte.pm#L36

Added line #L36 was not covered by tests

return $rs if FixMyStreet->staging_flag('skip_checks');

my $extra_bodies = $self->extra_reports_bodies();
my @extra_bodies_ids = map { $_->id } $extra_bodies;
my $bodies = [$self->body->id, @extra_bodies_ids];

Check warning on line 42 in perllib/FixMyStreet/Cobrand/Hylte.pm

View check run for this annotation

Codecov / codecov/patch

perllib/FixMyStreet/Cobrand/Hylte.pm#L40-L42

Added lines #L40 - L42 were not covered by tests

return $rs->to_body($bodies);

Check warning on line 44 in perllib/FixMyStreet/Cobrand/Hylte.pm

View check run for this annotation

Codecov / codecov/patch

perllib/FixMyStreet/Cobrand/Hylte.pm#L44

Added line #L44 was not covered by tests
}

sub problems_restriction {
my ($self, $rs) = @_;

Check warning on line 48 in perllib/FixMyStreet/Cobrand/Hylte.pm

View check run for this annotation

Codecov / codecov/patch

perllib/FixMyStreet/Cobrand/Hylte.pm#L48

Added line #L48 was not covered by tests

return $rs if FixMyStreet->staging_flag('skip_checks');

my $extra_bodies = $self->extra_reports_bodies();
my @extra_bodies_ids = map { $_->id } $extra_bodies;
my $bodies = [$self->body->id, @extra_bodies_ids];

Check warning on line 54 in perllib/FixMyStreet/Cobrand/Hylte.pm

View check run for this annotation

Codecov / codecov/patch

perllib/FixMyStreet/Cobrand/Hylte.pm#L52-L54

Added lines #L52 - L54 were not covered by tests

return $rs->to_body($bodies);

Check warning on line 56 in perllib/FixMyStreet/Cobrand/Hylte.pm

View check run for this annotation

Codecov / codecov/patch

perllib/FixMyStreet/Cobrand/Hylte.pm#L56

Added line #L56 was not covered by tests
}

sub updates_restriction {
my ($self, $rs) = @_;

Check warning on line 60 in perllib/FixMyStreet/Cobrand/Hylte.pm

View check run for this annotation

Codecov / codecov/patch

perllib/FixMyStreet/Cobrand/Hylte.pm#L60

Added line #L60 was not covered by tests

return $rs if FixMyStreet->staging_flag('skip_checks');

return $rs->to_body($self->body);

Check warning on line 64 in perllib/FixMyStreet/Cobrand/Hylte.pm

View check run for this annotation

Codecov / codecov/patch

perllib/FixMyStreet/Cobrand/Hylte.pm#L64

Added line #L64 was not covered by tests
}

sub disambiguate_location {
my $self = shift;
my $string = shift;

Check warning on line 69 in perllib/FixMyStreet/Cobrand/Hylte.pm

View check run for this annotation

Codecov / codecov/patch

perllib/FixMyStreet/Cobrand/Hylte.pm#L68-L69

Added lines #L68 - L69 were not covered by tests

return {
%{ $self->SUPER::disambiguate_location() },

Check warning on line 72 in perllib/FixMyStreet/Cobrand/Hylte.pm

View check run for this annotation

Codecov / codecov/patch

perllib/FixMyStreet/Cobrand/Hylte.pm#L72

Added line #L72 was not covered by tests
bounds => [ 56.8236518, 12.8207981, 57.1138647, 13.6935731 ],
};
}

sub abuse_reports_only { 1 }

Check warning on line 77 in perllib/FixMyStreet/Cobrand/Hylte.pm

View check run for this annotation

Codecov / codecov/patch

perllib/FixMyStreet/Cobrand/Hylte.pm#L77

Added line #L77 was not covered by tests

sub always_view_body_contribute_details { return; }

Check warning on line 79 in perllib/FixMyStreet/Cobrand/Hylte.pm

View check run for this annotation

Codecov / codecov/patch

perllib/FixMyStreet/Cobrand/Hylte.pm#L79

Added line #L79 was not covered by tests

sub default_show_name { 0 }

Check warning on line 81 in perllib/FixMyStreet/Cobrand/Hylte.pm

View check run for this annotation

Codecov / codecov/patch

perllib/FixMyStreet/Cobrand/Hylte.pm#L81

Added line #L81 was not covered by tests

sub recent {
my $self = shift;

Check warning on line 84 in perllib/FixMyStreet/Cobrand/Hylte.pm

View check run for this annotation

Codecov / codecov/patch

perllib/FixMyStreet/Cobrand/Hylte.pm#L84

Added line #L84 was not covered by tests

return $self->problems->search({ areas => { 'like', '%,' . $self->body->id . ',%' } })->recent(@_);

Check warning on line 86 in perllib/FixMyStreet/Cobrand/Hylte.pm

View check run for this annotation

Codecov / codecov/patch

perllib/FixMyStreet/Cobrand/Hylte.pm#L86

Added line #L86 was not covered by tests
}

1;
24 changes: 24 additions & 0 deletions templates/email/hylte/_email_color_overrides.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
[%

color_hylte_deepblue = '#0078BB'
color_black = '#000000'
color_white = '#FFFFFF'
color_hylte_lightblue = '#E6F2F8'

body_background_color = color_white
body_text_color = color_black

header_background_color = color_hylte_deepblue
header_text_color = color_white

secondary_column_background_color = color_hylte_lightblue

button_background_color = color_hylte_deepblue
button_text_color = color_white

logo_file = 'Hylte%20kommun%20logotyp.svg'
logo_width = "175" # pixel measurement, but without 'px' suffix
logo_height = "35" # pixel measurement, but without 'px' suffix
header_padding = "20px 30px"

%]
1 change: 1 addition & 0 deletions templates/email/hylte/site-name.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Hylte kommun
64 changes: 64 additions & 0 deletions templates/web/hylte/about/faq-sv.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
[% INCLUDE 'header.html', title => loc('Frequently Asked Questions'), bodyclass => 'twothirdswidthpage' %]

<div class="sticky-sidebar">
<aside>
<ul class="plain-list">
<li><a href="#faq">Vanliga frågor</a></li>
<li><a href="#privacy">Personuppgiftshantering, sekretess och kakor</a></li>
</ul>
</aside>
</div>

<h1><a name="faq"></a>Vanliga frågor</h1>
<dl>
<dt>Vad är FixaMinGata?</dt>
<dd>FixaMinGata är en e-tjänst som hjälper Hylte kommuns invånare att anmäla fel i deras närmiljö på ett enkelt sätt genom att markera felet på en karta. Invånarna kan sedan följa felet och får samtliga uppdateringar till den e-post de angivit vid rapporteringen.</dd>
<dd>Den här e-tjänsten tillhandahålls av <a href="http://sambruk.se/">Föreningen Sambruk</a>, en förening för kommunal samverkan kring e-tjänster. Totalt ingår runt 100 kommuner och landsting i Sambruk. Tjänsten togs fram i samarbete med <a href="http://kivos.se/">KIVOS</a> och <a href="http://ffkp.se/">Föreningen fri kultur och programvara</a>.</dd>
<dt>Vilken typ av fel ska jag anmäla i FixaMinGata?</dt>
<dd>
FixaMinGata är främst anpassad för att rapportera fysiska problem i din närmiljö, exempelvis sådant som behöver <strong>underhållas, lagas eller iordningsställas</strong> till exempel:
<ul>
<li>Nedskräpning</li>
<li>Trasiga gatulysen</li>
<li>Hål i vägar och gångbanor</li>
</ul>
</dd>
<dt>Vad är INTE FixaMinGata till för?</dt>
<dd>
FixaMinGata är inte lämpligt för andra typer av felanmälningar än de som anges ovan. Du måste kontakta din kommun eller fastighetsägare direkt för fel i stil med:
<ul>
<li>Brådskande och akuta problem</li>
<li>Oljud i din närmiljö</li>
<li>Brand och rök</li>
<li>Förslag på nya vägar, farthinder, etc.</li>
<li>Klaga på dina grannar</li>
<li>Klaga på din kommun</li>
<li>Droger, djurplågeri, stöld, eller andra kriminella aktiviteter.</li>
</ul>
</dd>
<dt>Hur använder jag e-tjänsten?</dt>
<dd>
<ol>
<li>Gå in på <a href="https://hylte.fixamingata.se">hylte.fixamingata.se</a> eller öppna Hylteappen (som du kan ladda ner <a href="https://www.hylte.se/hylteappen">här</a>) och klicka på <em>FixaMinGata</em>.</li>
<li>Ange postnummer/gatunamn och ort eller om du står på det stället anmälan gäller för klicka på <em>Använd min nuvarande position</em>.</li>
<li>Markera på kartan var felet finns.</li>
<li>Beskriv felet och skicka in.</li>
<li>Slutför anmälan genom att klicka på länken <em>Skicka min rapport</em> som du har fått till den e-postadress du angav.</li>
</ol>
</dd>
<dt>Hur löses problem?</dt>
<dd>Felanmälningar rapporteras till Hylte Kommun som sedan hanterar felanmälan enligt en intern process, exempelvis genom att delegera det till rätt enhet inom kommunen som får i uppdrag att lösa felanmälan.</dd>
<dt>Är det gratis?</dt>
<dd>Den här e-tjänsten används gratis för att göra en felanmälan. Tjänsten tillhandahålls av <a href="http://sambruk.se/">Föreningen Sambruk</a>, en förening för kommunal samverkan kring e-tjänster. Totalt ingår runt 100 kommuner och landsting i Sambruk.</dd>
<dt>Kan jag använda FixaMinGata på min mobil?</dt>
<dd>FixaMinGata kan du nå i din mobil via <a href="https://hylte.fixamingata.se/">hylte.fixamingata.se</a> eller öppna i <a href="https://www.hylte.se/hylteappen">Hylteappen</a> och klicka på FixaMinGata. Via Hylteappen kommer du snabbt in i systemet för att anmäla ett fel i närmiljön utan att behöva ta reda på vem som ansvarar för underhåll och service.</dd>
<dt>Hur tillgänglig är tjänsten?</dt>
<dd>Föreningen Sambruk står bakom webbplatsen FixaMinGata och målet är att så många som möjligt ska kunna använda webbplatsen. I FixaMinGatas <a href="https://fixamingata.se/about/accessibility">tillgänglighetsredogörelse</a> kan du läsa mer om hur lagen om tillgänglighet till digital offentlig service uppfylls samt om eventuella kända tillgänglighetsproblem och hur du kan rapportera brister så att de kan åtgärdas.</dd>
</dl>

<h1 style="margin-top: 2rem;"><a name="privacy"></a>Personuppgiftshantering, sekretess och kakor</h1>

<p>De personuppgifter du lämnar i samband med att du gör en felanmälan via FixaMinGata behandlar Hylte kommun för att kunna administrera ditt ärende. Uppgifterna hanteras med stöd av gällande dataskyddslagstiftning och den lagliga grunden allmänt intresse.</p>
<p>Samhällsbyggnadsnämnden är personuppgiftsansvarig för uppgifterna. Vi har kvar dina uppgifter den tid som behövs för att vi ska kunna uppfylla våra skyldigheter.</p>
<p>Mer information om hur vi hanterar dina personuppgifter, vilka rättigheter du har och hur du kontaktar oss kan du läsa <a href="https://www.hylte.se/kommun-och-politik/allmanna-handlingar-och-personuppgifter/hantering-av-personuppgifter">här</a>.</p>
<p>Föreningen Sambruk står bakom webbplatsen FixaMinGata. För mer information om personuppgiftshantering, sekretess och kakor se <a href="https://fixamingata.se/about/privacy">FixaMinGatas integritetsskyddspolicy</a>.</p>
9 changes: 9 additions & 0 deletions templates/web/hylte/about/privacy.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[% INCLUDE 'header.html', title => loc('Vanliga Frågor'), bodyclass => 'twothirdswidthpage' %]

<h1>Sekretess och kakor</h1>
<p>De personuppgifter du lämnar i samband med att du gör en felanmälan via FixaMinGata behandlar Hylte kommun för att kunna administrera ditt ärende. Uppgifterna hanteras med stöd av gällande dataskyddslagstiftning och den lagliga grunden allmänt intresse.</p>
<p>Samhällsbyggnadsnämnden är personuppgiftsansvarig för uppgifterna. Vi har kvar dina uppgifter den tid som behövs för att vi ska kunna uppfylla våra skyldigheter.</p>
<p>Mer information om hur vi hanterar dina personuppgifter, vilka rättigheter du har och hur du kontaktar oss kan du läsa <a href="https://www.hylte.se/kommun-och-politik/allmanna-handlingar-och-personuppgifter/hantering-av-personuppgifter">här</a>.</p>
<p>Föreningen Sambruk står bakom webbplatsen FixaMinGata. För mer information om personuppgiftshantering, sekretess och kakor se <a href="https://fixamingata.se/about/privacy">FixaMinGatas integritetsskyddspolicy</a>.</p>

[% INCLUDE 'footer.html' pagefooter = 'yes' %]
2 changes: 2 additions & 0 deletions templates/web/hylte/around/intro.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<h1>[% loc('Report, view, or discuss local problems') %]</h1>
<h2>till exempel nedskräpning eller trasig belysning</h2>
6 changes: 6 additions & 0 deletions templates/web/hylte/front/footer-marketing.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<div class="tablewrapper bordered footer-marketing" style="align-items: center; display: flex;">
<p style="flex-grow: 1; margin-bottom: 0; text-align: left;">
Använd <a href="https://fixamingata.se">FixaMinGata</a> för att rapportera problem utanför Hylte kommun.
</p>
<a href="https://fixamingata.se"><img alt="FixaMinGata" src="/cobrands/fixamingata/images/site-logo.svg"></a>
</div>
23 changes: 23 additions & 0 deletions templates/web/hylte/front/recent.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[%
recent_photos = c.cobrand.recent('front', 5);
%]

[% IF recent_photos.size %]
<div id="front-recently">
<h2>
[%- IF c.cobrand.moniker == 'hart' %]
Recently reported
[% ELSE %]
[% loc('Recently reported problems') %]
[% END -%]
</h2>

<section class="full-width">
<ul id="js-reports-list" class="item-list item-list--reports item-list--front-page">
[% FOREACH problem IN recent_photos %]
[% INCLUDE 'front/_list-entry.html' %]
[% END %]
</ul>
</section>
</div>
[% END %]
Empty file.
14 changes: 14 additions & 0 deletions templates/web/hylte/index-steps.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<h2>[% loc('How to report a problem') %]</h2>

<ol class="big-numbers">
<li>[% question %]</li>
<li>[% loc('Locate the problem on a map of the area') %]</li>
<li>[% loc('Enter details of the problem') %]</li>
<li>Bekräfta rapporten</li>
</ol>

<section class="full-width">
[% INCLUDE "front/stats.html" %]
[% TRY %][% INCLUDE "front/tips.html" %][% CATCH file %][% END %]
</section>

12 changes: 12 additions & 0 deletions templates/web/hylte/report/inspect/assignment.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[% inspectors = c.user.from_body.staff_with_permission('planned_reports') %]
[%
IF c.user.has_permission_to('assign_report_to_user', problem.bodies_str_ids)
&& inspectors
%]
<p>
<label for="assignment">[% loc('Assign to:') %]</label>
<select class="form-control" name="assignment" id="assignment">
[% INCLUDE 'report/inspect/_assignment-options.html' %]
</select>
</p>
[% END %]
14 changes: 14 additions & 0 deletions templates/web/hylte/report/inspect/public_update.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<p>
<label class="label-containing-checkbox">
<input type="checkbox" name="include_update" value="1" class="js-toggle-public-update">
[% loc('Save with a public update') %]
</label>
</p>
<div id="public_update_form_fields">
[% INCLUDE report/form/photo_upload.html %]
<p>
<label for="public_update">[% loc('Public update:') %]</label>
[% INCLUDE 'admin/response_templates_select.html' for='public_update' %]
<textarea rows="2" name="public_update" id="public_update" class="form-control">[% public_update | html %]</textarea>
</p>
</div>
Loading
Loading