Sha256: aeab846ebf26a6a47fdb5ade0be9477ec75a80f2555a948d0e76f40f2234617a
Contents?: true
Size: 1.22 KB
Versions: 18
Compression:
Stored size: 1.22 KB
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 with_invitation { render } end def update with_invitation do if @invitation.accept(params[:invitation]) sign_in @invitation.user redirect_to root_url else render :action => 'show' end end end private def assign_projects @projects = current_account.projects_by_name end def with_invitation @invitation = Invitation.find_by_code!(params[:id]) if @invitation.used? flash[:error] = t("invitations.show.used", :default => "That invitation has already been used.") redirect_to root_url else yield end end end
Version data entries
18 entries across 18 versions & 1 rubygems