Skip to content

Commit

Permalink
finish team pages
Browse files Browse the repository at this point in the history
  • Loading branch information
captn3m0 committed May 13, 2024
1 parent 96cfbfd commit bb36776
Show file tree
Hide file tree
Showing 7 changed files with 78 additions and 14 deletions.
7 changes: 6 additions & 1 deletion _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,9 @@ page_gen:
name_expr: record['date'].strftime('%Y-%m')
title_expr: record['date'].strftime("%B %Y")
page_data_prefix: event
# debug: true
- data: teams
template: team
dir: teams
name_expr: record['slug']
title_expr : record['name'] + " | Puzzled Pint BLR Team"
page_data_prefix: team
7 changes: 6 additions & 1 deletion _data/aliases.csv
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,9 @@ spicy-desi-chilli-crispy-baby-potatoes,desi-crispy-chilli-baby-potatoes
spicy-desi-crispy-chilli-baby-potatoes,desi-crispy-chilli-baby-potatoes
hot-spicy-desi-crispy-chilli-baby-potatoes,desi-crispy-chilli-baby-potatoes
red-hot-spicy-desi-crispy-baby-chili-potatoes,desi-crispy-chilli-baby-potatoes
fiery-red-hot-spicy-crispy-chilly-baby-potatoes,desi-crispy-chilli-baby-potatoes
fiery-red-hot-spicy-crispy-chilly-baby-potatoes,desi-crispy-chilli-baby-potatoes
siddy-s-fanclub,siddy-s-fan-club
siddy-s-fan-club-no-more,siddy-s-fan-club
siddy-s-fan-club-returns,siddy-s-fan-club
siddy-s-fan-club-again,siddy-s-fan-club
siddy-s-fan-club-4eva,siddy-s-fan-club
4 changes: 3 additions & 1 deletion _includes/color-style.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<style>
{% for C in site.data.colors %}
.color-{{forloop.index0}} {border-left: 4px solid {{C}};}
.color-{{forloop.index0}} {border-left: 4px solid {{C}}; }
.color-{{forloop.index0}} a {color: #333;}
.color-{{forloop.index0}}-wide {border-left: 15px solid {{C}};}
{% endfor %}
</style>
14 changes: 4 additions & 10 deletions _layouts/standings.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,17 @@
<div class="row">
<div class="column" style="margin-top: 10%; margin-bottom: 10%">

<img src="/images/favicon.png" class="avatar" alt="" />
<a href="/"><img src="/images/favicon.png" class="avatar" alt="Puzzled Pint Bangalore Logo" /></a>

<h2 role="heading">{{page.month | date:"%B %Y"}} Teams</h2>
<h4>{{page.event.theme}}</h4>
<h2 role="heading">{{page.event.date | date:"%B %Y"}} Teams</h2>
<h4><a style="color: #76316e" href='https://puzzledpint.com/events/{{page.event.date|date:"%B-%Y" | downcase}}/'>{{page.event.theme}}</a></h4>
<table>
<!-- <thead> -->
<tr>
<th>#</th>
<th>Team</th>
<th>Start Time</th>
<th>Solve Time</th>
</tr>
<!-- </thead> -->
<!-- <tbody> -->
{% assign idx=1 %}
{% assign rows = site.data.results | where: "Date", page.event.date %}
{% if rows.size > 0 %}
Expand All @@ -28,9 +25,7 @@ <h4>{{page.event.theme}}</h4>
<td>{{idx}}</td>

<td class="team color-{{row.color_index}}" data-slug="{{row.slug}}">
<a href="/teams/{{row.slug}}/">
{{row['Team Name']}}
</a>
<a href="/teams/{{row.slug}}/">{{row['Team Name']}}</a>
<span>{{row['Team Size']}} Players</span>
</td>
<td class="time">
Expand All @@ -50,7 +45,6 @@ <h4>{{page.event.theme}}</h4>
{% include live-standings.html %}
{% endif %}

<!-- </tbody> -->
</table>
</div>
</div>
Expand Down
51 changes: 51 additions & 0 deletions _layouts/team.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
---
layout: default
---
{% include color-style.html %}
<div class="container">
<div class="row">
<div class="column" style="margin-top: 10%; margin-bottom: 10%">

<a href="/"><img src="/images/favicon.png" class="avatar" alt="Puzzled Pint Bangalore Logo" /></a>

<h2 role="heading" class="color-{{page.team.color_index}}-wide">{{page.team.name}}</h2>
<table>
<tr>
<th>Event</th>
<th>Players</th>
<th>Solve Time</th>
</tr>
{% assign rows = page.team.results |reverse%}
{% for row in rows %}
<tr>
<td class=team style="text-align: left;">
<a href='/standings/{{row.event|date:"%Y-%m"}}/'>{{row.event | date:"%B %Y"}}</a>
<span>{{site.data.event_theme_mapping[row.event]}}</span>
</td>
<td class=time>
<span>{{row.players}}</span>
</td>
<td class="time">
{% if row.duration != '' %}
<span>{{row.duration}}</span>
{% endif %}
</td>
</tr>
{% endfor %}

</table>
</div>
</div>
<small>Team Slug: {{page.team.slug}}</small>
<br>
<small>
{% assign aliases = site.data.aliases | where: "slug",page.team.slug %}
{% if aliases.size > 0 %}
The team is known by the following aliases:
{% for i in aliases %}
{{i.name}}
{% endfor %}
{% endif %}
</small>
</div>

9 changes: 8 additions & 1 deletion _plugins/standings.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
Jekyll::Hooks.register :site, :post_read do |site|

def find_alias_or_slug(site, team_name)
slug = Jekyll::Utils.slugify team_name
tn = team_name.sub('β', 'beta')
slug = Jekyll::Utils.slugify tn
aliased = site.data['aliases'].find { |row| row['name'] == slug }
if aliased
return aliased['slug']
Expand Down Expand Up @@ -41,6 +42,7 @@ def find_alias_or_slug(site, team_name)
'd' => d/60,
'duration' => row['duration'],
'event' => row['Date'],
'players' => row['Team Size'],
}
else
site.data['teams'][row['slug']]['results'] << {
Expand All @@ -56,4 +58,9 @@ def find_alias_or_slug(site, team_name)
end
site.data['teams'] = site.data['teams'].values
site.data['teams'].sort_by! {|r| -r['results'].size }

site.data['event_theme_mapping'] = {}
site.data['events'].each do |event|
site.data['event_theme_mapping'][event['date'].to_s] = event['theme']
end
end
File renamed without changes.

0 comments on commit bb36776

Please sign in to comment.