diff options
author | Dave Whiteland <dave@mysociety.org> | 2012-10-03 17:47:25 +0100 |
---|---|---|
committer | Dave Whiteland <dave@mysociety.org> | 2012-10-03 17:47:25 +0100 |
commit | 272dba7ce6d59d81b52579dd4c5fc7d65e9bec20 (patch) | |
tree | cabbefec7823061781050ffb002a38ce53d68f56 /templates | |
parent | 39c1b648b30e67ceb8912a35b386eb4ee23857b8 (diff) | |
parent | f16a3e96b65394089d10c46c1d67cf82c67e72dd (diff) |
Merge branch 'fmb-read-only'
Conflicts:
db/schema.sql
perllib/FixMyStreet/DB/Result/Contact.pm
perllib/FixMyStreet/DB/Result/Problem.pm
Diffstat (limited to 'templates')
22 files changed, 641 insertions, 31 deletions
diff --git a/templates/web/default/admin/council_contacts.html b/templates/web/default/admin/council_contacts.html index 60e270c7c..eb9606a31 100644 --- a/templates/web/default/admin/council_contacts.html +++ b/templates/web/default/admin/council_contacts.html @@ -1,5 +1,7 @@ [% INCLUDE 'admin/header.html' title=tprintf(loc('Council contacts for %s'), council_name) -%] +[% conf = open311.next %] + [% IF updated %] <p> <em>[% updated %]</em> @@ -36,6 +38,7 @@ <th>[% loc('Email') %]</th> <th>[% loc('Confirmed') %]</th> <th>[% loc('Deleted') %]</th> + <th>[% loc('Devolved') %]</th> <th>[% loc('Last editor') %]</th> <th>[% loc('Note') %]</th> <th>[% loc('Public') %]</th> @@ -48,6 +51,7 @@ <td>[% contact.email | html %]</td> <td>[% IF contact.confirmed %][% loc('Yes') %][% ELSE %][% loc('No') %][% END %]</td> <td>[% IF contact.deleted %][% loc('Yes') %][% ELSE %][% loc('No') %][% END %]</td> + <td>[% IF conf.can_be_devolved && contact.send_method %][% loc('Yes') %][% ELSE %][% loc('No') %][% END %]</td> <td>[% contact.editor %]</td> <td>[% contact.note | html %]</td> <td>[% contact.non_public ? loc('Non Public') : loc('Public') %]</td> @@ -111,7 +115,6 @@ <h2>[% loc('Configure Open311 integration') %]</h2> <form method="post" action="[% c.uri_for('council_contacts', area_id ) %]" enctype="application/x-www-form-urlencoded" accept-charset="utf-8"> - [% conf = open311.next %] <p> <label for="endpoint">Endpoint</label>: <input type="text" name="endpoint" id="endpoint" value="[% conf.endpoint %]" size="50"> @@ -153,6 +156,11 @@ </p> <p> + <label for="devolved">Endpoint lookup can be devolved to contacts</label>: + <input type="checkbox" name="devolved"[% ' checked' IF conf.can_be_devolved %]> + </p> + + <p> <input type="hidden" name="open311_id" value="[% conf.id %]"> <input type="hidden" name="area_id" value="[% area_id %]"> <input type="hidden" name="posted" value="open311"> diff --git a/templates/web/default/admin/council_edit.html b/templates/web/default/admin/council_edit.html index 9ec0578ff..408466b51 100644 --- a/templates/web/default/admin/council_edit.html +++ b/templates/web/default/admin/council_edit.html @@ -31,6 +31,33 @@ <strong>[% loc('Note:') %] </strong><textarea name="note" rows="3" cols="40">[% contact.note | html %]</textarea> <br> + <h2>[% loc('Configure Endpoint') %]</h2> + <form method="post" action="[% c.uri_for('council_contacts', area_id ) %]" enctype="application/x-www-form-urlencoded" accept-charset="utf-8"> + <p> + <label for="endpoint">Endpoint</label>: + <input type="text" name="endpoint" id="endpoint" value="[% contact.endpoint %]" size="50"> + </p> + + <p> + <label for="jurisdiction">Jurisdiction</label>: + <input type="text" name="jurisdiction" id="jurisdiction" value="[% contact.jurisdiction %]" size="50"> + </p> + + <p> + <label for="api_key">Api Key</label>: + <input type="text" name="api_key" id="api_key" value="[% contact.api_key %]" size="25"> + </p> + + <p> + <label for="send_method">Send Method</label>: + <select name="send_method"> + <option value=""> -- Select a method -- </option> + [% FOR method IN send_methods %] + <option value="[% method %]"[% ' selected' IF contact.send_method == method %]>[% method %]</option> + [% END %] + </select> + </p> + <input type="hidden" name="area_id" value="[% area_id %]"> <input type="hidden" name="posted" value="new"> <input type="submit" name="Save changes" value="[% loc('Save changes') %]"> diff --git a/templates/web/default/dashboard/index.html b/templates/web/default/dashboard/index.html index c2bfa9ea3..169d7d3fe 100644 --- a/templates/web/default/dashboard/index.html +++ b/templates/web/default/dashboard/index.html @@ -17,6 +17,7 @@ </hgroup> <div class="filters"> + [% IF c.cobrand.moniker != 'fixmybarangay' %] <p> <label for="ward">Ward:</label> <select name="ward"><option value=''>All</option> @@ -25,6 +26,7 @@ [% END %] </select> </p> + [% END %] <p> <label for="category">Report category:</label> diff --git a/templates/web/default/maps/openlayers.html b/templates/web/default/maps/openlayers.html index e815642f1..b75e2bbd8 100644 --- a/templates/web/default/maps/openlayers.html +++ b/templates/web/default/maps/openlayers.html @@ -8,7 +8,7 @@ <script type="text/javascript"> var fixmystreet = { 'page': '[% page %]', - 'area': '[% map.area %]', + 'area': [ [% map.area.join(',') %] ], 'all_pins': '[% all_pins %]', 'latitude': [% map.latitude %], 'longitude': [% map.longitude %], diff --git a/templates/web/fixmybarangay/alert/_list.html b/templates/web/fixmybarangay/alert/_list.html new file mode 100644 index 000000000..8491b4562 --- /dev/null +++ b/templates/web/fixmybarangay/alert/_list.html @@ -0,0 +1,45 @@ + <input type="hidden" name="type" value="local"> + <input type="hidden" name="pc" value="[% pc | html %]"> + + + <p> + [% loc("Subscribe to an alert based upon what baranagay you’re in:") %] + </p> + + [% INCLUDE 'errors.html' %] + + <div id="rss_list"> + <p><strong> + [% loc('Problems within the boundary of:') %] + </strong></p> + <ul class="plain-list"> + + [% FOREACH option IN options %] + <li[% IF ! (loop.count % 2) %] class="a"[% END %]> + <input type="radio" name="feed" id="[% option.id %]" value="[% option.id %]"[% IF option.id == selected_feed %] checked[% END %]> + <label class="inline" for="[% option.id %]">[% option.text %]</label> + <a href="[% option.uri %]"><img src="/i/feed.png" width="16" height="16" +title="[% option.rss_text %]" alt="RSS feed" border="0"></a> + </li> + [% END %] +</ul> + + <p> + <input type="submit" name="rss" value="[% loc('Give me an RSS feed') %]"> + <p> + + <p id="alert_or"> + [% loc('or') %] + </p> + + [% UNLESS c.user_exists %] + <p> + [% loc('Your email:') %] <input type="text" id="rznvy" name="rznvy" value="[% rznvy | html %]" size="30"> + </p> + [% END %] + + <p> + <input type="submit" name="alert" value="[% loc('Subscribe me to an email alert') %]"> + </p> + </div> <!-- ???? --> + diff --git a/templates/web/fixmybarangay/alert/index.html b/templates/web/fixmybarangay/alert/index.html new file mode 100644 index 000000000..d9bb74ee9 --- /dev/null +++ b/templates/web/fixmybarangay/alert/index.html @@ -0,0 +1,45 @@ +[% INCLUDE 'header.html', title = loc('Local RSS feeds and email alerts'), bodyclass = 'twothirdswidthpage' %] + +<h1>[% loc('Local RSS feeds and email alerts') %]</h1> + +<p> +FixMyBarangay has a RSS feeds and email alerts for local problems. +</p> + +[% IF location_error %] + <div class="error">[% location_error %]</div> +[% ELSE %] + [% INCLUDE 'errors.html' %] +[% END %] + +[% options = [ { + id => 'council:1:Luz', + text => 'Luz', + uri => '/rss/reports/Luz' + }, + { + id => 'council:2:Basak_San_Nicolas', + text => 'Basak San Nicolas' + uri => '/rss/reports/Basak+San_Nicolas' + } ]; +%] + +<form id="alerts" name="alerts" method="post" action="/alert/subscribe"> + +[% IF photos.size %] +<div class="sticky-sidebar" id="alert_recent"> + <aside> + <h2>[% loc('Some photos of recent reports') %]</h2> + [% FOREACH p IN photos %] + <a href="/report/[% p.id %]"><img border="0" height="100" + src="/photo/[% p.id %].tn.jpeg" alt="[% p.title | html %]" title="[% p.title | html %]"></a> + [% END %] + </aside> +</div> +[% END %] + +[% INCLUDE 'alert/_list.html' %] + +</form> + +[% INCLUDE 'footer.html' %] diff --git a/templates/web/fixmybarangay/around/tabbed_lists.html b/templates/web/fixmybarangay/around/tabbed_lists.html new file mode 100644 index 000000000..14461628c --- /dev/null +++ b/templates/web/fixmybarangay/around/tabbed_lists.html @@ -0,0 +1,18 @@ +[% allow_creation = !c.cobrand.only_authed_can_create || (c.user && c.user.from_council); + +IF allow_creation %] +<menu id="problems-nav" class="tab-nav"> + <ul> + <li><a href="#current">Problems on the map</a></li> + <li><a href="#message_manager">Problems via text</a></li> + </ul> +</menu> +[% END %] + +<ul id="current" class="issue-list-a tab"> + [% INCLUDE "around/on_map_list_items.html" %] +</ul> + +[% IF allow_creation %] + [% TRY %][% INCLUDE 'report/_message_manager.html' %][% CATCH file %][% END %] +[% END %] diff --git a/templates/web/fixmybarangay/faq/faq-en-gb.html b/templates/web/fixmybarangay/faq/faq-en-gb.html new file mode 100644 index 000000000..320a7528e --- /dev/null +++ b/templates/web/fixmybarangay/faq/faq-en-gb.html @@ -0,0 +1,135 @@ +[% INCLUDE 'header.html', title => loc('Frequently Asked Questions'), bodyclass => 'twothirdswidthpage' %] + +<div class="sticky-sidebar"> + <aside> + <ul class="plain-list"> + <li><a href="#faq">Frequently Asked Questions</a></li> + <li><a href="#practical">Staff Questions</a></li> + <li><a href="#organisation">Organisation Questions</a></li> + </ul> + </aside> +</div> + +<h1><a name="faq"></a>Frequently Asked Questions</h1> + <dl> + <dt>What is FixMyBarangay?</dt> + <dd>FixMyBarangay is a site to help people report, view, +or discuss local problems they’ve found to the city departments. +The pilot project lets you report the problems by SMS (or dropping +into the barangay center). +</dd> + <dt>What areas are covered?</dt> + <dd> + The pilot project is just running in two barangays in Cebu – + Luz and Basak San Nicolas. + </dd> + <dt>What sort of problems should I report with FixMyBarangay?</dt> + <dd>The FixMyBarangay pilot project is just for potholes (and similar + road surface problems) and broken streetlights. + </dd> + + <dt>What isn’t FixMyBarangay for?</dt> + <dd>FixMyStreet is not a way of getting in touch with Cebu City Hall for other problems + – please use FixMyBarangay only for potholes and streetlights while the pilot + project is running.. + </dd> + + <dt>Staff only: How do I use the site?</dt> + <dd>If you have a staff login, you can view problems already reported in that area, +or report ones of your own simply by clicking on the map at the location of +the problem.</dd> + <dt>How are the problems solved?</dt> + <dd>Problems sent by SMS are initially handled by the barangay staff – they'll + confirm the problem and report it to the relevant department automatically. + Once it's in the department's problem-tracking system, they'll get onto it as + soon as they can.</dd> + <dt>Is it free?</dt> + <dd>The site is free to use, yes. The pilot project has been funded by the World Bank.</dd> + + </dl> + + <h2><a name="practical"></a>Staff questions</h2> + <dl> + <dt>What's my login?</dt> + <dd> + You can use your email address and set a password right away, but your + account won't be enabled as a <em>staff account</em> until one of the + system administrators has checked it. TODO: contact details. + </dd> + <dt>I've forgotten my password, what do I do?</dt> + <dd> + No problem — when you log in, if you can't remember your password we'll + send you a confirmation link which lasts for one session, and you can + reset your password once you've clicked on that. + </dd> + <dt>How do I sign out?</dt> + <dd> + Either click on <a href="/auth/sign_out">sign out</a> on the page you're on, + or quit the browser (just closing the window without quitting the browser is not enough). + </dd> + <dt>Reporting</dt> + <dd>TODO</dd> + <dt>How do I see the SMS messages people have sent?</dt> + <dd>When you look at the barangay problems, click on "Problems via text" + (or, if you're viewing a specific report, click "Show messages") to see the + currently available messages. You'll need a username and password + for the Message Manager (your manager will have told you what these + are). Note that you can only see messages that have not yet been used to + create a report (and also their replies). + </dd> + <dt>Is my Message Manager username and password the same as the ones I use for FixMyBarangay?</dt> + <dd> + No, it's a separate account (some FMB users don't have any access to the SMS messages). + Your manager will tell you what your login for Message Manager system is, if you have one. + </dd> + <dt>I tried to work with a message but it said "lock not granted". What's up?</dt> + <dd> + This means another staff member is working on the message. To prevent you both creating + a report, or sending a reply, we use a first-come-first-serve locking mechanism. + Collisions like this are rare, but if they do happen, try again a few minutes later + because the lock may have expired by then. + </dd> + <dt>Can I delete a message?</dt> + <dd> + Yes. Click on the red cross when you hover over it (although really you're only hiding it). + You need an <em>administrator</em> account in the Message Manager to be able to see the + messages that have been hidden, so hiding them is as good as deleting them. + </dd> + <dt>It looks like an incoming message is wrongly shown as a reply. Can I fix it?</dt> + <dd> + FixMyBarangay tries to recognise SMS replies, and automatically matches them to the right thread. If it + gets this wrong, the reply may appear as a new "available" message, or a new message might be + mistaken for a reply. You need to ask an administrator to log into Message Manager to sort this out for you. + </dd> + <dt>How do the replies get back to the original sender?</dt> + <dd> + Although you're replying from within FixMyBarangay, the replies are sent by SMS. + There may be a delay of a few minutes between the moment you press <strong>reply</strong> + and the message's arrival. + </dd> + + <h2><a name="organisation"></a>Organisation Questions</h2> + <dl> + <dt>Who built FixMyBarangay?</dt> + <dd>This site was built by <a href="http://www.mysociety.org/">mySociety</a>, in conjunction with the <a href="www.worldbank.org/">World Bank</a>. +mySociety is the project of a registered charity which has grown out of the community of +volunteers who built sites like <a href="http://www.theyworkforyou.com/">TheyWorkForYou.com</a> in the UK. +mySociety’s primary mission is to build Internet projects which give people simple, tangible +benefits in the civic and community aspects of their lives. +The charity is called UK Citizens Online Democracy and is charity number 1076346. mySociety +can be contacted by email at <a href="mailto:hello@mysociety.org">hello@mysociety.org</a>, +or by post at:<br> +mySociety<br> +483 Green Lanes<br> +London<br> +N13 4BS<br> +UK</dd> + <dt>I’d like a site like this for my own location/ where’s the "source code" to this site?</dt> + <dd> +The software behind this site is open source, and available +to you mainly under the GNU Affero GPL software license. +See <a href="http://code.fixmystreet.com/">code.fixmystreet.com</a> for more information about setting up +and running sites like these. +</dd> + </dl> +[% INCLUDE 'footer.html' pagefooter = 'yes' %] diff --git a/templates/web/fixmybarangay/footer.html b/templates/web/fixmybarangay/footer.html new file mode 100644 index 000000000..658d654c4 --- /dev/null +++ b/templates/web/fixmybarangay/footer.html @@ -0,0 +1,31 @@ + </div><!-- .content role=main --> + </div><!-- .container --> + </div><!-- .table-cell --> + + <div class="nav-wrapper"> + <div class="nav-wrapper-2"> + <div id="main-nav" role="navigation"> + <ul id="mysoc-menu"> + <li><a id="mysoc-logo" href="http://www.mysociety.org/">mySociety</a></li>[% + %]<!--<li><a href="http://mysociety.org/donate/">Donate</a></li>[% + %]<li><a href="http://www.mysociety.org/projects/">Our Sites</a></li>--> + </ul> + + <ul id="main-menu"> + <li><[% IF c.req.uri.path == '/' %]span[% ELSE %]a href="/"[% END %] class="report-a-problem-btn" + >View problems</[% c.req.uri.path == '/' ? 'span' : 'a' %]></li>[% + %]<li><[% IF c.req.uri.path == '/reports' %]span[% ELSE %]a href="/reports"[% END + %]>[% loc("All reports") %]</[% c.req.uri.path == '/reports' ? 'span' : 'a' %]></li>[% + %]<li><[% 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' %]></li>[% + %]<li><[% IF c.req.uri.path == '/faq' %]span[% ELSE %]a href="/faq"[% END + %]>[% loc("Help") %]</[% c.req.uri.path == '/faq' ? 'span' : 'a' %]></li> + </ul> + </div> + </div> + </div> + +<!-- [% INCLUDE 'debug_footer.html' %] --> + </div> <!-- .wrapper --> +</body> +</html> diff --git a/templates/web/fixmybarangay/header.html b/templates/web/fixmybarangay/header.html new file mode 100644 index 000000000..c3ddd154e --- /dev/null +++ b/templates/web/fixmybarangay/header.html @@ -0,0 +1,79 @@ +<!doctype html> +<!--[if lt IE 7]><html class="no-js ie6 oldie" lang="[% lang_code %]"><![endif]--> +<!--[if IE 7]> <html class="no-js ie7 oldie" lang="[% lang_code %]"><![endif]--> +<!--[if IE 8]> <html class="no-js ie8 oldie" lang="[% lang_code %]"><![endif]--> +<!--[if IE 9]> <html class="no-js ie9 oldie" lang="[% lang_code %]"><![endif]--> +<!--[if gt IE 9]><!--><html class="no-js" lang="[% lang_code %]"><!--<![endif]--> + <head> + <meta name="viewport" content="initial-scale=1.0"> + + <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1"> + <meta name="HandHeldFriendly" content="true"> + <meta name="mobileoptimized" content="0"> + + <link rel="stylesheet" href="[% version('/cobrands/fixmybarangay/base.css') %]"> + <link rel="stylesheet" href="[% version('/cobrands/fixmybarangay/layout.css') %]" media="(min-width:48em)"> + [% extra_css %] + <!--[if (lt IE 9) & (!IEMobile)]> + <link rel="stylesheet" href="[% version('/cobrands/fixmybarangay/layout.css') %]"> + <![endif]--> + + <script src="[% version('/js/modernizr.custom.js') %]" charset="utf-8"></script> + <script src="[% version('/cobrands/fixmybarangay/position_map.js') %]" charset="utf-8"></script> + [% INCLUDE 'common_header_tags.html', site_title = 'FixMyBarangay', js_override = '/cobrands/fixmystreet/fixmystreet.js' %] + [% extra_js %] + + [% allow_creation = !c.cobrand.only_authed_can_create || (c.user && c.user.from_council); %] + [% IF allow_creation %] + + <link rel="stylesheet" href="[% version('/js/fancybox/jquery.fancybox-1.3.4.css') %]"> + <script src="[% version('/js/fancybox/jquery.fancybox-1.3.4.pack.js') %]" charset="utf-8"></script> + + <script src="[% version('/cobrands/fixmybarangay/message_manager_client.js') %]" charset="utf-8"></script> + <script> + $(document).ready(function() { + + $('#mm_sign_out').click(function(){ + message_manager.sign_out(); + }); + + [% IF c.req.params.external_source_id && problem && problem.external_source_id.match('^\d+$') %] + var mm_msg_id ="[% c.req.params.external_source_id %]"; + var fms_id = "[% problem.id %]"; + if (mm_msg_id && fms_id) { + message_manager.config({url_root: "[% c.config.MESSAGE_MANAGER_URL %]"}); + message_manager.assign_fms_id(mm_msg_id, fms_id); + } + [% END %] + }); + </script> + [% END %] + </head> + <body class="[% bodyclass | html IF bodyclass %]"> + + <div class="wrapper"> + <div class="table-cell"> + <header id="site-header" role="banner"> + <div class="container"> + <a href="/" id="site-logo">[% c.cobrand.site_title %]</a> + <a href="#main-nav" id="nav-link">Main Navigation</a> + </div> + </header> + + <div id="user-meta"> + [% IF c.user_exists %] + <p> + [% tprintf(loc('Hi %s'), c.user.name || c.user.email) %] + <a href="/auth/sign_out" id="mm_sign_out">[% loc('sign out') %]</a> + </p> + [% ELSE %] + <!-- <a href="/auth">[% loc('Sign in') %]</a> --> + [% END %] + </div> + + [% pre_container_extra %] + + <div class="container"> + <div class="content[% " $mainclass" | html IF mainclass %]" role="main"> + + <!-- [% INCLUDE 'debug_header.html' %] --> diff --git a/templates/web/fixmybarangay/report/_message_manager.html b/templates/web/fixmybarangay/report/_message_manager.html new file mode 100644 index 000000000..1518a9d69 --- /dev/null +++ b/templates/web/fixmybarangay/report/_message_manager.html @@ -0,0 +1,163 @@ +[% IF c.user && c.user.from_council %] + +[% IF problem.id %] + <input type="button" class="green-btn" value="Show Messages" id="show_messages"> +[% END %] + +<ul id="message_manager" class="issue-list-a tab" style="display: none"> + <li id="message-control"> + <div id="mm-username-container">username: <span id="mm-received-username"></span></div> + <div id="mm-status-message-container"> + <div id="mm-status-message"></div> + </div> + <div id="mm-login-container"> + <div> + <label for="mm-htauth-username">Username:</label> + <input name="mm-htauth-username" id="mm-htauth-username" type="text"/> + </div> + <div> + <label for="mm-htauth-password">Password:</label> + <input name="mm-htauth-password" id="mm-htauth-password" type="password"/> + </div> + <div class="submit"> + <input id="available-submit" type="submit" value="Get available messages" class="green-btn"/> + </div> + </div> + </li> + <li> + <div id="mm-message-list" style="min-height:1em;"></div> + </li> +</ul> +<div style="display:none"> + <div id="reply-form-container"> + <div id="reply-form"> + <input type="hidden" name="message_id" id="reply_to_msg_id"/> + <div> + <label for="reply_text">Reply text:</label> + <textarea name="reply_text" id="reply_text"></textarea> + </div> + <div class="submit"> + <input id="reply-submit" type="submit" value="Send Reply" class="green-btn"/> + </div> + </div> + </div> +</div> + +<script type="text/javascript"> + +$(document).ready(function() { + var $mm_message_list = $('#mm-message-list'); + var mm_url = "[% c.config.MESSAGE_MANAGER_URL %]"; // from config + var problem_id = "[% problem.id %]"; + var dummy_busy = false; + var fms_username = "[% c.user.email | replace('\@.*', '') %]"; + + function sanitise_id(css_id) { + return css_id.replace(/\D/g, ""); + } + + var mm_populate_list = function(data) { + $('#mm-status-message-container').text("Accessed Message Manager as " + data['username']); + $('input[name=mm_text]').prop('checked', false); // uncheck all + } + + var mm_selected_message = function(data) { + var msg_text = ""; + var service_id = ""; + $('li.msg-is-active', $mm_message_list).removeClass('msg-is-active'); + if (data['success']) { + // msg_text = $('#form_detail').val( $('input[name=mm_text]:checked').val() ); # == message data + msg_text = data['data']['Message']['message']; + service_id = data['data']['Message']['id']; + $('#msg-' + service_id).addClass('msg-is-active'); + } else { + $('input[name=mm_text]').prop('checked', false); // uncheck all + } + $('#form_detail').val(msg_text); + $('#external_source_id').val(service_id); + } + + var dummy_reply_cleanup = function(data) { + $('#reply_text').val(''); + dummy_busy = false; + } + + var dummy_hide_cleanup = function(data) { + dummy_busy = false; + } + + message_manager.config({url_root: mm_url}); + message_manager.setup_click_listener({callback:mm_selected_message}); + + // problem form hidden input "external_source_id": pass the MM id into FMS, if used + $('<input type="hidden"/>').attr({ + 'id': 'external_source_id', + 'name': 'external_source_id', + }).appendTo($('#form_update_form')); + + $('#available-submit').click(function(e){ + e.preventDefault(); + message_manager.get_available_messages({callback:mm_populate_list, suggest_username:fms_username}); + }); + $('#available-submit').click(); + + $mm_message_list.on('mouseover', 'li.mm-msg', function(e){ + e.stopPropagation(); // because replies are nested + $('.mm-msg-action', $mm_message_list).stop().fadeOut(200); + $(this).find('> .mm-msg-action').stop().show(); + }); + + $mm_message_list.on('click', '.mm-hide', function(e){ + var want_hide = + confirm('Are you sure you want to delete the following message?\n\n"' + + $('p', $(this).parent()).first().text() + '"\n'); + if (want_hide) { + message_manager.hide( + sanitise_id($(this).parent().attr('id')), + {callback:dummy_hide_cleanup}); + } + }); + + $('#reply-submit').click(function(e) { + e.preventDefault(); + if (! dummy_busy) { + dummy_busy = true; + message_manager.reply( + $('#reply_to_msg_id').val(), + $('#reply_text').val(), + {callback:dummy_reply_cleanup}); + } + }); + + $("a#reply").fancybox({onClosed: function(){dummy_busy=false;}}); + + // only show on problem display page + if (problem_id) { + $('<input type="button" value="Copy to update"/>').attr({ + 'id': 'add_support', + 'name': 'add_support', + 'class': 'green-btn' + }).appendTo($('#message_manager')); + } + + $('#add_support').click(function(e){ + e.preventDefault(); + $('#mm-message-list input:checked').each( function(index) { + var id = $(this).attr('id'); + id = id.replace('mm_text_',''); + $('#external_source_id').val(id); + $('#form_update').val( $(this).val() ); + $('#form_update_form').on('submit', function(e) { + message_manager.assign_fms_id( $('#external_source_id').val(), problem_id, { 'is_async': false } ); + }); + }); + }); + + $('#show_messages').on('click', function(e) { + $('#message_manager').toggle(); + $('#show_messages').val( $('#show_messages').val() == 'Show Messages' ? 'Hide Messages' : 'Show Messages' ); + }); +}); + +</script> +[% END %] diff --git a/templates/web/fixmybarangay/report/_support.html b/templates/web/fixmybarangay/report/_support.html new file mode 100644 index 000000000..e8b958940 --- /dev/null +++ b/templates/web/fixmybarangay/report/_support.html @@ -0,0 +1,11 @@ +[% IF c.cobrand.can_support_problems %] +<p id="supporter"><small> + [% IF !problem.interest_count %][% text=loc('No supporters') %][% ELSIF problem.interest_count == 1 %][% text = loc('1 supporter') %][% ELSE %][% text = tprintf( loc('%d supporters' ), problem.interest_count ) %][% END %] + [% IF c.user && c.user.from_council %]<form action="[% c.uri_for( '/report/support' ) %]"> + [% text %] <input type="hidden" name="id" value="[% problem.id %]"><input type="submit" class="green-btn" value="Add support"> + </form> + [% ELSE %] + [% text %] + [% END %] +</small></p> +[% END %] diff --git a/templates/web/fixmybarangay/report/new/councils_text.html b/templates/web/fixmybarangay/report/new/councils_text.html new file mode 100644 index 000000000..7c48011ee --- /dev/null +++ b/templates/web/fixmybarangay/report/new/councils_text.html @@ -0,0 +1,5 @@ +<p> +The information provided here will be displayed publicly on the site as well as being sent to the +relevant authority ( Road, Lighing or National Highways ). If you select the Fix locally category then the +information will not be sent anywhere. +</p> diff --git a/templates/web/fixmystreet/around/display_location.html b/templates/web/fixmystreet/around/display_location.html index a7240688f..bad7c7af0 100755 --- a/templates/web/fixmystreet/around/display_location.html +++ b/templates/web/fixmystreet/around/display_location.html @@ -34,8 +34,11 @@ rss => [ loc('Recent local problems, FixMyStreet'), rss_url ], bodyclass => 'mappage', robots => 'noindex,nofollow'; + + allow_creation = !c.cobrand.only_authed_can_create || (c.user && c.user.from_council); %] +[% IF allow_creation %] <form action="[% c.uri_for('/report/new') %]" method="post" name="mapForm" id="mapForm" enctype="multipart/form-data" class="validate"> [% IF c.req.params.map_override %] <input type="hidden" name="map_override" value="[% c.req.params.map_override | html %]"> @@ -44,6 +47,7 @@ <input type="hidden" name="latitude" id="fixmystreet.latitude" value="[% short_latitude | html %]"> <input type="hidden" name="longitude" id="fixmystreet.longitude" value="[% short_longitude | html %]"> +[% END %] [% map_html %] @@ -69,13 +73,13 @@ <div id="side"> - <h1 class="big-green-banner">[% - loc( 'Click map to report a problem' ); - IF c.cobrand.moniker == 'bromley'; - '<span>Yellow pins show existing reports</span>'; - END - %]</h1> - + [% IF allow_creation %] + <h1 class="big-green-banner"> + [% loc( 'Click map to report a problem' ) %] + [% IF c.cobrand.moniker == 'bromley' %] + <span>Yellow pins show existing reports</span> + [% END %] + </h1> <p id="skip-this-step"> [% tprintf( @@ -84,6 +88,7 @@ ) %] </p> + [% END %] <div class="shadow-wrap"> <ul id="key-tools" class="singleton"> @@ -92,23 +97,11 @@ </div> <section class="full-width"> - <menu id="problems-nav" class="tab-nav"> - <ul> - <li><a href="#current">[% loc('Problems on the map') %]</a></li> - <li><a href="#current_near">[% loc( 'Problems nearby' ) %]</a></li> - </ul> - </menu> - - <ul id="current" class="issue-list-a tab"> - [% INCLUDE "around/on_map_list_items.html" %] - </ul> - - <ul id="current_near" class="issue-list-a tab"> - [% INCLUDE "around/around_map_list_items.html" %] - </ul> + [% INCLUDE "around/tabbed_lists.html" %] </section> </div> + [% IF allow_creation %] <div style="display:none" id="side-form"> [% INCLUDE "report/new/fill_in_details_form.html" js = 1, @@ -116,6 +109,10 @@ report.name = c.user.name %] </div> + [% END %] + +[% IF allow_creation %] </form> +[% END %] [% INCLUDE 'footer.html' %] diff --git a/templates/web/fixmystreet/around/postcode_form.html b/templates/web/fixmystreet/around/postcode_form.html index a98959d3a..2561a7710 100644 --- a/templates/web/fixmystreet/around/postcode_form.html +++ b/templates/web/fixmystreet/around/postcode_form.html @@ -2,6 +2,9 @@ <div id="front-main-container"> [% IF c.cobrand.moniker == 'bromley' %] <h1 class="main mob-only">Reporting a problem in Bromley’s streets or parks</h1> + [% ELSIF c.cobrand.moniker == 'fixmybarangay' %] + <h1>View local problems</h1> + <h2>(potholes or street lighting)</h2> [% ELSE %] <h1>[% loc('Report, view, or discuss local problems') %]</h1> <h2>[% loc('(like graffiti, fly tipping, broken paving slabs, or street lighting)') %]</h2> @@ -11,6 +14,12 @@ question = c.cobrand.enter_postcode_text || loc('Enter a nearby street name and area'); %] + [% IF c.cobrand.moniker == 'fixmybarangay' %] + <p id="barangay_buttons"> + <a href="/around?latitude=10.322;longitude=123.907" class="yellow-btn">Bgy. Luz</a> + <a href="/around?latitude=10.288;longitude=123.870" class="yellow-btn">Bgy. Basak San Nicolas</a> + </p> + [% ELSE %] <form action="[% c.uri_for('/around') %]" method="get" name="postcodeForm" id="postcodeForm"> <label for="pc">[% question %]:</label> <div> @@ -18,10 +27,11 @@ <input type="submit" value="[% loc('Go') %]" id="submit"> </div> - [% IF partial_token %] - <input type="hidden" name="partial" value="[% partial_token.token %]"> - [% END %] + [% IF partial_token %] + <input type="hidden" name="partial" value="[% partial_token.token %]"> + [% END %] </form> + [% END %] </div> </div> diff --git a/templates/web/fixmystreet/around/tabbed_lists.html b/templates/web/fixmystreet/around/tabbed_lists.html new file mode 100644 index 000000000..77c5a521b --- /dev/null +++ b/templates/web/fixmystreet/around/tabbed_lists.html @@ -0,0 +1,14 @@ +<menu id="problems-nav" class="tab-nav"> + <ul> + <li><a href="#current">[% loc('Problems on the map') %]</a></li> + <li><a href="#current_near">[% loc( 'Problems nearby' ) %]</a></li> + </ul> +</menu> + +<ul id="current" class="issue-list-a tab"> + [% INCLUDE "around/on_map_list_items.html" %] +</ul> + +<ul id="current_near" class="issue-list-a tab"> + [% INCLUDE "around/around_map_list_items.html" %] +</ul> diff --git a/templates/web/fixmystreet/auth/general.html b/templates/web/fixmystreet/auth/general.html index 6ecbcadc5..7fa2b57fe 100644 --- a/templates/web/fixmystreet/auth/general.html +++ b/templates/web/fixmystreet/auth/general.html @@ -26,7 +26,11 @@ <input type="email" class="required email" id="email" name="email" value="[% email | html %]" placeholder="[% loc('Your email address') %]"> <div id="form_sign_in"> + [% IF c.cobrand.moniker == 'fixmybarangay' %] + <h3>[% loc("Do you have a FixMyBarangay password?") %]</h3> + [% ELSE %] <h3>[% loc("Do you have a FixMyStreet password?") %]</h3> + [% END %] <div id="form_sign_in_yes" class="form-box"> <h5>[% loc('<strong>Yes</strong> I have a password') %]</h5> diff --git a/templates/web/fixmystreet/header.html b/templates/web/fixmystreet/header.html index 8d10d4c04..cb6ca8c43 100644 --- a/templates/web/fixmystreet/header.html +++ b/templates/web/fixmystreet/header.html @@ -36,7 +36,7 @@ <div class="table-cell"> <header id="site-header" role="banner"> <div class="container"> - <a href="/" id="site-logo">FixMyStreet</a> + <a href="/" id="site-logo">[% c.cobrand.site_title %]</a> <a href="#main-nav" id="nav-link">Main Navigation</a> </div> </header> diff --git a/templates/web/fixmystreet/index.html b/templates/web/fixmystreet/index.html index 492adbbe5..4bc2c0faf 100644 --- a/templates/web/fixmystreet/index.html +++ b/templates/web/fixmystreet/index.html @@ -36,6 +36,11 @@ kinds of problems like missed bins use our <h2>[% loc('How to report a problem') %]</h2> <ol class="big-numbers"> + [% IF c.cobrand.moniker == 'fixmybarangay' %] + <li>Text LUZ or BSN followed by your report to 12345</li> + <li>Visit the Barangay Center in person</li> + <li>Staff? <a href="/auth">Sign in</a> and click on the map! + [% ELSE %] <li>[% question %]</li> <li>[% loc('Locate the problem on a map of the area') %]</li> <li>[% loc('Enter details of the problem') %]</li> @@ -44,6 +49,7 @@ kinds of problems like missed bins use our [% ELSE %] <li>[% loc('We send it to the council on your behalf') %]</li> [% END %] + [% END %] </ol> <section class="full-width"> diff --git a/templates/web/fixmystreet/report/_main.html b/templates/web/fixmystreet/report/_main.html index 7ceb1f6a5..debd9be73 100644 --- a/templates/web/fixmystreet/report/_main.html +++ b/templates/web/fixmystreet/report/_main.html @@ -13,6 +13,7 @@ <br><small>[% loc('Not reported to council') %]</small> [% END %] </em></p> +[% TRY %][% INCLUDE 'report/_support.html' %][% CATCH file %][% END %] [% INCLUDE 'report/photo.html' object=problem center=1 %] diff --git a/templates/web/fixmystreet/report/display.html b/templates/web/fixmystreet/report/display.html index a22de373d..ab4ee52df 100644 --- a/templates/web/fixmystreet/report/display.html +++ b/templates/web/fixmystreet/report/display.html @@ -7,7 +7,9 @@ title = problem_title rss = [ loc('Updates to this problem, FixMyStreet'), "/rss/$problem.id" ] robots = 'index, nofollow' - bodyclass = 'mappage' + bodyclass = 'mappage'; + + allow_creation = !c.cobrand.only_authed_can_create || (c.user && c.user.from_council); %] [% map_html %] @@ -15,7 +17,9 @@ </div> [% INCLUDE 'report/banner.html' %] + [% INCLUDE 'report/_main.html' %] +[% TRY %][% INCLUDE 'report/_message_manager.html' %][% CATCH file %][% END %] <div class="shadow-wrap"> <ul id="key-tools"> @@ -46,6 +50,7 @@ [% INCLUDE 'report/updates.html' %] +[% IF allow_creation %] <div id="update_form"> <h2>[% loc( 'Provide an update') %]</h2> @@ -57,7 +62,7 @@ [% INCLUDE 'errors.html' %] - <form method="post" action="[% c.uri_for( '/report/update' ) %]" name="updateForm" class="validate"[% IF c.cobrand.allow_photo_upload %] enctype="multipart/form-data"[% END %]> + <form method="post" action="[% c.uri_for( '/report/update' ) %]" id="form_update_form" name="updateForm" class="validate"[% IF c.cobrand.allow_photo_upload %] enctype="multipart/form-data"[% END %]> <fieldset> <input type="hidden" name="submit_update" value="1"> <input type="hidden" name="id" value="[% problem.id | html %]"> @@ -167,7 +172,7 @@ </fieldset> </form> </div> - +[% END %] [% INCLUDE 'footer.html' %] diff --git a/templates/web/fixmystreet/report/new/fill_in_details_form.html b/templates/web/fixmystreet/report/new/fill_in_details_form.html index 237533657..ab427fbe7 100644 --- a/templates/web/fixmystreet/report/new/fill_in_details_form.html +++ b/templates/web/fixmystreet/report/new/fill_in_details_form.html @@ -15,6 +15,7 @@ [% PROCESS 'report/new/councils_text.html' %] [% END %] + [% IF c.cobrand.moniker != 'fixmybarangay' && c.user && c.user.from_council %] <div id="report-a-problem-sidebar"> <!-- The text for this section needs checking, but I can't work out which bit comes from where @@ -35,12 +36,13 @@ [% END %] </p> </div> - + <div class="sidebar-notes"> [% INCLUDE 'report/new/notes.html' %] </div> </div> + [% END %] [% INCLUDE 'errors.html' %] <fieldset> @@ -126,9 +128,11 @@ <label class="inline" for="form_may_show_name">[% loc('Show my name publicly') %]</label> </div> + [% IF c.cobrand.moniker != 'fixmybarangay' && c.user && c.user.from_council %] <div class="general-sidebar-notes"> <p>[% loc('We never show your email address or phone number.') %]</p> </div> + [% END %] <label for="form_phone">[% loc('Phone number (optional)') %]</label> <input class="" type="text" value="[% report.user.phone | html %]" name="phone" id="form_phone" placeholder="[% loc('Your phone number') %]"> |