Commit fff246d3 authored by Rémy Coutable's avatar Rémy Coutable

Merge branch '5949-render_optional' into 'master'

Use render_if_exists to hide EE specific codes

Closes #5949

See merge request gitlab-org/gitlab-ee!5767
parents 288595cc ae83dd1a
......@@ -4,6 +4,11 @@ require 'uri'
module ApplicationHelper
prepend EE::ApplicationHelper
# See https://docs.gitlab.com/ee/development/ee_features.html#code-in-app-views
def render_if_exists(partial, locals = {})
render(partial, locals) if lookup_context.exists?(partial, [], true)
end
# Check if a particular controller is the current one
#
# args - One or more controller names to check
......
......@@ -2,8 +2,7 @@
- breadcrumb_title "Dashboard"
%div{ class: container_class }
- if @license
= render "admin/licenses/breakdown", license: @license
= render_if_exists "admin/licenses/breakdown", license: @license
.admin-dashboard.prepend-top-default
.row
......@@ -23,9 +22,7 @@
%h3.text-center
Users:
= approximate_count_with_delimiters(User)
-# EE specific
.text-center
= link_to 'Users statistics', admin_dashboard_stats_path
= render_if_exists 'users_statistics'
%hr
= link_to 'New user', new_admin_user_path, class: "btn btn-new"
.col-sm-4
......@@ -104,16 +101,7 @@
%span.light.pull-right
= boolean_to_icon Gitlab::IncomingEmail.enabled?
- elastic = "Elasticsearch"
%p{ "aria-label" => "#{elastic}: status " + (Gitlab::CurrentSettings.elasticsearch_search? ? "on" : "off") }
= elastic
%span.light.pull-right
= boolean_to_icon Gitlab::CurrentSettings.elasticsearch_search?
- geo = link_to 'Geo', admin_geo_nodes_path
%p{ "aria-label" => "#{geo}: status " + (Gitlab::Geo.enabled? ? "on" : "off") }
= geo
%span.light.pull-right
= boolean_to_icon Gitlab::Geo.enabled?
= render_if_exists 'elastic_and_geo'
- container_reg = "Container Registry"
%p{ "aria-label" => "#{container_reg}: status " + (Gitlab.config.registry.enabled ? "on" : "off") }
......@@ -162,14 +150,9 @@
GitLab Pages
%span.pull-right
= Gitlab::Pages::VERSION
- if Gitlab::Geo.enabled?
%p
= link_to 'Geo', admin_geo_nodes_path
%span.pull-right
- if Gitlab::Geo.current_node
= Gitlab::Geo.current_node.primary ? 'Primary node' : 'Secondary node'
- else
Undefined
= render_if_exists 'geo'
%p
Ruby
%span.pull-right
......
......@@ -44,11 +44,11 @@ module Gitlab
ee_path = config.root.join('ee', Pathname.new(path).relative_path_from(config.root))
memo << ee_path.to_s if ee_path.exist?
end
config.eager_load_paths.concat(ee_paths)
config.eager_load_paths.unshift(*ee_paths)
config.paths['lib/tasks'] << "#{config.root}/ee/lib/tasks"
config.paths['app/views'] << "#{config.root}/ee/app/views"
config.helpers_paths << "#{config.root}/ee/app/helpers"
config.paths['lib/tasks'].unshift "#{config.root}/ee/lib/tasks"
config.paths['app/views'].unshift "#{config.root}/ee/app/views"
config.helpers_paths.unshift "#{config.root}/ee/app/helpers"
## EE-specific paths config END
# Rake tasks ignore the eager loading settings, so we need to set the
......
- elastic = "Elasticsearch"
%p{ "aria-label" => "#{elastic}: status " + (Gitlab::CurrentSettings.elasticsearch_search? ? "on" : "off") }
= elastic
%span.light.pull-right
= boolean_to_icon Gitlab::CurrentSettings.elasticsearch_search?
- geo = link_to 'Geo', admin_geo_nodes_path
%p{ "aria-label" => "#{geo}: status " + (Gitlab::Geo.enabled? ? "on" : "off") }
= geo
%span.light.pull-right
= boolean_to_icon Gitlab::Geo.enabled?
- return unless Gitlab::Geo.enabled?
%p
= link_to 'Geo', admin_geo_nodes_path
%span.pull-right
- if Gitlab::Geo.current_node
= Gitlab::Geo.current_node.primary ? 'Primary node' : 'Secondary node'
- else
Undefined
.text-center
= link_to 'Users statistics', admin_dashboard_stats_path
- return unless local_assigns.fetch(:license)
- if license.restricted?(:active_user_count)
- restricted = license.restrictions[:active_user_count]
- licensed_users = number_with_delimiter(restricted)
......
......@@ -2,7 +2,7 @@ module Banzai
module ReferenceParser
# The actual parser is implemented in the EE mixin
class EpicParser < IssuableParser
prepend EE::Banzai::ReferenceParser::EpicParser
prepend ::EE::Banzai::ReferenceParser::EpicParser
self.reference_type = :epic
......
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