2014-08-06 14:47:47 +02:00
|
|
|
# Helper for the event views
|
2013-12-28 23:45:13 +01:00
|
|
|
module EventsHelper
|
2014-08-06 14:47:47 +02:00
|
|
|
def set_events_meta
|
|
|
|
set_meta_tags \
|
2014-08-09 18:59:11 +02:00
|
|
|
description: t('layouts.application.subtitle'),
|
2014-08-10 12:24:43 +02:00
|
|
|
keywords: @events.map { |e| e.tags }.join(' ').split.group_by { |i| i }
|
2014-08-06 14:47:47 +02:00
|
|
|
.reject { |_k, v| v.size < 2 }.map { |k, _v| k },
|
|
|
|
DC: {
|
|
|
|
title: t('layouts.application.title'),
|
2014-08-07 22:16:05 +02:00
|
|
|
subject: t('layouts.application.subtitle'),
|
|
|
|
publisher: 'april'
|
2014-08-06 14:47:47 +02:00
|
|
|
}
|
|
|
|
end
|
|
|
|
|
|
|
|
def set_event_meta
|
|
|
|
set_meta_tags \
|
|
|
|
keywords: @event.tags,
|
|
|
|
DC: { title: @event.title, date: @event.start_time.to_s },
|
|
|
|
geo: {
|
|
|
|
placename: @event.city,
|
2014-08-24 12:19:45 +02:00
|
|
|
region: @event.related_region,
|
|
|
|
position: "#{@event.latitude};#{@event.longitude}",
|
|
|
|
ICBM: "#{@event.latitude}, #{@event.longitude}"
|
2014-08-06 14:47:47 +02:00
|
|
|
}
|
|
|
|
end
|
2014-08-16 17:39:24 +02:00
|
|
|
|
|
|
|
def wrap(s, width = 78)
|
|
|
|
s.gsub(/(.{1,#{width}})(\s+|\Z)/, "\\1\n")
|
|
|
|
end
|
2013-12-28 23:45:13 +01:00
|
|
|
end
|