* Admin-configurable display locale * Add i18n-js and namespacing * Basic tests and clean up * A few test adjustments * Update vendor cache * Fix a few tests * Fix a few tests * Update app/views/articles/_actions.html.erb Co-authored-by: Michael Kohl <citizen428@dev.to> * Update app/views/articles/_comments_actions.html.erb Co-authored-by: Michael Kohl <citizen428@dev.to> * Update app/views/articles/_single_story.html.erb Co-authored-by: Michael Kohl <citizen428@dev.to> * Update app/views/articles/_single_story.html.erb Co-authored-by: Michael Kohl <citizen428@dev.to> * Update app/views/comments/_comment_header.html.erb Co-authored-by: Michael Kohl <citizen428@dev.to> * Update app/views/layouts/_sidebar_tags.html.erb Co-authored-by: Michael Kohl <citizen428@dev.to> * Update app/views/listings/index.html.erb Co-authored-by: Michael Kohl <citizen428@dev.to> * Update spec/system/homepage/user_visits_homepage_articles_spec.rb Co-authored-by: Michael Kohl <citizen428@dev.to> * Update spec/system/user/view_user_index_spec.rb Co-authored-by: Michael Kohl <citizen428@dev.to> * Alphabetical locale page * Add activerecord custom validation error translations * Add i18n to webpacker * Fix a few tests * Adjust error messages * Add i18n-tasks * Adjust JS to get working with jest * Adjust the way translations are pulled in * Adjust jest tests * Remove time localization * Remove superfluous public js * Add basic tests for i18n application controller * Remove unnecessary content Co-authored-by: Michael Kohl <citizen428@dev.to>
28 lines
1.3 KiB
Ruby
28 lines
1.3 KiB
Ruby
module Settings
|
|
# Basic UX settings that can be overriden by individual user preferences.
|
|
class UserExperience < Base
|
|
self.table_name = :settings_user_experiences
|
|
|
|
HEX_COLOR_REGEX = /\A#(\h{6}|\h{3})\z/
|
|
|
|
# The default font for all users that have not chosen a custom font yet
|
|
setting :default_font, type: :string, default: "sans_serif"
|
|
setting :feed_strategy, type: :string, default: "basic"
|
|
# basic (current default), rich (cover image on all posts), compact (more minimal)
|
|
setting :feed_style, type: :string, default: "basic"
|
|
setting :home_feed_minimum_score, type: :integer, default: 0
|
|
setting :primary_brand_color_hex, type: :string, default: "#3b49df", validates: {
|
|
format: {
|
|
with: HEX_COLOR_REGEX,
|
|
message: "must be be a 3 or 6 character hex (starting with #)"
|
|
},
|
|
color_contrast: true
|
|
}
|
|
# a non-public forem will redirect all unauthenticated pages to the registration page.
|
|
# a public forem could have more fine-grained authentication (listings ar private etc.) in future
|
|
setting :public, type: :boolean, default: 0
|
|
setting :tag_feed_minimum_score, type: :integer, default: 0
|
|
setting :default_locale, type: :string, default: "en"
|
|
setting :display_in_directory, type: :boolean, default: true
|
|
end
|
|
end
|