Skip to content

Commit

Permalink
Seperate out register of interests from overview page
Browse files Browse the repository at this point in the history
- Create new register subpage
- Update top bar navigation
  • Loading branch information
ajparsons committed Jun 2, 2024
1 parent 6c5b4c9 commit 6acb352
Show file tree
Hide file tree
Showing 5 changed files with 102 additions and 26 deletions.
4 changes: 4 additions & 0 deletions www/docs/mp/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,10 @@ function($k) { return $k['score_difference'] >= 2; }

break;

case 'register':
// Send the output for rendering
MySociety\TheyWorkForYou\Renderer::output('mp/register', $data);

case 'policy_set_svg':
policy_image($data, $MEMBER, 'svg');
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
What you can do
</h2>
<ul class="rep-actions">
<li>Find out <a href="#profile">more about your MP</a>, including <a href="<?= $member_url ?>/votes">their voting summary</a><?php if ($register_interests) { ?>, <a href="#register">register of interests</a><?php } ?> and <a href="#appearances">recent speeches</a>.</li>
<li>Find out <a href="#profile">more about your MP</a>, including <a href="<?= $member_url ?>/votes">their voting summary</a><?php if ($register_interests) { ?>, <a href="<?= $member_url ?>/register">register of interests</a><?php } ?> and <a href="#appearances">recent speeches</a>.</li>
<?php if ($current_member[1]) { ?>
<li><a href="https://www.writetothem.com/">Write to your MP</a>, or find out about your other local representatives <a href="https://www.writetothem.com">on WriteToThem.com</a>.</li>
<?php } ?>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
<?php endif; ?>
<?php if (in_array($this_page, ["mp", "msp", "ms"])): ?>
<li <?php if ($pagetype == "recent"): ?>class="active"<?php endif; ?>><a href="<?= $member_url ?>/recent"><?= gettext('Recent Votes') ?></a></li>
<?php if ($register_interests): ?>
<li <?php if ($pagetype == "register"): ?>class="active"<?php endif; ?>><a href="<?= $member_url ?>/register"><?= gettext('Register of Interests') ?></a></li>
<?php endif; ?>
<?php endif; ?>
</ul>
</div>
25 changes: 0 additions & 25 deletions www/includes/easyparliament/templates/html/mp/profile.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@
<?php if (count($recent_appearances['appearances'])): ?>
<li><a href="#appearances"><?= gettext('Appearances') ?></a></li>
<?php endif; ?>
<?php if ($register_interests): ?>
<li><a href="#register"><?= gettext('Register of Interests') ?></a></li>
<?php endif; ?>
</ul>
<?php include '_featured_content.php'; ?>
<?php include '_donation.php'; ?>
Expand Down Expand Up @@ -251,28 +248,6 @@
</div>
<?php endif; ?>

<?php if ($register_interests): ?>
<div class="panel register">
<a name="register"></a>
<h2>Register of Members&rsquo; Interests</h2>
<p><b>New</b>: <a href="https://www.mysociety.org/2024/01/17/improving-the-register-of-mps-interests/">Download a spreadsheet of all Members Interests.</a></p>

<p>
<a href="<?= WEBPATH ?>regmem/?p=<?= $person_id ?>">View the history of this MP&rsquo;s entries in the Register</a>
</p>
<?php if ($register_interests['date']): ?>
<p>Last updated: <?= $register_interests['date'] ?>.</p>
<?php endif; ?>

<?= $register_interests['data'] ?>


<p>
<a class="moreinfo-link" href="https://www.publications.parliament.uk/pa/cm/cmregmem/100927/introduction.htm">More about the register</a>
</p>
</div>
<?php endif; ?>

<div class="panel panel--secondary">
<p><?= gettext('Note for journalists and researchers: The data on this page may be used freely, on condition that TheyWorkForYou.com is cited as the source.') ?></p>

Expand Down
94 changes: 94 additions & 0 deletions www/includes/easyparliament/templates/html/mp/register.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
<?php
include_once INCLUDESPATH . "easyparliament/templates/html/mp/header.php";
?>

<div class="full-page">
<div class="full-page__row">
<div class="full-page__unit">
<?php include '_person_navigation.php'; ?>
</div>
<div class="person-panels">
<div class="sidebar__unit in-page-nav">
<div>
<h3 class="browse-content"><?= gettext('Browse content') ?></h3>
<ul>
<li><a href="https://www.mysociety.org/2024/01/17/improving-the-register-of-mps-interests/">Download a spreadsheet</a></li>
<?php include '_featured_content.php'; ?>
<?php include '_donation.php'; ?>
</div>
</div>

<div class="primary-content__unit">

<?php if ($party == 'Sinn Féin' && in_array(HOUSE_TYPE_COMMONS, $houses)): ?>
<div class="panel">
<p>Sinn F&eacute;in MPs do not take their seats in Parliament.</p>
</div>
<?php elseif (isset($is_new_mp) && $is_new_mp && count($recent_appearances['appearances']) == 0): ?>
<div class="panel panel--secondary">
<h3><?= $full_name ?> is a recently elected MP &ndash; elected on <?= format_date($entry_date, LONGDATEFORMAT) ?></h3>

<p>When <?= $full_name ?> starts to speak in debates and vote on bills, that information will appear on this page.</p>

<?php if ($has_email_alerts) { ?>
<a href="<?= WEBPATH ?>alert/?pid=<?= $person_id ?>#" onclick="trackLinkClick(this, 'alert_click', 'Search', 'Person'); return false;">Sign up for email alerts to be the first to know when that happens.</a>
<?php } ?>
</div>
<?php endif; ?>
<?php if ($register_interests): ?>
<div class="panel register">
<a name="register"></a>
<h2>Register of Members&rsquo; Interests</h2>
<p><b>New</b>: <a href="https://www.mysociety.org/2024/01/17/improving-the-register-of-mps-interests/">Download a spreadsheet of all Members Interests.</a></p>

<p>
<a href="<?= WEBPATH ?>regmem/?p=<?= $person_id ?>">View the history of this MP&rsquo;s entries in the Register</a>
</p>
<?php if ($register_interests['date']): ?>
<p>Last updated: <?= $register_interests['date'] ?>.</p>
<?php endif; ?>

<?= $register_interests['data'] ?>


<p>
<a class="moreinfo-link" href="https://www.publications.parliament.uk/pa/cm/cmregmem/100927/introduction.htm">More about the register</a>
</p>
</div>
<?php endif; ?>

<div class="panel panel--secondary">
<p><?= gettext('Note for journalists and researchers: The data on this page may be used freely, on condition that TheyWorkForYou.com is cited as the source.') ?></p>

<p><?php print gettext('This data was produced by TheyWorkForYou from a variety of sources.') . ' ';
printf(gettext('Voting information from <a href="%s">Public Whip</a>.'), "https://www.publicwhip.org.uk/mp.php?id=uk.org.publicwhip/member/ $member_id&amp;showall=yes"); ?></p>

<?php if($image && $image['exists']) {
if(isset($data['photo_attribution_text'])) { ?>
<p>
<?php if(isset($data['photo_attribution_link'])) { ?>
<?= gettext('Profile photo:') ?>
<a href="<?= $data['photo_attribution_link'] ?>"><?= $data['photo_attribution_text'] ?></a>
<?php } else { ?>
<?= gettext('Profile photo:') ?> <?= $data['photo_attribution_text'] ?>
<?php } ?>
</p>
<?php }
} else { ?>
<p>
We&rsquo;re missing a photo of <?= $full_name ?>.
If you have a photo <em>that you can release under
a Creative Commons Attribution-ShareAlike license</em>
or can locate a <em>copyright free</em> photo,
<a href="mailto:<?= str_replace('@', '&#64;', CONTACTEMAIL) ?>">please email it to us</a>.
Please do not email us about copyrighted photos
elsewhere on the internet; we can&rsquo;t use them.
</p>
<?php } ?>
</div>

</div>
</div>
</div>
</div>

0 comments on commit 6acb352

Please sign in to comment.