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

Update theme template to change "former" to "incoming" for new senators #260

Merged
merged 2 commits into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
10 changes: 10 additions & 0 deletions web/themes/custom/nysenate_theme/nysenate_theme.theme
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,15 @@ function nysenate_theme_preprocess_block_content__microsite_hero(&$variables) {
}
$party = implode(', ', $arr_party);

// incoming
$incoming = $senator->get('field_microsite_theme')->getValue();
if($incoming == NULL){
$incoming = 'yes';
} else {
$incoming = 'no';
}
//dump($incoming);

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove dump(), also:

// $incoming will be boolean T/F
$incoming = is_null($senator->get('field_microsite_theme')->getValue();

// District.
$district_url = '';
$query = \Drupal::database()->select('taxonomy_term__field_senator', 's')
Expand Down Expand Up @@ -454,6 +463,7 @@ function nysenate_theme_preprocess_block_content__microsite_hero(&$variables) {
$variables['is_active'] = $senator->field_active_senator->value == 1 ? TRUE : FALSE;
$variables['socials'] = $socials;
$variables['actionbar']['type'] = 'microsite';
$variables['incoming'] = $incoming;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
<div class="c-senator-hero--info {% if not is_active %} inactive-pallette {% endif %}">
<div>
<h2 class="c-senator-hero--title">
{% if not is_active %}former
{% if incoming == "yes" %}incoming{% endif %}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change to detect T/F instead of yes/no

{% if not is_active and incoming == "no" %}former
{% endif %}New York State Senator<br>
{% if senator_microsite_link %}
<a href="{{ senator_microsite_link }}" class="c-senator-hero--name">{{ senator_name }}</a>
Expand Down Expand Up @@ -53,7 +54,7 @@
<ul class="c-senator-hero--social">
{% for social in socials %}
<li class="{% if loop.first %}first {% endif %}leaf c-senator-hero--social-item {{ social.name }}">
<a href="{{ social.url }}" target="_blank"}">{{ icons.get(social.name) }}</a>
<a href="{{ social.url }}" target="_blank"%}">{{ icons.get(social.name) }}</a>
</li>
{% endfor %}
</ul>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,6 @@
socials: socials,
user_id: user_id,
message_senator_link: message_senator_link,
your_dashboard_link: "/dashboard"
your_dashboard_link: "/dashboard",
incoming: incoming
} only %}
Loading