diff options
author | Martin Wortschack <mwortschack@gitlab.com> | 2019-03-14 20:13:35 +0100 |
---|---|---|
committer | Martin Wortschack <mwortschack@gitlab.com> | 2019-03-14 20:14:14 +0100 |
commit | 67fd866a5dc1321ec6b6495450f4b0ac313f30f2 (patch) | |
tree | 0c216628bbf47f47fc6047259bf0572762cef955 /app | |
parent | 6908c5f70eb4d5d7e8ef28b43d73d71da9b2a0c3 (diff) | |
download | gitlab-ce-67fd866a5dc1321ec6b6495450f4b0ac313f30f2.tar.gz |
Move EE specific code in admin application settings
- Leverage render_if_exists
- Externalize strings
- Extract help page setting into EE specific partial
Diffstat (limited to 'app')
6 files changed, 59 insertions, 53 deletions
diff --git a/app/views/admin/application_settings/_account_and_limit.html.haml b/app/views/admin/application_settings/_account_and_limit.html.haml index 65a24854583..9ed4bc44aae 100644 --- a/app/views/admin/application_settings/_account_and_limit.html.haml +++ b/app/views/admin/application_settings/_account_and_limit.html.haml @@ -6,32 +6,35 @@ .form-check = f.check_box :gravatar_enabled, class: 'form-check-input' = f.label :gravatar_enabled, class: 'form-check-label' do - Gravatar enabled + = _('Gravatar enabled') .form-group = f.label :default_projects_limit, class: 'label-bold' = f.number_field :default_projects_limit, class: 'form-control' .form-group - = f.label :max_attachment_size, 'Maximum attachment size (MB)', class: 'label-bold' + = f.label :max_attachment_size, _('Maximum attachment size (MB)'), class: 'label-bold' = f.number_field :max_attachment_size, class: 'form-control' + + = render_if_exists 'admin/application_settings/repository_size_limit_setting', form: f + .form-group - = f.label :receive_max_input_size, 'Maximum push size (MB)', class: 'label-light' + = f.label :receive_max_input_size, _('Maximum push size (MB)'), class: 'label-light' = f.number_field :receive_max_input_size, class: 'form-control qa-receive-max-input-size-field' .form-group - = f.label :session_expire_delay, 'Session duration (minutes)', class: 'label-light' + = f.label :session_expire_delay, _('Session duration (minutes)'), class: 'label-light' = f.number_field :session_expire_delay, class: 'form-control' - %span.form-text.text-muted#session_expire_delay_help_block GitLab restart is required to apply changes + %span.form-text.text-muted#session_expire_delay_help_block= _('GitLab restart is required to apply changes') .form-group - = f.label :user_oauth_applications, 'User OAuth applications', class: 'label-bold' + = f.label :user_oauth_applications, _('User OAuth applications'), class: 'label-bold' .form-check = f.check_box :user_oauth_applications, class: 'form-check-input' = f.label :user_oauth_applications, class: 'form-check-label' do - Allow users to register any application to use GitLab as an OAuth provider + = _('Allow users to register any application to use GitLab as an OAuth provider') .form-group - = f.label :user_default_external, 'New users set to external', class: 'label-bold' + = f.label :user_default_external, _('New users set to external'), class: 'label-bold' .form-check = f.check_box :user_default_external, class: 'form-check-input' = f.label :user_default_external, class: 'form-check-label' do - Newly registered users will by default be external + = _('Newly registered users will by default be external') .prepend-top-10 = _('Internal users') = f.text_field :user_default_internal_regex, placeholder: _('Regex pattern'), class: 'form-control prepend-top-5' @@ -40,10 +43,12 @@ = link_to _('More information'), help_page_path('user/permissions', anchor: 'external-users-permissions'), target: '_blank' .form-group - = f.label :user_show_add_ssh_key_message, 'Prompt users to upload SSH keys', class: 'label-bold' + = f.label :user_show_add_ssh_key_message, _('Prompt users to upload SSH keys'), class: 'label-bold' .form-check = f.check_box :user_show_add_ssh_key_message, class: 'form-check-input' = f.label :user_show_add_ssh_key_message, class: 'form-check-label' do - Inform users without uploaded SSH keys that they can't push over SSH until one is added + = _("Inform users without uploaded SSH keys that they can't push over SSH until one is added") + + = render_if_exists 'admin/application_settings/availability_on_namespace_setting', form: f - = f.submit 'Save changes', class: 'btn btn-success qa-save-changes-button' + = f.submit _('Save changes'), class: 'btn btn-success qa-save-changes-button' diff --git a/app/views/admin/application_settings/_ci_cd.html.haml b/app/views/admin/application_settings/_ci_cd.html.haml index c99d7e9b8e9..b8c481df0d2 100644 --- a/app/views/admin/application_settings/_ci_cd.html.haml +++ b/app/views/admin/application_settings/_ci_cd.html.haml @@ -8,7 +8,7 @@ .form-check = f.check_box :auto_devops_enabled, class: 'form-check-input' = f.label :auto_devops_enabled, class: 'form-check-label' do - Default to Auto DevOps pipeline for all projects + = s_('CICD|Default to Auto DevOps pipeline for all projects') .form-text.text-muted = s_('CICD|The Auto DevOps pipeline will run if no alternative CI configuration file is found.') = link_to _('More information'), help_page_path('topics/autodevops/index.md'), target: '_blank' @@ -21,34 +21,31 @@ .form-check = f.check_box :shared_runners_enabled, class: 'form-check-input' = f.label :shared_runners_enabled, class: 'form-check-label' do - Enable shared runners for new projects + = s_("AdminSettings|Enable shared runners for new projects") + + = render_if_exists 'admin/application_settings/shared_runners_minutes_setting', form: f + .form-group = f.label :shared_runners_text, class: 'label-bold' = f.text_area :shared_runners_text, class: 'form-control', rows: 4 - .form-text.text-muted Markdown enabled + .form-text.text-muted= _("Markdown enabled") .form-group - = f.label :max_artifacts_size, 'Maximum artifacts size (MB)', class: 'label-bold' + = f.label :max_artifacts_size, _('Maximum artifacts size (MB)'), class: 'label-bold' = f.number_field :max_artifacts_size, class: 'form-control' .form-text.text-muted - Set the maximum file size for each job's artifacts + = _("Set the maximum file size for each job's artifacts") = link_to icon('question-circle'), help_page_path('user/admin_area/settings/continuous_integration', anchor: 'maximum-artifacts-size') .form-group - = f.label :default_artifacts_expire_in, 'Default artifacts expiration', class: 'label-bold' + = f.label :default_artifacts_expire_in, _('Default artifacts expiration'), class: 'label-bold' = f.text_field :default_artifacts_expire_in, class: 'form-control' .form-text.text-muted - Set the default expiration time for each job's artifacts. - 0 for unlimited. - The default unit is in seconds, but you can define an alternative. For example: - <code>4 mins 2 sec</code>, <code>2h42min</code>. + = _("Set the default expiration time for each job's artifacts. 0 for unlimited. The default unit is in seconds, but you can define an alternative. For example: <code>4 mins 2 sec</code>, <code>2h42min</code>.").html_safe = link_to icon('question-circle'), help_page_path('user/admin_area/settings/continuous_integration', anchor: 'default-artifacts-expiration') .form-group - = f.label :archive_builds_in_human_readable, 'Archive jobs', class: 'label-bold' + = f.label :archive_builds_in_human_readable, _('Archive jobs'), class: 'label-bold' = f.text_field :archive_builds_in_human_readable, class: 'form-control', placeholder: 'never' .form-text.text-muted - Set the duration for which the jobs will be considered as old and expired. - Once that time passes, the jobs will be archived and no longer able to be - retried. Make it empty to never expire jobs. It has to be no less than 1 day, - for example: <code>15 days</code>, <code>1 month</code>, <code>2 years</code>. + = _("Set the duration for which the jobs will be considered as old and expired. Once that time passes, the jobs will be archived and no longer able to be retried. Make it empty to never expire jobs. It has to be no less than 1 day, for example: <code>15 days</code>, <code>1 month</code>, <code>2 years</code>.").html_safe .form-group .form-check = f.check_box :protected_ci_variables, class: 'form-check-input' @@ -57,4 +54,4 @@ .form-text.text-muted = s_('AdminSettings|When creating a new environment variable it will be protected by default.') - = f.submit 'Save changes', class: "btn btn-success" + = f.submit _('Save changes'), class: "btn btn-success" diff --git a/app/views/admin/application_settings/_email.html.haml b/app/views/admin/application_settings/_email.html.haml index 60a6be731ea..3f30c75fbb6 100644 --- a/app/views/admin/application_settings/_email.html.haml +++ b/app/views/admin/application_settings/_email.html.haml @@ -6,20 +6,16 @@ .form-check = f.check_box :email_author_in_body, class: 'form-check-input' = f.label :email_author_in_body, class: 'form-check-label' do - Include author name in notification email body + = _('Include author name in notification email body') .form-text.text-muted - Some email servers do not support overriding the email sender name. - Enable this option to include the name of the author of the issue, - merge request or comment in the email body instead. + = _('Some email servers do not support overriding the email sender name. Enable this option to include the name of the author of the issue, merge request or comment in the email body instead.') .form-group .form-check = f.check_box :html_emails_enabled, class: 'form-check-input' = f.label :html_emails_enabled, class: 'form-check-label' do - Enable HTML emails + = _('Enable HTML emails') .form-text.text-muted - By default GitLab sends emails in HTML and plain text formats so mail - clients can choose what format to use. Disable this option if you only - want to send emails in plain text format. + = _('By default GitLab sends emails in HTML and plain text formats so mail clients can choose what format to use. Disable this option if you only want to send emails in plain text format.') .form-group = f.label :commit_email_hostname, _('Custom hostname (for private commit emails)'), class: 'label-bold' = f.text_field :commit_email_hostname, class: 'form-control' @@ -27,4 +23,6 @@ - commit_email_hostname_docs_link = link_to _('Learn more'), help_page_path('user/admin_area/settings/email', anchor: 'custom-private-commit-email-hostname'), target: '_blank' = _("This setting will update the hostname that is used to generate private commit emails. %{learn_more}").html_safe % { learn_more: commit_email_hostname_docs_link } - = f.submit 'Save changes', class: "btn btn-success" + = render_if_exists 'admin/application_settings/email_additional_text_setting', form: f + + = f.submit _('Save changes'), class: "btn btn-success" diff --git a/app/views/admin/application_settings/_help_page.html.haml b/app/views/admin/application_settings/_help_page.html.haml index 70c8c74cc5d..aa491c735d1 100644 --- a/app/views/admin/application_settings/_help_page.html.haml +++ b/app/views/admin/application_settings/_help_page.html.haml @@ -2,18 +2,20 @@ = form_errors(@application_setting) %fieldset + = render_if_exists 'admin/application_settings/help_text_setting', form: f + .form-group = f.label :help_page_text, class: 'label-bold' = f.text_area :help_page_text, class: 'form-control', rows: 4 - .form-text.text-muted Markdown enabled + .form-text.text-muted= _('Markdown enabled') .form-group .form-check = f.check_box :help_page_hide_commercial_content, class: 'form-check-input' = f.label :help_page_hide_commercial_content, class: 'form-check-label' do - Hide marketing-related entries from help + = _('Hide marketing-related entries from help') .form-group - = f.label :help_page_support_url, 'Support page URL', class: 'label-bold' + = f.label :help_page_support_url, _('Support page URL'), class: 'label-bold' = f.text_field :help_page_support_url, class: 'form-control', placeholder: 'http://company.example.com/getting-help', :'aria-describedby' => 'support_help_block' - %span.form-text.text-muted#support_help_block Alternate support URL for help page + %span.form-text.text-muted#support_help_block= _('Alternate support URL for help page') - = f.submit 'Save changes', class: "btn btn-success" + = f.submit _('Save changes'), class: "btn btn-success" diff --git a/app/views/admin/application_settings/_repository_mirrors_form.html.haml b/app/views/admin/application_settings/_repository_mirrors_form.html.haml index 615aa6317b0..f2f2cd1282a 100644 --- a/app/views/admin/application_settings/_repository_mirrors_form.html.haml +++ b/app/views/admin/application_settings/_repository_mirrors_form.html.haml @@ -3,13 +3,15 @@ %fieldset .form-group - = f.label :mirror_available, 'Enable mirror configuration', class: 'label-bold' + = f.label :mirror_available, _('Enable mirror configuration'), class: 'label-bold' .form-check = f.check_box :mirror_available, class: 'form-check-input' = f.label :mirror_available, class: 'form-check-label' do - Allow mirrors to be set up for projects + = _('Allow mirrors to be set up for projects') %span.form-text.text-muted - If disabled, only admins will be able to set up mirrors in projects. + = _('If disabled, only admins will be able to set up mirrors in projects.') = link_to icon('question-circle'), help_page_path('workflow/repository_mirroring') - = f.submit 'Save changes', class: "btn btn-success" + = render_if_exists 'admin/application_settings/mirror_settings', form: f + + = f.submit _('Save changes'), class: "btn btn-success" diff --git a/app/views/admin/application_settings/_visibility_and_access.html.haml b/app/views/admin/application_settings/_visibility_and_access.html.haml index 0725ffb7f6c..8122d81f578 100644 --- a/app/views/admin/application_settings/_visibility_and_access.html.haml +++ b/app/views/admin/application_settings/_visibility_and_access.html.haml @@ -5,6 +5,7 @@ .form-group = f.label :default_branch_protection, class: 'label-bold' = f.select :default_branch_protection, options_for_select(Gitlab::Access.protection_options, @application_setting.default_branch_protection), {}, class: 'form-control' + = render_if_exists 'admin/application_settings/project_creation_level', form: f, application_setting: @application_setting .form-group.visibility-level-setting = f.label :default_project_visibility, class: 'label-bold' = render('shared/visibility_radios', model_method: :default_project_visibility, form: f, selected_level: @application_setting.default_project_visibility, form_model: Project.new) @@ -22,32 +23,33 @@ .form-check = level %span.form-text.text-muted#restricted-visibility-help - Selected levels cannot be used by non-admin users for groups, projects or snippets. - If the public level is restricted, user profiles are only visible to logged in users. + = _('Selected levels cannot be used by non-admin users for groups, projects or snippets. If the public level is restricted, user profiles are only visible to logged in users.') .form-group = f.label :import_sources, class: 'label-bold' = hidden_field_tag 'application_setting[import_sources][]' - import_sources_checkboxes('import-sources-help', class: 'form-check-input').each do |source| .form-check= source %span.form-text.text-muted#import-sources-help - Enabled sources for code import during project creation. OmniAuth must be configured for GitHub + = _('Enabled sources for code import during project creation. OmniAuth must be configured for GitHub') = link_to "(?)", help_page_path("integration/github") , Bitbucket = link_to "(?)", help_page_path("integration/bitbucket") and GitLab.com = link_to "(?)", help_page_path("integration/gitlab") + = render_if_exists 'admin/application_settings/ldap_access_setting', form: f + .form-group .form-check = f.check_box :project_export_enabled, class: 'form-check-input' = f.label :project_export_enabled, class: 'form-check-label' do - Project export enabled + = _('Project export enabled') .form-group - %label.label-bold Enabled Git access protocols + %label.label-bold= _('Enabled Git access protocols') = select(:application_setting, :enabled_git_access_protocol, [['Both SSH and HTTP(S)', nil], ['Only SSH', 'ssh'], ['Only HTTP(S)', 'http']], {}, class: 'form-control') %span.form-text.text-muted#clone-protocol-help - Allow only the selected protocols to be used for Git access. + = _('Allow only the selected protocols to be used for Git access.') - ApplicationSetting::SUPPORTED_KEY_TYPES.each do |type| - field_name = :"#{type}_key_restriction" @@ -55,4 +57,4 @@ = f.label field_name, "#{type.upcase} SSH keys", class: 'label-bold' = f.select field_name, key_restriction_options_for_select(type), {}, class: 'form-control' - = f.submit 'Save changes', class: "btn btn-success" + = f.submit _('Save changes'), class: "btn btn-success" |