diff options
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Report/New.pm | 6 | ||||
-rw-r--r-- | perllib/FixMyStreet/Cobrand/EmptyHomes.pm | 12 | ||||
-rw-r--r-- | perllib/FixMyStreet/DB/Result/Problem.pm | 2 | ||||
-rw-r--r-- | templates/web/emptyhomes/report/new/fill_in_details_form.html | 157 |
4 files changed, 176 insertions, 1 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Report/New.pm b/perllib/FixMyStreet/App/Controller/Report/New.pm index da9097ab1..788e57be0 100644 --- a/perllib/FixMyStreet/App/Controller/Report/New.pm +++ b/perllib/FixMyStreet/App/Controller/Report/New.pm @@ -833,6 +833,12 @@ sub process_report : Private { $bodies = join( ',', @{ $c->stash->{bodies_to_list} } ) || -1; $report->bodies_str( $bodies ); + my %extra; + $c->cobrand->process_extras( $c, undef, \%extra ); + if ( %extra ) { + $report->extra( \%extra ); + } + } elsif ( $first_area->{id} == COUNCIL_ID_BARNET ) { unless ( exists Utils::barnet_categories()->{ $report->category } ) { diff --git a/perllib/FixMyStreet/Cobrand/EmptyHomes.pm b/perllib/FixMyStreet/Cobrand/EmptyHomes.pm index bc0772c3d..ef27d2c4e 100644 --- a/perllib/FixMyStreet/Cobrand/EmptyHomes.pm +++ b/perllib/FixMyStreet/Cobrand/EmptyHomes.pm @@ -107,6 +107,18 @@ sub council_rss_alert_options { return ( \@options, @reported_to_options ? \@reported_to_options : undef ); } +sub process_extras { + my $self = shift; + my $ctx = shift; + my $body_id = shift; + my $extra = shift; + + my $value = $ctx->request->params->{address} || ''; + $ctx->stash->{field_errors}->{address} = _('This information is required') + unless $value; + $extra->{address} = $value; +} + # A record of the number of reports from the Channel 4 site and other old data sub old_site_stats { return { diff --git a/perllib/FixMyStreet/DB/Result/Problem.pm b/perllib/FixMyStreet/DB/Result/Problem.pm index 5bde902d4..24aa12944 100644 --- a/perllib/FixMyStreet/DB/Result/Problem.pm +++ b/perllib/FixMyStreet/DB/Result/Problem.pm @@ -424,7 +424,7 @@ sub check_for_errors { { $errors{name} = _( 'Please enter your full name, councils need this information – if you do not wish your name to be shown on the site, untick the box below' - ); + ) unless $self->cobrand eq 'emptyhomes'; } if ( $self->category diff --git a/templates/web/emptyhomes/report/new/fill_in_details_form.html b/templates/web/emptyhomes/report/new/fill_in_details_form.html new file mode 100644 index 000000000..b269267e1 --- /dev/null +++ b/templates/web/emptyhomes/report/new/fill_in_details_form.html @@ -0,0 +1,157 @@ +<h1>[% loc('Reporting a problem') %]</h1> + +[% IF report.used_map %] + [% IF partial_token %] + <p id="unknown">[% loc('Please note your report has <strong>not yet been sent</strong>. Choose a category and add further information below, then submit.') %]</p> + [% END %] +<p>[% loc('You have located the problem at the point marked with a green pin on the map. If this is not the correct location, simply click on the map again. ') %]</p> +[% END %] + +[% IF js %] + <p id="councils_text">[% + tprintf( + loc('All the information you provide here will be sent to <strong>%s</strong>.'), + loc('the local council') + ); + %] + </p> +[% ELSE %] + [% PROCESS 'report/new/councils_text.html' %] +[% END %] + +<p> +[% IF report.used_map %] + [% INCLUDE 'report/new/fill_in_details_text.html' %] +[% ELSE %] + [% loc('Please fill in the form below with details of the problem, and describe the location as precisely as possible in the details box.') %] +[% END %] +</p> + +[% INCLUDE 'errors.html' %] + +<div id="problem_form"> + +[% INCLUDE 'report/new/form_heading.html' %] + +<div class="fieldset"> + +[% IF field_errors.bodies %] + <div class='form-error'>[% field_errors.bodies %]</div> +[% END %] + +<div id="form_sign_in_yes"> + +<h3>[% loc('Public information (shown on site)') %]</h3> + +<p>[% loc('Please do not give address or personal information in this section.') %]</p> + +[% IF js %] + <div class="form-field" id="form_category_row"> + <label for="form_category">[% loc('Category:') %]</label> + <select name="category" id="form_category" required><option>[% loc('Loading...') %]</option></select> + </div> +[% ELSE %] + [% IF category_options.size %] + [% IF field_errors.category %] + <div class='form-error'>[% field_errors.category %]</div> + [% END %] + + <div class="form-field"> + [% PROCESS "report/new/category.html" %] + </div> + [% END %] +[% END %] + +[% IF field_errors.title %] + <div class='form-error'>[% field_errors.title %]</div> +[% END %] + +<div class="form-field"> + <label for="form_title">[% loc('Subject:') %]</label> + <input type="text" value="[% report.title | html %]" name="title" id="form_title" size="25" required> +</div> + +[% IF field_errors.detail %] + <div class='form-error'>[% field_errors.detail %]</div> +[% END %] + +<div class="form-field"> + <label for="form_detail">[% loc('Details:') %]</label> + <textarea name="detail" id="form_detail" rows="7" cols="26" required>[% report.detail | html %]</textarea> +</div> + +[% IF c.cobrand.allow_photo_upload %] + [% IF field_errors.photo %] + <div class='form-error'>[% field_errors.photo %]</div> + [% END %] + + <div class='form-field'> + [% IF upload_fileid || report.photo %] + <p>[% loc('You have already attached a photo to this report, attaching another one will replace it.') %]</p> + [% IF upload_fileid %] + <input type="hidden" name="upload_fileid" value="[% upload_fileid %]" /> + [% END %] + [% IF report.photo %] + <img align="right" src="/photo/[% report.id %].jpeg" hspace="5"> + [% END %] + [% END %] + + <label for="form_photo">[% loc('Photo:') %]</label> + <input type="file" name="photo" id="form_photo" style="width:20em"> + </div> +[% END %] + +</div> + +<div id="form_sign_in_no"> + +<h3>[% loc('Private information (not shown on site)') %]</h3> + +[% IF field_errors.address %] + <div class='form-error'>[% field_errors.address %]</div> +[% END %] + +<div class="form-field"> + <label for="form_address">[% loc('Property address:') %]</label> + <textarea name="address" id="form_address" rows="7" cols="26">[% report.extra.address | html %]</textarea> +</div> + + [% IF field_errors.name %] + <div class='form-error'>[% field_errors.name %]</div> + [% END %] + + <div class="form-field"> + <label for="form_name">[% loc('Your name:') %]</label> + <input type="text" required value="[% report.name | html %]" name="name" id="form_name" size="25"> + </div> + + [% IF field_errors.email %] + <div class='form-error'>[% field_errors.email %]</div> + [% END %] + + <div class="form-field"> + <label for="form_email">[% loc('Your email:') %]</label> + <input type="email" value="[% report.user.email | html %]" name="email" id="form_email" size="25" required> + </div> + + <div class="form-field"> + <label for="form_phone">[% loc('Phone:') %]</label> + <input type="text" value="[% report.user.phone | html %]" name="phone" id="form_phone" size="15"> + <small>[% loc('(optional)') %]</small> + </div> + + <p> + <input type="submit" value="[% loc('Submit') %]"> + </p> + +</div> + +[% IF partial_token %] + <input type="hidden" name="partial" value="[% partial_token.token %]"> +[% END %] + +<input type="hidden" name="submit_problem" value="1"> + +</div> +</div> + |