Skip to content

Commit 0413e63

Browse files
committed
[FixaMinGata] Add various updates
1 parent ce80472 commit 0413e63

File tree

12 files changed

+77
-64
lines changed

12 files changed

+77
-64
lines changed

Diff for: perllib/FixMyStreet/Cobrand/FixaMinGata.pm

+19-8
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ sub language_override { 'sv' }
1818

1919
sub enter_postcode_text {
2020
my ( $self ) = @_;
21+
2122
return _('Enter a nearby postcode, or street name and area');
2223
}
2324

@@ -87,43 +88,54 @@ sub geocoder_munge_results {
8788

8889
sub area_types {
8990
my $self = shift;
91+
9092
return $self->next::method() if FixMyStreet->staging_flag('skip_checks');
93+
9194
[ 'KOM' ];
9295
}
9396

9497
sub geocode_postcode {
9598
my ( $self, $s ) = @_;
99+
96100
# Most people write Swedish postcodes like this:
97101
# XXX XX, so let's remove the space
98102
$s =~ s/\ //g;
103+
99104
if ($s =~ /^\d{5}$/) {
100105
my $location = mySociety::MaPit::call('postcode', $s);
106+
101107
if ($location->{error}) {
102108
return {
103109
error => $location->{code} =~ /^4/
104110
? _('That postcode was not recognised, sorry.')
105111
: $location->{error}
106112
};
107113
}
114+
108115
return {
109116
latitude => $location->{wgs84_lat},
110117
longitude => $location->{wgs84_lon},
111118
};
112119
}
120+
113121
return {};
114122
}
115123

116124
# Vad gör den här funktionen? Är "Sverige" rätt här?
117125
sub geocoded_string_check {
118126
my ( $self, $s ) = @_;
127+
119128
return 1 if $s =~ /, Sverige/;
129+
120130
return 0;
121131
}
122132

123133
sub find_closest {
124134
my ( $self, $problem ) = @_;
135+
125136
$problem = $problem->{problem} if ref $problem eq 'HASH';
126-
return FixMyStreet::Geocode::OSM->closest_road_text( $self, $problem->latitude, $problem->longitude );
137+
138+
return FixMyStreet::Geocode::OSM::closest_road_text( $self, $problem->latitude, $problem->longitude );
127139
}
128140

129141
# Used by send-reports, calling find_closest, calling OSM geocoding
@@ -132,13 +144,15 @@ sub guess_road_operator {
132144

133145
my $highway = $inforef->{highway} || "unknown";
134146
my $refs = $inforef->{ref} || "unknown";
147+
135148
return "Trafikverket"
136149
if $highway eq "trunk" || $highway eq "primary";
137150

138151
for my $ref (split(/;/, $refs)) {
139152
return "Trafikverket"
140153
if $ref =~ m/E ?\d+/ || $ref =~ m/Fv\d+/i;
141154
}
155+
142156
return '';
143157
}
144158

@@ -167,9 +181,13 @@ sub filter_all_council_ids_list {
167181
# confirmed state), and red otherwise.
168182
sub pin_colour {
169183
my ( $self, $p, $context ) = @_;
184+
170185
return 'green' if $p->is_closed;
186+
171187
return 'green' if $p->is_fixed;
188+
172189
return 'yellow' if $p->is_in_progress;
190+
173191
return 'red';
174192
}
175193

@@ -181,11 +199,6 @@ sub state_groups_inspect {
181199
]
182200
}
183201

184-
sub always_view_body_contribute_details {
185-
my ( $self, $contributed_as ) = @_;
186-
return $contributed_as eq '';
187-
}
188-
189202
# Average responsiveness will only be calculated if a body
190203
# has at least this many fixed reports.
191204
# (Used in the Top 5 list in /reports)
@@ -195,6 +208,4 @@ sub body_responsiveness_threshold {
195208

196209
sub suggest_duplicates { 1 }
197210

198-
sub default_show_name { 1 }
199-
200211
1;

Diff for: templates/email/fixamingata/submit.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ <h2 style="[% h2_style %]">[% report.title | html %]</h2>
5353
<a href="[% osm_url %]" title="Se den här platsen på OpenStreetMap">
5454
[%~ report.latitude %], [% report.longitude ~%]
5555
</a>
56-
[% IF closest_address %]<br>[% closest_address | trim | replace("\n\n", "<br>") %][% END %]
56+
[% IF closest_address %]<br>[% closest_address | trim | replace("\n\n", " ") %][% END %]
5757
</p>
5858
[% END %]
5959

Diff for: templates/web/fixamingata/about/faq-sv.html

+3-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
[% INCLUDE 'header.html', title => loc('Frequently Asked Questions'), bodyclass => 'twothirdswidthpage' %]
22

3-
[% INCLUDE 'about/_sticky-button-content-navbar.html' %]
4-
53
<div class="sticky-sidebar">
64
<aside>
75
<ul class="plain-list">
@@ -36,15 +34,14 @@ <h1><a name="faq"></a>Vanliga frågor</h1>
3634
<dt>Vad är inte FixaMinGata till för?</dt>
3735
<dd>
3836
FixaMinGata är inte lämpligt för andra typer av problem än de som anges ovan. Du måste kontakta din kommun eller fastighetsägare direkt för problem i stil med:
39-
<ul>
37+
<ul style="margin-bottom: 0;">
4038
<li>Brådskande och akuta problem</li>
4139
<li>Oljud i din närmiljö</li>
42-
<li>Brand och rök</li>
4340
<li>Förslag på nya vägar, farthinder, etc.</li>
4441
<li>Klaga på dina grannar</li>
4542
<li>Klaga på din kommun</li>
46-
<li>Droger, djurplågeri, stöld, eller andra kriminella aktiviteter.</li>
4743
</ul>
44+
<p style="margin-bottom: 2em;">Vid pågående brott och vid fara för liv, hälsa eller egendom ska du ringa 112.</p>
4845
</dd>
4946

5047
<dt>Hur använder jag e-tjänsten?</dt>
@@ -87,4 +84,4 @@ <h2><a name="privacy"></a>Sekretess och kakor</h2>
8784
<dd>Läs vår information om <a href="/about/privacy">Sekretess och kakor</a>.</dd>
8885
</dl>
8986

90-
[% INCLUDE 'footer.html' %]
87+
[% INCLUDE 'footer.html' pagefooter = 'yes' %]

Diff for: templates/web/fixamingata/about/privacy.html

+2-17
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,5 @@
11
[% INCLUDE 'header.html', title => loc('Vanliga Frågor'), bodyclass => 'twothirdswidthpage' %]
22

3-
[% INCLUDE 'about/_sticky-button-content-navbar.html' %]
4-
5-
<div class="sticky-sidebar">
6-
<aside>
7-
<ul class="plain-list">
8-
<li><a href="/faq#faq">Vanliga frågor</a></li>
9-
<li><a href="/faq#practical">Praktiska frågor</a></li>
10-
<li><a href="/faq#organisation">Organisation</a></li>
11-
<li><a href="/faq#pul">Dataskyddsombud</a></li>
12-
<li><a href="about/privacy">Sekretess och kakor</a></li>
13-
</ul>
14-
</aside>
15-
</div>
16-
17-
183
<h1>Sekretess och kakor</h1>
194
<p><strong>Vår användning av din information och vad du behöver veta.</strong></p>
205
<p>Offentlighetsprincipen är en viktig del i det demokratiska samhället. Genom tryckfrihetsförordningen och offentlighetslagen har du rätt att ta del av allmänna offentliga handlingar hos statliga och kommunala myndigheter. Det kan ge dig insyn i hur förtroendevalda (politiker) och tjänstemän handlägger ärenden, vilka handlingar som kommit in till kommunens olika förvaltningar och vilka som skickats ut.</p>
@@ -67,7 +52,7 @@ <h2>Kakor</h2>
6752

6853
<dl>
6954
<dt>Vad är <em>INTE</em> FixaMinGata till för?</dt>
70-
<dd>FixaMinGata är inte lämpligt för andra typer av problem än de som anges ovan. Du måste kontakta din kommun eller fastighetsägare direkt för problem 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><li>Information kring brott/överträdelser eller misstanke om detsamma</li></ul></dd>
55+
<dd>FixaMinGata är inte lämpligt för andra typer av problem än de som anges ovan. Du måste kontakta din kommun eller fastighetsägare direkt för problem i stil med:<ul style="margin-bottom: 0;"><li>Brådskande och akuta problem</li><li>Oljud i din närmiljö</li><li>Förslag på nya vägar, farthinder, etc.</li><li>Klaga på dina grannar</li><li>Klaga på din kommun</li><li>Information kring brott/överträdelser eller misstanke om detsamma</li></ul><p style="margin-bottom: 2em;">Vid pågående brott och vid fara för liv, hälsa eller egendom ska du ringa 112.</p></dd>
7156
</dl>
7257

73-
[% INCLUDE 'footer.html' %]
58+
[% INCLUDE 'footer.html' pagefooter = 'yes' %]

Diff for: templates/web/fixamingata/contact/address.html

+3-2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
Du kan kontakta Föreningen Sambruk via post:</p>
55

66
<p>Föreningen Sambruk<br>
7-
c/o Sandvikens kommun<br>
8-
811 80 Sandviken</p>
7+
Sandbacka Park<br>
8+
Högbovägen 45<br>
9+
811 32 Sandviken</p>
910
</div>

Diff for: templates/web/fixamingata/contact/blurb.html

+10-7
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1-
<p>
2-
Rapportera <strong>inte</strong> problem i din närmiljö genom det här formuläret. Breven går till FixaMinGata i stället för din kommun. Vill du rapportera ett problem i din närmiljö måste du <a href="/">gå till framsidan</a> och följa instruktionerna där.
3-
</p>
4-
5-
<p>
6-
Vi vill gärna höra vad du tycker om FixaMinGata. Fyll i formuläret nedan och skicka in.
7-
</p>
1+
<p>Rapportera <strong>inte</strong> problem i din närmiljö genom det här
2+
formuläret. Breven går till FixaMinGata i stället för din kommun. Vill du
3+
rapportera ett problem i din närmiljö måste du <a href="/">gå till framsidan</a>
4+
och följa instruktionerna där.</p>
5+
<p>Vi vill gärna höra vad du tycker om FixaMinGata. Fyll i formuläret nedan och
6+
skicka in.</p>
7+
<p>Du kan även begära att få ditt konto borttaget via detta formulär. När kontot
8+
raderas anonymiseras dina uppgifter, inklusive din ditt namn, e-postadress och
9+
eventuella telefonnummer. Rapporter och uppdateringar finns dock kvar för
10+
statistik.</p>

Diff for: templates/web/fixamingata/footer_extra.html

+11-11
Original file line numberDiff line numberDiff line change
@@ -34,30 +34,30 @@ <h2 class="mysoc-footer__site-name">FixaMinGata</h2>
3434
<div class="col-sm-5">
3535
<nav class="mysoc-footer__links">
3636
<ul>
37-
<li><[% IF c.req.uri.path == '/' %]span[% ELSE %]a href="/"[% END %] class="report-a-problem-btn"
37+
<li><[% IF c.req.uri.path == '/' %]span[% ELSE %]a href="[% base %]/"[% END %] class="report-a-problem-btn"
3838
>[% loc("Report a problem") %]</[% c.req.uri.path == '/' ? 'span' : 'a' %]></li>
39-
<li><[% IF c.req.uri.path == '/my' %]span[% ELSE %]a href="/my"[% END
39+
<li><[% IF c.req.uri.path == '/my' %]span[% ELSE %]a href="[% base %]/my"[% END
4040
%]>[% loc("Your reports") %]</[% c.req.uri.path == '/my' ? 'span' : 'a' %]></li>
41-
<li><[% IF c.req.uri.path == '/reports' %]span[% ELSE %]a href="/reports"[% END
41+
<li><[% IF c.req.uri.path == '/reports' %]span[% ELSE %]a href="[% base %]/reports"[% END
4242
%]>[% loc("All reports") %]</[% c.req.uri.path == '/reports' ? 'span' : 'a' %]></li>
43-
<li><[% IF c.req.uri.path == '/alert' %]span[% ELSE %]a href="/alert[% pc ? '/list?pc=' : '' %][% pc | uri %]"[% END
43+
<li><[% IF c.req.uri.path == '/alert' %]span[% ELSE %]a href="[% base %]/alert[% pc ? '/list?pc=' : '' %][% pc | uri %]"[% END
4444
%]>[% loc("Local alerts") %]</[% c.req.uri.path == '/alert' ? 'span' : 'a' %]></li>
4545
</ul>
4646
<ul>
47-
<!-- <li><[% IF c.req.uri.path == '/posters' %]span[% ELSE %]a href="/posters"[% END
47+
<!-- <li><[% IF c.req.uri.path == '/posters' %]span[% ELSE %]a href="[% base %]/posters"[% END
4848
%]>[% loc("FixMyStreet Goodies") %]</[% c.req.uri.path == '/posters' ? 'span' : 'a' %]></li> -->
49-
<!-- <li><[% IF c.req.uri.path == '/contact' %]span[% ELSE %]a href="/contact"[% END
49+
<!-- <li><[% IF c.req.uri.path == '/contact' %]span[% ELSE %]a href="[% base %]/contact"[% END
5050
%]>[% loc("Contact") %]</[% c.req.uri.path == '/contact' ? 'span' : 'a' %]></li> -->
51-
<li><[% IF c.req.uri.path == '/contact' %]span[% ELSE %]a href="/contact"[% END
51+
<li><[% IF c.req.uri.path == '/contact' %]span[% ELSE %]a href="[% base %]/contact"[% END
5252
%]>Kontakt</[% c.req.uri.path == '/contact' ? 'span' : 'a' %]></li>
53-
<li><[% IF c.req.uri.path == '/faq' %]span[% ELSE %]a href="/faq"[% END
53+
<li><[% IF c.req.uri.path == '/faq' %]span[% ELSE %]a href="[% base %]/faq"[% END
5454
%]>[% loc("Help") %]</[% c.req.uri.path == '/faq' ? 'span' : 'a' %]></li>
55-
<!-- <li><[% IF c.req.uri.path == '/privacy' %]span[% ELSE %]a href="/privacy"[% END
55+
<!-- <li><[% IF c.req.uri.path == '/privacy' %]span[% ELSE %]a href="[% base %]/privacy"[% END
5656
%]>[% loc("Privacy") %]</[% c.req.uri.path == '/privacy' ? 'span' : 'a' %]></li> -->
57-
<li><[% IF c.req.uri.path == '/about/privacy' %]span[% ELSE %]a href="/about/privacy"[% END
57+
<li><[% IF c.req.uri.path == '/about/privacy' %]span[% ELSE %]a href="[% base %]/about/privacy"[% END
5858
%]>Sekretess</[% c.req.uri.path == '/about/privacy' ? 'span' : 'a' %]></li>
5959
<li><a href="https://github.com/Sambruk/fixmystreet">Öppen källkod</a></li>
60-
<li><[% IF c.req.uri.path == '/about/accessibility' %]span[% ELSE %]a href="/about/accessibility"[% END
60+
<li><[% IF c.req.uri.path == '/about/accessibility' %]span[% ELSE %]a href="[% base %]/about/accessibility"[% END
6161
%]>Tillgänglighet</[% c.req.uri.path == '/about/accessibility' ? 'span' : 'a' %]></li>
6262
</ul>
6363
</nav>

Diff for: templates/web/fixamingata/footer_extra_js.html

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
[% scripts.push(
22
version('/cobrands/fixamingata/js.js'),
3+
version('/cobrands/fixmystreet/assets.js'),
34
) %]

Diff for: templates/web/fixamingata/report/inspect/public_update.html

Whitespace-only changes.

Diff for: templates/web/fixamingata/report/new/inline-tips.html

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
<div class="description_tips">
2-
<h4>Tips för bra rapporter:</h4>
1+
<div class="description_tips" aria-label="Tips för bra rapporter:">
32
<ul class="do">
43
<li>Var trevlig</li>
54
<li>Ange platser noggrant</li>

Diff for: web/cobrands/fixamingata/base.scss

+12
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,18 @@ $grid-breakpoint-sm: $mysoc-footer-breakpoint-sm;
231231
padding-top: 0;
232232
}
233233

234+
#geolocate_link {
235+
margin-top: 2em !important;
236+
}
237+
238+
.mobile #geolocate_link {
239+
margin-top: 15px !important;
240+
}
241+
234242
#pc-hint {
235243
display: none;
236244
}
245+
246+
.sticky-sidebar li:last-child {
247+
margin-bottom: 0;
248+
}

Diff for: web/cobrands/fixamingata/js.js

+14-10
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,27 @@
11
fixmystreet.inspect_form_no_scroll_on_load = 1;
22

3-
// Chrome ignores autocomplete="off" on the title input,
4-
// and incorrectly autocompletes it with the user's email address.
5-
// For now we'll reset the title to empty if it contains
6-
// an email address when the user has selected a category.
7-
// Hopefully we can get rid of this eventually if Chrome changes
8-
// its behaviour.
3+
// Chrome ignores autocomplete="off" on the title input, and incorrectly
4+
// autocompletes it with the user's email address. For now we'll reset the title
5+
// to empty if it contains an email address when the user has selected a
6+
// category. Hopefully we can get rid of this eventually if Chrome changes its
7+
// behaviour.
98
fixmystreet.fixChromeAutocomplete = function() {
109
var title = document.getElementById("form_title");
1110

1211
if (title) {
13-
if (title.value == "" ||
14-
/^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@(?:\S{1,63})$/.test(title.value)) {
12+
if (
13+
title.value == "" ||
14+
/^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@(?:\S{1,63})$/.test(title.value)
15+
) {
1516
title.value = "";
1617
}
1718
}
1819
};
1920

20-
// jQuery is not imported on every page
21+
// jQuery is not imported on every page.
2122
if (window.$) {
22-
$(fixmystreet).on('report_new:category_change', fixmystreet.fixChromeAutocomplete);
23+
$(fixmystreet).on(
24+
"report_new:category_change",
25+
fixmystreet.fixChromeAutocomplete
26+
);
2327
}

0 commit comments

Comments
 (0)