Sha256: 7ef007aa2a8f77fb5cd3781b3b4d57639a9c4bc763033fbc1e8377d4d5bdd8dd

Contents?: true

Size: 1.33 KB

Versions: 6

Compression:

Stored size: 1.33 KB

Contents

class Forge::SubscriberGroupsController < ForgeController
  load_and_authorize_resource

  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

  def new
    @subscriber_group = SubscriberGroup.new
  end

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

  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

  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

  def destroy
    @subscriber_group.destroy
    redirect_to(forge_subscriber_groups_path)
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
forge-cli-0.1.10 lib/forge/app/controllers/forge/subscriber_groups_controller.rb
forge-cli-0.1.9 lib/forge/app/controllers/forge/subscriber_groups_controller.rb
forge-cli-0.1.8 lib/forge/app/controllers/forge/subscriber_groups_controller.rb
forge-cli-0.1.7 lib/forge/app/controllers/forge/subscriber_groups_controller.rb
forge-cli-0.1.6 lib/forge/app/controllers/forge/subscriber_groups_controller.rb
forge-cli-0.1.5 lib/forge/app/controllers/forge/subscriber_groups_controller.rb