2018-05-07 16:47:29 -07:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
2014-08-07 07:42:22 +03:00
|
|
|
module Admin
|
2014-08-13 14:37:05 +03:00
|
|
|
class ContactsController < Admin::BaseController
|
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)
|
2014-08-13 22:46:41 +03:00
|
|
|
redirect_to edit_admin_conference_contact_path, notice: 'Contact details were successfully updated.'
|
2014-08-12 20:23:51 +03:00
|
|
|
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
|
|
|
private
|
2014-08-14 12:08:01 +03:00
|
|
|
|
2014-08-07 21:33:08 +02:00
|
|
|
# Only allow a trusted parameter "white list" through.
|
|
|
|
|
def contact_params
|
2018-11-13 13:47:20 -08:00
|
|
|
params.require(:contact).permit(
|
|
|
|
|
:social_tag, :email, :facebook, :googleplus, :twitter, :instagram,
|
|
|
|
|
:mastodon, :public, :sponsor_email, :youtube, :blog)
|
2014-08-07 21:33:08 +02:00
|
|
|
end
|
2014-08-07 07:42:22 +03:00
|
|
|
end
|
2014-07-31 18:49:46 +02:00
|
|
|
end
|