Skip to content

Commit

Permalink
Add announcements to MP sidebar
Browse files Browse the repository at this point in the history
- Adds announcement location to MP sidebar
- Adds 'donation' location to MP sidebar
- Adds 'Browse content' green box to draw attention to sidebar.

Co-authored-by: Lucas <[email protected]>
  • Loading branch information
ajparsons and lucascumsille committed Jun 6, 2023
1 parent f90a3d0 commit 95eeb3d
Show file tree
Hide file tree
Showing 8 changed files with 131 additions and 43 deletions.
Binary file added www/docs/style/img/logo-mysociety.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
41 changes: 36 additions & 5 deletions www/docs/style/sass/pages/_mp.scss
Original file line number Diff line number Diff line change
Expand Up @@ -314,23 +314,34 @@

& > * {
@include radius(3px);
background-color: white;
margin-left: 0px;
margin-bottom: 0px;
font-size: em-calc(16);

position: sticky;
top: 1rem;
margin-bottom: 2.22222rem;
}

h3.browse-content {
margin-top: 0;
margin-bottom: 0;
padding: 0.5em 0.75em;
background: #9ddc93;
}

ul {
background-color: white;
margin-left: 0;
@media (min-width: $medium-screen) {
margin-bottom: 2.22222em;
}
}

li {
list-style-position: inside;
padding: 0.5em 0.5em 0.5em 1.5em;
padding: 0.5em 0.5em 0.5em 1em;
line-height: 1.3em;
border-bottom: 1px solid $body-bg;
color: $borders;
text-indent: -1em;
&.active {
color: $primary-color;
}
Expand All @@ -341,6 +352,26 @@
color: $body-font-color;
}
}

.featured_side__mysociety {
color: white;
background: #333333;
padding: 0.75em 1em;
}

.featured_side__content,
.sidebar__unit__donation {
background-color: white;
padding: 0.5em 1em 1em;
margin-bottom: 1.11111em;
@media (min-width: $medium-screen) {
margin-bottom: 2.22222em;
}
}

.content__button {
margin-bottom: 0;
}
}

.panel {
Expand Down
17 changes: 17 additions & 0 deletions www/includes/easyparliament/templates/html/mp/_donation.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@


<?php $featured_item = $announcement_manager->get_random_valid_item("donation"); ?>

<?php if ( $featured_item ) { ?>

<div class="sidebar__unit__featured_side">
<div class="featured_side__content">
<a href="<?= $featured_item->url ?>"><h3 class="content__title"><?= $featured_item->title ?></h3></a>
<p class="content__description"><?= $featured_item->content ?></p>
<?php if (isset($featured_item->button_text)) { ?>
<a class="button content__button <?= $featured_item->button_class ?>" href="<?= $featured_item->url ?>"><?= (isset($featured_item->button_text) ? $featured_item->button_text : "Read more") ?></a>
<?php } ?>
</div>
</div>

<?php }; ?>
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@

<?php $featured_item = $announcement_manager->get_random_valid_item("sidebar"); ?>

<?php if ( $featured_item ) { ?>

<div class="sidebar__unit__featured_side">
<div class="featured_side__mysociety">
<img src="/style/img/logo-mysociety.png" alt="mySociety logo" width="150">
</div>
<img class="featured_side__image" src="<?= $featured_item->thumbnail_image_url ?>" alt="<?= $featured_item->thumbnail_image_alt_text ?>">
<div class="featured_side__content">
<a href="<?= $featured_item->url ?>"><h3 class="content__title"><?= $featured_item->title ?></h3></a>
<?php if (isset($featured_item->button_text)) { ?>
<a class="button content__button <?= $featured_item->button_class ?>" href="<?= $featured_item->url ?>"><?= (isset($featured_item->button_text) ? $featured_item->button_text : "Read more") ?></a>
<?php } ?>
</div>
</div>

<?php }; ?>
21 changes: 13 additions & 8 deletions www/includes/easyparliament/templates/html/mp/divisions.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,19 @@
</div>
<div class="person-panels">
<div class="sidebar__unit in-page-nav">
<?php if ( isset($policydivisions) && $policydivisions && count($policydivisions) == 1 ) { ?>
<p class="policy-votes-intro">
How <?= $full_name ?> voted on <?= $policydivisions[array_keys($policydivisions)[0]]['desc'] ?>.
</p>
<?php } ?>
<ul>
<li><a href="<?= $member_url ?>/votes">Back to all topics</a></li>
</ul>
<div>
<?php if ( isset($policydivisions) && $policydivisions && count($policydivisions) == 1 ) { ?>
<p class="policy-votes-intro">
How <?= $full_name ?> voted on <?= $policydivisions[array_keys($policydivisions)[0]]['desc'] ?>.
</p>
<?php } ?>
<h3 class="browse-content">Browse content</h3>
<ul>
<li><a href="<?= $member_url ?>/votes">Back to all topics</a></li>
</ul>
<?php include '_featured_content.php'; ?>
<?php include '_donation.php'; ?>
</div>
</div>

<div class="primary-content__unit">
Expand Down
30 changes: 18 additions & 12 deletions www/includes/easyparliament/templates/html/mp/profile.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,25 @@
</div>
<div class="person-panels">
<div class="sidebar__unit in-page-nav">
<ul>
<?php if (count($policyPositions->positions) > 0): ?>
<li><a href="#votes">Votes</a></li>
<?php endif; ?>
<?php if (count($recent_appearances['appearances'])): ?>
<li><a href="#appearances">Appearances</a></li>
<?php endif; ?>
<li><a href="#profile">Profile</a></li>
<?php if ($register_interests): ?>
<li><a href="#register">Register of Interests</a></li>
<?php endif; ?>
</ul>
<div>
<h3 class="browse-content">Browse content</h3>
<ul>
<?php if (count($policyPositions->positions) > 0): ?>
<li><a href="#votes">Votes</a></li>
<?php endif; ?>
<?php if (count($recent_appearances['appearances'])): ?>
<li><a href="#appearances">Appearances</a></li>
<?php endif; ?>
<li><a href="#profile">Profile</a></li>
<?php if ($register_interests): ?>
<li><a href="#register">Register of Interests</a></li>
<?php endif; ?>
</ul>
<?php include '_featured_content.php'; ?>
<?php include '_donation.php'; ?>
</div>
</div>

<div class="primary-content__unit">

<?php if ($profile_message): ?>
Expand Down
23 changes: 14 additions & 9 deletions www/includes/easyparliament/templates/html/mp/recent.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,20 @@
</div>

<div class="sidebar__unit in-page-nav">
<ul>
<?php foreach($sidebar_links as $date) { ?>
<li>
<a href="#<?= strftime('%Y-%m-%d', strtotime($date)) ?>">
<?= strftime('%e %b %Y', strtotime($date)) ?>
</a>
</li>
<?php } ?>
</ul>
<div>
<h3 class="browse-content">Browse content</h3>
<ul>
<?php foreach($sidebar_links as $date) { ?>
<li>
<a href="#<?= strftime('%Y-%m-%d', strtotime($date)) ?>">
<?= strftime('%e %b %Y', strtotime($date)) ?>
</a>
</li>
<?php } ?>
</ul>
<?php include '_featured_content.php'; ?>
<?php include '_donation.php'; ?>
</div>
</div>
</div>
</div>
Expand Down
23 changes: 14 additions & 9 deletions www/includes/easyparliament/templates/html/mp/votes.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,20 @@
</div>
<div class="person-panels">
<div class="sidebar__unit in-page-nav">
<ul>
<?php if ($has_voting_record): ?>
<?php foreach ($key_votes_segments as $segment): ?>
<?php if (count($segment['votes']->positions) > 0): ?>
<li><a href="#<?= $segment['key'] ?>"><?= $segment['title'] ?></a></li>
<?php endif; ?>
<?php endforeach; ?>
<?php endif; ?>
</ul>
<div>
<h3 class="browse-content">Browse content</h3>
<ul>
<?php if ($has_voting_record): ?>
<?php foreach ($key_votes_segments as $segment): ?>
<?php if (count($segment['votes']->positions) > 0): ?>
<li><a href="#<?= $segment['key'] ?>"><?= $segment['title'] ?></a></li>
<?php endif; ?>
<?php endforeach; ?>
<?php endif; ?>
</ul>
<?php include '_featured_content.php'; ?>
<?php include '_donation.php'; ?>
</div>
</div>
<div class="primary-content__unit">

Expand Down

0 comments on commit 95eeb3d

Please sign in to comment.