Commit 7602e839 authored by Robert Speicher's avatar Robert Speicher

Merge branch 'move-helper-prepends' into 'master'

Move EE prepend/include to the end of helpers

See merge request gitlab-org/gitlab-ee!8422
parents 0724350f 2c3daf77
# frozen_string_literal: true
module AppearancesHelper
prepend EE::AppearancesHelper
def brand_title
current_appearance&.title.presence || 'GitLab Enterprise Edition'
end
......@@ -38,3 +36,5 @@ module AppearancesHelper
end
end
end
AppearancesHelper.prepend(EE::AppearancesHelper)
......@@ -4,8 +4,6 @@ require 'digest/md5'
require 'uri'
module ApplicationHelper
prepend EE::ApplicationHelper
# See https://docs.gitlab.com/ee/development/ee_features.html#code-in-app-views
# rubocop: disable CodeReuse/ActiveRecord
def render_if_exists(partial, locals = {})
......@@ -303,3 +301,5 @@ module ApplicationHelper
}
end
end
ApplicationHelper.prepend(EE::ApplicationHelper)
# frozen_string_literal: true
module ApplicationSettingsHelper
prepend EE::ApplicationSettingsHelper
extend self
delegate :allow_signup?,
......@@ -227,3 +226,9 @@ module ApplicationSettingsHelper
Rails.env.test?
end
end
ApplicationSettingsHelper.prepend(EE::ApplicationSettingsHelper)
# The methods in `EE::ApplicationSettingsHelper` should be available as both
# instance and class methods.
ApplicationSettingsHelper.extend(EE::ApplicationSettingsHelper)
# frozen_string_literal: true
module AuthHelper
prepend EE::AuthHelper
PROVIDERS_WITH_ICONS = %w(twitter github gitlab bitbucket google_oauth2 facebook azure_oauth2 authentiq).freeze
LDAP_PROVIDER = /\Aldap/
......@@ -80,3 +78,9 @@ module AuthHelper
extend self
end
AuthHelper.prepend(EE::AuthHelper)
# The methods added in EE should be available as both class and instance
# methods, just like the methods provided by `AuthHelper` itself.
AuthHelper.extend(EE::AuthHelper)
# frozen_string_literal: true
module AwardEmojiHelper
prepend EE::AwardEmojiHelper
def toggle_award_url(awardable)
return url_for([:toggle_award_emoji, awardable]) unless @project || awardable.is_a?(Note)
......@@ -18,3 +16,5 @@ module AwardEmojiHelper
end
end
end
AwardEmojiHelper.prepend(EE::AwardEmojiHelper)
# frozen_string_literal: true
module BoardsHelper
prepend EE::BoardsHelper
def board
@board ||= @board || @boards.first
end
......@@ -91,3 +89,5 @@ module BoardsHelper
s_("IssueBoards|Board")
end
end
BoardsHelper.prepend(EE::BoardsHelper)
# frozen_string_literal: true
module BranchesHelper
prepend EE::BranchesHelper
def project_branches
options_for_select(@project.repository.branch_names, @project.default_branch)
end
......@@ -19,3 +17,5 @@ module BranchesHelper
end
end
end
BranchesHelper.prepend(EE::BranchesHelper)
# frozen_string_literal: true
module ClustersHelper
prepend EE::ClustersHelper
# EE overrides this
def has_multiple_clusters?
false
......@@ -17,3 +15,5 @@ module ClustersHelper
end
end
end
ClustersHelper.prepend(EE::ClustersHelper)
# frozen_string_literal: true
module EmailsHelper
prepend EE::EmailsHelper
include AppearancesHelper
# Google Actions
......@@ -101,3 +99,5 @@ module EmailsHelper
"#{string} on #{Gitlab.config.gitlab.host}"
end
end
EmailsHelper.prepend(EE::EmailsHelper)
......@@ -2,8 +2,6 @@
# Shorter routing method for some project items
module GitlabRoutingHelper
include EE::GitlabRoutingHelper
extend ActiveSupport::Concern
included do
......@@ -196,3 +194,5 @@ module GitlabRoutingHelper
take_ownership_project_pipeline_schedule_path(project, schedule, *args)
end
end
GitlabRoutingHelper.include(EE::GitlabRoutingHelper)
# frozen_string_literal: true
module GroupsHelper
prepend EE::GroupsHelper
def group_overview_nav_link_paths
%w[
groups#show
......@@ -201,3 +199,5 @@ module GroupsHelper
s_("GroupSettings|This setting is applied on %{ancestor_group} and has been overridden on this subgroup.").html_safe % { ancestor_group: ancestor_group(group) }
end
end
GroupsHelper.prepend(EE::GroupsHelper)
# frozen_string_literal: true
module IssuablesHelper
prepend EE::IssuablesHelper
include GitlabRoutingHelper
def sidebar_gutter_toggle_icon
......@@ -440,3 +438,5 @@ module IssuablesHelper
end
end
end
IssuablesHelper.prepend(EE::IssuablesHelper)
# frozen_string_literal: true
module IssuesHelper
include EE::IssuesHelper
def issue_css_classes(issue)
classes = ["issue"]
classes << "closed" if issue.closed?
......@@ -142,3 +140,5 @@ module IssuesHelper
module_function :url_for_internal_issue
module_function :url_for_tracker_issue
end
IssuesHelper.include(EE::IssuesHelper)
# frozen_string_literal: true
module MergeRequestsHelper
prepend EE::MergeRequestsHelper
def new_mr_path_from_push_event(event)
target_project = event.project.default_merge_request_target
project_new_merge_request_path(
......@@ -161,3 +159,5 @@ module MergeRequestsHelper
end
end
end
MergeRequestsHelper.prepend(EE::MergeRequestsHelper)
# frozen_string_literal: true
module MilestonesHelper
prepend EE::MilestonesHelper
include EntityDateHelper
def milestones_filter_path(opts = {})
......@@ -245,3 +244,5 @@ module MilestonesHelper
end
end
end
MilestonesHelper.prepend(EE::MilestonesHelper)
# frozen_string_literal: true
module NamespacesHelper
include EE::NamespacesHelper
def namespace_id_from(params)
params.dig(:project, :namespace_id) || params[:namespace_id]
end
......@@ -87,3 +85,5 @@ module NamespacesHelper
[group_label.camelize, elements]
end
end
NamespacesHelper.include(EE::NamespacesHelper)
# frozen_string_literal: true
module NotesHelper
prepend EE::NotesHelper
def note_target_fields(note)
if note.noteable
hidden_field_tag(:target_type, note.noteable.class.name.underscore) +
......@@ -195,3 +193,5 @@ module NotesHelper
rendered_for_merge_request? || params['html'].nil?
end
end
NotesHelper.prepend(EE::NotesHelper)
......@@ -2,8 +2,6 @@
# Helper methods for per-User preferences
module PreferencesHelper
prepend EE::PreferencesHelper
def layout_choices
[
['Fixed', :fixed],
......@@ -69,3 +67,5 @@ module PreferencesHelper
['operations']
end
end
PreferencesHelper.prepend(EE::PreferencesHelper)
# frozen_string_literal: true
module SearchHelper
prepend EE::SearchHelper
def search_autocomplete_opts(term)
return unless current_user
......@@ -193,3 +191,5 @@ module SearchHelper
count > limit ? "#{limit}+" : count
end
end
SearchHelper.prepend(EE::SearchHelper)
# frozen_string_literal: true
module ServicesHelper
prepend EE::ServicesHelper
def service_event_description(event)
case event
when "push", "push_events"
......@@ -46,3 +44,9 @@ module ServicesHelper
extend self
end
ServicesHelper.prepend(EE::ServicesHelper)
# The methods in `EE::ServicesHelper` should be available as both instance and
# class methods.
ServicesHelper.extend(EE::ServicesHelper)
# frozen_string_literal: true
module SystemNoteHelper
prepend EE::SystemNoteHelper
ICON_NAMES_BY_ACTION = {
'commit' => 'commit',
'description' => 'pencil-square',
......@@ -40,3 +38,9 @@ module SystemNoteHelper
extend self
end
SystemNoteHelper.prepend(EE::SystemNoteHelper)
# The methods in `EE::SystemNoteHelper` should be available as both instance and
# class methods.
SystemNoteHelper.extend(EE::SystemNoteHelper)
# frozen_string_literal: true
module TodosHelper
prepend EE::NotesHelper
def todos_pending_count
@todos_pending_count ||= current_user.todos_pending_count
end
......@@ -179,3 +177,5 @@ module TodosHelper
groups.unshift({ id: '', text: 'Any Group' }).to_json
end
end
TodosHelper.prepend(EE::NotesHelper)
# frozen_string_literal: true
module VersionCheckHelper
prepend EE::VersionCheckHelper
def version_status_badge
return unless Rails.env.production?
return unless Gitlab::CurrentSettings.version_check_enabled
......@@ -25,3 +23,5 @@ module VersionCheckHelper
'gitlab-ce'
end
end
VersionCheckHelper.prepend(EE::VersionCheckHelper)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment