diff --git a/app/controllers/admin/commercials_controller.rb b/app/controllers/admin/commercials_controller.rb index 3dca6d6f..a624a191 100644 --- a/app/controllers/admin/commercials_controller.rb +++ b/app/controllers/admin/commercials_controller.rb @@ -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 diff --git a/app/controllers/admin/contacts_controller.rb b/app/controllers/admin/contacts_controller.rb index 4455a3cb..39ee2108 100644 --- a/app/controllers/admin/contacts_controller.rb +++ b/app/controllers/admin/contacts_controller.rb @@ -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 diff --git a/app/controllers/admin/emails_controller.rb b/app/controllers/admin/emails_controller.rb index 4ce4eede..e4489180 100644 --- a/app/controllers/admin/emails_controller.rb +++ b/app/controllers/admin/emails_controller.rb @@ -1,5 +1,5 @@ module Admin - class Admin::EmailsController < ApplicationController + class EmailsController < ApplicationController before_filter :verify_organizer def update diff --git a/app/controllers/api/base_controller.rb b/app/controllers/api/base_controller.rb index 6ec4ef9d..f5ff431f 100644 --- a/app/controllers/api/base_controller.rb +++ b/app/controllers/api/base_controller.rb @@ -1,3 +1,5 @@ -class Api::BaseController < ActionController::Base - protect_from_forgery +module Api + class BaseController < ActionController::Base + protect_from_forgery + end end diff --git a/app/controllers/api/v1/conferences_controller.rb b/app/controllers/api/v1/conferences_controller.rb index 9e0338b1..4b6b5239 100644 --- a/app/controllers/api/v1/conferences_controller.rb +++ b/app/controllers/api/v1/conferences_controller.rb @@ -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 diff --git a/app/controllers/api/v1/rooms_controller.rb b/app/controllers/api/v1/rooms_controller.rb index 580e553d..5b88b343 100644 --- a/app/controllers/api/v1/rooms_controller.rb +++ b/app/controllers/api/v1/rooms_controller.rb @@ -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 diff --git a/app/controllers/api/v1/tracks_controller.rb b/app/controllers/api/v1/tracks_controller.rb index cc76760f..b196dc03 100644 --- a/app/controllers/api/v1/tracks_controller.rb +++ b/app/controllers/api/v1/tracks_controller.rb @@ -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 diff --git a/config/initializers/ahoy.rb b/config/initializers/ahoy.rb index 22d326e5..a16a820c 100644 --- a/config/initializers/ahoy.rb +++ b/config/initializers/ahoy.rb @@ -1,3 +1,5 @@ -class Ahoy::Store < Ahoy::Stores::ActiveRecordStore - # customize here +module Ahoy + class Store < Ahoy::Stores::ActiveRecordStore + # customize here + end end