osem-fcy/app/controllers/admin/contacts_controller.rb

33 lines
879 B
Ruby
Raw Normal View History

# frozen_string_literal: true
2014-08-07 07:42:22 +03:00
module Admin
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-08-12 20:23:51 +03:00
# PATCH/PUT /:conference/contact
def update
if @contact.update(contact_params)
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
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