Class: Muck::InvitesController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Muck::InvitesController
- Defined in:
- app/controllers/muck/invites_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'app/controllers/muck/invites_controller.rb', line 39 def create if params[:emails] current_user.invite(params[:emails], current_user) = t('muck.invites.create_success', :emails => params[:emails].join(', '), :app_name => GlobalConfig.application_name) end respond_to do |format| format.html do flash[:notice] = redirect_to('/') end format.pjs { render :text => } end rescue ActiveRecord::RecordInvalid => ex if @invite errors = @invite.errors..to_sentence else errors = ex end flash[:error] = t('muck.invites.create_error', :errors => errors) respond_to do |format| format.html { render :template => 'invites/new' } format.pjs { render :template => 'invites/new', :layout => false } end end |
#get_contacts ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'app/controllers/muck/invites_controller.rb', line 16 def get_contacts success = true begin @contacts = User.get_contacts(params[:get_contacts][:email], params[:get_contacts][:password]) if @contacts.blank? = t('muck.invites.no_contacts_found') success = false end rescue Contacts::AuthenticationError => ex success = false = ex.to_s end respond_to do |format| format.html do flash[:error] = if render :template => 'invites/_get_contacts' end format.json do render :json => { :success => success, :message => , :html => get_contacts_html } end end end |
#new ⇒ Object
7 8 9 10 11 12 13 14 |
# File 'app/controllers/muck/invites_controller.rb', line 7 def new flash.discard @page_title = t('muck.invites.new_invites', :app_name => GlobalConfig.application_name) respond_to do |format| format.html { render :template => 'invites/new' } format.pjs { render :template => 'invites/new', :layout => false } end end |