Sha256: 071e6ae507b9374f20807332803ac80c75680313b3c899638323771de3ec3a8a

Contents?: true

Size: 830 Bytes

Versions: 5

Compression:

Stored size: 830 Bytes

Contents

class Admin::ReadersController < Admin::ResourceController
  paginate_models
  before_filter :redirect_to_user, :only => :edit

  only_allow_access_to :new, :create, :edit, :update, :remove, :destroy, :settings,
    :when => :admin,
    :denied_url => { :controller => 'pages', :action => 'index' },
    :denied_message => 'You must be an administrator to add or modify readers'
    
  def create
    model.update_attributes!(params[:reader])
    model.clear_password = params[:reader][:password] if params[:reader] && params[:reader][:password]      # condition is so that radiant tests pass
    model.send_invitation_message
    announce_saved
    response_for :create
  end

private

  def redirect_to_user
    if model.is_user?
      redirect_to edit_admin_user_url(model.user)
      return false
    end
    true
  end
  
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
radiant-reader-extension-1.1.1 app/controllers/admin/readers_controller.rb
radiant-reader-extension-1.1.0 app/controllers/admin/readers_controller.rb
radiant-reader-extension-1.0.1 app/controllers/admin/readers_controller.rb
radiant-reader-extension-1.0.0 app/controllers/admin/readers_controller.rb
radiant-reader-extension-0.9.2 app/controllers/admin/readers_controller.rb