Sha256: dd326957cc8607442ea853f2c4151040f34d899067ce5d6391b5a4efc07094d4

Contents?: true

Size: 886 Bytes

Versions: 2

Compression:

Stored size: 886 Bytes

Contents

class GroupsController < ReaderActionController
  helper :reader
  
  before_filter :require_reader
  before_filter :get_group_or_groups
  before_filter :require_group_visibility, :only => [:show]

  def index
  end

  def show
    @readers = @group.readers.uniq
    respond_to do |format|
      format.html
      format.csv {
        send_data generate_csv(@readers), :type => 'text/csv; charset=utf-8; header=present', :filename => "#{@group.filename}.csv"
      }
      format.vcard {
        send_data @readers.map(&:vcard).join("\n"), :filename => "#{@group.filename}.vcf"	
      }
    end
  end
    
private
  
  def get_group_or_groups
    @groups = Group.visible_to(current_reader)
    @group = @groups.find(params[:id]).first if params[:id]
  end

  def require_group_visibility
    raise ReaderError::AccessDenied if @group && !@group.visible_to?(current_reader)
  end
  
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
radiant-reader-extension-3.0.0.rc4 app/controllers/groups_controller.rb
radiant-reader-extension-3.0.0.rc3 app/controllers/groups_controller.rb