Sha256: 6d8b8a13b460affc8f8d6ab435c68b2b48376523e9301aca8e22b1801aafdd1b

Contents?: true

Size: 1.5 KB

Versions: 17

Compression:

Stored size: 1.5 KB

Contents

class GroupsController < ApplicationController
  skip_before_filter :populate_layout, :except => [:edit, :index, :list, :new, :show]

  def index
    list
    render :action => 'list'
  end

  # GETs should be safe (see http://www.w3.org/2001/tag/doc/whenToUseGet.html)
  verify :method => :post, :except => [ :edit, :index, :list, :new ],
         :redirect_to => { :action => :list }

  def list
    @groups = Group.paginate({:page => params[:page]})
  end

  def new
    @group = Group.new
  end

  def create
    @group = Group.new(params[:group])
    if @group.save
      flash[:notice] = 'Group was successfully created.'
      back_or_redirect_to :action => 'list'
    else
      render :action => 'new'
    end
  end

  def edit
    @group = Group.find(params[:id])
    @users = User.find(:all, :order => 'first_name, last_name')
    @groups = Group.find(:all, :order => 'name')
  end

  def update
    @group = Group.find(params[:id])
    if @group.update_attributes(params[:group])
      flash[:notice] = 'Group was successfully updated.'
      back_or_redirect_to :action => :edit, :id => @group
    else
      render :action => 'edit'
    end
  end

  def destroy
    Group.find(params[:id]).destroy
    redirect_to :action => 'list'
  end

  def set_member
    @group = Group.find(params[:id])
    @user = User.find(params[:user_id])
    if params[:value] == 'true'
      @group.users << @user unless @group.users.include? @user 
    else
      @group.users.delete @user
    end
    @users = User.find(:all)
  end

end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
backlog-0.36.2 app/controllers/groups_controller.rb
backlog-0.29.0 app/controllers/groups_controller.rb
backlog-0.30.0 app/controllers/groups_controller.rb
backlog-0.31.0 app/controllers/groups_controller.rb
backlog-0.31.1 app/controllers/groups_controller.rb
backlog-0.32.0 app/controllers/groups_controller.rb
backlog-0.33.0 app/controllers/groups_controller.rb
backlog-0.34.1 app/controllers/groups_controller.rb
backlog-0.33.1 app/controllers/groups_controller.rb
backlog-0.34.2 app/controllers/groups_controller.rb
backlog-0.34 app/controllers/groups_controller.rb
backlog-0.35.0 app/controllers/groups_controller.rb
backlog-0.35.2 app/controllers/groups_controller.rb
backlog-0.35.1 app/controllers/groups_controller.rb
backlog-0.35.3 app/controllers/groups_controller.rb
backlog-0.35.4 app/controllers/groups_controller.rb
backlog-0.35.5 app/controllers/groups_controller.rb