1
0
Fork 0
This repository has been archived on 2023-03-27. You can view files and clone it, but cannot push or open issues or pull requests.
lpr-partynest/app/controllers/settings/contacts_controller.rb

39 lines
787 B
Ruby
Raw Normal View History

# frozen_string_literal: true
class Settings::ContactsController < ApplicationController
before_action :skip_policy_scope, only: :index
2019-09-02 22:52:13 -04:00
before_action :set_contact_list
before_action :set_contact, except: :index
# GET /settings/contacts
def index
authorize %i[settings contact]
2019-09-02 22:52:13 -04:00
@contacts = @contact_list.contacts
end
# DELETE /settings/contacts/:id
def destroy
authorize [:settings, @contact]
@contact.destroy!
2019-09-03 00:13:36 -04:00
redirect_to(
settings_contacts_url,
notice: translate_flash(
network_name: @contact.contact_network.name,
value: @contact.value,
),
)
end
private
2019-09-02 22:52:13 -04:00
def set_contact_list
@contact_list = current_account&.contact_list
end
def set_contact
@contact = Contact.find params[:id]
end
end