Sha256: 78e499ad6d6ad97546f78aa32ece9de733bbb30a48692ba77419c055c151221a
Contents?: true
Size: 1.29 KB
Versions: 23
Compression:
Stored size: 1.29 KB
Contents
class SegmentsController < ArtfullyOseController before_filter :load_tags, :only => [:show] def index authorize! :view, Segment @segments = current_organization.segments.paginate(:page => params[:page], :per_page => 10) end def show @segment = Segment.find(params[:id]) authorize! :view, @segment @people = @segment.people.paginate(:page => params[:page], :per_page => 20) respond_to do |format| format.html format.csv { render :csv => @segment.people, :filename => "#{@segment.name}-#{DateTime.now.strftime("%m-%d-%y")}" } end end def create authorize! :create, Segment @segment = current_organization.segments.build(params[:segment]) if @segment.save redirect_to @segment else flash[:error] = "List segment could not be created. Please remember to type a name." redirect_to session[:return_to] end end def destroy authorize! :destroy, Segment current_organization.segments.find(params[:id]).destroy redirect_to segments_path end def tag @segment = Segment.find(params[:id]) authorize! :tag, Segment @segment.tag(params[:name]) flash[:notice] = "We're tagging all the people in this list segment and we'll be done shortly. Refresh this page in a minute or two." redirect_to @segment end end
Version data entries
23 entries across 23 versions & 1 rubygems