Add create method on proposals controller to redirect to proposal share page with notice after save
This commit is contained in:
@@ -3,7 +3,7 @@ class ProposalsController < ApplicationController
|
|||||||
include FlagActions
|
include FlagActions
|
||||||
|
|
||||||
before_action :parse_tag_filter, only: :index
|
before_action :parse_tag_filter, only: :index
|
||||||
before_action :load_categories, only: [:index, :new, :edit, :map, :summary]
|
before_action :load_categories, only: [:index, :new, :create, :edit, :map, :summary]
|
||||||
before_action :load_geozones, only: [:edit, :map, :summary]
|
before_action :load_geozones, only: [:edit, :map, :summary]
|
||||||
before_action :authenticate_user!, except: [:index, :show, :map, :summary]
|
before_action :authenticate_user!, except: [:index, :show, :map, :summary]
|
||||||
|
|
||||||
@@ -22,6 +22,17 @@ class ProposalsController < ApplicationController
|
|||||||
redirect_to proposal_path(@proposal), status: :moved_permanently if request.path != proposal_path(@proposal)
|
redirect_to proposal_path(@proposal), status: :moved_permanently if request.path != proposal_path(@proposal)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def create
|
||||||
|
@proposal = Proposal.new(proposal_params)
|
||||||
|
@proposal.author = current_user
|
||||||
|
|
||||||
|
if @proposal.save
|
||||||
|
redirect_to share_proposal_path(@proposal), notice: I18n.t("flash.actions.create.proposal")
|
||||||
|
else
|
||||||
|
render :new
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def index_customization
|
def index_customization
|
||||||
discard_archived
|
discard_archived
|
||||||
load_retired
|
load_retired
|
||||||
|
|||||||
Reference in New Issue
Block a user