Class: Protege::ToolkitsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/protege/toolkits_controller.rb

Overview

Manages toolkits — the dashboard CRUD for the tool-bundle binding. A top-level section (like Responsibilities): toolkits are global, reusable tool bundles, attached to agents from the agent page. A toolkit is just its tools — permission (the sender gate + proactive flag) lives on each grant (+AgentToolkit+), so this controller only edits the name/description/tool set.

Instance Method Summary collapse

Instance Method Details

#createvoid

This method returns an undefined value.

Create a toolkit. On failure, re-render the form with validation errors.



38
39
40
41
42
43
44
45
46
# File 'app/controllers/protege/toolkits_controller.rb', line 38

def create
  @toolkit = Toolkit.new(toolkit_params)

  if @toolkit.save
    redirect_to toolkit_path(@toolkit), notice: 'Toolkit created.'
  else
    render :new, status: :unprocessable_entity
  end
end

#destroyvoid

This method returns an undefined value.

Remove a toolkit (detaching it from every agent via the join's dependent destroy).



62
63
64
65
# File 'app/controllers/protege/toolkits_controller.rb', line 62

def destroy
  @toolkit.destroy
  redirect_to toolkits_path, notice: 'Toolkit deleted.'
end

#editvoid

This method returns an undefined value.

Render the form for editing a toolkit.



33
# File 'app/controllers/protege/toolkits_controller.rb', line 33

def edit; end

#indexvoid

This method returns an undefined value.

List every toolkit.



14
15
16
# File 'app/controllers/protege/toolkits_controller.rb', line 14

def index
  @toolkits = Toolkit.order(:name)
end

#newvoid

This method returns an undefined value.

Render the form for creating a toolkit.



26
27
28
# File 'app/controllers/protege/toolkits_controller.rb', line 26

def new
  @toolkit = Toolkit.new
end

#showvoid

This method returns an undefined value.

Show a single toolkit and its gate rules.



21
# File 'app/controllers/protege/toolkits_controller.rb', line 21

def show; end

#updatevoid

This method returns an undefined value.

Update a toolkit. On failure, re-render the edit form with validation errors.



51
52
53
54
55
56
57
# File 'app/controllers/protege/toolkits_controller.rb', line 51

def update
  if @toolkit.update(toolkit_params)
    redirect_to toolkit_path(@toolkit), notice: 'Toolkit updated.'
  else
    render :edit, status: :unprocessable_entity
  end
end