Skip to content

Commit 59dcb9b

Browse files
authored
Add custom closed registrations message to landing page when set (mastodon#10347)
1 parent 80c3f9f commit 59dcb9b

3 files changed

Lines changed: 55 additions & 11 deletions

File tree

app/javascript/styles/mastodon/forms.scss

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -475,6 +475,42 @@ code {
475475
}
476476
}
477477
}
478+
479+
&__overlay-area {
480+
position: relative;
481+
482+
&__overlay {
483+
position: absolute;
484+
top: 0;
485+
left: 0;
486+
width: 100%;
487+
height: 100%;
488+
display: flex;
489+
justify-content: center;
490+
align-items: center;
491+
background: rgba($ui-base-color, 0.65);
492+
backdrop-filter: blur(2px);
493+
border-radius: 4px;
494+
495+
&__content {
496+
text-align: center;
497+
498+
&.rich-formatting {
499+
&,
500+
p {
501+
color: $primary-text-color;
502+
}
503+
}
504+
}
505+
}
506+
}
507+
}
508+
509+
.block-icon {
510+
display: block;
511+
margin: 0 auto;
512+
margin-bottom: 10px;
513+
font-size: 24px;
478514
}
479515

480516
.flash-message {

app/presenters/instance_presenter.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ class InstancePresenter
88
:site_description,
99
:site_extended_description,
1010
:site_terms,
11+
:closed_registrations_message,
1112
to: Setting
1213
)
1314

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,23 @@
11
= simple_form_for(new_user, url: user_registration_path) do |f|
2-
%p.lead= t('about.federation_hint_html', instance: content_tag(:strong, site_hostname))
2+
.simple_form__overlay-area
3+
%p.lead= t('about.federation_hint_html', instance: content_tag(:strong, site_hostname))
34

4-
.fields-group
5-
= f.simple_fields_for :account do |account_fields|
6-
= account_fields.input :username, wrapper: :with_label, autofocus: true, label: false, required: true, input_html: { 'aria-label' => t('simple_form.labels.defaults.username'), :autocomplete => 'off', placeholder: t('simple_form.labels.defaults.username') }, append: "@#{site_hostname}", hint: false, disabled: closed_registrations?
5+
.fields-group
6+
= f.simple_fields_for :account do |account_fields|
7+
= account_fields.input :username, wrapper: :with_label, autofocus: true, label: false, required: true, input_html: { 'aria-label' => t('simple_form.labels.defaults.username'), :autocomplete => 'off', placeholder: t('simple_form.labels.defaults.username') }, append: "@#{site_hostname}", hint: false, disabled: closed_registrations?
78

8-
= f.input :email, placeholder: t('simple_form.labels.defaults.email'), required: true, input_html: { 'aria-label' => t('simple_form.labels.defaults.email'), :autocomplete => 'off' }, hint: false, disabled: closed_registrations?
9-
= f.input :password, placeholder: t('simple_form.labels.defaults.password'), required: true, input_html: { 'aria-label' => t('simple_form.labels.defaults.password'), :autocomplete => 'off' }, hint: false, disabled: closed_registrations?
10-
= f.input :password_confirmation, placeholder: t('simple_form.labels.defaults.confirm_password'), required: true, input_html: { 'aria-label' => t('simple_form.labels.defaults.confirm_password'), :autocomplete => 'off' }, hint: false, disabled: closed_registrations?
9+
= f.input :email, placeholder: t('simple_form.labels.defaults.email'), required: true, input_html: { 'aria-label' => t('simple_form.labels.defaults.email'), :autocomplete => 'off' }, hint: false, disabled: closed_registrations?
10+
= f.input :password, placeholder: t('simple_form.labels.defaults.password'), required: true, input_html: { 'aria-label' => t('simple_form.labels.defaults.password'), :autocomplete => 'off' }, hint: false, disabled: closed_registrations?
11+
= f.input :password_confirmation, placeholder: t('simple_form.labels.defaults.confirm_password'), required: true, input_html: { 'aria-label' => t('simple_form.labels.defaults.confirm_password'), :autocomplete => 'off' }, hint: false, disabled: closed_registrations?
1112

12-
.fields-group
13-
= f.input :agreement, as: :boolean, wrapper: :with_label, label: t('auth.checkbox_agreement_html', rules_path: about_more_path, terms_path: terms_path), disabled: closed_registrations?
13+
.fields-group
14+
= f.input :agreement, as: :boolean, wrapper: :with_label, label: t('auth.checkbox_agreement_html', rules_path: about_more_path, terms_path: terms_path), disabled: closed_registrations?
1415

15-
.actions
16-
= f.button :button, sign_up_message, type: :submit, class: 'button button-primary', disabled: closed_registrations?
16+
.actions
17+
= f.button :button, sign_up_message, type: :submit, class: 'button button-primary', disabled: closed_registrations?
18+
19+
- if closed_registrations? && @instance_presenter.closed_registrations_message.present?
20+
.simple_form__overlay-area__overlay
21+
.simple_form__overlay-area__overlay__content.rich-formatting
22+
.block-icon= fa_icon 'warning'
23+
= @instance_presenter.closed_registrations_message.html_safe

0 commit comments

Comments
 (0)