diff options
Diffstat (limited to 'app/views')
15 files changed, 210 insertions, 80 deletions
diff --git a/app/views/admin/application_settings/_sourcegraph.html.haml b/app/views/admin/application_settings/_sourcegraph.html.haml new file mode 100644 index 00000000000..23cda0334a2 --- /dev/null +++ b/app/views/admin/application_settings/_sourcegraph.html.haml @@ -0,0 +1,38 @@ +- return unless Gitlab::Sourcegraph.feature_available? +- expanded = integration_expanded?('sourcegraph_') + +%section.settings.as-sourcegraph.no-animate#js-sourcegraph-settings{ class: ('expanded' if expanded) } + .settings-header + %h4 + = _('Sourcegraph') + %button.btn.btn-default.js-settings-toggle{ type: 'button' } + = expanded ? _('Collapse') : _('Expand') + %p + - link_start = '<a href="%{url}" target="_blank" rel="noopener noreferrer">'.html_safe % { url: 'https://sourcegraph.com/' } + - link_end = "#{sprite_icon('external-link', size: 12, css_class: 'ml-1 vertical-align-center')}</a>".html_safe + = s_('SourcegraphAdmin|Enable code intelligence powered by %{link_start}Sourcegraph%{link_end} on your GitLab instance\'s code views and merge requests.').html_safe % { link_start: link_start, link_end: link_end } + %span + = link_to s_('SourcegraphAdmin|More information'), help_page_path('integration/sourcegraph.md'), target: '_blank' + + + .settings-content + = form_for @application_setting, url: integrations_admin_application_settings_path(anchor: 'js-sourcegraph-settings'), html: { class: 'fieldset-form' } do |f| + = form_errors(@application_setting) + + %fieldset + .form-group + .form-check + = f.check_box :sourcegraph_enabled, class: 'form-check-input' + = f.label :sourcegraph_enabled, s_('SourcegraphAdmin|Enable Sourcegraph'), class: 'form-check-label' + .form-group + .form-check + = f.check_box :sourcegraph_public_only, class: 'form-check-input' + = f.label :sourcegraph_public_only, s_('SourcegraphAdmin|Block on private and internal projects'), class: 'form-check-label' + .form-text.text-muted + = s_('SourcegraphAdmin|If checked, only public projects will have code intelligence and communicate with Sourcegraph.') + .form-group + = f.label :sourcegraph_url, s_('SourcegraphAdmin|Sourcegraph URL'), class: 'label-bold' + = f.text_field :sourcegraph_url, class: 'form-control', placeholder: s_('SourcegraphAdmin|e.g. https://sourcegraph.example.com') + .form-text.text-muted + = s_('SourcegraphAdmin|Configure the URL to a Sourcegraph instance which can read your GitLab projects.') + = f.submit s_('SourcegraphAdmin|Save changes'), class: 'btn btn-success' diff --git a/app/views/admin/application_settings/integrations.html.haml b/app/views/admin/application_settings/integrations.html.haml index 3f459e0f491..0aa833e49a8 100644 --- a/app/views/admin/application_settings/integrations.html.haml +++ b/app/views/admin/application_settings/integrations.html.haml @@ -4,6 +4,7 @@ = render_if_exists 'admin/application_settings/elasticsearch_form' = render 'admin/application_settings/plantuml' += render 'admin/application_settings/sourcegraph' = render_if_exists 'admin/application_settings/slack' = render 'admin/application_settings/third_party_offers' = render 'admin/application_settings/snowplow' diff --git a/app/views/profiles/preferences/_sourcegraph.html.haml b/app/views/profiles/preferences/_sourcegraph.html.haml new file mode 100644 index 00000000000..20a904694ca --- /dev/null +++ b/app/views/profiles/preferences/_sourcegraph.html.haml @@ -0,0 +1,26 @@ +- return unless Gitlab::Sourcegraph::feature_available? && Gitlab::CurrentSettings.sourcegraph_enabled +- sourcegraph_url = Gitlab::CurrentSettings.sourcegraph_url + +.col-sm-12 + %hr + +.col-lg-4.profile-settings-sidebar + %h4.prepend-top-0 + = s_('Preferences|Integrations') + %p + = s_('Preferences|Customize integrations with third party services.') + = succeed '.' do + = link_to _('Learn more'), help_page_path('user/profile/preferences.md', anchor: 'integrations'), target: '_blank' +.col-lg-8 + %label.label-bold + = s_('Preferences|Sourcegraph') + = link_to icon('question-circle'), help_page_path('user/profile/preferences.md', anchor: 'sourcegraph'), target: '_blank', class: 'has-tooltip', title: _('More information') + .form-group.form-check + = f.check_box :sourcegraph_enabled, class: 'form-check-input' + = f.label :sourcegraph_enabled, class: 'form-check-label' do + - link_start = '<a href="%{url}">'.html_safe % { url: sourcegraph_url } + - link_end = '</a>'.html_safe + = s_('Preferences|Enable integrated code intelligence on code views').html_safe % { link_start: link_start, link_end: link_end } + .form-text.text-muted + = sourcegraph_url_message + = sourcegraph_experimental_message diff --git a/app/views/profiles/preferences/show.html.haml b/app/views/profiles/preferences/show.html.haml index 84657592cd8..bf76b7379dd 100644 --- a/app/views/profiles/preferences/show.html.haml +++ b/app/views/profiles/preferences/show.html.haml @@ -111,6 +111,9 @@ = time_display_label .form-text.text-muted = s_('Preferences|For example: 30 mins ago.') + + = render 'sourcegraph', f: f + .col-lg-4.profile-settings-sidebar .col-lg-8 .form-group diff --git a/app/views/projects/blob/_markdown_buttons.html.haml b/app/views/projects/blob/_markdown_buttons.html.haml index 28d1ff97825..44ec2fa69cb 100644 --- a/app/views/projects/blob/_markdown_buttons.html.haml +++ b/app/views/projects/blob/_markdown_buttons.html.haml @@ -6,7 +6,7 @@ = markdown_toolbar_button({ icon: "link", data: { "md-tag" => "[{text}](url)", "md-select" => "url" }, title: _("Add a link") }) = markdown_toolbar_button({ icon: "list-bulleted", data: { "md-tag" => "* ", "md-prepend" => true }, title: _("Add a bullet list") }) = markdown_toolbar_button({ icon: "list-numbered", data: { "md-tag" => "1. ", "md-prepend" => true }, title: _("Add a numbered list") }) - = markdown_toolbar_button({ icon: "task-done", data: { "md-tag" => "* [ ] ", "md-prepend" => true }, title: _("Add a task list") }) + = markdown_toolbar_button({ icon: "list-task", data: { "md-tag" => "* [ ] ", "md-prepend" => true }, title: _("Add a task list") }) = markdown_toolbar_button({ icon: "table", data: { "md-tag" => "| header | header |\n| ------ | ------ |\n| cell | cell |\n| cell | cell |", "md-prepend" => true }, title: _("Add a table") }) - if show_fullscreen_button %button.toolbar-btn.toolbar-fullscreen-btn.js-zen-enter.has-tooltip{ type: "button", tabindex: -1, "aria-label": "Go full screen", title: _("Go full screen"), data: { container: "body" } } diff --git a/app/views/projects/pages/_list.html.haml b/app/views/projects/pages/_list.html.haml index b05491f2c6e..4676c7399f1 100644 --- a/app/views/projects/pages/_list.html.haml +++ b/app/views/projects/pages/_list.html.haml @@ -21,11 +21,11 @@ %span.badge.badge-danger = s_('GitLabPages|Expired') %div - = link_to s_('GitLabPages|Details'), project_pages_domain_path(@project, domain), class: "btn btn-sm btn-grouped" + = link_to s_('GitLabPages|Edit'), edit_project_pages_domain_path(@project, domain), class: "btn btn-sm btn-grouped btn-success btn-inverted" = link_to s_('GitLabPages|Remove'), project_pages_domain_path(@project, domain), data: { confirm: s_('GitLabPages|Are you sure?')}, method: :delete, class: "btn btn-remove btn-sm btn-grouped" - if verification_enabled && domain.unverified? %li.list-group-item.bs-callout-warning - - details_link_start = "<a href='#{project_pages_domain_path(@project, domain)}'>".html_safe + - details_link_start = "<a href='#{edit_project_pages_domain_path(@project, domain)}'>".html_safe - details_link_end = '</a>'.html_safe = s_('GitLabPages|%{domain} is not verified. To learn how to verify ownership, visit your %{link_start}domain details%{link_end}.').html_safe % { domain: domain.domain, link_start: details_link_start, diff --git a/app/views/projects/pages_domains/_certificate.html.haml b/app/views/projects/pages_domains/_certificate.html.haml index 42631fca5e8..92d30e0b056 100644 --- a/app/views/projects/pages_domains/_certificate.html.haml +++ b/app/views/projects/pages_domains/_certificate.html.haml @@ -1,18 +1,63 @@ -- if @domain.auto_ssl_enabled? - - if @domain.enabled? - - if @domain.certificate_text - %pre - = @domain.certificate_text - - else - .bs-callout.bs-callout-info - = _("GitLab is obtaining a Let's Encrypt SSL certificate for this domain. This process can take some time. Please try again later.") +- auto_ssl_available = ::Gitlab::LetsEncrypt.enabled? +- auto_ssl_enabled = @domain.auto_ssl_enabled? +- auto_ssl_available_and_enabled = auto_ssl_available && auto_ssl_enabled +- has_user_defined_certificate = @domain.certificate && @domain.certificate_user_provided? + +- if auto_ssl_available + .form-group.border-section + .row + .col-sm-2 + = _('Certificate') + .col-sm-10.js-auto-ssl-toggle-container + %label{ for: "pages_domain_auto_ssl_enabled_button" } + - lets_encrypt_link_url = "https://letsencrypt.org/" + - lets_encrypt_link_start = "<a href=\"%{lets_encrypt_link_url}\" target=\"_blank\" rel=\"noopener noreferrer\" class=\"text-nowrap\">".html_safe % { lets_encrypt_link_url: lets_encrypt_link_url } + - lets_encrypt_link_end = "</a>".html_safe + = _("Automatic certificate management using %{lets_encrypt_link_start}Let's Encrypt%{lets_encrypt_link_end}").html_safe % { lets_encrypt_link_start: lets_encrypt_link_start, lets_encrypt_link_end: lets_encrypt_link_end } + %button{ type: "button", id: "pages_domain_auto_ssl_enabled_button", + class: "js-project-feature-toggle project-feature-toggle mt-2 #{"is-checked" if auto_ssl_available_and_enabled}", + "aria-label": _("Automatic certificate management using Let's Encrypt") } + = f.hidden_field :auto_ssl_enabled?, class: "js-project-feature-toggle-input" + %span.toggle-icon + = sprite_icon("status_success_borderless", size: 16, css_class: "toggle-icon-svg toggle-status-checked") + = sprite_icon("status_failed_borderless", size: 16, css_class: "toggle-icon-svg toggle-status-unchecked") + %p.text-secondary.mt-3 + - docs_link_url = help_page_path("user/project/pages/custom_domains_ssl_tls_certification/lets_encrypt_integration.md") + - docs_link_start = "<a href=\"%{docs_link_url}\" target=\"_blank\" rel=\"noopener noreferrer\" class=\"text-nowrap\">".html_safe % { docs_link_url: docs_link_url } + - docs_link_end = "</a>".html_safe + = _("Let's Encrypt is a free, automated, and open certificate authority (CA) that gives digital certificates in order to enable HTTPS (SSL/TLS) for websites. Learn more about Let's Encrypt configuration by following the %{docs_link_start}documentation on GitLab Pages%{docs_link_end}.").html_safe % { docs_link_url: docs_link_url, docs_link_start: docs_link_start, docs_link_end: docs_link_end } + +.form-group.border-section.js-shown-unless-auto-ssl{ class: ("d-none" if auto_ssl_available_and_enabled) } + - if has_user_defined_certificate + .row + .col-sm-10.offset-sm-2 + .card + .card-header + = _('Certificate') + .d-flex.justify-content-between.align-items-center.p-3 + %span + = @domain.subject || _('missing') + = link_to _('Remove'), + clean_certificate_project_pages_domain_path(@project, @domain), + data: { confirm: _('Are you sure?') }, + class: 'btn btn-remove btn-sm', + method: :delete - else - .bs-callout.bs-callout-warning - = _("A Let's Encrypt SSL certificate can not be obtained until your domain is verified.") -- else - - if @domain.certificate_text - %pre - = @domain.certificate_text - - else - .light - = _("missing") + .row + .col-sm-10.offset-sm-2 + = f.label :user_provided_certificate, _("Certificate (PEM)") + = f.text_area :user_provided_certificate, + rows: 5, + class: "form-control js-enabled-unless-auto-ssl", + disabled: auto_ssl_available_and_enabled + %span.help-inline.text-muted= _("Upload a certificate for your domain with all intermediates") + .row + .col-sm-10.offset-sm-2 + = f.label :user_provided_key, _("Key (PEM)") + = f.text_area :user_provided_key, + rows: 5, + class: "form-control js-enabled-unless-auto-ssl", + disabled: auto_ssl_available_and_enabled + %span.help-inline.text-muted= _("Upload a private key for your certificate") + += render 'lets_encrypt_callout', auto_ssl_available_and_enabled: auto_ssl_available_and_enabled diff --git a/app/views/projects/pages_domains/_dns.html.haml b/app/views/projects/pages_domains/_dns.html.haml new file mode 100644 index 00000000000..e4e590f0a98 --- /dev/null +++ b/app/views/projects/pages_domains/_dns.html.haml @@ -0,0 +1,33 @@ +- verification_enabled = Gitlab::CurrentSettings.pages_domain_verification_enabled? +- dns_record = "#{@domain.domain} CNAME #{@domain.project.pages_subdomain}.#{Settings.pages.host}." + +.form-group.border-section + .row + .col-sm-2 + = _("DNS") + .col-sm-10 + .input-group + = text_field_tag :domain_dns, dns_record , class: "monospace js-select-on-focus form-control", readonly: true + .input-group-append + = clipboard_button(target: '#domain_dns', class: 'btn-default input-group-text d-none d-sm-block') + %p.form-text.text-muted + = _("To access this domain create a new DNS record") +- if verification_enabled + - verification_record = "#{@domain.verification_domain} TXT #{@domain.keyed_verification_code}" + .form-group.border-section + .row + .col-sm-2 + = _("Verification status") + .col-sm-10 + .status-badge + - text, status = @domain.unverified? ? [_('Unverified'), 'badge-danger'] : [_('Verified'), 'badge-success'] + .badge{ class: status } + = text + = link_to sprite_icon("redo"), verify_project_pages_domain_path(@project, @domain), method: :post, class: "btn has-tooltip", title: _("Retry verification") + .input-group + = text_field_tag :domain_verification, verification_record, class: "monospace js-select-on-focus form-control", readonly: true + .input-group-append + = clipboard_button(target: '#domain_verification', class: 'btn-default d-none d-sm-block') + %p.form-text.text-muted + - link_to_help = link_to(_('verify ownership'), help_page_path('user/project/pages/custom_domains_ssl_tls_certification/index.md', anchor: '4-verify-the-domains-ownership')) + = _("To %{link_to_help} of your domain, add the above key to a TXT record within to your DNS configuration.").html_safe % { link_to_help: link_to_help } diff --git a/app/views/projects/pages_domains/_form.html.haml b/app/views/projects/pages_domains/_form.html.haml index 4aa1e574d93..e06dab9be06 100644 --- a/app/views/projects/pages_domains/_form.html.haml +++ b/app/views/projects/pages_domains/_form.html.haml @@ -3,62 +3,25 @@ - @domain.errors.full_messages.each do |msg| = msg -.form-group.row - .col-sm-2.col-form-label - = f.label :domain, _("Domain") - .col-sm-10 - = f.text_field :domain, required: true, autocomplete: "off", class: "form-control", disabled: @domain.persisted? - -- if Gitlab.config.pages.external_https - - - auto_ssl_available = ::Gitlab::LetsEncrypt.enabled? - - auto_ssl_enabled = @domain.auto_ssl_enabled? - - auto_ssl_available_and_enabled = auto_ssl_available && auto_ssl_enabled - - - if auto_ssl_available - .form-group.row - .col-sm-2.col-form-label - %label{ for: "pages_domain_auto_ssl_enabled_button" } - - lets_encrypt_link_url = "https://letsencrypt.org/" - - lets_encrypt_link_start = "<a href=\"%{lets_encrypt_link_url}\" target=\"_blank\" rel=\"noopener noreferrer\" class=\"text-nowrap\">".html_safe % { lets_encrypt_link_url: lets_encrypt_link_url } - - lets_encrypt_link_end = "</a>".html_safe - = _("Automatic certificate management using %{lets_encrypt_link_start}Let's Encrypt%{lets_encrypt_link_end}").html_safe % { lets_encrypt_link_start: lets_encrypt_link_start, lets_encrypt_link_end: lets_encrypt_link_end } - - .col-sm-10.js-auto-ssl-toggle-container - %button{ type: "button", id: "pages_domain_auto_ssl_enabled_button", - class: "js-project-feature-toggle project-feature-toggle mt-2 #{"is-checked" if auto_ssl_available_and_enabled}", - "aria-label": _("Automatic certificate management using Let's Encrypt") } - = f.hidden_field :auto_ssl_enabled?, class: "js-project-feature-toggle-input" - %span.toggle-icon - = sprite_icon("status_success_borderless", size: 16, css_class: "toggle-icon-svg toggle-status-checked") - = sprite_icon("status_failed_borderless", size: 16, css_class: "toggle-icon-svg toggle-status-unchecked") - %p.text-secondary.mt-3 - - docs_link_url = help_page_path("user/project/pages/custom_domains_ssl_tls_certification/lets_encrypt_integration.md") - - docs_link_start = "<a href=\"%{docs_link_url}\" target=\"_blank\" rel=\"noopener noreferrer\" class=\"text-nowrap\">".html_safe % { docs_link_url: docs_link_url } - - docs_link_end = "</a>".html_safe - = _("Let's Encrypt is a free, automated, and open certificate authority (CA) that gives digital certificates in order to enable HTTPS (SSL/TLS) for websites. Learn more about Let's Encrypt configuration by following the %{docs_link_start}documentation on GitLab Pages%{docs_link_end}.").html_safe % { docs_link_url: docs_link_url, docs_link_start: docs_link_start, docs_link_end: docs_link_end } - - .js-shown-unless-auto-ssl{ class: ("d-none" if auto_ssl_available_and_enabled) } - .form-group.row - .col-sm-2.col-form-label - = f.label :user_provided_certificate, _("Certificate (PEM)") +.form-group.border-section + .row + - if @domain.persisted? + .col-sm-2 + = _("Domain") .col-sm-10 - = f.text_area :user_provided_certificate, - rows: 5, - class: "form-control js-enabled-unless-auto-ssl", - disabled: auto_ssl_available_and_enabled - %span.help-inline.text-muted= _("Upload a certificate for your domain with all intermediates") - - .form-group.row - .col-sm-2.col-form-label - = f.label :user_provided_key, _("Key (PEM)") + = external_link(@domain.url, @domain.url) + - else + .col-sm-2 + = f.label :domain, _("Domain") .col-sm-10 - = f.text_area :user_provided_key, - rows: 5, - class: "form-control js-enabled-unless-auto-ssl", - disabled: auto_ssl_available_and_enabled - %span.help-inline.text-muted= _("Upload a private key for your certificate") + .input-group + = f.text_field :domain, required: true, autocomplete: "off", class: "form-control" +- if @domain.persisted? + = render 'dns' + +- if Gitlab.config.pages.external_https + = render 'certificate', f: f - else - .nothing-here-block + .border-section.nothing-here-block = _("Support for custom certificates is disabled. Ask your system's administrator to enable it.") diff --git a/app/views/projects/pages_domains/_lets_encrypt_callout.html.haml b/app/views/projects/pages_domains/_lets_encrypt_callout.html.haml new file mode 100644 index 00000000000..d6406a78fca --- /dev/null +++ b/app/views/projects/pages_domains/_lets_encrypt_callout.html.haml @@ -0,0 +1,13 @@ +- if @domain.enabled? + - if @domain.auto_ssl_enabled && !@domain.certificate + .form-group.border-section.js-shown-if-auto-ssl{ class: ("d-none" unless auto_ssl_available_and_enabled) } + .row + .col-sm-10.offset-sm-2 + .bs-callout.bs-callout-info.mt-0 + = _("GitLab is obtaining a Let's Encrypt SSL certificate for this domain. This process can take some time. Please try again later.") +- else + .form-group.border-section.js-shown-if-auto-ssl{ class: ("d-none" unless auto_ssl_available_and_enabled) } + .row + .col-sm-10.offset-sm-2 + .bs-callout.bs-callout-warning.mt-0 + = _("A Let's Encrypt SSL certificate can not be obtained until your domain is verified.") diff --git a/app/views/projects/pages_domains/edit.html.haml b/app/views/projects/pages_domains/edit.html.haml index 7c0777e5496..a08be65d7e4 100644 --- a/app/views/projects/pages_domains/edit.html.haml +++ b/app/views/projects/pages_domains/edit.html.haml @@ -1,12 +1,21 @@ - add_to_breadcrumbs _("Pages"), project_pages_path(@project) - breadcrumb_title @domain.domain - page_title @domain.domain + +- verification_enabled = Gitlab::CurrentSettings.pages_domain_verification_enabled? + +- if verification_enabled && @domain.unverified? + = content_for :flash_message do + .alert.alert-warning + .container-fluid.container-limited + = _("This domain is not verified. You will need to verify ownership before access is enabled.") + %h3.page-title - = @domain.domain + = _('Pages Domain') = render 'projects/pages_domains/helper_text' -%hr.clearfix %div = form_for [@project.namespace.becomes(Namespace), @project, @domain], html: { class: 'fieldset-form' } do |f| = render 'form', { f: f } - .form-actions + .form-actions.d-flex.justify-content-between = f.submit _('Save Changes'), class: "btn btn-success" + = link_to _('Cancel'), project_pages_path(@project), class: 'btn btn-default btn-inverse' diff --git a/app/views/projects/pages_domains/new.html.haml b/app/views/projects/pages_domains/new.html.haml index e23ccb5d4c6..3210bfe9231 100644 --- a/app/views/projects/pages_domains/new.html.haml +++ b/app/views/projects/pages_domains/new.html.haml @@ -3,7 +3,6 @@ %h3.page-title = _("New Pages Domain") = render 'projects/pages_domains/helper_text' -%hr.clearfix %div = form_for [@project.namespace.becomes(Namespace), @project, @domain], html: { class: 'fieldset-form' } do |f| = render 'form', { f: f } diff --git a/app/views/projects/pages_domains/show.html.haml b/app/views/projects/pages_domains/show.html.haml index 33837e21c8d..8eec3d51835 100644 --- a/app/views/projects/pages_domains/show.html.haml +++ b/app/views/projects/pages_domains/show.html.haml @@ -58,4 +58,4 @@ %td = _("Certificate") %td - = render 'certificate' + = render 'lets_encrypt_callout', auto_ssl_available_and_enabled: false diff --git a/app/views/shared/issuable/_form.html.haml b/app/views/shared/issuable/_form.html.haml index a8aae03aad7..0fb23adc31f 100644 --- a/app/views/shared/issuable/_form.html.haml +++ b/app/views/shared/issuable/_form.html.haml @@ -14,7 +14,6 @@ = render 'shared/issuable/form/branch_chooser', issuable: issuable, form: form -%hr .form-group.row = form.label :title, class: 'col-form-label col-sm-2' diff --git a/app/views/shared/issuable/form/_branch_chooser.html.haml b/app/views/shared/issuable/form/_branch_chooser.html.haml index 03eebe7c987..29ac17c43b9 100644 --- a/app/views/shared/issuable/form/_branch_chooser.html.haml +++ b/app/views/shared/issuable/form/_branch_chooser.html.haml @@ -20,3 +20,4 @@ = form.hidden_field(:target_branch, { class: 'target_branch js-target-branch-select ref-name mw-xl', data: { placeholder: _('Select branch'), endpoint: refs_project_path(@project, sort: 'updated_desc', find: 'branches') }}) +%hr |