Skip to content

Commit

Permalink
display which sections an alert is limited to
Browse files Browse the repository at this point in the history
  • Loading branch information
struan committed Oct 22, 2024
1 parent db0494d commit c861390
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions classes/Utility/Alert.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ public static function forUser($email) {
'raw' => $row['criteria'],
'keywords' => [],
'exclusions' => [],
'sections' => [],
];

$alert = array_merge($alert, $parts);
Expand Down
8 changes: 7 additions & 1 deletion www/includes/easyparliament/templates/html/alert/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,9 @@
</dl>
</div>

<?php if ($alert["keywords"] or $alert["exclusions"] or $alert["sections"] or array_key_exists('spokenby', $alert)) { ?>
<hr>
<?php } ?>

<?php if ($alert["keywords"]) { ?>
<div class="keyword-list alert-page-subsection">
Expand Down Expand Up @@ -376,6 +378,7 @@
</div>
<?php } ?>

<?php if ($alert['sections']) { ?>
<div class="keyword-list alert-page-subsection">
<h3 class="display-none"><label for="sections">Which section should this alert apply to?</label></h3>
<select name="sections" id="sections" class="display-none">
Expand All @@ -385,10 +388,13 @@
</select>
<h3 class="heading-with-bold-word">Which <span class="bold">section</span> should this alert apply to:</h3>
<ul>
<li class="label label--red">All sections
<?php foreach ($alert["sections_verbose"] as $section) { ?>
<li class="label label--red"><?= _htmlspecialchars($section) ?>
<i aria-hidden="true" role="img" class="fi-x"></i></li>
<?php } ?>
</ul>
</div>
<?php } ?>

<!-- Only to be displayed if there is a person in this query -->

Expand Down

0 comments on commit c861390

Please sign in to comment.