Skip to content

Commit

Permalink
[maud] Add compact mode
Browse files Browse the repository at this point in the history
Signed-off-by: lindwurm <lindwurm.q@gmail.com>
  • Loading branch information
lindwurm committed Nov 12, 2022
1 parent 861050d commit 619998a
Show file tree
Hide file tree
Showing 10 changed files with 57 additions and 1 deletion.
1 change: 1 addition & 0 deletions app/controllers/settings/preferences_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ def user_settings_params
:setting_bigger_publish,
:setting_wider_column,
:setting_always_send_emails,
:setting_compact_padding,
notification_emails: %i(follow follow_request reblog favourite mention report pending_account trending_tag appeal),
interactions: %i(must_be_follower must_be_following must_be_following_dm)
)
Expand Down
1 change: 1 addition & 0 deletions app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ def body_classes
output << (current_account&.user&.setting_reduce_motion ? 'reduce-motion' : 'no-reduce-motion')
output << 'bigger-publish' if current_account&.user&.setting_bigger_publish
output << 'wider-column' if (current_account&.user&.setting_advanced_layout && current_account&.user&.setting_wider_column)
output << 'compact-padding' if current_account&.user&.setting_compact_padding
output << 'rtl' if locale_direction == 'rtl'
output.reject(&:blank?).join(' ')
end
Expand Down
1 change: 1 addition & 0 deletions app/javascript/styles/application.scss
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,4 @@

@import 'mods/bigger-publish';
@import 'mods/wider-column';
@import 'mods/compact-padding';
40 changes: 40 additions & 0 deletions app/javascript/styles/mods/compact-padding.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
.compact-padding {
.status__prepend {
padding-top: 6px;
padding-bottom: 0;
}

.status {
padding: 12px;
padding-bottom: 6px;
}

.status-reply, .muted {
padding-top: 6px;
}

.status__info {
margin-bottom: 6px;
}

.status__content {
padding-top: 0;
}

.status__action-bar {
margin-top: 6px;
justify-content: flex-start;
}

.status .media-gallery {
margin-top: 6px;
}

.status .attachment-list {
margin-top: 2px;
}

.notification__message {
padding: 12px 12px 0;
}
}
5 changes: 5 additions & 0 deletions app/lib/user_settings_decorator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ def process_update
user.settings['bigger_publish'] = bigger_publish_preference if change?('setting_bigger_publish')
user.settings['wider_column'] = wider_column_preference if change?('setting_wider_column')
user.settings['always_send_emails'] = always_send_emails_preference if change?('setting_always_send_emails')
user.settings['compact_padding'] = compact_padding_preference if change?('setting_compact_padding')
end

def merged_notification_emails
Expand Down Expand Up @@ -147,6 +148,10 @@ def always_send_emails_preference
boolean_cast_setting 'setting_always_send_emails'
end

def compact_padding_preference
boolean_cast_setting 'setting_compact_padding'
end

def boolean_cast_setting(key)
ActiveModel::Type::Boolean.new.cast(settings[key])
end
Expand Down
2 changes: 1 addition & 1 deletion app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ class User < ApplicationRecord
:expand_spoilers, :default_language, :aggregate_reblogs, :show_application,
:advanced_layout, :use_blurhash, :use_pending_items, :trends, :crop_images,
:disable_swiping, :always_send_emails,
:bigger_publish, :wider_column,
:bigger_publish, :wider_column, :compact_padding,
to: :settings, prefix: :setting, allow_nil: false

delegate :can?, to: :role
Expand Down
3 changes: 3 additions & 0 deletions app/views/settings/preferences/appearance/show.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
.fields-group
= f.input :setting_bigger_publish, as: :boolean, wrapper: :with_label, hint: true

.fields-group
= f.input :setting_compact_padding, as: :boolean, wrapper: :with_label, hint: true

%h4= t 'appearance.advanced_web_interface'

%p.hint= t 'appearance.advanced_web_interface_hint'
Expand Down
2 changes: 2 additions & 0 deletions config/locales/simple_form.en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ en:
setting_use_pending_items: Hide timeline updates behind a click instead of automatically scrolling the feed
setting_bigger_publish: Make button larger and easier to press
setting_wider_column: Equalize column widths to fit window or display
setting_compact_padding: Make padding/margin tighter like previous version
username: Your username will be unique on %{domain}
whole_word: When the keyword or phrase is alphanumeric only, it will only be applied if it matches the whole word
domain_allow:
Expand Down Expand Up @@ -217,6 +218,7 @@ en:
setting_use_pending_items: Slow mode
setting_bigger_publish: Use bigger publish button
setting_wider_column: Use wider columns
setting_compact_padding: Use more compact UI
severity: Severity
sign_in_token_attempt: Security code
title: Title
Expand Down
2 changes: 2 additions & 0 deletions config/locales/simple_form.ja.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ ja:
setting_use_pending_items: 新着があってもタイムラインを自動的にスクロールしないようにします
setting_bigger_publish: より大きく、押しやすくなった投稿ボタンを使用します
setting_wider_column: ウィンドウやディスプレイの幅に合わせてカラムの幅を等分します
setting_compact_padding: 従来のバージョンのものに近い、余白が狭めの表示に切り替えます
username: あなたのユーザー名は %{domain} の中で重複していない必要があります
whole_word: キーワードまたはフレーズが英数字のみの場合、単語全体と一致する場合のみ適用されるようになります
domain_allow:
Expand Down Expand Up @@ -217,6 +218,7 @@ ja:
setting_use_pending_items: 手動更新モード
setting_bigger_publish: より大きな投稿ボタンを使用する
setting_wider_column: より幅広なカラムを使用する
setting_compact_padding: よりコンパクトな表示にする
severity: 重大性
sign_in_token_attempt: セキュリティコード
title: タイトル
Expand Down
1 change: 1 addition & 0 deletions config/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ defaults: &defaults
require_invite_text: false
bigger_publish: false
wider_column: false
compact_padding: false
backups_retention_period: 7

development:
Expand Down

0 comments on commit 619998a

Please sign in to comment.