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/bundle
# Acts as Indexed
index/**/*

View File

@ -41,7 +41,7 @@ class EventsController < ApplicationController
def create
@event = Event.new(event_params)
# 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]
@event.valid?
@ -56,7 +56,7 @@ class EventsController < ApplicationController
# Send a mail to moderators
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 }
else
format.html { render action: 'new' }
@ -117,8 +117,8 @@ class EventsController < ApplicationController
end
def check_secret
if (params[:secret] != @event.secret)
redirect_to @event, notice: t(:forbidden, scope: [:events, :edit])
if params[:secret] != @event.secret
redirect_to :root, notice: t(:forbidden, scope: [:events, :edit])
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
%h1=t '.lug-list'
- if @event.region