diff --git a/app/controllers/plans_controller.rb b/app/controllers/plans_controller.rb index 3315152..7f3c5af 100644 --- a/app/controllers/plans_controller.rb +++ b/app/controllers/plans_controller.rb @@ -55,8 +55,12 @@ funder_templates = get_most_recent( funder.templates.where(published: true).all ) # get org templates and index by customization id - orgtemplates = get_most_recent( current_user.org.templates.all ) - + if current_user.org.nil? + orgtemplates = [] + else + orgtemplates = get_most_recent( current_user.org.templates.all ) + end + orgt_by_customization = orgtemplates.collect{|t| [t.customization_of, t]}.to_h # go through funder templates and replace with org cusomizations if needed @@ -105,13 +109,12 @@ @plan.title = _('My plan')+' ('+@plan.template.title+')' # We should use interpolated string since the order of the words from this message could vary among languages - @plan.assign_creator(current_user.id) - @all_guidance_groups = @plan.get_guidance_group_options @selected_guidance_groups = @plan.guidance_groups.pluck(:id) respond_to do |format| if @plan.save + @plan.assign_creator(current_user.id) flash.notice = _('Plan was successfully created.') + message format.html { redirect_to({:action => "show", :id => @plan.id, :editing => true }) } else diff --git a/app/controllers/registrations_controller.rb b/app/controllers/registrations_controller.rb index 8f12488..1cd51ea 100644 --- a/app/controllers/registrations_controller.rb +++ b/app/controllers/registrations_controller.rb @@ -52,6 +52,7 @@ if resource.active_for_authentication? set_flash_message :notice, :signed_up if is_navigational_format? sign_up(resource_name, resource) + UserMailer.welcome_notification(current_user).deliver respond_with resource, location: after_sign_up_path_for(resource) else set_flash_message :notice, :"signed_up_but_#{resource.inactive_message}" if is_navigational_format?