Skip to content

Commit

Permalink
Minor fixes everywhere (correct tiktok url in footer, remove section …
Browse files Browse the repository at this point in the history
…tag on not public sections, remove hyperlink for not live authors, hide non-correct month days on events calendar month view for mobile (sorry too lazy to explain that coherently), update events categorization)
  • Loading branch information
SamuelmdLow committed Feb 21, 2025
1 parent 46cced0 commit 14cb159
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 33 deletions.
2 changes: 1 addition & 1 deletion article/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1049,7 +1049,7 @@ def get_authors_string(self, links=False, authors_list=[]) -> str:
links: Whether the author names link to their respective pages.
"""
def format_author(article_author):
if links:
if links and article_author.author.live:
return '<a href="%s">%s</a>' % (article_author.author.full_url, article_author.author.full_name)
return article_author.author.full_name

Expand Down
23 changes: 14 additions & 9 deletions article/templates/article/objects/author_card.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,20 @@
{% load wagtailimages_tags %}
{% load article_authors %}

{% with author.author as author_page %}
<div class="author_card">
<div class="author_title {% if author.author.image and author.author.display_image %}with_image{%endif%}">
{% if author.author.image and author.author.display_image %}
{% image author.author.image width-200 format-webp loading="lazy" class="author_image" alt=author.author.full_name %}
<div class="author_title {% if author_page.image and author_page.display_image %}with_image{%endif%}">
{% if author_page.image and author_page.display_image %}
{% image author_page.image width-200 format-webp loading="lazy" class="author_image" alt=author_page.full_name %}
{% endif %}
<p>
<span class="author_name">
<a href="{{ author.author.full_url }}"> {{ author.author.full_name|safe }}</a>
{% if author_page.live %}<a href="{{ author_page.full_url }}"> {{ author_page.full_name|safe }}</a>{% else %}{{ author_page.full_name|safe }}{% endif %}
</span>
<span class="author_role">
{% for role in author_roles %}
{% if role == "org_role" %}
{{ author.author.ubyssey_role }}{% if not forloop.last %},{% endif %}
{{ author_page.ubyssey_role }}{% if not forloop.last %},{% endif %}
{% else %}
{{ role }}{% if not forloop.last %},{% endif %}
{% endif %}
Expand All @@ -24,11 +25,15 @@
</div>
<!-- if forloop.first and no image then 0 padding for the authors_info left, author_info and author title-->
<div class="author_info">
{% if author.author.short_bio_description != "" %}
<p>{{ author.author.short_bio_description }}</p>
{% if author_page.short_bio_description != "" %}
<p>{{ author_page.short_bio_description }}</p>
{% endif %}

{% if author_page.live %}
<ul>
<li><a href="{{ author.author.full_url }}">See more from {{ author.author.full_name|safe }}</a></li>
<li><a href="{{ author_page.full_url }}">See more from {{ author_page.full_name|safe }}</a></li>
</ul>
{% endif %}
</div>
</div>
</div>
{% endwith %}
6 changes: 5 additions & 1 deletion article/templates/article/objects/cover_story.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,11 @@
<div class="o-article__byline">
<span class="o-article__author">{% if article.get_authors_split_out_visual_bylines %}{{article.authors_split_out_visual_bylines |safe }}{% else %}Ubyssey Staff{% endif %}</span>
<span> &nbsp;&nbsp; </span>
<a href="{{article|get_section_link}}" class="o-article__section-tag" style="background-color: {{article|get_colour}}">{{article|get_section_title}}</a>
{% with article.get_parent.specific as parent %}
{% if parent.live %}
<a href="{% pageurl parent %}" class="o-article__section-tag" style="background-color: {{parent.colour}}">{{parent.title}}</a>
{% endif %}
{% endwith %}
<span> &nbsp;&nbsp; </span>
<span class="o-article__published">{% if article.explicit_published_at %}{{article.explicit_published_at|display_pubdate }}{% else %}{{article.first_published_at|display_pubdate}}{% endif %}</span>
</div>
Expand Down
26 changes: 14 additions & 12 deletions events/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,17 +219,19 @@ async def wp_events_api_create_event(self, event_json, api, host, categorize, lo
for category in categories:
if event.category != categorize['default']:
break
categorize_key = category + '_type'
if categorize_key in categorize:
for event_type in event_json['event-type']:

for category_type in categorize[categorize_key]:
if event_type == category_type:
event.category = category
for param in ['type', 'tags']:
categorize_key = category + '_' + param
if categorize_key in categorize:
for event_type in event_json['event-' + param]:

for category_type in categorize[categorize_key]:
if event_type == category_type:
event.category = category
break

if event.category != categorize['default']:
break

if event.category != categorize['default']:
break


if event.hidden == False and 'hidden_title_terms' in categorize:
for term in categorize['hidden_title_terms']:
Expand Down Expand Up @@ -419,7 +421,7 @@ def ubcevents_category(self, event):
if i in title:
return 'community'

for i in ['ubc cpd', 'seminar']:
for i in ['ubc cpd', 'seminar',]:
if i in title:
return 'seminar'

Expand All @@ -445,7 +447,7 @@ def ubcevents_category(self, event):
return 'seminar'

# Check for seminar keywords
for i in ['workshop', 'seminar', 'research', 'learning', 'conference',]:
for i in ['workshop', 'seminar', 'research', 'learning', 'conference', 'lecture']:
if i in categories:
return 'seminar'

Expand Down
17 changes: 9 additions & 8 deletions events/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ async def update_events(request):
'api': 'https://anth.ubc.ca/wp-json/wp/v2/',
'categorize': {
'default': 'community',
'seminar_type': [633, 632, 634, 528, 530],
'seminar_type': [528, 530, 632, 633, 634, 728, 729],
'hidden_title_terms': ['coffee hour'],
'seminar_title_terms': ['Archaeology Lab Nights', 'Information Session'],
},
Expand All @@ -281,15 +281,15 @@ async def update_events(request):
'api': 'https://asia.ubc.ca/wp-json/wp/v2/',
'categorize': {
'default': 'community',
'seminar_type': [570, 572, 571, 574, 739],
'seminar_type': [570, 571, 572, 574, 739],
},
},

{'name': 'UBC Central, Eastern, and Northern European Studies',
'api': 'https://cenes.ubc.ca/wp-json/wp/v2/',
'categorize': {
'default': 'community',
'seminar_type': [552, 554, 559, 553, 677, 558],
'seminar_type': [552, 554, 553, 558, 559, 677],
'hidden_title_terms': ['fika', 'plauder', 'kaffeestunde', 'slavic tea']
},
},
Expand All @@ -298,7 +298,7 @@ async def update_events(request):
'api': 'https://english.ubc.ca/wp-json/wp/v2/',
'categorize': {
'default': 'community',
'seminar_type': [512, 515, 510, 513],
'seminar_type': [510, 512, 513, 515],
'seminar_title_terms': ['Information Session'],
},
},
Expand All @@ -307,24 +307,24 @@ async def update_events(request):
'api': 'http://fhis.ubc.ca/wp-json/wp/v2/',
'categorize': {
'default': 'community',
'seminar_type': [534, 537, 532],
'seminar_type': [532, 534, 537],
'seminar_title_terms': ['Information Session'],
},
},

{'name': 'UBC Institute for Gender, Race, Sexuality and Social Justice',
'api': 'https://grsj.arts.ubc.ca/wp-json/wp/v2/',
'categorize': {
'default': 'community',
'seminar_type': [512, 514, 632]
'default': 'seminar',
'community_type': [516, ]
},
},

{'name': 'UBC History',
'api': 'https://history.ubc.ca/wp-json/wp/v2/',
'categorize': {
'default': 'community',
'seminar_type': [531, 525, 527, 526, 530]
'seminar_type': [525, 526, 527, 530, 531]
},
},

Expand All @@ -333,6 +333,7 @@ async def update_events(request):
'categorize': {
'default': 'community',
'seminar_type': [1208,1209,785,546,1206,1198],
'seminar_tags': [1269],
'hidden_title_terms': ['community luncheon'],
},
},
Expand Down
2 changes: 1 addition & 1 deletion navigation/templates/navigation/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ <h3>Social media</h3>
<ul>
<li><a href="https://bsky.app/profile/ubyssey.ca" target="_blank" title="The Ubyssey on Bluesky">Bluesky</a></li>
<li><a href="https://www.instagram.com/ubyssey/" target="_blank" title="The Ubyssey on Instagram">Instagram</a></li>
<li><a href="https://www.tiktok.com/@ubyssey" target="_blank" title="The Ubyssey on Tiktok">TikTok</a></li>
<li><a href="https://www.tiktok.com/@theubyssey" target="_blank" title="The Ubyssey on Tiktok">TikTok</a></li>
<li><a href="https://www.facebook.com/ubyssey" target="_blank" title="The Ubyssey on Facebook">Facebook</a></li>
<li><a href="https://twitter.com/Ubyssey" target="_blank" title="The Ubyssey on X">X</a></li>

Expand Down
15 changes: 14 additions & 1 deletion ubyssey/static_src/src/js/components/Events/calendar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export function QueryEventsCalendar() {
const [numberOfWeeks, setNumberOfWeeks] = useState(calculateNumberOfWeeks());
const [start, setStart] = useState(getInitialStartDate());
const [isDarkMode, setIsDarkMode] = useState(false);
const [isMonthToggled, setIsMonthToggled] = React.useState(false);
const [isMonthToggled, setIsMonthToggled] = React.useState(urlParams.has("month"));
const [isLoading, setIsLoading] = React.useState(true);

function getDate(month, year) {
Expand Down Expand Up @@ -810,7 +810,19 @@ function EventsCalendar({events, start, setStart, numberOfWeeks, setNumberOfWeek
const loaderWeek = Math.floor((numberOfWeeks - 1) / 2);
const isMiddleDay = !isPhablet? week_index === loaderWeek && day_index === Math.floor(week.days.length / 2)
: week_index === 0 && day_index === 0;
if (isPhablet && ((!isMonthToggled && day.phase == "past") || (isMonthToggled && week_index === 0 && day.day > 7) || (isMonthToggled && week_index > 1 && day.day < 8))) {
return (<></>);
}

return (
<>
{(week_index !== 0 && day.day == 1) &&
<h2 className="events-calendar--month">
<span className="full">{week.month}</span>
<span className="short">{week.month_short}</span>
</h2>
}

<div key={day_index} className={"day " + day.phase}>
{isMiddleDay && isLoading && !isPhablet &&
<div className="loader-container">
Expand Down Expand Up @@ -861,6 +873,7 @@ function EventsCalendar({events, start, setStart, numberOfWeeks, setNumberOfWeek
))}
</ul>
</div>
</>
);
})}
</div>
Expand Down

0 comments on commit 14cb159

Please sign in to comment.