Class: Profiles::GpgKeysController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/profiles/gpg_keys_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject


11
12
13
14
15
16
17
18
19
20
# File 'app/controllers/profiles/gpg_keys_controller.rb', line 11

def create
  @gpg_key = GpgKeys::CreateService.new(current_user, gpg_key_params).execute

  if @gpg_key.persisted?
    redirect_to profile_gpg_keys_path
  else
    @gpg_keys = current_user.gpg_keys.select(&:persisted?)
    render :index
  end
end

#destroyObject


22
23
24
25
26
27
28
29
# File 'app/controllers/profiles/gpg_keys_controller.rb', line 22

def destroy
  @gpg_key.destroy

  respond_to do |format|
    format.html { redirect_to profile_gpg_keys_url, status: :found }
    format.js { head :ok }
  end
end

#indexObject


6
7
8
9
# File 'app/controllers/profiles/gpg_keys_controller.rb', line 6

def index
  @gpg_keys = current_user.gpg_keys.with_subkeys
  @gpg_key = GpgKey.new
end

#revokeObject


31
32
33
34
35
36
37
38
# File 'app/controllers/profiles/gpg_keys_controller.rb', line 31

def revoke
  @gpg_key.revoke

  respond_to do |format|
    format.html { redirect_to profile_gpg_keys_url, status: :found }
    format.js { head :ok }
  end
end