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 Polymorphic
|
||||||
include Search
|
include Search
|
||||||
include DownloadSettingsHelper
|
include DownloadSettingsHelper
|
||||||
|
include RemotelyTranslatable
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@resources = resource_model.all
|
@resources = resource_model.all
|
||||||
@@ -23,6 +24,8 @@ module CommentableActions
|
|||||||
set_resource_votes(@resources)
|
set_resource_votes(@resources)
|
||||||
|
|
||||||
set_resources_instance
|
set_resources_instance
|
||||||
|
@remote_translations = detect_remote_translations(@resources, featured_proposals)
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html
|
format.html
|
||||||
format.csv {send_data to_csv(resources_csv, resource_model),
|
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)
|
@comment_tree = CommentTree.new(@commentable, params[:page], @current_order)
|
||||||
set_comment_flags(@comment_tree.comments)
|
set_comment_flags(@comment_tree.comments)
|
||||||
set_resource_instance
|
set_resource_instance
|
||||||
|
@remote_translations = detect_remote_translations([@resource], @comment_tree.comments)
|
||||||
end
|
end
|
||||||
|
|
||||||
def new
|
def new
|
||||||
@@ -132,4 +136,7 @@ module CommentableActions
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def featured_proposals
|
||||||
|
@featured_proposals ||= []
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -21,6 +21,14 @@ describe "Debates" do
|
|||||||
"edit_debate_path",
|
"edit_debate_path",
|
||||||
%w[title],
|
%w[title],
|
||||||
{ "description" => :ckeditor }
|
{ "description" => :ckeditor }
|
||||||
|
it_behaves_like "remotely_translatable",
|
||||||
|
:debate,
|
||||||
|
"debates_path",
|
||||||
|
{}
|
||||||
|
it_behaves_like "remotely_translatable",
|
||||||
|
:debate,
|
||||||
|
"debate_path",
|
||||||
|
{ "id": "id" }
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario "Index" do
|
scenario "Index" do
|
||||||
|
|||||||
@@ -25,6 +25,14 @@ describe "Proposals" do
|
|||||||
"edit_proposal_path",
|
"edit_proposal_path",
|
||||||
%w[title summary],
|
%w[title summary],
|
||||||
{ "description" => :ckeditor }
|
{ "description" => :ckeditor }
|
||||||
|
it_behaves_like "remotely_translatable",
|
||||||
|
:proposal,
|
||||||
|
"proposals_path",
|
||||||
|
{}
|
||||||
|
it_behaves_like "remotely_translatable",
|
||||||
|
:proposal,
|
||||||
|
"proposal_path",
|
||||||
|
{ "id": "id" }
|
||||||
end
|
end
|
||||||
|
|
||||||
context "Index" do
|
context "Index" do
|
||||||
|
|||||||
Reference in New Issue
Block a user