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:
taitus
2019-01-25 17:40:54 +01:00
committed by voodoorai2000
parent b6642f826e
commit c1f3a4ad3b
3 changed files with 23 additions and 0 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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