diff options
author | Matija Čupić <matteeyah@gmail.com> | 2018-02-02 23:56:22 +0300 |
---|---|---|
committer | Matija Čupić <matteeyah@gmail.com> | 2018-02-02 23:56:22 +0300 |
commit | 40753029e40b9c2824648a966048595d36efc793 (patch) | |
tree | 62d97ed6a45a0d2cecc76faf2fea87e63212dde8 /app/helpers | |
parent | cc209519c892355f019335bbe0107af2f434846b (diff) | |
parent | a00aed74af67dd72a2aa7bf7e485ff7bdb949ea4 (diff) |
Merge branch 'master' into 38175-add-domain-field-to-auto-devops-application-setting
Diffstat (limited to 'app/helpers')
-rw-r--r-- | app/helpers/application_settings_helper.rb | 14 | ||||
-rw-r--r-- | app/helpers/auth_helper.rb | 4 | ||||
-rw-r--r-- | app/helpers/projects_helper.rb | 10 | ||||
-rw-r--r-- | app/helpers/version_check_helper.rb | 2 | ||||
-rw-r--r-- | app/helpers/visibility_level_helper.rb | 4 | ||||
-rw-r--r-- | app/helpers/webpack_helper.rb | 18 |
6 files changed, 32 insertions, 20 deletions
diff --git a/app/helpers/application_settings_helper.rb b/app/helpers/application_settings_helper.rb index 5dc1fa27293..e293b3ef329 100644 --- a/app/helpers/application_settings_helper.rb +++ b/app/helpers/application_settings_helper.rb @@ -1,25 +1,23 @@ module ApplicationSettingsHelper extend self - include Gitlab::CurrentSettings - delegate :allow_signup?, :gravatar_enabled?, :password_authentication_enabled_for_web?, :akismet_enabled?, :koding_enabled?, - to: :current_application_settings + to: :'Gitlab::CurrentSettings.current_application_settings' def user_oauth_applications? - current_application_settings.user_oauth_applications + Gitlab::CurrentSettings.user_oauth_applications end def allowed_protocols_present? - current_application_settings.enabled_git_access_protocol.present? + Gitlab::CurrentSettings.enabled_git_access_protocol.present? end def enabled_protocol - case current_application_settings.enabled_git_access_protocol + case Gitlab::CurrentSettings.enabled_git_access_protocol when 'http' gitlab_config.protocol when 'ssh' @@ -57,7 +55,7 @@ module ApplicationSettingsHelper # toggle button effect. def import_sources_checkboxes(help_block_id) Gitlab::ImportSources.options.map do |name, source| - checked = current_application_settings.import_sources.include?(source) + checked = Gitlab::CurrentSettings.import_sources.include?(source) css_class = checked ? 'active' : '' checkbox_name = 'application_setting[import_sources][]' @@ -72,7 +70,7 @@ module ApplicationSettingsHelper def oauth_providers_checkboxes button_based_providers.map do |source| - disabled = current_application_settings.disabled_oauth_sign_in_sources.include?(source.to_s) + disabled = Gitlab::CurrentSettings.disabled_oauth_sign_in_sources.include?(source.to_s) css_class = 'btn' css_class << ' active' unless disabled checkbox_name = 'application_setting[enabled_oauth_sign_in_sources][]' diff --git a/app/helpers/auth_helper.rb b/app/helpers/auth_helper.rb index 66dc0b1e6f7..f909f664034 100644 --- a/app/helpers/auth_helper.rb +++ b/app/helpers/auth_helper.rb @@ -1,6 +1,4 @@ module AuthHelper - include Gitlab::CurrentSettings - PROVIDERS_WITH_ICONS = %w(twitter github gitlab bitbucket google_oauth2 facebook azure_oauth2 authentiq).freeze FORM_BASED_PROVIDERS = [/\Aldap/, 'crowd'].freeze @@ -41,7 +39,7 @@ module AuthHelper end def enabled_button_based_providers - disabled_providers = current_application_settings.disabled_oauth_sign_in_sources || [] + disabled_providers = Gitlab::CurrentSettings.disabled_oauth_sign_in_sources || [] button_based_providers.map(&:to_s) - disabled_providers end diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb index f7bdcc6fd9c..6512617a02d 100644 --- a/app/helpers/projects_helper.rb +++ b/app/helpers/projects_helper.rb @@ -1,6 +1,4 @@ module ProjectsHelper - include Gitlab::CurrentSettings - def link_to_project(project) link_to [project.namespace.becomes(Namespace), project], title: h(project.name) do title = content_tag(:span, project.name, class: 'project-name') @@ -214,7 +212,7 @@ module ProjectsHelper project.cache_key, controller.controller_name, controller.action_name, - current_application_settings.cache_key, + Gitlab::CurrentSettings.cache_key, 'v2.5' ] @@ -447,10 +445,10 @@ module ProjectsHelper path = "#{import_path}?repo=#{repo}&branch=#{branch}&sha=#{sha}" - return URI.join(current_application_settings.koding_url, path).to_s + return URI.join(Gitlab::CurrentSettings.koding_url, path).to_s end - current_application_settings.koding_url + Gitlab::CurrentSettings.koding_url end def contribution_guide_path(project) @@ -559,7 +557,7 @@ module ProjectsHelper def restricted_levels return [] if current_user.admin? - current_application_settings.restricted_visibility_levels || [] + Gitlab::CurrentSettings.restricted_visibility_levels || [] end def project_permissions_settings(project) diff --git a/app/helpers/version_check_helper.rb b/app/helpers/version_check_helper.rb index 456598b4c28..c20753ece72 100644 --- a/app/helpers/version_check_helper.rb +++ b/app/helpers/version_check_helper.rb @@ -1,6 +1,6 @@ module VersionCheckHelper def version_status_badge - if Rails.env.production? && current_application_settings.version_check_enabled + if Rails.env.production? && Gitlab::CurrentSettings.version_check_enabled image_url = VersionCheck.new.url image_tag image_url, class: 'js-version-status-badge' end diff --git a/app/helpers/visibility_level_helper.rb b/app/helpers/visibility_level_helper.rb index c3d5628f241..e395cda03d3 100644 --- a/app/helpers/visibility_level_helper.rb +++ b/app/helpers/visibility_level_helper.rb @@ -151,12 +151,12 @@ module VisibilityLevelHelper def restricted_visibility_levels(show_all = false) return [] if current_user.admin? && !show_all - current_application_settings.restricted_visibility_levels || [] + Gitlab::CurrentSettings.restricted_visibility_levels || [] end delegate :default_project_visibility, :default_group_visibility, - to: :current_application_settings + to: :'Gitlab::CurrentSettings.current_application_settings' def disallowed_visibility_level?(form_model, level) return false unless form_model.respond_to?(:visibility_level_allowed?) diff --git a/app/helpers/webpack_helper.rb b/app/helpers/webpack_helper.rb index 77433acb92a..9d071f2d59a 100644 --- a/app/helpers/webpack_helper.rb +++ b/app/helpers/webpack_helper.rb @@ -5,6 +5,24 @@ module WebpackHelper javascript_include_tag(*gitlab_webpack_asset_paths(bundle, force_same_domain: force_same_domain)) end + def webpack_controller_bundle_tags + bundles = [] + segments = [*controller.controller_path.split('/'), controller.action_name].compact + + until segments.empty? + begin + asset_paths = gitlab_webpack_asset_paths("pages.#{segments.join('.')}", extension: 'js') + bundles.unshift(*asset_paths) + rescue Webpack::Rails::Manifest::EntryPointMissingError + # no bundle exists for this path + end + + segments.pop + end + + javascript_include_tag(*bundles) + end + # override webpack-rails gem helper until changes can make it upstream def gitlab_webpack_asset_paths(source, extension: nil, force_same_domain: false) return "" unless source.present? |