Skip to content

Commit

Permalink
Add table of contents to about page (mastodon#11885)
Browse files Browse the repository at this point in the history
Move public domain blocks information to about page
  • Loading branch information
Gargron authored and hiyuki2578 committed Oct 2, 2019
1 parent 16ba81a commit c8280e8
Show file tree
Hide file tree
Showing 10 changed files with 322 additions and 209 deletions.
43 changes: 15 additions & 28 deletions app/controllers/about_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
class AboutController < ApplicationController
layout 'public'

before_action :require_open_federation!, only: [:show, :more, :blocks]
before_action :check_blocklist_enabled, only: [:blocks]
before_action :authenticate_user!, only: [:blocks], if: :blocklist_account_required?
before_action :require_open_federation!, only: [:show, :more]
before_action :set_body_classes, only: :show
before_action :set_instance_presenter
before_action :set_expires_in, only: [:show, :more, :terms]
Expand All @@ -16,53 +14,42 @@ def show; end

def more
flash.now[:notice] = I18n.t('about.instance_actor_flash') if params[:instance_actor]

toc_generator = TOCGenerator.new(@instance_presenter.site_extended_description)

@contents = toc_generator.html
@table_of_contents = toc_generator.toc
@blocks = DomainBlock.with_user_facing_limitations.by_severity if display_blocks?
end

def terms; end

def blocks
@show_rationale = Setting.show_domain_blocks_rationale == 'all'
@show_rationale |= Setting.show_domain_blocks_rationale == 'users' && !current_user.nil? && current_user.functional?
@blocks = DomainBlock.with_user_facing_limitations.order('(CASE severity WHEN 0 THEN 1 WHEN 1 THEN 2 WHEN 2 THEN 0 END), reject_media, domain').to_a
end
helper_method :display_blocks?
helper_method :display_blocks_rationale?
helper_method :public_fetch_mode?
helper_method :new_user

private

def require_open_federation!
not_found if whitelist_mode?
end

def check_blocklist_enabled
not_found if Setting.show_domain_blocks == 'disabled'
end

def blocklist_account_required?
Setting.show_domain_blocks == 'users'
def display_blocks?
Setting.show_domain_blocks == 'all' || (Setting.show_domain_blocks == 'users' && user_signed_in?)
end

def block_severity_text(block)
if block.severity == 'suspend'
I18n.t('domain_blocks.suspension')
else
limitations = []
limitations << I18n.t('domain_blocks.media_block') if block.reject_media?
limitations << I18n.t('domain_blocks.silence') if block.severity == 'silence'
limitations.join(', ')
end
def display_blocks_rationale?
Setting.show_domain_blocks_rationale == 'all' || (Setting.show_domain_blocks_rationale == 'users' && user_signed_in?)
end

helper_method :block_severity_text
helper_method :public_fetch_mode?

def new_user
User.new.tap do |user|
user.build_account
user.build_invite_request
end
end

helper_method :new_user

def set_instance_presenter
@instance_presenter = InstancePresenter.new
end
Expand Down
138 changes: 61 additions & 77 deletions app/javascript/styles/mastodon/about.scss
Original file line number Diff line number Diff line change
Expand Up @@ -17,109 +17,102 @@ $small-breakpoint: 960px;

.rich-formatting {
font-family: $font-sans-serif, sans-serif;
font-size: 16px;
font-size: 14px;
font-weight: 400;
font-size: 16px;
line-height: 30px;
line-height: 1.7;
word-wrap: break-word;
color: $darker-text-color;
padding-right: 10px;

a {
color: $highlight-text-color;
text-decoration: underline;

&:hover,
&:focus,
&:active {
text-decoration: none;
}
}

p,
li {
font-family: $font-sans-serif, sans-serif;
font-size: 16px;
font-weight: 400;
font-size: 16px;
line-height: 30px;
margin-bottom: 12px;
color: $darker-text-color;
}

a {
color: $highlight-text-color;
text-decoration: underline;
}
p {
margin-top: 0;
margin-bottom: .85em;

&:last-child {
margin-bottom: 0;
}
}

strong,
em {
strong {
font-weight: 700;
color: lighten($darker-text-color, 10%);
color: $secondary-text-color;
}

h1 {
font-family: $font-display, sans-serif;
font-size: 26px;
line-height: 30px;
font-weight: 500;
margin-bottom: 20px;
em {
font-style: italic;
color: $secondary-text-color;
}

small {
font-family: $font-sans-serif, sans-serif;
display: block;
font-size: 18px;
font-weight: 400;
color: lighten($darker-text-color, 10%);
}
code {
font-size: 0.85em;
background: darken($ui-base-color, 8%);
border-radius: 4px;
padding: 0.2em 0.3em;
}

h2 {
h1,
h2,
h3,
h4,
h5,
h6 {
font-family: $font-display, sans-serif;
font-size: 22px;
line-height: 26px;
margin-top: 1.275em;
margin-bottom: .85em;
font-weight: 500;
margin-bottom: 20px;
color: $secondary-text-color;
}

h1 {
font-size: 2em;
}

h2 {
font-size: 1.75em;
}

h3 {
font-family: $font-display, sans-serif;
font-size: 18px;
line-height: 24px;
font-weight: 500;
margin-bottom: 20px;
color: $secondary-text-color;
font-size: 1.5em;
}

h4 {
font-family: $font-display, sans-serif;
font-size: 16px;
line-height: 24px;
font-weight: 500;
margin-bottom: 20px;
color: $secondary-text-color;
font-size: 1.25em;
}

h5 {
font-family: $font-display, sans-serif;
font-size: 14px;
line-height: 24px;
font-weight: 500;
margin-bottom: 20px;
color: $secondary-text-color;
h5,
h6 {
font-size: 1em;
}

h6 {
font-family: $font-display, sans-serif;
font-size: 12px;
line-height: 24px;
font-weight: 500;
margin-bottom: 20px;
color: $secondary-text-color;
ul {
list-style: disc;
}

ol {
list-style: decimal;
}

ul,
ol {
margin-left: 20px;
margin: 0;
padding: 0;
padding-left: 2em;
margin-bottom: 0.85em;

&[type='a'] {
list-style-type: lower-alpha;
Expand All @@ -130,31 +123,22 @@ $small-breakpoint: 960px;
}
}

ul {
list-style: disc;
}

ol {
list-style: decimal;
}

li > ol,
li > ul {
margin-top: 6px;
}

hr {
width: 100%;
height: 0;
border: 0;
border-bottom: 1px solid rgba($ui-base-lighter-color, .6);
margin: 20px 0;
border-bottom: 1px solid lighten($ui-base-color, 4%);
margin: 1.7em 0;

&.spacer {
height: 1px;
border: 0;
}
}

& > :first-child {
margin-top: 0;
}
}

.information-board {
Expand Down Expand Up @@ -416,7 +400,7 @@ $small-breakpoint: 960px;
}

&__call-to-action {
background: darken($ui-base-color, 4%);
background: $ui-base-color;
border-radius: 4px;
padding: 25px 40px;
overflow: hidden;
Expand Down
62 changes: 62 additions & 0 deletions app/javascript/styles/mastodon/containers.scss
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,63 @@
grid-row: 3;
}

@media screen and (max-width: $no-gap-breakpoint) {
grid-gap: 0;
grid-template-columns: minmax(0, 100%);

.column-0 {
grid-column: 1;
}

.column-1 {
grid-column: 1;
grid-row: 3;
}

.column-2 {
grid-column: 1;
grid-row: 2;
}

.column-3 {
grid-column: 1;
grid-row: 4;
}
}
}

.grid-4 {
display: grid;
grid-gap: 10px;
grid-template-columns: 1fr 1fr 1fr 1fr;
grid-auto-columns: 25%;
grid-auto-rows: max-content;

.column-0 {
grid-column: 1 / 5;
grid-row: 1;
}

.column-1 {
grid-column: 1 / 4;
grid-row: 2;
}

.column-2 {
grid-column: 4;
grid-row: 2;
}

.column-3 {
grid-column: 2 / 5;
grid-row: 3;
}

.column-4 {
grid-column: 1;
grid-row: 3;
}

.landing-page__call-to-action {
min-height: 100%;
}
Expand Down Expand Up @@ -189,6 +246,11 @@
}

.column-3 {
grid-column: 1;
grid-row: 5;
}

.column-4 {
grid-column: 1;
grid-row: 4;
}
Expand Down
Loading

0 comments on commit c8280e8

Please sign in to comment.