Skip to content

Commit

Permalink
Merge branch 'research-quant2-update'
Browse files Browse the repository at this point in the history
  • Loading branch information
jacksonj04 committed May 22, 2015
2 parents 76a1dce + 49d62d8 commit 3db7c2b
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 51 deletions.
50 changes: 26 additions & 24 deletions www/docs/js/qual2.js → www/docs/js/quant2.js
@@ -1,5 +1,7 @@
var researchUser;
var startTime = new Date();
var recordEndpoint = 'http://logbook.mysociety.org/quant2';
var siteTag = 'twfy';

$(document).ready(function() {

Expand All @@ -15,21 +17,21 @@ $(document).ready(function() {

// Record this page view and bucket
$.ajax({
url: '/action/record.php',
type: 'POST',
url: recordEndpoint,
data: {
'site': siteTag,
'method': 'view',
'page': document.URL,
'bucket': researchUser.bucket
},
dataType: 'json'
dataType: 'jsonp'
});

// Choose which action to take
if (researchUser.bucket == 1) {

// Bind the "where next" click event
$('#research-qual2-bucket1-wherenext').click(function(e){
$('#research-quant2-bucket1-wherenext').click(function(e){

e.preventDefault();

Expand All @@ -40,16 +42,16 @@ $(document).ready(function() {
timer /= 1000;

$.ajax({
url: '/action/record.php',
type: 'POST',
url: recordEndpoint,
data: {
'site': siteTag,
'method': 'click_popup_link',
'page': document.URL,
'bucket': researchUser.bucket,
'data': 'where-next',
'timer': timer
},
dataType: 'json',
dataType: 'jsonp',
timeout: 300
}).always(function() {
window.location.assign(link.attr('href'));
Expand All @@ -58,7 +60,7 @@ $(document).ready(function() {
});

// Bind the "where next" click event
$('[data-research-qual2-bucket1-linkname]').click(function(e){
$('[data-research-quant2-bucket1-linkname]').click(function(e){

e.preventDefault();

Expand All @@ -69,16 +71,16 @@ $(document).ready(function() {
timer /= 1000;

$.ajax({
url: '/action/record.php',
type: 'POST',
url: recordEndpoint,
data: {
'site': siteTag,
'method': 'click_popup_link',
'page': document.URL,
'bucket': researchUser.bucket,
'data': link.data('research-qual2-bucket1-linkname'),
'data': link.data('research-quant2-bucket1-linkname'),
'timer': timer
},
dataType: 'json'
dataType: 'jsonp'
});

$('#whereNextModal').foundation('reveal', 'close');
Expand All @@ -96,29 +98,29 @@ $(document).ready(function() {

$('#whereNextModal').foundation('reveal', 'open');
$.ajax({
url: '/action/record.php',
type: 'POST',
url: recordEndpoint,
data: {
'site': siteTag,
'method': 'show_popup',
'page': document.URL,
'bucket': researchUser.bucket,
'data': 'timed'
},
dataType: 'json'
dataType: 'jsonp'
});

} else {

$.ajax({
url: '/action/record.php',
type: 'POST',
url: recordEndpoint,
data: {
'method': 'surpressed_popup',
'site': siteTag,
'method': 'suppressed_popup',
'page': document.URL,
'bucket': researchUser.bucket,
'data': 'timed'
},
dataType: 'json'
dataType: 'jsonp'
});

}
Expand All @@ -127,10 +129,10 @@ $(document).ready(function() {

} else if (researchUser.bucket == 2) {

$('#research-qual2-bucket2').show();
$('#research-quant2-bucket2').show();

// Bind the click event
$('#research-qual2-bucket2 a').click(function(e){
$('#research-quant2-bucket2 a').click(function(e){

e.preventDefault();

Expand All @@ -141,15 +143,15 @@ $(document).ready(function() {
timer /= 1000;

$.ajax({
url: '/action/record.php',
type: 'POST',
url: recordEndpoint,
data: {
'site': siteTag,
'method': 'click_nav_link',
'page': document.URL,
'bucket': researchUser.bucket,
'timer': timer
},
dataType: 'json',
dataType: 'jsonp',
timeout: 300
}).always(function() {
window.location.assign(link.attr('href'));
Expand Down
13 changes: 5 additions & 8 deletions www/includes/easyparliament/templates/html/action/where-next.php
Expand Up @@ -20,13 +20,13 @@
<div class="action-option">
<h5>&hellip;with a public body or organisation</h5>
<p>The Ombudsman Association can help you find the right organisation to take your complaint to:<br>
<a href="http://www.ombudsmanassociation.org/">http://www.ombudsmanassociation.org/</a></p>
<a href="http://www.ombudsmanassociation.org/" onclick="trackLinkClick(this, 'Links', 'WhereNext', 'OmbudsmanAssociation'); return false;">http://www.ombudsmanassociation.org/</a></p>
</div>
<div class="action-option">
<h5>&hellip;with your own personal circumstances</h5>
<p>The Citizens Advice Bureau can help you with everything from budgeting, to pensions, to workplace complaints, and more:<br>
<a href="http://www.adviceguide.org.uk/england.htm">http://www.adviceguide.org.uk/england.htm</a></p>
<a href="http://www.adviceguide.org.uk/england.htm" onclick="trackLinkClick(this, 'Links', 'WhereNext', 'CAB'); return false;">http://www.adviceguide.org.uk/england.htm</a></p>
</div>
</div>
Expand All @@ -37,28 +37,25 @@
<div class="action-option">
<h5>&hellip;about how Parliament works</h5>
<p>OpenDemocracy can provide you with more information about democracy and politics in the UK:<br>
<a href="https://www.opendemocracy.net/">https://www.opendemocracy.net/</a></p>
<a href="https://www.opendemocracy.net/" onclick="trackLinkClick(this, 'Links', 'WhereNext', 'OpenDemocracy'); return false;">https://www.opendemocracy.net/</a></p>
</div>
<div class="action-option">
<h5>&hellip;from a public authority</h5>
<p>You can ask for information from any publicly-funded body in the UK, using WhatDoTheyKnow.com. You can also view requests made by other people, and see the responses that they received:<br>
<a href="https://www.whatdotheyknow.com/">https://www.whatdotheyknow.com/</a></p>
<a href="https://www.whatdotheyknow.com/" onclick="trackLinkClick(this, 'Links', 'WhereNext', 'WDTK'); return false;">https://www.whatdotheyknow.com/</a></p>
</div>
</div>
<!--
<div class="action-section">
<h3 class="action-option-heading">If you want to tell your MP how you feel about what you&rsquo;ve just read</h3>
<p>You can use WriteToThem.com to get in touch with them directly:<br>
<a href="https://www.writetothem.com/">https://www.writetothem.com/</a></p>
<a href="https://www.writetothem.com/" onclick="trackLinkClick(this, 'Links', 'WhereNext', 'WTT'); return false;">https://www.writetothem.com/</a></p>
</div>
-->
</div>
</div>
</div>
4 changes: 2 additions & 2 deletions www/includes/easyparliament/templates/html/mp/profile.php
Expand Up @@ -30,7 +30,7 @@
<?php if ($register_interests): ?>
<li data-magellan-arrival="register"><a href="#register">Register of Interests</a></li>
<?php endif; ?>
<li hidden id="research-qual2-bucket2"><a href="/action/where-next">What to do with the information on this page?</a></li>
<li hidden id="research-quant2-bucket2"><a href="/action/where-next">What to do with the information on this page?</a></li>
</ul>
<div class="magellan-placeholder">&nbsp;</div>
</div>
Expand Down Expand Up @@ -317,4 +317,4 @@
</div>
</div>

<?php include INCLUDESPATH . 'easyparliament/templates/research/qual2.php'; ?>
<?php include INCLUDESPATH . 'easyparliament/templates/research/quant2.php'; ?>
Expand Up @@ -19,7 +19,7 @@
<p class="cta">
<a class="button alert" href="/alerts/?alertsearch=<?= urlencode($email_alert_text) ?>">Alert me about debates like this</a>
</p>
<p class="cta" hidden id="research-qual2-bucket2"><a class="button alert" href="/action/where-next">What to do with the information on this page?</a></p>
<p class="cta" hidden id="research-quant2-bucket2"><a class="button alert" href="/action/where-next">What to do with the information on this page?</a></p>
</div>
</div>
<nav class="debate-navigation" role="navigation">
Expand Down Expand Up @@ -393,7 +393,7 @@

</div>

<?php include INCLUDESPATH . 'easyparliament/templates/research/qual2.php'; ?>
<?php include INCLUDESPATH . 'easyparliament/templates/research/quant2.php'; ?>

<nav class="debate-navigation debate-navigation--footer" role="navigation">
<div class="full-page__row">
Expand Down
15 changes: 0 additions & 15 deletions www/includes/easyparliament/templates/research/qual2.php

This file was deleted.

15 changes: 15 additions & 0 deletions www/includes/easyparliament/templates/research/quant2.php
@@ -0,0 +1,15 @@
<div id="whereNextModal" class="reveal-modal" data-reveal aria-labelledby="modalTitle" aria-hidden="true" role="dialog">
<h2 id="modalTitle">Where to next?</h2>
<p class="lead">Do you know what would you like to do with the information on this page?</p>
<p>We are looking at ways to improve this site. In one click, please tell us what you will do with the information you have found on this page.</p>
<ul>
<li><a id="research-quant2-bucket1-wherenext" href="/action/where-next">I&rsquo;m not sure &mdash; Click here for suggestions on what to do next</a></li>
<li><a data-research-quant2-bucket1-linkname="write-mp">I&rsquo;m going to write to an MP</a></li>
<li><a data-research-quant2-bucket1-linkname="social-share">I&rsquo;m going to share this information on social media</a></li>
<li><a data-research-quant2-bucket1-linkname="work">I&rsquo;m going to use this information for work purposes</a></li>
<li><a data-research-quant2-bucket1-linkname="browsing">I don&rsquo;t need to do anything with this information &mdash; I was just browsing</a></li>
</ul>
</div>

<script src="<?= cache_version('js/jquery.storageapi.min.js') ?>"></script>
<script src="<?= cache_version('js/quant2.js') ?>"></script>

0 comments on commit 3db7c2b

Please sign in to comment.