2014-08-07 07:42:22 +03:00
|
|
|
module Admin
|
|
|
|
|
class ContactsController < ApplicationController
|
2014-08-12 20:23:51 +03:00
|
|
|
load_and_authorize_resource :conference, find_by: :short_title
|
|
|
|
|
load_and_authorize_resource through: :conference, singleton: true
|
2014-07-31 18:49:46 +02:00
|
|
|
|
2014-08-12 20:23:51 +03:00
|
|
|
# GET /:conference/contact
|
|
|
|
|
def show; end
|
2014-07-31 18:49:46 +02:00
|
|
|
|
2014-08-12 20:23:51 +03:00
|
|
|
# GET /:conference/contact/edit
|
|
|
|
|
def edit; end
|
2014-07-31 20:09:38 +02:00
|
|
|
|
2014-08-12 20:23:51 +03:00
|
|
|
# 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
|
2014-08-07 21:33:08 +02:00
|
|
|
end
|
2014-07-31 18:49:46 +02:00
|
|
|
|
2014-08-12 20:23:51 +03:00
|
|
|
# DELETE /:conference/contact
|
|
|
|
|
def destroy
|
|
|
|
|
@contact.destroy
|
|
|
|
|
redirect_to admin_conference_contacts_url, notice: 'Contact details were successfully destroyed.'
|
|
|
|
|
end
|
2014-07-31 18:49:46 +02:00
|
|
|
|
2014-08-12 20:23:51 +03:00
|
|
|
private
|
2014-08-07 21:33:08 +02:00
|
|
|
# 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
|
2014-08-07 07:42:22 +03:00
|
|
|
end
|
2014-07-31 18:49:46 +02:00
|
|
|
end
|