Add remote translations to debates and proposals
Include RemotelyTranslatable concern on commentable actions to detect remote translations on index and show controllers actions.
This commit is contained in:
@@ -3,6 +3,7 @@ module CommentableActions
|
||||
include Polymorphic
|
||||
include Search
|
||||
include DownloadSettingsHelper
|
||||
include RemotelyTranslatable
|
||||
|
||||
def index
|
||||
@resources = resource_model.all
|
||||
@@ -23,6 +24,8 @@ module CommentableActions
|
||||
set_resource_votes(@resources)
|
||||
|
||||
set_resources_instance
|
||||
@remote_translations = detect_remote_translations(@resources, featured_proposals)
|
||||
|
||||
respond_to do |format|
|
||||
format.html
|
||||
format.csv {send_data to_csv(resources_csv, resource_model),
|
||||
@@ -38,6 +41,7 @@ module CommentableActions
|
||||
@comment_tree = CommentTree.new(@commentable, params[:page], @current_order)
|
||||
set_comment_flags(@comment_tree.comments)
|
||||
set_resource_instance
|
||||
@remote_translations = detect_remote_translations([@resource], @comment_tree.comments)
|
||||
end
|
||||
|
||||
def new
|
||||
@@ -132,4 +136,7 @@ module CommentableActions
|
||||
end
|
||||
end
|
||||
|
||||
def featured_proposals
|
||||
@featured_proposals ||= []
|
||||
end
|
||||
end
|
||||
|
||||
@@ -21,6 +21,14 @@ describe "Debates" do
|
||||
"edit_debate_path",
|
||||
%w[title],
|
||||
{ "description" => :ckeditor }
|
||||
it_behaves_like "remotely_translatable",
|
||||
:debate,
|
||||
"debates_path",
|
||||
{}
|
||||
it_behaves_like "remotely_translatable",
|
||||
:debate,
|
||||
"debate_path",
|
||||
{ "id": "id" }
|
||||
end
|
||||
|
||||
scenario "Index" do
|
||||
|
||||
@@ -25,6 +25,14 @@ describe "Proposals" do
|
||||
"edit_proposal_path",
|
||||
%w[title summary],
|
||||
{ "description" => :ckeditor }
|
||||
it_behaves_like "remotely_translatable",
|
||||
:proposal,
|
||||
"proposals_path",
|
||||
{}
|
||||
it_behaves_like "remotely_translatable",
|
||||
:proposal,
|
||||
"proposal_path",
|
||||
{ "id": "id" }
|
||||
end
|
||||
|
||||
context "Index" do
|
||||
|
||||
Reference in New Issue
Block a user