Class: MailyHerald::Webui::DispatchesController

Inherits:
ResourcesController show all
Defined in:
app/controllers/maily_herald/webui/dispatches_controller.rb

Direct Known Subclasses

MailingsController, SequencesController

Instance Method Summary collapse

Methods inherited from ResourcesController

#create, #edit, #new, #show, #update

Methods inherited from ApplicationController

#expert_mode?, #work_mode

Methods included from MenuManager::ControllerExtensions

included

Methods included from Breadcrumbs::ControllerExtensions

included

Instance Method Details

#archivedObject



9
10
11
12
13
14
15
# File 'app/controllers/maily_herald/webui/dispatches_controller.rb', line 9

def archived 
  self.class.superclass.instance_method(:index).bind(self).call do |scope|
    scope.archived
  end

  render "index"
end

#destroyObject



22
23
24
25
26
27
# File 'app/controllers/maily_herald/webui/dispatches_controller.rb', line 22

def destroy
  @item.archive!

  render_containers ["details", "entities"]
  render_update
end

#indexObject



3
4
5
6
7
# File 'app/controllers/maily_herald/webui/dispatches_controller.rb', line 3

def index
  super do |scope|
    scope.not_archived
  end
end

#toggleObject



29
30
31
32
33
34
35
36
37
38
39
40
# File 'app/controllers/maily_herald/webui/dispatches_controller.rb', line 29

def toggle
  find_item

  unless @item.enabled?
    @item.enable!
  else
    @item.disable!
  end

  render_containers ["details", "entities"]
  render_update
end

#update_formObject



17
18
19
20
# File 'app/controllers/maily_herald/webui/dispatches_controller.rb', line 17

def update_form
  new
  @item.attributes = item_params
end