Add event materials, add support for slides and many talks from one person

This commit is contained in:
Mikko Ahlroth 2023-03-18 10:04:34 +02:00
parent 8d77860ec8
commit 886bee453e
14 changed files with 255 additions and 70 deletions

View file

@ -64,34 +64,46 @@
<h3 class="talk-title">Why Elixir matters</h3>
<img src="mikkonaama2&period;webp" alt="Mikko Ahlroth" title="Mikko Ahlroth" class="speaker-image pure-img" />
<p class="speaker-name">
Mikko Ahlroth, Vincit Oyj
</p>
<p class="speaker-description">
Mikko works primarily as a full stack developer at <a href="https://vincit.com/en">Vincit</a>, but on his free time has dabbled with Elixir since 2013. He has published <a href="https://hex.pm/users/nicd">some packages</a> on hex.pm and runs <a href="https://codestats.net/">Code::Stats</a> on Phoenix.
</p>
</div>
<div class="l-box-lrg pure-u-1 pure-u-md-1-2">
<h3 class="talk-title">GenServer &amp; Agent</h3>
<img src="jannenaama&period;jpg" alt="Janne Tenhovirta" title="Janne Tenhovirta" class="speaker-image pure-img" />
<p class="speaker-name">
Janne Tenhovirta, Cybersoft
</p>
<p class="speaker-description">
Janne mainly gets his hands dirty in .NET backend development at his job with <a href="http://headpower.fi">Cybersoft, a subsidiary of Headpower</a>. He feels they get dirtier when fiddling with the frontend. He first learned of Elixir's existence in 2015 and started to fool around with it in 2016.
</p>
</div>
</div>

View file

@ -74,22 +74,56 @@
<h3 class="talk-title">Gleam &ndash; Type Safe BEAM</h3>
<img src="mikkonaama2&period;webp" alt="Mikko Ahlroth" title="Mikko Ahlroth" class="speaker-image pure-img" />
<p class="speaker-name">
Mikko Ahlroth, Vincit Oyj
</p>
<p class="speaker-description">
Mikko works primarily as a full stack developer at <a href="https://vincit.com/en">Vincit</a>, but on his free time has dabbled with Elixir since 2013. He has published <a href="https://hex.pm/users/nicd">some packages</a> on hex.pm and runs <a href="https://codestats.net/">Code::Stats</a> on Phoenix.
</p>
<h4>Slides & materials</h4>
<ul>
<li><a href="https&colon;&sol;&sol;docs&period;google&period;com&sol;presentation&sol;d&sol;1Jz&lowbar;eQFemw&fjlig;V&lowbar;0KqG8YXQ9GJQ7rdTAYOStvbN6sUySA&sol;edit&quest;usp&equals;sharing" target="_blank">Presentation</a></li>
</ul>
</div>
<div class="l-box-lrg pure-u-1 pure-u-md-1-2">
<h3 class="talk-title">More talks TBA</h3>
<h3 class="talk-title">Forget config&period;exs</h3>
<p class="speaker-name">
Mikko Ahlroth
</p>
<h4>Slides & materials</h4>
<ul>
<li><a href="https&colon;&sol;&sol;docs&period;google&period;com&sol;presentation&sol;d&sol;1KUB3qXolxa&lowbar;RRXy84NftzpvVuR46f4S4eLqe4ROc5mQ&sol;edit&quest;usp&equals;sharing" target="_blank">Presentation</a></li>
<li><a href="https&colon;&sol;&sol;blog&period;nytsoi&period;net&sol;2021&sol;04&sol;17&sol;elixir-simple-configuration" target="_blank">Blog post about configuration</a></li>
</ul>
</div>

View file

@ -2,12 +2,39 @@
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
<title>TRElixir</title>
<link>https://trelixir.fi/</link>
<link>
https://trelixir.fi
</link>
<description>TRElixir newsletter feed.</description>
<generator>Glemplate</generator>
<copyright>© Mikko Ahlroth</copyright>
<item>
<title>
<![CDATA[Thanks and materials added]]>
</title>
<dc:creator>Mikko Ahlroth</dc:creator>
<link>
https://trelixir.fi/event-2023-03-16.html
</link>
<guid>
d11e88e3-87a1-4ee1-a02c-6e50b1c123d0
</guid>
<description>
<![CDATA[
<p>Thanks to everyone for attending the first TRElixir in a long time! It was really nice to get to see all of you. I've added my talk materials to the website.</p><p>The next TRElixir will likely be at the end of May or beginning of June. Watch this feed! :)</p><p>If you have inspiration to talk about something yourself at the next event, or ideas or feedback for the event, please let me know! My contact details are on the main page of the website.</p>
]]>
</description>
<pubDate>
Sat, 18 Mar 2023 10:00:00 +0200
</pubDate>
</item>
<item>
<title>
<![CDATA[Lightning talk possibility]]>
@ -54,7 +81,7 @@
</p>
<p>
<a href="https://trelixir.fi/event-2023-03-16.html">Go to event page.</a>
<a href="https&colon;&sol;&sol;trelixir&period;fi/event-2023-03-16.html">Go to event page.</a>
</p>
]]>

View file

@ -77,7 +77,7 @@
<li>
More talks TBA
Forget config&period;exs (Mikko Ahlroth)
</li>

View file

@ -0,0 +1 @@
pub const url = "https://trelixir.fi"

View file

@ -18,8 +18,16 @@ pub fn data() {
),
signup_info: utils.load_child_tpl("generic", "signup_closed", assigns.new()),
talks: [
types.Talk(title: "Why Elixir matters", speaker: mikko_ahlroth.data()),
types.Talk(title: "GenServer & Agent", speaker: janne_tenhovirta.data()),
types.Talk(
title: "Why Elixir matters",
speaker: mikko_ahlroth.data(),
slides: [],
),
types.Talk(
title: "GenServer & Agent",
speaker: janne_tenhovirta.data(),
slides: [],
),
],
)
}

View file

@ -24,8 +24,27 @@ pub fn data() {
types.Talk(
title: "Gleam Type Safe BEAM",
speaker: mikko_ahlroth.data(),
slides: [
types.Slide(
title: "Presentation",
link: "https://docs.google.com/presentation/d/1Jz_eQFemwfjV_0KqG8YXQ9GJQ7rdTAYOStvbN6sUySA/edit?usp=sharing",
),
],
),
types.Talk(
title: "Forget config.exs",
speaker: mikko_ahlroth.data(),
slides: [
types.Slide(
title: "Presentation",
link: "https://docs.google.com/presentation/d/1KUB3qXolxa_RRXy84NftzpvVuR46f4S4eLqe4ROc5mQ/edit?usp=sharing",
),
types.Slide(
title: "Blog post about configuration",
link: "https://blog.nytsoi.net/2021/04/17/elixir-simple-configuration",
),
],
),
types.Placeholder,
],
)
}

View file

@ -9,9 +9,13 @@ pub type Speaker {
Speaker(name: String, img: String, company: Company, description: String)
}
pub type Slide {
Slide(title: String, link: String)
}
pub type Talk {
Placeholder
Talk(title: String, speaker: Speaker)
Talk(title: String, speaker: Speaker, slides: List(Slide))
}
pub type Event {

View file

@ -1,5 +1,6 @@
import gleam/map
import gleam/list
import gleam/set
import gleam/string_builder
import glemplate/assigns
import glemplate/html
@ -7,6 +8,7 @@ import glemplate/ast
import glemplate/renderer
import trelixir/tpls
import trelixir/events/types
import trelixir/config
pub fn render(
template: ast.Template,
@ -16,6 +18,10 @@ pub fn render(
html.render(template, event_to_assigns(data), template_cache)
}
pub fn event_url(event_file: String) {
config.url <> "/" <> event_file <> ".html"
}
pub fn event_to_assigns(event: types.Event) -> assigns.Assigns {
assigns.from_list([
#("title", assigns.String(event.title)),
@ -23,37 +29,94 @@ pub fn event_to_assigns(event: types.Event) -> assigns.Assigns {
#("host_name", assigns.String(event.host_name)),
#("host_url", assigns.String(event.host_url)),
#("signup_info", assigns.String(event.signup_info)),
#("talks", assigns.List(list.map(event.talks, talk_to_assigns))),
#("talks", talks_to_assigns(event.talks)),
#("is_index", assigns.Bool(False)),
])
}
pub fn talk_to_assigns(talk: types.Talk) -> assigns.AssignData {
case talk {
types.Talk(title, speaker) ->
type TalkAcc {
TalkAcc(talks: List(assigns.AssignData), speakers: set.Set(types.Speaker))
}
pub fn talks_to_assigns(talks: List(types.Talk)) -> assigns.AssignData {
let talk_acc =
list.fold(
talks,
TalkAcc(talks: [], speakers: set.new()),
fn(acc, talk) {
let talk_assign = case talk {
types.Talk(title, speaker, slides) ->
assigns.Map(map.from_list([
#("title", assigns.String(title)),
#("speaker", speaker_to_assigns(speaker)),
#(
"speaker",
speaker_to_assigns(speaker, set.contains(acc.speakers, speaker)),
),
#("is_placeholder", assigns.Bool(False)),
#("slides", slides_to_assigns(slides)),
]))
types.Placeholder ->
assigns.Map(map.from_list([#("is_placeholder", assigns.Bool(True))]))
}
let speakers = case talk {
types.Talk(_title, speaker, _slides) ->
set.insert(acc.speakers, speaker)
types.Placeholder -> acc.speakers
}
TalkAcc(talks: [talk_assign, ..acc.talks], speakers: speakers)
},
)
assigns.List(list.reverse(talk_acc.talks))
}
pub fn speaker_to_assigns(speaker: types.Speaker) -> assigns.AssignData {
pub fn speaker_to_assigns(
speaker: types.Speaker,
suppressed: Bool,
) -> assigns.AssignData {
let general_data =
map.from_list([
#("name", assigns.String(speaker.name)),
#("img", assigns.String(speaker.img)),
])
let data = case suppressed {
True ->
general_data
|> map.insert("is_detailed", assigns.Bool(False))
False -> {
let company = case speaker.company {
types.NoCompany -> assigns.Bool(False)
types.Company(name) -> assigns.String(name)
}
general_data
|> map.insert("company", company)
|> map.insert("description", assigns.String(speaker.description))
|> map.insert("is_detailed", assigns.Bool(True))
}
}
assigns.Map(data)
}
pub fn slides_to_assigns(slides: List(types.Slide)) -> assigns.AssignData {
case slides {
[] -> assigns.Bool(False)
slides ->
assigns.List(list.map(
slides,
fn(slide) {
assigns.Map(map.from_list([
#("name", assigns.String(speaker.name)),
#("img", assigns.String(speaker.img)),
#("company", company),
#("description", assigns.String(speaker.description)),
#("title", assigns.String(slide.title)),
#("link", assigns.String(slide.link)),
]))
},
))
}
}
pub fn load_child_tpl(

View file

@ -3,5 +3,5 @@
</p>
<p>
<a href="https://trelixir.fi/<%= event_file %>.html">Go to event page.</a>
<a href="<%= site_url %>/<%= event_file %>.html">Go to event page.</a>
</p>

View file

@ -8,6 +8,8 @@ import glemplate/ast
import glemplate/renderer
import trelixir/tpls
import trelixir/events/event_2023_03_16
import trelixir/events/utils
import trelixir/config
pub const tpl = "feed.xml.glemp"
@ -32,20 +34,27 @@ pub fn render(template: ast.Template, template_cache: renderer.TemplateCache) {
fn items() {
[
Item(
title: "Thanks and materials added",
link: utils.event_url(event_2023_03_16.file),
guid: "d11e88e3-87a1-4ee1-a02c-6e50b1c123d0",
description: "<p>Thanks to everyone for attending the first TRElixir in a long time! It was really nice to get to see all of you. I've added my talk materials to the website.</p>" <> "<p>The next TRElixir will likely be at the end of May or beginning of June. Watch this feed! :)</p>" <> "<p>If you have inspiration to talk about something yourself at the next event, or ideas or feedback for the event, please let me know! My contact details are on the main page of the website.</p>",
pub_date: "Sat, 18 Mar 2023 10:00:00 +0200",
),
Item(
title: "Lightning talk possibility",
link: "https://trelixir.fi/" <> event_2023_03_16.file <> ".html",
link: utils.event_url(event_2023_03_16.file),
guid: "8f77b5c8-2de0-49bb-b652-077a601f762b",
description: "It's possible to hold a lightning talk (510 mins) at our event! Inquire for the possibility from Mikko Ahlroth (contact details on the website), or come talk to him before the event.",
pub_date: "Sun, 12 Mar 2023 9:40:00 +0200"
pub_date: "Sun, 12 Mar 2023 9:40:00 +0200",
),
Item(
title: "Upcoming event: 16.3.2023",
link: "https://trelixir.fi/" <> event_2023_03_16.file <> ".html",
link: utils.event_url(event_2023_03_16.file),
guid: "cfc19ed7-f46d-45b6-a134-e11df93a864d",
description: load_description(
"cfc19ed7-f46d-45b6-a134-e11df93a864d",
assigns.new()
base_assigns()
|> assigns.add_string("event_file", event_2023_03_16.file),
),
pub_date: "Tue, 21 Feb 2023 21:30:00 +0200",
@ -70,7 +79,7 @@ fn items_to_assigns(items: List(Item)) {
},
)
assigns.new()
base_assigns()
|> assigns.add_list("items", mapped)
}
@ -80,3 +89,8 @@ fn load_description(item: String, data: assigns.Assigns) {
let assert Ok(rendered) = html.render(parsed, data, map.new())
string_builder.to_string(rendered)
}
fn base_assigns() {
assigns.new()
|> assigns.add_string("site_url", config.url)
}

View file

@ -1,5 +1,4 @@
import gleam/map
import gleam/list
import glemplate/assigns
import glemplate/renderer
import glemplate/html
@ -28,13 +27,7 @@ pub fn assigns() {
",
),
),
#(
"talks",
assigns.List(list.map(
event_2023_03_16.data().talks,
utils.talk_to_assigns,
)),
),
#("talks", utils.talks_to_assigns(event_2023_03_16.data().talks)),
])),
),
#(
@ -53,13 +46,7 @@ pub fn assigns() {
",
),
),
#(
"talks",
assigns.List(list.map(
event_2017_09_21.data().talks,
utils.talk_to_assigns,
)),
),
#("talks", utils.talks_to_assigns(event_2017_09_21.data().talks)),
])),
]),
),

View file

@ -2,7 +2,9 @@
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
<title>TRElixir</title>
<link>https://trelixir.fi/</link>
<link>
<%= site_url %>
</link>
<description>TRElixir newsletter feed.</description>
<generator>Glemplate</generator>
<copyright>© Mikko Ahlroth</copyright>

View file

@ -35,16 +35,30 @@
<% else %>
<h3 class="talk-title"><%= talk.title %></h3>
<% if talk.speaker.is_detailed %>
<img src="<%= talk.speaker.img %>" alt="<%= talk.speaker.name %>" title="<%= talk.speaker.name %>" class="speaker-image pure-img" />
<% end %>
<p class="speaker-name">
<%= talk.speaker.name %><% if talk.speaker.company %>, <%= talk.speaker.company %><% end %>
<%= talk.speaker.name %><% if talk.speaker.is_detailed %><% if talk.speaker.company %>, <%= talk.speaker.company %><% end %><% end %>
</p>
<% if talk.speaker.is_detailed %>
<p class="speaker-description">
<%= raw talk.speaker.description %>
</p>
<% end %>
<% if talk.slides %>
<h4>Slides & materials</h4>
<ul>
<% for slide in talk.slides %>
<li><a href="<%= slide.link %>" target="_blank"><%= slide.title %></a></li>
<% end %>
</ul>
<% end %>
<% end %>
</div>
<% end %>
</div>