Skip to content
Extraits de code Groupes Projets
Valider 35fdf9b3 rédigé par echarp's avatar echarp
Parcourir les fichiers

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

parent 88bca98a
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -12,6 +12,11 @@ body.digests main ...@@ -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
...@@ -10,7 +10,7 @@ class DigestsController < ApplicationController ...@@ -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
......
# 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 ...@@ -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
- 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| - @events.group_by { |evt| evt.start_time.to_date }.sort.each do |day, evts|
* [[#{event.city}] #{event.title}](#{event_url event}) = '* ' + 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,
month: t('date.month_names')[@week.month], year: @week.year,
count: @events.count
\
- @events.sort_by(&:start_time).each do |event|
- @event = event - @event = event
[#{event.city}] [#{event.title}](#{event_url event}) \## [#{event.city}] [#{event.title}](#{event_url event})
\----- = display_date
= event.full_address
%p= display_date - strip_tags(@event.description).split(/\r\n/)[0..3].reject { |p| p.blank? }.each do |p|
%p= event.full_address &gt; #{p}
&gt; #{strip_tags(@event.description).remove(/\n.*/)}
\ \
* #{link_to @event.url, @event.url} * #{Event.human_attribute_name :url}: #{link_to @event.url, @event.url}
* #{@event.tags.split.collect { |tag| "[#{tag}](#{tag_url tag})" }.join ', '} * #{Event.human_attribute_name :tags}: #{@event.tags.split.collect { |tag| "[#{tag}](#{tag_url tag})" }.join ', '}
\ \
%h1= title %h1= title
:markdown %description
#{description} :markdown
#{description}
%hr %hr
...@@ -46,8 +49,9 @@ ...@@ -46,8 +49,9 @@
%hr %hr
:markdown .second_part
#{second_part} :markdown
#{second_part}
%hr %hr
......
...@@ -282,6 +282,10 @@ description plus complète." ...@@ -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:
......
...@@ -2,6 +2,7 @@ require 'test_helper' ...@@ -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
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter