share links to debate
This commit is contained in:
@@ -40,7 +40,7 @@ module CommentableActions
|
||||
|
||||
if @resource.save_with_captcha
|
||||
track_event
|
||||
redirect_path = url_for(controller: controller_name, action: :show, id: @resource.id)
|
||||
redirect_path = after_create_path
|
||||
redirect_to redirect_path, notice: t("flash.actions.create.#{resource_name.underscore}")
|
||||
else
|
||||
load_categories
|
||||
@@ -153,4 +153,8 @@ module CommentableActions
|
||||
def index_customization
|
||||
nil
|
||||
end
|
||||
|
||||
def after_create_path
|
||||
url_for(controller: controller_name, action: :show, id: @resource.id)
|
||||
end
|
||||
end
|
||||
|
||||
26
app/controllers/debate_links_controller.rb
Normal file
26
app/controllers/debate_links_controller.rb
Normal file
@@ -0,0 +1,26 @@
|
||||
class DebateLinksController < ApplicationController
|
||||
include CommentableActions
|
||||
|
||||
load_and_authorize_resource class: "Debate"
|
||||
|
||||
respond_to :html, :js
|
||||
|
||||
private
|
||||
|
||||
def create_params
|
||||
params.require(:debate).permit(:title, :external_link, :tag_list, :terms_of_service, :captcha, :captcha_key)
|
||||
end
|
||||
|
||||
def debate_params
|
||||
params.require(:debate).permit(:title, :external_link, :tag_list, :terms_of_service, :captcha, :captcha_key)
|
||||
end
|
||||
|
||||
def after_create_path
|
||||
debate_path(@resource)
|
||||
end
|
||||
|
||||
def resource_model
|
||||
Debate
|
||||
end
|
||||
|
||||
end
|
||||
@@ -26,7 +26,7 @@ class DebatesController < ApplicationController
|
||||
private
|
||||
|
||||
def debate_params
|
||||
params.require(:debate).permit(:title, :description, :tag_list, :terms_of_service, :captcha, :captcha_key)
|
||||
params.require(:debate).permit(:title, :description, :external_link, :tag_list, :terms_of_service, :captcha, :captcha_key)
|
||||
end
|
||||
|
||||
def resource_model
|
||||
|
||||
Reference in New Issue
Block a user