Sha256: 72b07ea70398b83acfd590d4a08acd28e48cc69a20ea88dec4a6b845458491a1

Contents?: true

Size: 986 Bytes

Versions: 34

Compression:

Stored size: 986 Bytes

Contents

class InvitationsController < ApplicationController
  before_filter :authorize_admin, :except => [:show, :update]
  skip_before_filter :authenticate, :only => [:show, :update]
  layout Saucy::Layouts.to_proc

  def new
    assign_projects
    @invitation = Invitation.new
    render
  end

  def create
    @invitation = Invitation.new(params[:invitation])
    @invitation.account = current_account
    if @invitation.save
      flash[:success] = "User invited."
      redirect_to account_memberships_url(current_account)
    else
      assign_projects
      render :action => 'new'
    end
  end

  def show
    @invitation = Invitation.find(params[:id])
    render
  end

  def update
    @invitation = Invitation.find(params[:id])
    if @invitation.accept(params[:invitation])
      sign_in @invitation.user
      redirect_to root_url
    else
      render :action => 'show'
    end
  end

  private

  def assign_projects
    @projects = current_account.projects_by_name
  end
end

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
saucy-0.2.18 app/controllers/invitations_controller.rb
saucy-0.2.17 app/controllers/invitations_controller.rb
saucy-0.2.16 app/controllers/invitations_controller.rb
saucy-0.2.15 app/controllers/invitations_controller.rb
saucy-0.2.14 app/controllers/invitations_controller.rb
saucy-0.2.13 app/controllers/invitations_controller.rb
saucy-0.2.12 app/controllers/invitations_controller.rb
saucy-0.2.11 app/controllers/invitations_controller.rb
saucy-0.2.10 app/controllers/invitations_controller.rb
saucy-0.2.9 app/controllers/invitations_controller.rb
saucy-0.2.8.1 app/controllers/invitations_controller.rb
saucy-0.2.8 app/controllers/invitations_controller.rb
saucy-0.2.7 app/controllers/invitations_controller.rb
saucy-0.2.6.1 app/controllers/invitations_controller.rb
saucy-0.2.6 app/controllers/invitations_controller.rb
saucy-0.2.5 app/controllers/invitations_controller.rb
saucy-0.2.4.1 app/controllers/invitations_controller.rb
saucy-0.2.4 app/controllers/invitations_controller.rb
saucy-0.2.3 app/controllers/invitations_controller.rb
saucy-0.2.2 app/controllers/invitations_controller.rb