Use new module_parent and module_parents methods
We were getting some deprecation warnings: DEPRECATION WARNING: `Module#parent` has been renamed to `module_parent`. `parent` is deprecated and will be removed in Rails 6.1. DEPRECATION WARNING: `Module#parents` has been renamed to `module_parents`. `parents` is deprecated and will be removed in Rails 6.1.
This commit is contained in:
@@ -22,7 +22,7 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% if feature?(:legislation) %>
|
<% if feature?(:legislation) %>
|
||||||
<li class="<%= "is-active" if controller.class.parent == Admin::Legislation %>">
|
<li class="<%= "is-active" if controller.class.module_parent == Admin::Legislation %>">
|
||||||
<%= link_to t("admin.menu.legislation"), admin_legislation_processes_path, class: "legislation-link" %>
|
<%= link_to t("admin.menu.legislation"), admin_legislation_processes_path, class: "legislation-link" %>
|
||||||
</li>
|
</li>
|
||||||
<% end %>
|
<% end %>
|
||||||
@@ -69,7 +69,7 @@
|
|||||||
banners_link,
|
banners_link,
|
||||||
information_texts_link,
|
information_texts_link,
|
||||||
documents_link,
|
documents_link,
|
||||||
class: ("is-active" if customization? && controller.class.parent != Admin::Poll::Questions::Answers)
|
class: ("is-active" if customization? && controller.class.module_parent != Admin::Poll::Questions::Answers)
|
||||||
) %>
|
) %>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ class Admin::MenuComponent < ApplicationComponent
|
|||||||
private
|
private
|
||||||
|
|
||||||
def moderated_content?
|
def moderated_content?
|
||||||
moderated_sections.include?(controller_name) && controller.class.parent != Admin::Legislation
|
moderated_sections.include?(controller_name) && controller.class.module_parent != Admin::Legislation
|
||||||
end
|
end
|
||||||
|
|
||||||
def moderated_sections
|
def moderated_sections
|
||||||
@@ -17,7 +17,7 @@ class Admin::MenuComponent < ApplicationComponent
|
|||||||
end
|
end
|
||||||
|
|
||||||
def polls?
|
def polls?
|
||||||
controller.class.parent == Admin::Poll::Questions::Answers ||
|
controller.class.module_parent == Admin::Poll::Questions::Answers ||
|
||||||
%w[polls active_polls recounts results questions answers].include?(controller_name) &&
|
%w[polls active_polls recounts results questions answers].include?(controller_name) &&
|
||||||
action_name != "booth_assignments"
|
action_name != "booth_assignments"
|
||||||
end
|
end
|
||||||
@@ -35,7 +35,7 @@ class Admin::MenuComponent < ApplicationComponent
|
|||||||
controllers_names = ["settings", "tags", "geozones", "images", "content_blocks",
|
controllers_names = ["settings", "tags", "geozones", "images", "content_blocks",
|
||||||
"local_census_records", "imports"]
|
"local_census_records", "imports"]
|
||||||
controllers_names.include?(controller_name) &&
|
controllers_names.include?(controller_name) &&
|
||||||
controller.class.parent != Admin::Poll::Questions::Answers
|
controller.class.module_parent != Admin::Poll::Questions::Answers
|
||||||
end
|
end
|
||||||
|
|
||||||
def customization?
|
def customization?
|
||||||
@@ -57,7 +57,7 @@ class Admin::MenuComponent < ApplicationComponent
|
|||||||
|
|
||||||
def local_census_records?
|
def local_census_records?
|
||||||
controller_name == "local_census_records" ||
|
controller_name == "local_census_records" ||
|
||||||
(controller_name == "imports" && controller.class.parent == Admin::LocalCensusRecords)
|
(controller_name == "imports" && controller.class.module_parent == Admin::LocalCensusRecords)
|
||||||
end
|
end
|
||||||
|
|
||||||
def messages_menu_active?
|
def messages_menu_active?
|
||||||
@@ -69,11 +69,11 @@ class Admin::MenuComponent < ApplicationComponent
|
|||||||
end
|
end
|
||||||
|
|
||||||
def sdg_managers?
|
def sdg_managers?
|
||||||
controller_name == "managers" && controller.class.parent == Admin::SDG
|
controller_name == "managers" && controller.class.module_parent == Admin::SDG
|
||||||
end
|
end
|
||||||
|
|
||||||
def managers?
|
def managers?
|
||||||
controller_name == "managers" && controller.class.parent == Admin
|
controller_name == "managers" && controller.class.module_parent == Admin
|
||||||
end
|
end
|
||||||
|
|
||||||
def officers_link
|
def officers_link
|
||||||
@@ -320,7 +320,7 @@ class Admin::MenuComponent < ApplicationComponent
|
|||||||
[
|
[
|
||||||
t("admin.menu.site_customization.images"),
|
t("admin.menu.site_customization.images"),
|
||||||
admin_site_customization_images_path,
|
admin_site_customization_images_path,
|
||||||
controller_name == "images" && controller.class.parent != Admin::Poll::Questions::Answers
|
controller_name == "images" && controller.class.module_parent != Admin::Poll::Questions::Answers
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ module TranslatableFormHelper
|
|||||||
end
|
end
|
||||||
|
|
||||||
def backend_translations_enabled?
|
def backend_translations_enabled?
|
||||||
(controller.class.parents & [Admin, Management, Valuation, SDGManagement]).any?
|
(controller.class.module_parents & [Admin, Management, Valuation, SDGManagement]).any?
|
||||||
end
|
end
|
||||||
|
|
||||||
def highlight_translation_html_class
|
def highlight_translation_html_class
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
"aria-hidden": true, class: "button hollow expanded" %>
|
"aria-hidden": true, class: "button hollow expanded" %>
|
||||||
|
|
||||||
<%= render "layouts/flash" %>
|
<%= render "layouts/flash" %>
|
||||||
<%= render "layouts/officing_booth" if controller.class.parent == Officing && session[:booth_id].present? %>
|
<%= render "layouts/officing_booth" if controller.class.module_parent == Officing && session[:booth_id].present? %>
|
||||||
<%= yield %>
|
<%= yield %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
<li>
|
<li>
|
||||||
<%= layout_menu_link_to t("layouts.header.poll_questions"),
|
<%= layout_menu_link_to t("layouts.header.poll_questions"),
|
||||||
polls_path,
|
polls_path,
|
||||||
controller_name == "polls" || (controller_name == "questions" && controller.class.parent == Polls),
|
controller_name == "polls" || (controller_name == "questions" && controller.class.module_parent == Polls),
|
||||||
accesskey: "3" %>
|
accesskey: "3" %>
|
||||||
</li>
|
</li>
|
||||||
<% end %>
|
<% end %>
|
||||||
@@ -30,7 +30,7 @@
|
|||||||
<li>
|
<li>
|
||||||
<%= layout_menu_link_to t("layouts.header.collaborative_legislation"),
|
<%= layout_menu_link_to t("layouts.header.collaborative_legislation"),
|
||||||
legislation_processes_path,
|
legislation_processes_path,
|
||||||
controller.class.parent == Legislation,
|
controller.class.module_parent == Legislation,
|
||||||
accesskey: "4" %>
|
accesskey: "4" %>
|
||||||
</li>
|
</li>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
Reference in New Issue
Block a user