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

recurrent
echarp 9 years ago
parent 1a2945fc47
commit 20b8c11c66
  1. 1
      .gitignore
  2. 8
      app/controllers/events_controller.rb
  3. 2
      app/views/events/show.html.haml

1
.gitignore vendored

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

@ -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

@ -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

Loading…
Cancel
Save