Class: CartridgesController

Inherits:
ConsoleController show all
Defined in:
app/controllers/cartridges_controller.rb

Instance Method Summary collapse

Methods inherited from ConsoleController

#active_tab

Methods included from SshkeyAware

#sshkey_uploaded?

Methods included from DomainAware

#domain_is_missing, #user_default_domain

Methods included from CapabilityAware

#user_capabilities

Instance Method Details

#createObject



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'app/controllers/cartridges_controller.rb', line 16

def create
  cart_params = params[:cartridge]
  @domain = Domain.find :one, :as => current_user
  @application = @domain.find_application params[:application_id]
  # TODO: check for app errors and redirect to app list if error

  @cartridge = Cartridge.new cart_params

  @cartridge.application = @application
  @cartridge.as = current_user

  @cartridge_type = CartridgeType.find cart_params[:name], :as => current_user

  if @cartridge.save
    @wizard = true

    message = @cartridge.remote_results
    flash.now[:info_pre] = message

    render :next_steps
  else
    Rails.logger.debug @cartridge.errors.inspect
    @application_id = @application.id
    render 'cartridge_types/show'
  end
end

#indexObject



3
4
5
6
# File 'app/controllers/cartridges_controller.rb', line 3

def index
   # on index get, redirect back to application details page
   redirect_to application_path(params['application_id'])
end

#showObject



8
9
10
11
12
13
14
# File 'app/controllers/cartridges_controller.rb', line 8

def show
  user_default_domain
  @application = @domain.find_application params[:application_id]
  @application_type = ApplicationType.find @application.framework
  Rails.logger.debug @application.cartridges
  @cartridge = @application.find_cartridge params[:id]
end