The link between events and organisations is not based on a "tagified" orga's name.

Space, quote and asterisk are replaced with a dash. Colons are removed.

Close #3
This commit is contained in:
echarp 2015-10-22 22:03:18 +02:00
parent 27901e6adf
commit 3387a38bda
3 changed files with 9 additions and 4 deletions

View File

@ -37,8 +37,8 @@ class OrgasController < ApplicationController
def show def show
@search = Orga.search params[:q] @search = Orga.search params[:q]
@events_future = Event.moderated.future.tag @orga.name @events_future = Event.moderated.future.tag @orga.name_as_tag
@events_past = Event.moderated.past.tag @orga.name @events_past = Event.moderated.past.tag @orga.name_as_tag
end end
# PATCH/PUT /orgas/1 # PATCH/PUT /orgas/1

View File

@ -45,4 +45,8 @@ class Orga < ActiveRecord::Base
def send_secret def send_secret
OrgaMailer.create(self).deliver_now! OrgaMailer.create(self).deliver_now!
end end
def name_as_tag
name.gsub(/[\s\*']/, '-').delete ':'
end
end end

View File

@ -96,5 +96,6 @@
%dt= t '.past' %dt= t '.past'
%dd= t '.count', count: @events_past.count %dd= t '.count', count: @events_past.count
.events#map{ data: { url: maps_path(format: :json, tag: @orga.name, .events#map{ title: @orga.name_as_tag,
future: false) } } data: { url: maps_path(format: :json, tag: @orga.name_as_tag,
future: false) } }