keys_controller.rb 525 Bytes
Newer Older
gitlabhq's avatar
gitlabhq committed
1
class KeysController < ApplicationController
gitlabhq's avatar
gitlabhq committed
2
  layout "profile"
gitlabhq's avatar
gitlabhq committed
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
  respond_to :js

  def index
    @keys = current_user.keys.all
  end

  def new
    @key = current_user.keys.new

    respond_with(@key)
  end

  def create
    @key = current_user.keys.new(params[:key])
    @key.save

    respond_with(@key)
  end

  def destroy
    @key = current_user.keys.find(params[:id])
    @key.destroy

    respond_to do |format|
      format.html { redirect_to keys_url }
Nihad Abbasov's avatar
Nihad Abbasov committed
28
      format.js { render :nothing => true }
gitlabhq's avatar
gitlabhq committed
29 30 31
    end
  end
end