Browse Source

Cleaner call to helper methods

remotes/origin/master
echarp 3 years ago
parent
commit
84c04d5fc5
  1. 14
      app/helpers/events_helper.rb
  2. 14
      app/helpers/orgas_helper.rb
  3. 4
      app/views/events/show.html.haml
  4. 2
      app/views/orgas/show.html.haml

14
app/helpers/events_helper.rb

@ -11,15 +11,15 @@ module EventsHelper
}
end
def set_event_meta
def set_event_meta(event = @event)
set_meta_tags \
keywords: @event.tag_list,
DC: { title: @event.title, date: @event.start_time.to_s },
keywords: event.tag_list,
DC: { title: event.title, date: event.start_time.to_s },
geo: {
placename: @event.city,
region: @event.region,
position: "#{@event.latitude};#{@event.longitude}",
ICBM: "#{@event.latitude}, #{@event.longitude}"
placename: event.city,
region: event.region,
position: "#{event.latitude};#{event.longitude}",
ICBM: "#{event.latitude}, #{event.longitude}"
}
end

14
app/helpers/orgas_helper.rb

@ -1,14 +1,14 @@
# Helper for the orga views
module OrgasHelper
def set_orga_meta
def orga_meta(orga)
set_meta_tags \
description: strip_tags(@orga.description),
DC: { title: @orga.name },
description: strip_tags(orga.description),
DC: { title: orga.name },
geo: {
placename: @orga.city,
region: @orga.region,
position: "#{@orga.latitude};#{@orga.longitude}",
ICBM: "#{@orga.latitude}, #{@orga.longitude}"
placename: orga.city,
region: orga.region,
position: "#{orga.latitude};#{orga.longitude}",
ICBM: "#{orga.latitude}, #{orga.longitude}"
}
end
end

4
app/views/events/show.html.haml

@ -1,4 +1,4 @@
- set_event_meta
- event_meta @event
= render partial: '/tags/context', locals: { tags: @event.tag_list }
@ -14,7 +14,7 @@
%h3= t '.dateAndPlace'
%p= display_date
%p= display_date @event
%p.full_address
- if @event.place_name.present?

2
app/views/orgas/show.html.haml

@ -1,4 +1,4 @@
- set_orga_meta
- orga_meta @orga
%h2
- if @orga.kind

Loading…
Cancel
Save