The linuxfr weekly digest should be mostly ready. Refs #4

This commit is contained in:
echarp 2015-11-21 17:29:50 +01:00
parent 88bca98adf
commit 35fdf9b3d5
6 changed files with 41 additions and 26 deletions

View File

@ -12,6 +12,11 @@ body.digests main
font-size: larger font-size: larger
text-align: left text-align: left
// Some hack so the display is similar to the one on dlfp
.description, .second_part
p
white-space: pre-line
textarea textarea
width: 40em width: 40em
height: 20em height: 20em

View File

@ -10,7 +10,7 @@ class DigestsController < ApplicationController
before_action :set_events, only: [:show] before_action :set_events, only: [:show]
def show def show
render params[:id] render :markdown
end end
private private

View File

@ -1,7 +1,8 @@
# Manage event tags # Manage event tags
class TagsController < InheritedResources::Base class TagsController < InheritedResources::Base
has_scope :region, :locality, :tag, :daylimit has_scope :region, :locality, :daylimit
has_scope :period, type: :hash, using: [:year, :week] has_scope :period, type: :hash, using: [:year, :week]
has_scope :tag, as: :id
def index def index
@tags = apply_scopes(Event.moderated) @tags = apply_scopes(Event.moderated)
@ -18,7 +19,7 @@ class TagsController < InheritedResources::Base
end end
def show def show
@events_future = apply_scopes(Event).moderated.future.tag params[:id] @events_future = apply_scopes(Event).moderated.future
@events_past = apply_scopes(Event).moderated.past.tag params[:id] @events_past = apply_scopes(Event).moderated.past
end end
end end

View File

@ -1,35 +1,38 @@
- title = "Agenda du Libre pour la semaine #{@week.cweek} de l'année #{@week.year}" - title = t '.title', week: @week.cweek, year: @week.year
- description = capture_haml do - description = capture_haml do
- @events.group_by { |evt| evt.start_time.to_date }.sort.each do |day, evts| = t '.week', begin: @week.beginning_of_week.day, end: @week.end_of_week.day,
= l(day, format: :long).capitalize month: t('date.month_names')[@week.month], year: @week.year,
\----- count: @events.count
- evts.each do |event|
* [[#{event.city}] #{event.title}](#{event_url event})
\ \
- @events.group_by { |evt| evt.start_time.to_date }.sort.each do |day, evts|
= '* ' + t('date.day_names')[day.wday].capitalize + ':'
= evts.collect { |event| "[#{event.city}] [#{event.title}](#{event_url event})" }.join '; '
- second_part = capture_haml do - second_part = capture_haml do
= title = title
\===== \=====
- @events.sort_by { |e| e.start_time }.each do |event| = t '.week', begin: @week.beginning_of_week.day, end: @week.end_of_week.day,
- @event = event month: t('date.month_names')[@week.month], year: @week.year,
[#{event.city}] [#{event.title}](#{event_url event}) count: @events.count
\-----
%p= display_date
%p= event.full_address
&gt; #{strip_tags(@event.description).remove(/\n.*/)}
\ \
* #{link_to @event.url, @event.url} - @events.sort_by(&:start_time).each do |event|
* #{@event.tags.split.collect { |tag| "[#{tag}](#{tag_url tag})" }.join ', '} - @event = event
\## [#{event.city}] [#{event.title}](#{event_url event})
= display_date
= event.full_address
- strip_tags(@event.description).split(/\r\n/)[0..3].reject { |p| p.blank? }.each do |p|
&gt; #{p}
\
* #{Event.human_attribute_name :url}: #{link_to @event.url, @event.url}
* #{Event.human_attribute_name :tags}: #{@event.tags.split.collect { |tag| "[#{tag}](#{tag_url tag})" }.join ', '}
\ \
%h1= title %h1= title
:markdown %description
:markdown
#{description} #{description}
%hr %hr
@ -46,7 +49,8 @@
%hr %hr
:markdown .second_part
:markdown
#{second_part} #{second_part}
%hr %hr

View File

@ -282,6 +282,10 @@ description plus complète."
ko: Non ko: Non
destroy: destroy:
ok: L'organisation a bien été supprimée ok: L'organisation a bien été supprimée
digests:
markdown:
title: Agenda du Libre pour la semaine %{week} de l'année %{year}
week: Semaine du %{begin} au %{end} %{month} %{year}. %{count} événements.
devise: devise:
sessions: sessions:

View File

@ -2,6 +2,7 @@ require 'test_helper'
# Test the geocoding life cycle # Test the geocoding life cycle
class MapsControllerTest < ActionController::TestCase class MapsControllerTest < ActionController::TestCase
include Devise::TestHelpers
test 'should get index' do test 'should get index' do
get :index get :index
assert_response :success assert_response :success