Browse Source

Working version

master
aeris 4 years ago
commit
dfce46388b
  1. 5
      .gitignore
  2. 16
      Gemfile
  3. 190
      Gemfile.lock
  4. 29
      bin/middleman
  5. 16
      config.rb
  6. 4
      locale/fr.yml
  7. 25
      mailer/notify.text.erb
  8. 58
      notify.rb
  9. 0
      source/images/.keep
  10. 92
      source/index.html.erb
  11. 35
      source/index.ics.erb
  12. 78
      source/javascripts/site.js.coffee
  13. 16
      source/layouts/layout.erb
  14. 93
      source/stylesheets/site.css.scss

5
.gitignore

@ -0,0 +1,5 @@
.bundle
.cache
.DS_Store
.sass-cache
build/

16
Gemfile

@ -0,0 +1,16 @@
source 'https://rubygems.org'
gem 'middleman', '~> 4.2'
gem 'middleman-autoprefixer'
gem 'middleman-livereload'
gem 'middleman-sprockets'
gem 'bootstrap-sass'
gem 'awesome_print'
gem 'pry-byebug'
gem 'actionmailer'
gem 'icalendar'
gem 'tzinfo-data', platforms: %i[mswin mingw jruby]
gem 'wdm', platforms: %i[mswin mingw]

190
Gemfile.lock

@ -0,0 +1,190 @@
GEM
remote: https://rubygems.org/
specs:
actionmailer (5.0.7)
actionpack (= 5.0.7)
actionview (= 5.0.7)
activejob (= 5.0.7)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 2.0)
actionpack (5.0.7)
actionview (= 5.0.7)
activesupport (= 5.0.7)
rack (~> 2.0)
rack-test (~> 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
actionview (5.0.7)
activesupport (= 5.0.7)
builder (~> 3.1)
erubis (~> 2.7.0)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.3)
activejob (5.0.7)
activesupport (= 5.0.7)
globalid (>= 0.3.6)
activesupport (5.0.7)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2)
minitest (~> 5.1)
tzinfo (~> 1.1)
addressable (2.5.2)
public_suffix (>= 2.0.2, < 4.0)
autoprefixer-rails (8.2.0)
execjs
awesome_print (1.8.0)
backports (3.11.1)
bootstrap-sass (3.3.7)
autoprefixer-rails (>= 5.2.1)
sass (>= 3.3.4)
builder (3.2.3)
byebug (10.0.2)
coderay (1.1.2)
coffee-script (2.4.1)
coffee-script-source
execjs
coffee-script-source (1.12.2)
compass-import-once (1.0.5)
sass (>= 3.2, < 3.5)
concurrent-ruby (1.0.5)
contracts (0.13.0)
crass (1.0.4)
dotenv (2.2.2)
em-websocket (0.5.1)
eventmachine (>= 0.12.9)
http_parser.rb (~> 0.6.0)
erubis (2.7.0)
eventmachine (1.2.5)
execjs (2.7.0)
fast_blank (1.0.0)
fastimage (2.1.1)
ffi (1.9.23)
globalid (0.4.1)
activesupport (>= 4.2.0)
haml (5.0.4)
temple (>= 0.8.0)
tilt
hamster (3.0.0)
concurrent-ruby (~> 1.0)
hashie (3.5.7)
http_parser.rb (0.6.0)
i18n (0.7.0)
icalendar (2.4.1)
kramdown (1.16.2)
listen (3.0.8)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
loofah (2.2.2)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
mail (2.7.0)
mini_mime (>= 0.1.1)
memoist (0.16.0)
method_source (0.9.0)
middleman (4.2.1)
coffee-script (~> 2.2)
compass-import-once (= 1.0.5)
haml (>= 4.0.5)
kramdown (~> 1.2)
middleman-cli (= 4.2.1)
middleman-core (= 4.2.1)
sass (>= 3.4.0, < 4.0)
middleman-autoprefixer (2.9.0)
autoprefixer-rails (~> 8.0)
middleman-core (>= 3.3.3)
middleman-cli (4.2.1)
thor (>= 0.17.0, < 2.0)
middleman-core (4.2.1)
activesupport (>= 4.2, < 5.1)
addressable (~> 2.3)
backports (~> 3.6)
bundler (~> 1.1)
contracts (~> 0.13.0)
dotenv
erubis
execjs (~> 2.0)
fast_blank
fastimage (~> 2.0)
hamster (~> 3.0)
hashie (~> 3.4)
i18n (~> 0.7.0)
listen (~> 3.0.0)
memoist (~> 0.14)
padrino-helpers (~> 0.13.0)
parallel
rack (>= 1.4.5, < 3)
sass (>= 3.4)
servolux
tilt (~> 2.0)
uglifier (~> 3.0)
middleman-livereload (3.4.6)
em-websocket (~> 0.5.1)
middleman-core (>= 3.3)
rack-livereload (~> 0.3.15)
middleman-sprockets (4.1.1)
middleman-core (~> 4.0)
sprockets (>= 3.0)
mini_mime (1.0.0)
mini_portile2 (2.3.0)
minitest (5.11.3)
nokogiri (1.8.2)
mini_portile2 (~> 2.3.0)
padrino-helpers (0.13.3.4)
i18n (~> 0.6, >= 0.6.7)
padrino-support (= 0.13.3.4)
tilt (>= 1.4.1, < 3)
padrino-support (0.13.3.4)
activesupport (>= 3.1)
parallel (1.12.1)
pry (0.11.3)
coderay (~> 1.1.0)
method_source (~> 0.9.0)
pry-byebug (3.6.0)
byebug (~> 10.0)
pry (~> 0.10)
public_suffix (3.0.2)
rack (2.0.4)
rack-livereload (0.3.17)
rack
rack-test (0.6.3)
rack (>= 1.0)
rails-dom-testing (2.0.3)
activesupport (>= 4.2.0)
nokogiri (>= 1.6)
rails-html-sanitizer (1.0.4)
loofah (~> 2.2, >= 2.2.2)
rb-fsevent (0.10.3)
rb-inotify (0.9.10)
ffi (>= 0.5.0, < 2)
sass (3.4.25)
servolux (0.13.0)
sprockets (3.7.1)
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
temple (0.8.0)
thor (0.20.0)
thread_safe (0.3.6)
tilt (2.0.8)
tzinfo (1.2.5)
thread_safe (~> 0.1)
uglifier (3.2.0)
execjs (>= 0.3.0, < 3)
PLATFORMS
ruby
DEPENDENCIES
actionmailer
awesome_print
bootstrap-sass
icalendar
middleman (~> 4.2)
middleman-autoprefixer
middleman-livereload
middleman-sprockets
pry-byebug
tzinfo-data
wdm
BUNDLED WITH
1.16.1

29
bin/middleman

@ -0,0 +1,29 @@
#!/usr/bin/env ruby
# frozen_string_literal: true
#
# This file was generated by Bundler.
#
# The application 'middleman' is installed as part of a gem, and
# this file is here to facilitate running it.
#
require "pathname"
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
Pathname.new(__FILE__).realpath)
bundle_binstub = File.expand_path("../bundle", __FILE__)
if File.file?(bundle_binstub)
if File.read(bundle_binstub, 150) =~ /This file was generated by Bundler/
load(bundle_binstub)
else
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
end
end
require "rubygems"
require "bundler/setup"
load Gem.bin_path("middleman-cli", "middleman")

16
config.rb

@ -0,0 +1,16 @@
activate :sprockets
activate :i18n, mount_at_root: :fr
activate :autoprefixer do |prefix|
prefix.browsers = 'last 2 versions'
end
configure :development do
activate :livereload, apply_css_live: true, apply_js_live: true, no_swf: true
end
configure :build do
set :relative_links, true
activate :relative_assets
activate :minify_css
activate :minify_javascript
end

4
locale/fr.yml

@ -0,0 +1,4 @@
fr:
date:
formats:
default: "%d/%m/%Y"

25
mailer/notify.text.erb

@ -0,0 +1,25 @@
Bonjour,
Félicitations à toi, ta proposition d’intervention pour PSES 2018 a été retenue !
<% @events.each do |event| %>
<%= event[:type] %> : <%= event[:title].strip %>
<%= I18n.l event[:date] %>, de <%= event[:from] %> à <%= event[:to] %>
<% end %>
Pourrais-tu nous confirmer rapidement par retour de mail ta disponibilité définitive pour ce créneau, si possible avant le 15 avril ? Le programme définitif sera publié le 1er mai.
Les conférences se déroulent sur 55 minutes, environ 45 minutes d’intervention suivies de 10 minutes de questions ou discussion avec le public.
Merci de te présenter auprès de la régie au moins 10 minutes avant le début de ta conférence, afin d’être éventuellement équipé en micro et de préparer ton PC pour la diffusion de ton support de présentation.
Les conférences sont par défaut filmées et rediffusées en direct sur Internet. Les vidéos seront ensuite mises à disposition, sur notre site Internet ainsi que sur d’autres plate-formes de vidéo en ligne (Youtube & cie).
Si tu ne souhaites pas être filmé, merci de nous le signaler à l’avance, nous pouvons faire une captation sonore uniquement, voire pas de captation du tout.
Afin de palier à une éventuelle défaillance du matériel de diffusion ainsi que de permettre sa diffusion ultérieure, pourrais-tu nous communiquer ton support de présentation avant le 24 juin ?
Concernant les ateliers, ils sont sur un créneau de 55 minutes, et ne sont pas filmés. Il n’est pas certain d’avoir du matériel de projection à disposition, les ateliers étant plutôt prévus sous un format de discussions informelles avec le public présent.
Encore merci pour ta proposition d’intervention, et à bientôt pour PSES 2018 ! 🐇
--
L’équipe PSES

58
notify.rb

@ -0,0 +1,58 @@
#!/usr/bin/env ruby
require 'awesome_print'
require 'action_mailer'
I18n.load_path = Dir['locale/*.yml']
I18n.available_locales = %i[fr]
I18n.default_locale = :fr
I18n.enforce_available_locales = false
ActionMailer::Base.raise_delivery_errors = true
ActionMailer::Base.delivery_method = :smtp
ActionMailer::Base.smtp_settings = {
address: 'localhost',
# port: 1025,
openssl_verify_mode: 'none'
}
ActionMailer::Base.view_paths = File.dirname(__FILE__)
class Mailer < ActionMailer::Base
def notify(to, events)
puts "Notify #{to} with #{events.size} events"
@events = events
mail from: 'conferences@passageenseine.fr',
to: to,
# to: ['aeris@imirhil.fr', 'dashcom@protonmail.com'],
subject: '[PSES] Conférence retenue'
end
end
TYPES = {
talks: 'Conférence',
workshops: 'Atelier'
}.freeze
planning = YAML.load File.read 'config/2018.yml'
events = []
planning.each do |date, ess|
ess.each do |type, es|
es.each do |e|
email = e[:email]
next unless email
events << {
email: email,
type: TYPES[type.to_sym],
title: e[:title],
date: date,
from: e[:from],
to: e[:to]
}
end
end
end
events = events.group_by { |e| e[:email] }.to_h
events.each do |to, events|
Mailer.notify(to, events).deliver
# break
end

0
source/images/.keep

92
source/index.html.erb

@ -0,0 +1,92 @@
<%
planning = YAML.load File.read File.join Middleman::Application.root, 'config/2018.yml'
def parse_time(time)
hour, min = time.split ':'
60 * hour.to_i + min.to_i
end
%>
<div class="container-fluid">
<div class="row">
<table class="timetable table-bordered table-condensed col-xs-12">
<thead>
<tr>
<th></th>
<% planning.each do |day, events| %>
<%=
n = events.size
attributes = n == 1 ? nil : { colspan: n }
content_tag :th, day, attributes
%>
<% end %>
</tr>
<!--tr>
<% planning.each do |day, events| %>
<% events.each do |type, _| %>
<td><%= type %></td>
<% end %>
<% end %>
</tr-->
</thead>
<tbody>
<tr>
<td>
<ul>
<% (10..21).each do |hour| %>
<li data-time="<%= hour %>:00"><%= hour %>:00</li>
<% end %>
</ul>
</td>
<% planning.each do |_, events| %>
<% events.each do |_, events| %>
<td>
<ul>
<% (events || []).each do |event| %>
<%
from, to = event[:from], event[:to]
duration = parse_time(to) - parse_time(from)
classes = [event[:place]]
classes << :half if duration <= 30
classes << :double if duration >= 90
classes = classes.join ' '
%>
<% content_tag :li, class: classes, data: { from: from, to: to } do %>
<div class="time">
<%= from %> - <%= to %>
</div>
<div class="title">
<%= event[:title] %>
</div>
<div class="author">
<%= event[:author] %>
</div>
<div class="description">
<%= event[:description] %>
</div>
<% end %>
<% end %>
</ul>
</td>
<% end %>
<% end %>
</tr>
</tbody>
</table>
</div>
</div>
<div class="modal">
<header class="header">
<div class="content">
<span class="date"></span>
<h3 class="name"></h3>
</div>
<div class="header-bg"></div>
</header>
<div class="body">
<div class="event-info"></div>
<div class="body-bg"></div>
</div>
<a href="#" class="close">Close</a>
</div>

35
source/index.ics.erb

@ -0,0 +1,35 @@
<%=
require 'icalendar'
def merge(day, time)
hour, min = time.split ':'
date = DateTime.new day.year, day.month, day.mday, hour.to_i, min.to_i, 0, 'CEST'
Icalendar::Values::DateTime.new date
end
planning = YAML.load File.read File.join Middleman::Application.root, 'config/2018.yml'
cal = Icalendar::Calendar.new
cal.append_custom_property 'NAME', 'PSES 2018'
planning.each do |day, events|
events.each do |type, events|
events.each do |event|
from = event[:from]
to = event[:to]
title = event[:title]
cal.event do |e|
e.uid = "urn:sha1:#{Digest::SHA1.hexdigest title}"
e.dtstart = merge day, from
e.dtend = merge day, to
e.organizer = Icalendar::Values::CalAddress.new nil, cn: event[:author]
e.summary = title
e.description = event[:description]
e.location = event[:place].to_s
end
end
end
end
cal.to_ical
%>

78
source/javascripts/site.js.coffee

@ -0,0 +1,78 @@
class TimeTable
constructor: (@element) ->
parse_time: (time) ->
time = time.split ':'
hour = parseInt time[0]
min = parseInt time[1]
60 * hour + min
find_including: (times, time) ->
previous = null
for current in times
if previous?
if previous.time <= time < current.time
return [previous, current]
else
previous = current
null
prorate: (ref, time) ->
from = ref[0]
to = ref[1]
ratio = (time - from.time) / (to.time - from.time)
top = from.top + (to.top - from.top) * ratio
Math.round top
position: (times, element) ->
from = @parse_time element.dataset.from
to = @parse_time element.dataset.to
including_from = @find_including times, from
including_to = @find_including times, to
top = @prorate including_from, from
bottom = @prorate including_to, to
root = element.parentElement
width = root.clientWidth
element.style.top = "#{top}px"
element.style.height = "#{bottom - top}px"
element.style.width = "#{width}px"
element.style.position = 'absolute'
init: ->
times = []
hours = @element.querySelectorAll 'tbody td:first-child li'
for hour in hours
time = @parse_time hour.dataset.time
times.push {
time: time,
top: hour.getBoundingClientRect().top
}
last = hours[hours.length - 1]
time = @parse_time last.dataset.time
rect = last.getBoundingClientRect()
times.push {
time: time + 60
top: rect.top + rect.height
}
events = @element.querySelectorAll 'tbody td:not(:first-child) li'
for event in events
@position times, event
init = ->
tables = document.querySelectorAll 'table.timetable'
for table in tables
new TimeTable(table).init()
document.addEventListener 'DOMContentLoaded', init
window.addEventListener 'resize', init

16
source/layouts/layout.erb

@ -0,0 +1,16 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="viewport"
content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Use the title from a page's frontmatter if it has one -->
<title>Programme PSES</title>
<%= stylesheet_link_tag 'site' %>
<%= javascript_include_tag 'site' %>
</head>
<body>
<%= yield %>
</body>
</html>

93
source/stylesheets/site.css.scss

@ -0,0 +1,93 @@
@import 'bootstrap';
html {
box-sizing: border-box;
}
$line-height: 150px;
$event-color-1: #577F92; // Smalt Blue
$event-color-2: #443453; // Martinique
$event-color-3: #A2B9B2; // Edward
$event-color-4: #f6b067; // Rajah
table.timetable {
table-layout: fixed;
tr {
th:first-child {
width: 50px;
}
}
thead {
th, td {
text-align: center;
}
}
ul {
list-style-type: none;
padding: 0;
margin: 0;
li {
height: $line-height;
&:not(:first-child) {
margin-top: 5px;
}
}
}
tbody {
td {
vertical-align: top;
&:not(:first-child) {
ul {
li {
padding: 10px;
color: #fff;
&.half {
height: $line-height/2;
}
&.double {
height: 2*$line-height;
}
}
}
}
}
.cinema {
background-color: $event-color-1;
}
.hall {
background-color: $event-color-2;
}
.town {
background-color: $event-color-4;
}
.time {
font-size: 0.75em;
}
.title {
font-weight: bold;
}
.author {
text-align: right;
}
.description {
display: none;
}
}
}
Loading…
Cancel
Save