Put current conference in url
This commit is contained in:
parent
1bbebb54d3
commit
fb7c39315a
|
@ -6,13 +6,27 @@ module Management
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
|
def default_url_options(options = {})
|
||||||
|
{ current_conference: current_conference.slug }.merge(options)
|
||||||
|
end
|
||||||
|
|
||||||
def current_conference?
|
def current_conference?
|
||||||
current_conference.present?
|
current_conference.present?
|
||||||
end
|
end
|
||||||
helper_method :current_conference?
|
helper_method :current_conference?
|
||||||
|
|
||||||
|
# TODO (2015-06-09) Fetch conferences by slug only
|
||||||
def current_conference
|
def current_conference
|
||||||
@current_conference ||= (session[:current_conference_id] and Conference.find_by(id: session[:current_conference_id]))
|
@current_conference ||=
|
||||||
|
begin
|
||||||
|
# if params[:current_conference]
|
||||||
|
# Conference.find_by_slug(params[:current_conference])
|
||||||
|
# end
|
||||||
|
|
||||||
|
if session[:current_conference_id]
|
||||||
|
Conference.find_by(id: session[:current_conference_id])
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
helper_method :current_conference
|
helper_method :current_conference
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,16 @@ class Conference < ActiveRecord::Base
|
||||||
submissions.group_by { |s| s.confirmed_at.to_date }
|
submissions.group_by { |s| s.confirmed_at.to_date }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def slug
|
||||||
|
title.gsub(' ', '-')
|
||||||
|
end
|
||||||
|
|
||||||
|
# TODO (2015-06-09) Stupid and temporary, put slug in db
|
||||||
|
# TODO (2015-06-09) Also, doesn't work due to translations?
|
||||||
|
# def self.find_by_slug(slug)
|
||||||
|
# find_by(title: slug.to_s.gsub('-', ' '))
|
||||||
|
# end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def start_date_is_before_end_date
|
def start_date_is_before_end_date
|
||||||
|
|
|
@ -7,14 +7,17 @@ Rails.application.routes.draw do
|
||||||
put '/set_conference/:id', to: 'home#set_conference', as: :set_conference
|
put '/set_conference/:id', to: 'home#set_conference', as: :set_conference
|
||||||
|
|
||||||
resources :conferences
|
resources :conferences
|
||||||
resources :events
|
|
||||||
resources :volunteers
|
|
||||||
resources :sponsorship_offers
|
|
||||||
resource :call_for_participation, only: [:create, :destroy]
|
|
||||||
|
|
||||||
resources :users do
|
scope ':current_conference' do
|
||||||
member do
|
resources :events
|
||||||
put :toggle_admin
|
resources :volunteers
|
||||||
|
resources :sponsorship_offers
|
||||||
|
resource :call_for_participation, only: [:create, :destroy]
|
||||||
|
|
||||||
|
resources :users do
|
||||||
|
member do
|
||||||
|
put :toggle_admin
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue