diff options
author | Steffen van Bergerem <svbergerem@online.de> | 2015-04-04 06:20:18 +0300 |
---|---|---|
committer | Steffen van Bergerem <svbergerem@online.de> | 2015-04-07 11:45:09 +0300 |
commit | 75ef9f47d030c5c279a7ae80992e218f21e7f5d3 (patch) | |
tree | 77dc24b128914199c0ec3c3065de66c442bf80c1 /app/controllers/aspects_controller.rb | |
parent | 4812dc7a23c0efcf7765c4743de0cb8436cd1478 (diff) |
Use Bootstrap modal for new aspect form
Diffstat (limited to 'app/controllers/aspects_controller.rb')
-rw-r--r-- | app/controllers/aspects_controller.rb | 28 |
1 files changed, 4 insertions, 24 deletions
diff --git a/app/controllers/aspects_controller.rb b/app/controllers/aspects_controller.rb index 73b23724b..77e8bfc4a 100644 --- a/app/controllers/aspects_controller.rb +++ b/app/controllers/aspects_controller.rb @@ -11,35 +11,15 @@ class AspectsController < ApplicationController def create @aspect = current_user.aspects.build(aspect_params) - aspecting_person_id = params[:aspect][:person_id] + aspecting_person_id = params[:person_id] if @aspect.save - flash[:notice] = I18n.t('aspects.create.success', :name => @aspect.name) - - if current_user.getting_started || request.referer.include?("contacts") - redirect_to :back - elsif aspecting_person_id.present? + if aspecting_person_id.present? connect_person_to_aspect(aspecting_person_id) - else - redirect_to contacts_path(:a_id => @aspect.id) end + render json: {id: @aspect.id, name: @aspect.name} else - respond_to do |format| - format.js { render :text => I18n.t('aspects.create.failure'), :status => 422 } - format.html do - flash[:error] = I18n.t('aspects.create.failure') - redirect_to :back - end - end - end - end - - def new - @aspect = Aspect.new - @person_id = params[:person_id] - @remote = params[:remote] == "true" - respond_to do |format| - format.html { render :layout => false } + render nothing: true, status: 422 end end |