Class: CartridgeTypesController
Instance Method Summary
collapse
#active_tab
#sshkey_uploaded?
#domain_is_missing, #user_default_domain
#user_capabilities
Instance Method Details
#conflicts?(cart_type) ⇒ Boolean
31
32
33
34
35
36
37
38
39
40
|
# File 'app/controllers/cartridge_types_controller.rb', line 31
def conflicts?(cart_type)
t = cart_type
return false if @installed.nil? || t.conflicts.empty?
@installed.each { |c| return true if t.conflicts.include? c.name }
return false
end
|
#index ⇒ Object
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
# File 'app/controllers/cartridge_types_controller.rb', line 3
def index
user_default_domain
@application = @domain.find_application params[:application_id]
installed_carts = @application.cartridges
types = CartridgeType.cached.embedded
@blocked = []
@installed, types = types.partition{ |t| installed_carts.any?{ |c| c.name == t.name } }
@blacklist, types = types.partition{ |t| t.tags.include?(:blacklist) }
@conflicts, types = types.partition{ |t| conflicts? t }
@requires, types = types.partition{ |t| requires? t }
@installed.sort!; @conflicts.sort!; @requires.sort!
@carts = types.sort!
end
|
#requires?(cart_type) ⇒ Boolean
42
43
44
45
46
47
48
49
50
51
52
|
# File 'app/controllers/cartridge_types_controller.rb', line 42
def requires?(cart_type)
t = cart_type
return true if @installed.nil? && !t.requires.empty?
return false if t.requires.empty?
@installed.each { |c| return false if t.requires.include? c.name }
return true
end
|
#show ⇒ Object
23
24
25
26
27
28
29
|
# File 'app/controllers/cartridge_types_controller.rb', line 23
def show
user_default_domain
@application = @domain.find_application params[:application_id]
@cartridge_type = CartridgeType.cached.find params[:id]
@cartridge = Cartridge.new :as => current_user
end
|