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
text-align: left
// Some hack so the display is similar to the one on dlfp
.description, .second_part
p
white-space: pre-line
textarea
width: 40em
height: 20em

View File

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

View File

@ -1,7 +1,8 @@
# Manage event tags
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 :tag, as: :id
def index
@tags = apply_scopes(Event.moderated)
@ -18,7 +19,7 @@ class TagsController < InheritedResources::Base
end
def show
@events_future = apply_scopes(Event).moderated.future.tag params[:id]
@events_past = apply_scopes(Event).moderated.past.tag params[:id]
@events_future = apply_scopes(Event).moderated.future
@events_past = apply_scopes(Event).moderated.past
end
end

View File

@ -1,34 +1,37 @@
- 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
- @events.group_by { |evt| evt.start_time.to_date }.sort.each do |day, evts|
= l(day, format: :long).capitalize
\-----
- evts.each do |event|
* [[#{event.city}] #{event.title}](#{event_url event})
= t '.week', begin: @week.beginning_of_week.day, end: @week.end_of_week.day,
month: t('date.month_names')[@week.month], year: @week.year,
count: @events.count
\
- @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
= title
\=====
- @events.sort_by { |e| e.start_time }.each do |event|
- @event = event
[#{event.city}] [#{event.title}](#{event_url event})
\-----
%p= display_date
%p= event.full_address
&gt; #{strip_tags(@event.description).remove(/\n.*/)}
= t '.week', begin: @week.beginning_of_week.day, end: @week.end_of_week.day,
month: t('date.month_names')[@week.month], year: @week.year,
count: @events.count
\
* #{link_to @event.url, @event.url}
* #{@event.tags.split.collect { |tag| "[#{tag}](#{tag_url tag})" }.join ', '}
- @events.sort_by(&:start_time).each do |event|
- @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
%description
:markdown
#{description}
@ -46,6 +49,7 @@
%hr
.second_part
:markdown
#{second_part}

View File

@ -282,6 +282,10 @@ description plus complète."
ko: Non
destroy:
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:
sessions:

View File

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