Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Post election #1806

Merged
merged 2 commits into from
Jul 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions classes/Homepage.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,16 @@ public function display() {
$common = new Common;
$dissolution = Dissolution::dates();

// temp for 2024 election
$now = new \DateTime();
$election_date = new \DateTime('2024-07-04 22:00:00');

$data['debates'] = $this->getDebatesData();

$user = new User();
$data['mp_data'] = $user->getRep($this->cons_type, $this->mp_house);
$data["commons_dissolved"] = isset($dissolution[1]);
$data["after_election"] = $now > $election_date;

$data['regional'] = $this->getRegionalList();
$data['popular_searches'] = $common->getPopularSearches();
Expand Down
29 changes: 29 additions & 0 deletions markdown/post-election.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# The polls are closed!

The UK general election is now over.

Through Thursday night and into Friday, the votes will be counted, winners announced - and we will be loading the new MPs into TheyWorkForYou.

We've prepared a [few blog posts and resources](https://www.mysociety.org/?p=54263) to understand the new Parliament - you can read these [on our blog](https://www.mysociety.org/?p=54263).

___

### Get emails about your MP

There are many new MPs in this election. You can sign up below to get an email when your new/returning MP has spoken, voted, or received a written answer:

{{ form }}

___

### Support TheyWorkForYou's work in the coming Parliament

TheyWorkForYou and WriteToThem are run by [mySociety](https://www.mysociety.org/), a small UK charity.

We're a very efficient operation and do a lot with a small team: at the moment TheyWorkForYou, which is used by millions of people every year, is run with the equivalent of about two people.

If we had [a *bit* more money, we could achieve a *lot* more]((/support-us/)).

We want to see a transparent, resilient democracy, with equal access to information, representation and voice for citizens.

If you believe in this vision [please donate today](/support-us/) to enable greater transparency and accountability of the next government.
7 changes: 7 additions & 0 deletions www/docs/postcode/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@
$data = array();
$errors = array();

// handling to switch the GE message based either on time or a query string

$now = new DateTime();
$election_date = new DateTime('2024-07-04 22:00:00');

$data['post_election_message'] = (($now > $election_date) || (get_http_var("post_election") == 1));

$pc = get_http_var('pc');
if (!$pc) {
postcode_error('Please supply a postcode!');
Expand Down
4 changes: 4 additions & 0 deletions www/includes/easyparliament/templates/html/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@
</div>
</div>
<?php } else { ?>
<?php if ($after_election === true) { ?>
<h1>Find out more about your new MP</h1>
<?php } else { ?>
<h1>Find out more about your <?php if ($commons_dissolved) { ?>former <?php } ?>MP, and election candidates</h1>
<?php } ?>
<div class="row collapse">
<form action="/postcode/" class="mp-search__form" onsubmit="trackFormSubmit(this, 'PostcodeSearch', 'Submit', 'Home'); return false;">
<label for="postcode">Your postcode</label>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@


<?php ob_start(); ?>
<form class="alerts-form" method="post" action="/alert/by-postcode/">
<input type="hidden" name="add-alert" value="1">
<input type="hidden" name="postcode" id="id_postcode" value="<?= strtoupper($data["pc"]) ?>">

<label for="id_email">Your email address</label>
<input type="text" name="email" id="id_email">

<button type="submit" class="button radius">Set up alerts</button>
</form>
<?php $form = ob_get_clean(); ?>


<?php
$markdown_file = '../../../markdown/post-election.md';
$Parsedown = new \Parsedown();

$text = file_get_contents($markdown_file);
$html = $Parsedown->text($text);

$html = str_replace("{{ form }}", $form, $html);

echo $html;
?>


Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,11 @@ function member_image_box(string $person_id, string $person_url, string $person_
}
}

include "ge2024.php";
if ($post_election_message) {
include "ge2024-post-election.php";
} else {
include "ge2024.php";
};

# The below is normally the main column, but for now let us make it the sidebar...

Expand Down
Loading