summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/assets/javascripts/pages/admin/broadcast_messages/broadcast_message.js31
-rw-r--r--app/assets/stylesheets/framework/broadcast_messages.scss28
-rw-r--r--app/assets/stylesheets/framework/job_log.scss1
-rw-r--r--app/controllers/projects/git_http_controller.rb1
-rw-r--r--app/helpers/broadcast_messages_helper.rb24
-rw-r--r--app/helpers/user_callouts_helper.rb2
-rw-r--r--app/views/admin/broadcast_messages/_form.html.haml27
-rw-r--r--app/views/admin/broadcast_messages/index.html.haml5
-rw-r--r--app/views/layouts/_broadcast.html.haml4
-rw-r--r--app/views/projects/pages/_ssl_limitations_warning.html.haml7
-rw-r--r--app/views/projects/pages/show.html.haml1
11 files changed, 103 insertions, 28 deletions
diff --git a/app/assets/javascripts/pages/admin/broadcast_messages/broadcast_message.js b/app/assets/javascripts/pages/admin/broadcast_messages/broadcast_message.js
index 7a6a486f551..7c2008d9edc 100644
--- a/app/assets/javascripts/pages/admin/broadcast_messages/broadcast_message.js
+++ b/app/assets/javascripts/pages/admin/broadcast_messages/broadcast_message.js
@@ -6,21 +6,31 @@ import { __ } from '~/locale';
import { textColorForBackground } from '~/lib/utils/color_utils';
export default () => {
- const $broadcastMessageColor = $('input#broadcast_message_color');
- const $broadcastMessagePreview = $('div.broadcast-message-preview');
+ const $broadcastMessageColor = $('.js-broadcast-message-color');
+ const $broadcastMessageType = $('.js-broadcast-message-type');
+ const $broadcastBannerMessagePreview = $('.js-broadcast-banner-message-preview');
+ const $broadcastMessage = $('.js-broadcast-message-message');
+ const previewPath = $broadcastMessage.data('previewPath');
+ const $jsBroadcastMessagePreview = $('.js-broadcast-message-preview');
+
$broadcastMessageColor.on('input', function onMessageColorInput() {
const previewColor = $(this).val();
- $broadcastMessagePreview.css('background-color', previewColor);
+ $broadcastBannerMessagePreview.css('background-color', previewColor);
});
$('input#broadcast_message_font').on('input', function onMessageFontInput() {
const previewColor = $(this).val();
- $broadcastMessagePreview.css('color', previewColor);
+ $broadcastBannerMessagePreview.css('color', previewColor);
});
- const $broadcastMessage = $('textarea#broadcast_message_message');
- const previewPath = $broadcastMessage.data('previewPath');
- const $jsBroadcastMessagePreview = $('.js-broadcast-message-preview');
+ $broadcastMessageType.on('change', () => {
+ const $broadcastMessageColorFormGroup = $('.js-broadcast-message-background-color-form-group');
+ const $broadcastNotificationMessagePreview = $('.js-broadcast-notification-message-preview');
+
+ $broadcastMessageColorFormGroup.toggleClass('hidden');
+ $broadcastBannerMessagePreview.toggleClass('hidden');
+ $broadcastNotificationMessagePreview.toggleClass('hidden');
+ });
$broadcastMessage.on(
'input',
@@ -58,7 +68,7 @@ export default () => {
$('.label-color-preview').css(selectedColorStyle);
- return $broadcastMessagePreview.css(selectedColorStyle);
+ return $jsBroadcastMessagePreview.css(selectedColorStyle);
};
const setSuggestedColor = e => {
@@ -67,7 +77,10 @@ export default () => {
.val(color)
// Notify the form, that color has changed
.trigger('input');
- updateColorPreview();
+ // Only banner supports colors
+ if ($broadcastMessageType === 'banner') {
+ updateColorPreview();
+ }
return e.preventDefault();
};
diff --git a/app/assets/stylesheets/framework/broadcast_messages.scss b/app/assets/stylesheets/framework/broadcast_messages.scss
index d3e7d751e63..95ea3d90a0e 100644
--- a/app/assets/stylesheets/framework/broadcast_messages.scss
+++ b/app/assets/stylesheets/framework/broadcast_messages.scss
@@ -1,7 +1,5 @@
.broadcast-message {
- @extend .alert-warning;
- padding: 10px;
- text-align: center;
+ padding: $gl-padding-8;
div,
p {
@@ -15,9 +13,29 @@
}
}
-.broadcast-message-preview {
+.broadcast-banner-message {
+ @extend .broadcast-message;
+ @extend .alert-warning;
+ text-align: center;
+}
+
+.broadcast-notification-message {
@extend .broadcast-message;
- margin-bottom: 20px;
+
+ position: fixed;
+ bottom: $gl-padding;
+ right: $gl-padding;
+ max-width: 300px;
+ width: auto;
+ background: $white-light;
+ border: 1px solid $gray-200;
+ box-shadow: 0 1px 2px 0 rgba($black, 0.1);
+ border-radius: $border-radius-default;
+ z-index: 999;
+
+ &.preview {
+ position: static;
+ }
}
.toggle-colors {
diff --git a/app/assets/stylesheets/framework/job_log.scss b/app/assets/stylesheets/framework/job_log.scss
index 4a57a458c50..fefc51bf1f7 100644
--- a/app/assets/stylesheets/framework/job_log.scss
+++ b/app/assets/stylesheets/framework/job_log.scss
@@ -22,6 +22,7 @@
min-width: $job-line-number-width;
margin-left: -$job-line-number-margin;
padding-right: 1em;
+ user-select: none;
&:hover,
&:active,
diff --git a/app/controllers/projects/git_http_controller.rb b/app/controllers/projects/git_http_controller.rb
index c7055e1df3f..236f1b967de 100644
--- a/app/controllers/projects/git_http_controller.rb
+++ b/app/controllers/projects/git_http_controller.rb
@@ -75,6 +75,7 @@ class Projects::GitHttpController < Projects::GitHttpClientController
end
def enqueue_fetch_statistics_update
+ return if Gitlab::Database.read_only?
return if repo_type.wiki?
return unless project&.daily_statistics_enabled?
diff --git a/app/helpers/broadcast_messages_helper.rb b/app/helpers/broadcast_messages_helper.rb
index 21e57a8d391..b95fd8800c0 100644
--- a/app/helpers/broadcast_messages_helper.rb
+++ b/app/helpers/broadcast_messages_helper.rb
@@ -1,19 +1,29 @@
# frozen_string_literal: true
module BroadcastMessagesHelper
- def current_broadcast_messages
- BroadcastMessage.current(request.path)
+ def current_broadcast_banner_messages
+ BroadcastMessage.current_banner_messages(request.path)
end
- def broadcast_message(message)
+ def current_broadcast_notification_message
+ BroadcastMessage.current_notification_messages(request.path).last
+ end
+
+ def broadcast_message(message, opts = {})
return unless message.present?
- content_tag :div, dir: 'auto', class: 'broadcast-message', style: broadcast_message_style(message) do
- sprite_icon('bullhorn', size: 16, css_class: 'vertical-align-text-top mr-2') << ' ' << render_broadcast_message(message)
+ classes = "broadcast-#{message.broadcast_type}-message #{opts[:preview] && 'preview'}"
+
+ content_tag :div, dir: 'auto', class: classes, style: broadcast_message_style(message) do
+ concat sprite_icon('bullhorn', size: 16, css_class: 'vertical-align-text-top')
+ concat ' '
+ concat render_broadcast_message(message)
end
end
def broadcast_message_style(broadcast_message)
+ return '' if broadcast_message.notification?
+
style = []
if broadcast_message.color.present?
@@ -40,4 +50,8 @@ module BroadcastMessagesHelper
def render_broadcast_message(broadcast_message)
Banzai.render_field(broadcast_message, :message).html_safe
end
+
+ def broadcast_type_options
+ BroadcastMessage.broadcast_types.keys.map { |w| [w.humanize, w] }
+ end
end
diff --git a/app/helpers/user_callouts_helper.rb b/app/helpers/user_callouts_helper.rb
index 11b78b8fd59..b3eee25674b 100644
--- a/app/helpers/user_callouts_helper.rb
+++ b/app/helpers/user_callouts_helper.rb
@@ -27,7 +27,7 @@ module UserCalloutsHelper
end
def show_tabs_feature_highlight?
- !user_dismissed?(TABS_POSITION_HIGHLIGHT) && !Rails.env.test?
+ current_user && !user_dismissed?(TABS_POSITION_HIGHLIGHT) && !Rails.env.test?
end
private
diff --git a/app/views/admin/broadcast_messages/_form.html.haml b/app/views/admin/broadcast_messages/_form.html.haml
index 44d57beec0f..33b56655206 100644
--- a/app/views/admin/broadcast_messages/_form.html.haml
+++ b/app/views/admin/broadcast_messages/_form.html.haml
@@ -1,23 +1,38 @@
-.broadcast-message-preview{ style: broadcast_message_style(@broadcast_message) }
- = sprite_icon('bullhorn', size: 16, css_class:'vertical-align-text-top mr-2')
+.broadcast-banner-message.js-broadcast-banner-message-preview.mt-2{ style: broadcast_message_style(@broadcast_message), class: ('hidden' unless @broadcast_message.banner? ) }
+ = sprite_icon('bullhorn', size: 16, css_class:'vertical-align-text-top')
.js-broadcast-message-preview
- if @broadcast_message.message.present?
= render_broadcast_message(@broadcast_message)
- else
Your message here
+- if Feature.enabled?(:broadcast_notification_type)
+ .d-flex.justify-content-center
+ .broadcast-notification-message.preview.js-broadcast-notification-message-preview.mt-2{ class: ('hidden' unless @broadcast_message.notification? ) }
+ = sprite_icon('bullhorn', size: 16, css_class:'vertical-align-text-top')
+ .js-broadcast-message-preview
+ - if @broadcast_message.message.present?
+ = render_broadcast_message(@broadcast_message)
+ - else
+ Your message here
= form_for [:admin, @broadcast_message], html: { class: 'broadcast-message-form js-quick-submit js-requires-input'} do |f|
= form_errors(@broadcast_message)
- .form-group.row
+ .form-group.row.mt-4
.col-sm-2.col-form-label
= f.label :message
.col-sm-10
- = f.text_area :message, class: "form-control js-autosize",
+ = f.text_area :message, class: "form-control js-autosize js-broadcast-message-message",
required: true,
dir: 'auto',
data: { preview_path: preview_admin_broadcast_messages_path }
- .form-group.row
+ - if Feature.enabled?(:broadcast_notification_type)
+ .form-group.row
+ .col-sm-2.col-form-label
+ = f.label :broadcast_type, _('Type')
+ .col-sm-10
+ = f.select :broadcast_type, broadcast_type_options, {}, class: 'form-control js-broadcast-message-type'
+ .form-group.row.js-broadcast-message-background-color-form-group{ class: ('hidden' unless @broadcast_message.banner? ) }
.col-sm-2.col-form-label
= f.label :color, _("Background color")
.col-sm-10
@@ -25,7 +40,7 @@
.input-group-prepend
.input-group-text.label-color-preview{ :style => 'background-color: ' + @broadcast_message.color + '; color: ' + @broadcast_message.font }
= '&nbsp;'.html_safe
- = f.text_field :color, class: "form-control"
+ = f.text_field :color, class: "form-control js-broadcast-message-color"
.form-text.text-muted
= _('Choose any color.')
%br
diff --git a/app/views/admin/broadcast_messages/index.html.haml b/app/views/admin/broadcast_messages/index.html.haml
index 4731421fd9e..6f2433e3306 100644
--- a/app/views/admin/broadcast_messages/index.html.haml
+++ b/app/views/admin/broadcast_messages/index.html.haml
@@ -20,6 +20,7 @@
%th Starts
%th Ends
%th Target Path
+ %th Type
%th &nbsp;
%tbody
- @broadcast_messages.each do |message|
@@ -27,7 +28,7 @@
%td
= broadcast_message_status(message)
%td
- = broadcast_message(message)
+ = broadcast_message(message, preview: true)
%td
= message.starts_at
%td
@@ -35,6 +36,8 @@
%td
= message.target_path
%td
+ = message.broadcast_type.capitalize
+ %td
= link_to sprite_icon('pencil-square'), edit_admin_broadcast_message_path(message), title: 'Edit', class: 'btn'
= link_to sprite_icon('remove'), admin_broadcast_message_path(message), method: :delete, remote: true, title: 'Remove', class: 'js-remove-tr btn btn-danger'
diff --git a/app/views/layouts/_broadcast.html.haml b/app/views/layouts/_broadcast.html.haml
index ee3ca824342..9d7ad249ac8 100644
--- a/app/views/layouts/_broadcast.html.haml
+++ b/app/views/layouts/_broadcast.html.haml
@@ -1,2 +1,4 @@
-- current_broadcast_messages&.each do |message|
+- current_broadcast_banner_messages.each do |message|
= broadcast_message(message)
+- if Feature.enabled?(:broadcast_notification_type)
+ = broadcast_message(current_broadcast_notification_message)
diff --git a/app/views/projects/pages/_ssl_limitations_warning.html.haml b/app/views/projects/pages/_ssl_limitations_warning.html.haml
new file mode 100644
index 00000000000..7188e169824
--- /dev/null
+++ b/app/views/projects/pages/_ssl_limitations_warning.html.haml
@@ -0,0 +1,7 @@
+.bs-callout.bs-callout-warning
+ %i.fa.fa-warning
+ %strong= _("Warning:")
+ - pages_host = Gitlab.config.pages.host
+ = s_("GitLabPages|When using Pages under the general domain of a GitLab instance (%{pages_host}), you cannot use HTTPS with sub-subdomains. This means that if your username/groupname contains a dot it will not work. This is a limitation of the HTTP Over TLS protocol. HTTP pages will continue to work provided you don't redirect HTTP to HTTPS.").html_safe % { pages_host: pages_host }
+
+ %strong= external_link(s_("GitLabPages|Learn more."), "https://docs.gitlab.com/ee/user/project/pages/introduction.html#limitations")
diff --git a/app/views/projects/pages/show.html.haml b/app/views/projects/pages/show.html.haml
index 8dbe67e153a..4b7810ea357 100644
--- a/app/views/projects/pages/show.html.haml
+++ b/app/views/projects/pages/show.html.haml
@@ -15,6 +15,7 @@
%hr.clearfix
+ = render 'ssl_limitations_warning' if @project.pages_subdomain.include?(".")
= render 'access'
= render 'use'
- if Gitlab.config.pages.external_http || Gitlab.config.pages.external_https