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

recurrent
echarp 7 years ago
parent 88bca98adf
commit 35fdf9b3d5
  1. 5
      app/assets/stylesheets/digest.css.sass
  2. 2
      app/controllers/digests_controller.rb
  3. 7
      app/controllers/tags_controller.rb
  4. 48
      app/views/digests/markdown.html.haml
  5. 4
      config/locales/views/fr.yml
  6. 1
      test/controllers/maps_controller_test.rb

@ -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

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

@ -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

@ -1,36 +1,39 @@
- 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
\-----
= 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
\
- 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
= 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.city}] [#{event.title}](#{event_url event})
\-----
%p= display_date
%p= event.full_address
&gt; #{strip_tags(@event.description).remove(/\n.*/)}
\## [#{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}
\
* #{link_to @event.url, @event.url}
* #{@event.tags.split.collect { |tag| "[#{tag}](#{tag_url tag})" }.join ', '}
* #{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
:markdown
#{description}
%description
:markdown
#{description}
%hr
@ -46,8 +49,9 @@
%hr
:markdown
#{second_part}
.second_part
:markdown
#{second_part}
%hr

@ -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:

@ -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

Loading…
Cancel
Save