Après création d'événement redirection vers :root

This commit is contained in:
echarp 2014-06-26 21:55:23 +02:00
parent 1a2945fc47
commit 20b8c11c66
3 changed files with 6 additions and 5 deletions

1
.gitignore vendored
View File

@ -40,6 +40,7 @@ public/refinery/*
# Vendor Cache # Vendor Cache
vendor/cache vendor/cache
vendor/bundle
# Acts as Indexed # Acts as Indexed
index/**/* index/**/*

View File

@ -41,7 +41,7 @@ class EventsController < ApplicationController
def create def create
@event = Event.new(event_params) @event = Event.new(event_params)
# This is a special case, required to handle the region attribute with same foreign key name # This is a special case, required to handle the region attribute with same foreign key name
@event.region = Region.find(params[:event][:region]) @event.region = Region.find params[:event][:region]
if params[:visu] if params[:visu]
@event.valid? @event.valid?
@ -56,7 +56,7 @@ class EventsController < ApplicationController
# Send a mail to moderators # Send a mail to moderators
ModerationMailer.create(@event).deliver ModerationMailer.create(@event).deliver
format.html { redirect_to @event, notice: t('.ok') } format.html { redirect_to :root, notice: t('.ok') }
format.json { render action: 'show', status: :created, location: @event } format.json { render action: 'show', status: :created, location: @event }
else else
format.html { render action: 'new' } format.html { render action: 'new' }
@ -117,8 +117,8 @@ class EventsController < ApplicationController
end end
def check_secret def check_secret
if (params[:secret] != @event.secret) if params[:secret] != @event.secret
redirect_to @event, notice: t(:forbidden, scope: [:events, :edit]) redirect_to :root, notice: t(:forbidden, scope: [:events, :edit])
end end
end end

View File

@ -1,4 +1,4 @@
- if request.format == 'text/html' && controller.controller_name != 'moderations' && controller.controller_name != 'notes' && controller.action_name != 'edit' - if request.format == 'text/html' && controller.controller_name != 'moderations' && controller.controller_name != 'notes' && controller.action_name != 'edit' && controller.action_name != 'cancel'
#lug-list #lug-list
%h1=t '.lug-list' %h1=t '.lug-list'
- if @event.region - if @event.region