Merge pull request #2903 from consul/backport-refactor-translatable-specs
[Backport] Refactor translatable specs
This commit is contained in:
@@ -36,19 +36,11 @@ class NotificationsController < ApplicationController
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def linkable_resource_path(notification)
|
||||
case notification.linkable_resource.class.name
|
||||
when "Budget::Investment"
|
||||
budget_investment_path @notification.linkable_resource.budget, @notification.linkable_resource
|
||||
when "Topic"
|
||||
community_topic_path @notification.linkable_resource.community, @notification.linkable_resource
|
||||
if notification.linkable_resource.is_a?(AdminNotification)
|
||||
notification.linkable_resource.link || notifications_path
|
||||
else
|
||||
if @notification.linkable_resource.is_a?(AdminNotification)
|
||||
@notification.linkable_resource.link || notifications_path
|
||||
else
|
||||
url_for @notification.linkable_resource
|
||||
end
|
||||
polymorphic_hierarchy_path(notification.linkable_resource)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -41,22 +41,7 @@ module CommentsHelper
|
||||
end
|
||||
|
||||
def commentable_path(comment)
|
||||
commentable = comment.commentable
|
||||
|
||||
case comment.commentable_type
|
||||
when "Budget::Investment"
|
||||
budget_investment_path(commentable.budget_id, commentable)
|
||||
when "Legislation::Question"
|
||||
legislation_process_question_path(commentable.process, commentable)
|
||||
when "Legislation::Annotation"
|
||||
legislation_process_draft_version_annotation_path(commentable.draft_version.process, commentable.draft_version, commentable)
|
||||
when "Topic"
|
||||
community_topic_path(commentable.community, commentable)
|
||||
when "Legislation::Proposal"
|
||||
legislation_process_proposal_path(commentable.legislation_process_id, commentable)
|
||||
else
|
||||
commentable
|
||||
end
|
||||
polymorphic_hierarchy_path(comment.commentable)
|
||||
end
|
||||
|
||||
def user_level_class(comment)
|
||||
|
||||
Reference in New Issue
Block a user