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 module Admin
before_action :set_conference class CommercialsController < ApplicationController
before_action :set_commercial, only: [:edit, :update, :destroy] before_action :set_conference
before_action :set_commercial, only: [:edit, :update, :destroy]
def index def index
@commercials = @conference.commercials @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
end end
end
def update def new
if @commercial.update(commercial_params) @commercial = @conference.commercials.build
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
end
def destroy def edit
@commercial.destroy end
redirect_to admin_conference_commercials_path, notice: 'Commercial was successfully destroyed.'
end
private def create
@commercial = @conference.commercials.build(commercial_params)
def set_commercial if @commercial.save
@commercial = @conference.commercials.find(params[:id]) redirect_to admin_conference_commercials_path,
end 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 def update
@conference = Conference.find_by(short_title: params[:conference_id]) if @commercial.update(commercial_params)
end 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 def destroy
#params.require(:commercial).permit(:commercial_id, :commercial_type) @commercial.destroy
params[:commercial] 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
end end

View file

@ -1,44 +1,46 @@
class Admin::ContactsController < ApplicationController module Admin
before_action :set_conference class ContactsController < ApplicationController
before_action :set_contact, only: [:show, :edit, :update, :destroy] before_action :set_conference
before_action :set_contact, only: [:show, :edit, :update, :destroy]
# GET /:conference/contact # GET /:conference/contact
def show 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
end end
def set_conference # GET /:conference/contact/edit
@conference = Conference.find_by(short_title: params[:conference_id]) def edit
end end
# Only allow a trusted parameter "white list" through. # PATCH/PUT /:conference/contact
def contact_params def update
# params.require(:contact).permit(:social_tag, :email, :facebook, :googleplus, :twitter, :instagram, :public) if @contact.update(contact_params)
params[:contact] redirect_to admin_conference_contact_path, notice: 'Contact details were successfully updated.'
else
render :edit
end
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 end

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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