Class: Forge::SubscriberGroupsController

Inherits:
ForgeController show all
Defined in:
lib/forge/app/controllers/forge/subscriber_groups_controller.rb

Instance Method Summary collapse

Methods inherited from ForgeController

#get_menu_items, #load_help, #set_crumbs, #set_title, #uses_ckeditor

Methods inherited from ApplicationController

#app_init

Instance Method Details

#createObject



29
30
31
32
33
34
35
36
37
# File 'lib/forge/app/controllers/forge/subscriber_groups_controller.rb', line 29

def create
  @subscriber_group = SubscriberGroup.new(params[:subscriber_group])
  if @subscriber_group.save
    flash[:notice] = 'Subscriber Group was successfully created.'
    redirect_to(forge_subscriber_groups_path)
  else
    render :action => "new"
  end
end

#destroyObject



48
49
50
51
# File 'lib/forge/app/controllers/forge/subscriber_groups_controller.rb', line 48

def destroy
  @subscriber_group.destroy
  redirect_to(forge_subscriber_groups_path)
end

#editObject



22
23
24
25
26
27
# File 'lib/forge/app/controllers/forge/subscriber_groups_controller.rb', line 22

def edit
  respond_to do |format|
    format.html {}
    format.js { render :layout => false }
  end
end

#indexObject



4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/forge/app/controllers/forge/subscriber_groups_controller.rb', line 4

def index
  respond_to do |format|
    format.html {
      @subscriber_groups = SubscriberGroup.paginate(:per_page => 10, :page => params[:page])
      @subscriber_group = SubscriberGroup.new
    }
    format.js {
      params[:q] ||= ''
      @subscriber_groups = SubscriberGroup.where("LOWER(title) LIKE ?", "%#{params[:q].downcase}%")
      render :partial => "subscriber_group", :collection => @subscriber_groups
    }
  end
end

#newObject



18
19
20
# File 'lib/forge/app/controllers/forge/subscriber_groups_controller.rb', line 18

def new
  @subscriber_group = SubscriberGroup.new
end

#updateObject



39
40
41
42
43
44
45
46
# File 'lib/forge/app/controllers/forge/subscriber_groups_controller.rb', line 39

def update
  if @subscriber_group.update_attributes(params[:subscriber_group])
    flash[:notice] = 'Subscriber Group was successfully updated.'
    redirect_to(forge_subscriber_groups_path)
  else
    render :action => "edit"
  end
end