style: correct coding style with rubocop linter

This commit is contained in:
kbe
2025-09-05 12:02:44 +02:00
parent 46c8faf10c
commit 15e3c7dff5
40 changed files with 121 additions and 1663 deletions

View File

@@ -5,7 +5,7 @@
class Promoter::EventsController < ApplicationController
before_action :authenticate_user!
before_action :ensure_can_manage_events!
before_action :set_event, only: [:show, :edit, :update, :destroy, :publish, :unpublish, :cancel, :mark_sold_out]
before_action :set_event, only: [ :show, :edit, :update, :destroy, :publish, :unpublish, :cancel, :mark_sold_out ]
# Display all events for the current promoter
def index
@@ -25,9 +25,9 @@ class Promoter::EventsController < ApplicationController
# Create a new event
def create
@event = current_user.events.build(event_params)
if @event.save
redirect_to promoter_event_path(@event), notice: 'Event créé avec succès!'
redirect_to promoter_event_path(@event), notice: "Event créé avec succès!"
else
render :new, status: :unprocessable_entity
end
@@ -41,7 +41,7 @@ class Promoter::EventsController < ApplicationController
# Update an existing event
def update
if @event.update(event_params)
redirect_to promoter_event_path(@event), notice: 'Event mis à jour avec succès!'
redirect_to promoter_event_path(@event), notice: "Event mis à jour avec succès!"
else
render :edit, status: :unprocessable_entity
end
@@ -50,16 +50,16 @@ class Promoter::EventsController < ApplicationController
# Delete an event
def destroy
@event.destroy
redirect_to promoter_events_path, notice: 'Event supprimé avec succès!'
redirect_to promoter_events_path, notice: "Event supprimé avec succès!"
end
# Publish an event (make it visible to public)
def publish
if @event.draft?
@event.update(state: :published)
redirect_to promoter_event_path(@event), notice: 'Event publié avec succès!'
redirect_to promoter_event_path(@event), notice: "Event publié avec succès!"
else
redirect_to promoter_event_path(@event), alert: 'Cet event ne peut pas être publié.'
redirect_to promoter_event_path(@event), alert: "Cet event ne peut pas être publié."
end
end
@@ -67,9 +67,9 @@ class Promoter::EventsController < ApplicationController
def unpublish
if @event.published?
@event.update(state: :draft)
redirect_to promoter_event_path(@event), notice: 'Event dépublié avec succès!'
redirect_to promoter_event_path(@event), notice: "Event dépublié avec succès!"
else
redirect_to promoter_event_path(@event), alert: 'Cet event ne peut pas être dépublié.'
redirect_to promoter_event_path(@event), alert: "Cet event ne peut pas être dépublié."
end
end
@@ -77,9 +77,9 @@ class Promoter::EventsController < ApplicationController
def cancel
if @event.published?
@event.update(state: :canceled)
redirect_to promoter_event_path(@event), notice: 'Event annulé avec succès!'
redirect_to promoter_event_path(@event), notice: "Event annulé avec succès!"
else
redirect_to promoter_event_path(@event), alert: 'Cet event ne peut pas être annulé.'
redirect_to promoter_event_path(@event), alert: "Cet event ne peut pas être annulé."
end
end
@@ -87,9 +87,9 @@ class Promoter::EventsController < ApplicationController
def mark_sold_out
if @event.published?
@event.update(state: :sold_out)
redirect_to promoter_event_path(@event), notice: 'Event marqué comme complet!'
redirect_to promoter_event_path(@event), notice: "Event marqué comme complet!"
else
redirect_to promoter_event_path(@event), alert: 'Cet event ne peut pas être marqué comme complet.'
redirect_to promoter_event_path(@event), alert: "Cet event ne peut pas être marqué comme complet."
end
end
@@ -97,14 +97,14 @@ class Promoter::EventsController < ApplicationController
def ensure_can_manage_events!
unless current_user.can_manage_events?
redirect_to dashboard_path, alert: 'Vous n\'avez pas les permissions nécessaires pour gérer des événements.'
redirect_to dashboard_path, alert: "Vous n'avez pas les permissions nécessaires pour gérer des événements."
end
end
def set_event
@event = current_user.events.find(params[:id])
rescue ActiveRecord::RecordNotFound
redirect_to promoter_events_path, alert: 'Event non trouvé ou vous n\'avez pas accès à cet event.'
redirect_to promoter_events_path, alert: "Event non trouvé ou vous n'avez pas accès à cet event."
end
def event_params
@@ -114,4 +114,4 @@ class Promoter::EventsController < ApplicationController
:start_time, :end_time, :featured
)
end
end
end