more style fixes

This commit is contained in:
Stella Rouzi 2014-08-07 07:42:22 +03:00
parent 1c1391c69e
commit e06e0a5ca3
8 changed files with 134 additions and 114 deletions

View file

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

View file

@ -1,44 +1,46 @@
class Admin::ContactsController < ApplicationController
before_action :set_conference
before_action :set_contact, only: [:show, :edit, :update, :destroy]
module Admin
class ContactsController < ApplicationController
before_action :set_conference
before_action :set_contact, only: [:show, :edit, :update, :destroy]
# GET /:conference/contact
def show
end
# GET /:conference/contact/edit
def edit
end
# PATCH/PUT /:conference/contact
def update
if @contact.update(contact_params)
redirect_to admin_conference_contact_path, notice: 'Contact details were successfully updated.'
else
render :edit
end
end
# DELETE /:conference/contact
def destroy
@contact.destroy
redirect_to admin_conference_contacts_url, notice: 'Contact details were successfully destroyed.'
end
private
# Use callbacks to share common setup or constraints between actions.
def set_contact
@contact = @conference.contact
# GET /:conference/contact
def show
end
def set_conference
@conference = Conference.find_by(short_title: params[:conference_id])
# GET /:conference/contact/edit
def edit
end
# Only allow a trusted parameter "white list" through.
def contact_params
# params.require(:contact).permit(:social_tag, :email, :facebook, :googleplus, :twitter, :instagram, :public)
params[:contact]
# PATCH/PUT /:conference/contact
def update
if @contact.update(contact_params)
redirect_to admin_conference_contact_path, notice: 'Contact details were successfully updated.'
else
render :edit
end
end
# DELETE /:conference/contact
def destroy
@contact.destroy
redirect_to admin_conference_contacts_url, notice: 'Contact details were successfully destroyed.'
end
private
# Use callbacks to share common setup or constraints between actions.
def set_contact
@contact = @conference.contact
end
def set_conference
@conference = Conference.find_by(short_title: params[:conference_id])
end
# Only allow a trusted parameter "white list" through.
def contact_params
# params.require(:contact).permit(:social_tag, :email, :facebook, :googleplus, :twitter, :instagram, :public)
params[:contact]
end
end
end

View file

@ -1,5 +1,5 @@
module Admin
class Admin::EmailsController < ApplicationController
class EmailsController < ApplicationController
before_filter :verify_organizer
def update