diff options
-rw-r--r-- | .cypress/cypress/integration/simple_spec.js | 3 | ||||
-rw-r--r-- | CHANGELOG.md | 1 | ||||
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Report/New.pm | 12 | ||||
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Test.pm | 3 | ||||
-rw-r--r-- | t/app/controller/report_new.t | 2 | ||||
-rw-r--r-- | templates/web/base/report/form/submit.html | 2 | ||||
-rw-r--r-- | templates/web/base/report/form/user_loggedout_by_email.html | 2 | ||||
-rw-r--r-- | templates/web/base/report/new/form_report.html | 1 | ||||
-rw-r--r-- | templates/web/base/report/new/form_user_loggedin.html | 2 | ||||
-rw-r--r-- | templates/web/base/report/new/login_success_form.html | 2 | ||||
-rw-r--r-- | templates/web/base/report/new/oauth_email_form.html | 2 | ||||
-rw-r--r-- | templates/web/base/report/update/form_user_loggedin.html | 4 | ||||
-rw-r--r-- | templates/web/zurich/report/new/fill_in_details_form.html | 5 | ||||
-rw-r--r-- | web/cobrands/fixmystreet/fixmystreet.js | 1 |
14 files changed, 32 insertions, 10 deletions
diff --git a/.cypress/cypress/integration/simple_spec.js b/.cypress/cypress/integration/simple_spec.js index e2b776d21..074bf72bd 100644 --- a/.cypress/cypress/integration/simple_spec.js +++ b/.cypress/cypress/integration/simple_spec.js @@ -20,6 +20,9 @@ describe('Clicking the map', function() { cy.get('#map_sidebar').should('contain', 'check and confirm your details'); cy.get('#map_sidebar').parents('form').submit(); cy.get('body').should('contain', 'Thank you for reporting this issue'); + cy.visit('http://fixmystreet.localhost:3001/_test/setup/simple-service-check').then(function(w) { + expect(w.document.documentElement.innerText).to.equal('desktop'); + }); }); }); diff --git a/CHANGELOG.md b/CHANGELOG.md index 8aa628795..cbdd0663f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -43,6 +43,7 @@ - Allow inspectors to change report asset. - Staff users can use HTML tags in updates. #3143 - Response templates can include HTML tags. #3143 + - Record whether report made on desktop or mobile. - Development improvements: - `#geolocate_link` is now easier to re-style. #3006 - Links inside `#front-main` can be customised using `$primary_link_*` Sass variables. #3007 diff --git a/perllib/FixMyStreet/App/Controller/Report/New.pm b/perllib/FixMyStreet/App/Controller/Report/New.pm index d676e2856..037e1992a 100644 --- a/perllib/FixMyStreet/App/Controller/Report/New.pm +++ b/perllib/FixMyStreet/App/Controller/Report/New.pm @@ -29,8 +29,8 @@ Create a new report, or complete a partial one. submit_problem: true if a problem has been submitted, at all. submit_sign_in: true if the sign in button has been clicked by logged out user. -submit_register: true if the register/confirm by email button has been clicked -by logged out user. +submit_register(_mobile): true if the register/confirm by email button has been clicked +by logged out user, or submit button clicked by logged in user. =head2 location (required) @@ -1046,7 +1046,13 @@ sub process_report : Private { $report->detail( $detail ); # mobile device type - $report->service( $params{service} ) if $params{service}; + if ($params{service}) { + $report->service($params{service}); + } elsif ($c->get_param('submit_register_mobile')) { + $report->service('mobile'); + } elsif ($c->get_param('submit_register')) { + $report->service('desktop'); + } # set these straight from the params $report->category( _ $params{category} ) if $params{category}; diff --git a/perllib/FixMyStreet/App/Controller/Test.pm b/perllib/FixMyStreet/App/Controller/Test.pm index 19a8c5321..ce54f004f 100644 --- a/perllib/FixMyStreet/App/Controller/Test.pm +++ b/perllib/FixMyStreet/App/Controller/Test.pm @@ -61,6 +61,9 @@ sub setup : Path('/_test/setup') : Args(1) { }); $category->update; $c->response->body("OK"); + } elsif ($test eq 'simple-service-check') { + my $problem = FixMyStreet::DB->resultset("Problem")->search(undef, { order_by => { -desc => 'id' } })->first; + $c->response->body($problem->service); } } diff --git a/t/app/controller/report_new.t b/t/app/controller/report_new.t index b0c93c332..77eb4fefb 100644 --- a/t/app/controller/report_new.t +++ b/t/app/controller/report_new.t @@ -149,7 +149,7 @@ foreach my $test ( $mech->submit_form_ok( { - button => 'submit_register', + button => 'submit_register_mobile', with_fields => { title => 'Test Report', detail => 'Test report details.', diff --git a/templates/web/base/report/form/submit.html b/templates/web/base/report/form/submit.html new file mode 100644 index 000000000..950bed965 --- /dev/null +++ b/templates/web/base/report/form/submit.html @@ -0,0 +1,2 @@ +<input class="desk-only btn btn--primary btn--block btn--final js-submit_register" type="submit" name="submit_register" value="[% loc('Submit') %]"> +<input class="mob-only btn btn--primary btn--block btn--final js-submit_register" type="submit" name="submit_register_mobile" value="[% loc('Submit') %]"> diff --git a/templates/web/base/report/form/user_loggedout_by_email.html b/templates/web/base/report/form/user_loggedout_by_email.html index 2e41deaea..3446fd767 100644 --- a/templates/web/base/report/form/user_loggedout_by_email.html +++ b/templates/web/base/report/form/user_loggedout_by_email.html @@ -87,7 +87,7 @@ [% PROCESS 'auth/form_extra.html' %] - <input class="btn btn--primary btn--block btn--final js-submit_register" type="submit" name="submit_register" value="[% loc('Submit') %]"> + [% PROCESS 'report/form/submit.html' %] </div> <!-- /user_loggedout_by_email.html --> diff --git a/templates/web/base/report/new/form_report.html b/templates/web/base/report/new/form_report.html index 3b28d4aa7..33dd5769e 100644 --- a/templates/web/base/report/new/form_report.html +++ b/templates/web/base/report/new/form_report.html @@ -89,5 +89,6 @@ <input type="hidden" id="single_body_only" name="single_body_only" value=""> <input type="hidden" id="do_not_send" name="do_not_send" value=""> <input type="hidden" name="submit_problem" value="1"> + <input type="hidden" id="form_service" name="service" value=""> </div> <!-- /report/new/form_report.html --> diff --git a/templates/web/base/report/new/form_user_loggedin.html b/templates/web/base/report/new/form_user_loggedin.html index 515f3842a..9215e7d59 100644 --- a/templates/web/base/report/new/form_user_loggedin.html +++ b/templates/web/base/report/new/form_user_loggedin.html @@ -74,5 +74,5 @@ </div> [% END %] -<input class="btn btn--primary btn--block btn--final js-submit_register" type="submit" name="submit_register" value="[% loc('Submit') %]"> +[% PROCESS 'report/form/submit.html' %] <!-- /report/new/form_user_loggedin.html --> diff --git a/templates/web/base/report/new/login_success_form.html b/templates/web/base/report/new/login_success_form.html index 32c414bda..7ef896910 100644 --- a/templates/web/base/report/new/login_success_form.html +++ b/templates/web/base/report/new/login_success_form.html @@ -14,6 +14,6 @@ [% PROCESS "report/form/user_loggedout.html" type='report' object=report %] [% END %] [% PROCESS 'report/new/form_report.html' %] - <input class="btn btn--primary btn--block btn--final js-submit_register" type="submit" name="submit_register" value="[% loc('Submit') %]"> + [% PROCESS 'report/form/submit.html' %] </div> </fieldset> diff --git a/templates/web/base/report/new/oauth_email_form.html b/templates/web/base/report/new/oauth_email_form.html index a0adbe563..126f93409 100644 --- a/templates/web/base/report/new/oauth_email_form.html +++ b/templates/web/base/report/new/oauth_email_form.html @@ -17,6 +17,6 @@ <input type="hidden" name="oauth_need_email" value="1"> [% PROCESS 'report/new/form_report.html' %] - <input class="btn btn--primary btn--block btn--final js-submit_register" type="submit" name="submit_register" value="[% loc('Submit') %]"> + [% PROCESS 'report/form/submit.html' %] </div> </fieldset> diff --git a/templates/web/base/report/update/form_user_loggedin.html b/templates/web/base/report/update/form_user_loggedin.html index 8d55737d2..02e7de51f 100644 --- a/templates/web/base/report/update/form_user_loggedin.html +++ b/templates/web/base/report/update/form_user_loggedin.html @@ -38,5 +38,7 @@ <label class="inline" for="form_add_alert">[% loc( 'Alert me to future updates' ) %]</label> </div> -<div class="clearfix"><input class="btn btn--primary btn--block btn--final js-submit_register" type="submit" name="submit_register" value="[% loc('Post') %]"></div> +<div class="clearfix"> + [% PROCESS 'report/form/submit.html' %] +</div> <!-- /report/update/form_user_loggedin.html --> diff --git a/templates/web/zurich/report/new/fill_in_details_form.html b/templates/web/zurich/report/new/fill_in_details_form.html index 8d840c43e..c7ad0fb96 100644 --- a/templates/web/zurich/report/new/fill_in_details_form.html +++ b/templates/web/zurich/report/new/fill_in_details_form.html @@ -70,7 +70,10 @@ <div class="form-txt-submit-box"> [%# class of submit_sign_in so name can be optional, name of submit_register so it doesn't try and sign us in %] - <p><input class="green-btn js-submit_sign_in" type="submit" name="submit_register" value="[% loc('Submit') %]"> + <p> + <input class="desk-only green-btn js-submit_sign_in" type="submit" name="submit_register" value="[% loc('Submit') %]"> + <input class="mob-only green-btn js-submit_sign_in" type="submit" name="submit_register_mobile" value="[% loc('Submit') %]"> + </p> </div> </div> diff --git a/web/cobrands/fixmystreet/fixmystreet.js b/web/cobrands/fixmystreet/fixmystreet.js index 9c6ce83ed..15856f4ce 100644 --- a/web/cobrands/fixmystreet/fixmystreet.js +++ b/web/cobrands/fixmystreet/fixmystreet.js @@ -659,6 +659,7 @@ $.extend(fixmystreet.set_up, { } else { fixmystreet.resize_to.desktop_page(); } + $('#form_service').val(type); last_type = type; }).resize(); }, |