Class: System::Admin::InstancesController

Inherits:
Controller
  • Object
show all
Defined in:
app/controllers/system/admin/instances_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject

:nodoc:


14
15
16
17
18
19
20
# File 'app/controllers/system/admin/instances_controller.rb', line 14

def create #:nodoc:
  if @instance.save
    redirect_to admin_instances_path, success: t('.success')
  else
    render 'new'
  end
end

#destroyObject

:nodoc:


33
34
35
36
37
38
39
40
# File 'app/controllers/system/admin/instances_controller.rb', line 33

def destroy #:nodoc:
  if @instance.destroy
    redirect_to admin_instances_path, success: t('.success', instance: @instance.name)
  else
    redirect_to admin_instances_path,
                danger: t('.failure', error: @instance.errors.full_messages.to_sentence)
  end
end

#editObject

:nodoc:


22
23
# File 'app/controllers/system/admin/instances_controller.rb', line 22

def edit #:nodoc:
end

#indexObject

:nodoc:


6
7
8
9
# File 'app/controllers/system/admin/instances_controller.rb', line 6

def index #:nodoc:
  @instances = Instance.order_for_display.page(page_param).
               calculated(:active_course_count, :course_count, :active_user_count, :user_count)
end

#newObject

:nodoc:


11
12
# File 'app/controllers/system/admin/instances_controller.rb', line 11

def new #:nodoc:
end

#updateObject

:nodoc:


25
26
27
28
29
30
31
# File 'app/controllers/system/admin/instances_controller.rb', line 25

def update #:nodoc:
  if @instance.update_attributes(instance_params)
    redirect_to admin_instances_path, success: t('.success')
  else
    render 'edit'
  end
end