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

View file

@ -1,3 +1,5 @@
class Api::BaseController < ActionController::Base
protect_from_forgery
module Api
class BaseController < ActionController::Base
protect_from_forgery
end
end

View file

@ -1,12 +1,16 @@
class Api::V1::ConferencesController < Api::BaseController
respond_to :json
module Api
module V1
class ConferencesController < Api::BaseController
respond_to :json
def index
if params[:conference_id].blank?
conferences = Conference.all
else
conferences = Conference.find_all_by_guid(params[:conference_id])
def index
if params[:conference_id].blank?
conferences = Conference.all
else
conferences = Conference.find_all_by_guid(params[:conference_id])
end
render json: conferences, serializer: ConferencesArraySerializer
end
end
render json: conferences, serializer: ConferencesArraySerializer
end
end

View file

@ -1,13 +1,17 @@
class Api::V1::RoomsController < Api::BaseController
respond_to :json
module Api
module V1
class RoomsController < Api::BaseController
respond_to :json
def index
if params[:conference_id].blank?
rooms = Room.all
else
conference = Conference.find_by_guid(params[:conference_id])
rooms = conference.rooms
def index
if params[:conference_id].blank?
rooms = Room.all
else
conference = Conference.find_by_guid(params[:conference_id])
rooms = conference.rooms
end
respond_with rooms
end
end
respond_with rooms
end
end

View file

@ -1,13 +1,17 @@
class Api::V1::TracksController < Api::BaseController
respond_to :json
module Api
module V1
class TracksController < Api::BaseController
respond_to :json
def index
if params[:conference_id].blank?
tracks = Track.all
else
tracks = Track.joins(:conference)
tracks = tracks.where("conferences.guid" => params[:conference_id])
def index
if params[:conference_id].blank?
tracks = Track.all
else
tracks = Track.joins(:conference)
tracks = tracks.where("conferences.guid" => params[:conference_id])
end
respond_with tracks
end
end
respond_with tracks
end
end

View file

@ -1,3 +1,5 @@
class Ahoy::Store < Ahoy::Stores::ActiveRecordStore
# customize here
module Ahoy
class Store < Ahoy::Stores::ActiveRecordStore
# customize here
end
end