diff --git a/app/controllers/plans_controller.rb b/app/controllers/plans_controller.rb index ae629a1..e4bce3a 100644 --- a/app/controllers/plans_controller.rb +++ b/app/controllers/plans_controller.rb @@ -161,10 +161,11 @@ respond_to do |format| if @plan.update_attributes(attrs) format.html { redirect_to @plan, :editing => false, notice: success_message(_('plan'), _('saved')) } - format.json { head :no_content } + format.json {render json: {code: 1, msg: success_message(_('plan'), _('saved'))}} else flash[:alert] = failed_update_error(@plan, _('plan')) format.html { render action: "edit" } + format.json {render json: {code: 0, msg: failed_update_error(@plan, _('plan'))}} end end end @@ -318,9 +319,9 @@ authorize plan plan.visibility = (params[:is_test] === "1" ? :is_test : :privately_visible) if plan.save - render json: {msg: (plan.is_test? ? _('Your project is now a test.') : _('Your project is no longer a test.') )} + render json: {code: 1, msg: (plan.is_test? ? _('Your project is now a test.') : _('Your project is no longer a test.') )} else - render status: :bad_request, json: {msg: _("Unable to change the plan's test status")} + render status: :bad_request, json: {code: 0, msg: _("Unable to change the plan's test status")} end end diff --git a/app/controllers/roles_controller.rb b/app/controllers/roles_controller.rb index 43e0c55..041a0c3 100644 --- a/app/controllers/roles_controller.rb +++ b/app/controllers/roles_controller.rb @@ -50,9 +50,7 @@ UserMailer.permissions_change_notification(@role, current_user).deliver_now render json: {code: 1, msg: "Successfully changed the permissions for #{@role.user.email}. They have been notified via email."} else -# flash[:alert] = failed_create_error(@role, _('role')) - #format.html{ render action: "edit" } - render json: {code: 1, msg: flash[:alert]} + render json: {code: 0, msg: flash[:alert]} end end diff --git a/app/views/plans/_share_form.html.erb b/app/views/plans/_share_form.html.erb index a62fb16..b9bb8d7 100644 --- a/app/views/plans/_share_form.html.erb +++ b/app/views/plans/_share_form.html.erb @@ -1,7 +1,7 @@
<%= _('Public or organisational visibility is intended for finished plans. You must answer at least one question to enable these options.') %>
-<%= form_for @plan, html: {method: :put} do |f| %> +<%= form_for @plan, html: {method: :put, id: "set_visibility"} do |f| %>