mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-16 21:24:05 +00:00
more style fixes
This commit is contained in:
parent
1c1391c69e
commit
e06e0a5ca3
8 changed files with 134 additions and 114 deletions
|
|
@ -1,57 +1,59 @@
|
|||
class Admin::CommercialsController < ApplicationController
|
||||
before_action :set_conference
|
||||
before_action :set_commercial, only: [:edit, :update, :destroy]
|
||||
module Admin
|
||||
class CommercialsController < ApplicationController
|
||||
before_action :set_conference
|
||||
before_action :set_commercial, only: [:edit, :update, :destroy]
|
||||
|
||||
def index
|
||||
@commercials = @conference.commercials
|
||||
end
|
||||
|
||||
def new
|
||||
@commercial = @conference.commercials.build
|
||||
end
|
||||
|
||||
def edit
|
||||
end
|
||||
|
||||
def create
|
||||
@commercial = @conference.commercials.build(commercial_params)
|
||||
|
||||
if @commercial.save
|
||||
redirect_to admin_conference_commercials_path,
|
||||
notice: 'Commercial was successfully created.'
|
||||
else
|
||||
flash[:alert] = "A error prohibited this Commercial from being saved: #{@commercial.errors.full_messages.join('. ')}."
|
||||
render :new
|
||||
def index
|
||||
@commercials = @conference.commercials
|
||||
end
|
||||
end
|
||||
|
||||
def update
|
||||
if @commercial.update(commercial_params)
|
||||
redirect_to admin_conference_commercials_path,
|
||||
notice: 'Commercial was successfully updated.'
|
||||
else
|
||||
flash[:alert] = "A error prohibited this Commercial from being saved: #{@commercial.errors.full_messages.join('. ')}."
|
||||
render :edit
|
||||
def new
|
||||
@commercial = @conference.commercials.build
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
@commercial.destroy
|
||||
redirect_to admin_conference_commercials_path, notice: 'Commercial was successfully destroyed.'
|
||||
end
|
||||
def edit
|
||||
end
|
||||
|
||||
private
|
||||
def create
|
||||
@commercial = @conference.commercials.build(commercial_params)
|
||||
|
||||
def set_commercial
|
||||
@commercial = @conference.commercials.find(params[:id])
|
||||
end
|
||||
if @commercial.save
|
||||
redirect_to admin_conference_commercials_path,
|
||||
notice: 'Commercial was successfully created.'
|
||||
else
|
||||
flash[:alert] = "A error prohibited this Commercial from being saved: #{@commercial.errors.full_messages.join('. ')}."
|
||||
render :new
|
||||
end
|
||||
end
|
||||
|
||||
def set_conference
|
||||
@conference = Conference.find_by(short_title: params[:conference_id])
|
||||
end
|
||||
def update
|
||||
if @commercial.update(commercial_params)
|
||||
redirect_to admin_conference_commercials_path,
|
||||
notice: 'Commercial was successfully updated.'
|
||||
else
|
||||
flash[:alert] = "A error prohibited this Commercial from being saved: #{@commercial.errors.full_messages.join('. ')}."
|
||||
render :edit
|
||||
end
|
||||
end
|
||||
|
||||
def commercial_params
|
||||
#params.require(:commercial).permit(:commercial_id, :commercial_type)
|
||||
params[:commercial]
|
||||
def destroy
|
||||
@commercial.destroy
|
||||
redirect_to admin_conference_commercials_path, notice: 'Commercial was successfully destroyed.'
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def set_commercial
|
||||
@commercial = @conference.commercials.find(params[:id])
|
||||
end
|
||||
|
||||
def set_conference
|
||||
@conference = Conference.find_by(short_title: params[:conference_id])
|
||||
end
|
||||
|
||||
def commercial_params
|
||||
#params.require(:commercial).permit(:commercial_id, :commercial_type)
|
||||
params[:commercial]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue