Class: Plugins::CamaSubscriber::GroupsController

Inherits:
AdminController
  • Object
show all
Defined in:
app/controllers/plugins/cama_subscriber/groups_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



11
12
13
14
15
# File 'app/controllers/plugins/cama_subscriber/groups_controller.rb', line 11

def create
  @item = current_site.subscriber_groups.create(item_params)
  flash[:notice] = t('.saved', default: 'The group was saved')
  redirect_to action: :index
end

#destroyObject



33
34
35
36
37
# File 'app/controllers/plugins/cama_subscriber/groups_controller.rb', line 33

def destroy
  @item = current_site.subscriber_groups.find(params[:id]).destroy
  flash[:notice] = t('.destroyed', default: 'The group was destroyed')
  redirect_to action: :index
end

#editObject



17
18
19
20
# File 'app/controllers/plugins/cama_subscriber/groups_controller.rb', line 17

def edit
  @item ||= current_site.subscriber_groups.find(params[:id])
  render 'form', layout: false
end

#indexObject



2
3
4
# File 'app/controllers/plugins/cama_subscriber/groups_controller.rb', line 2

def index
  @items = current_site.subscriber_groups
end

#newObject



6
7
8
9
# File 'app/controllers/plugins/cama_subscriber/groups_controller.rb', line 6

def new
  @item = current_site.subscriber_groups.new
  render 'form', layout: false
end

#showObject



28
29
30
31
# File 'app/controllers/plugins/cama_subscriber/groups_controller.rb', line 28

def show
  @item = current_site.subscriber_groups.find(params[:id])
  render layout: false
end

#updateObject



22
23
24
25
26
# File 'app/controllers/plugins/cama_subscriber/groups_controller.rb', line 22

def update
  @item = current_site.subscriber_groups.find(params[:id]).update(item_params)
  flash[:notice] = t('.updated', default: 'The group was udpated')
  redirect_to action: :index
end