* WIP: add a creatore settings form * WIP: updat the controller to use the Creator Settings FOREM * feat: use the creator settings form for the new action * feat: add some default values for the new action * a note about form data * update the initiaize function to set some default values * feat: update the form to use the model data * feat: permit adn use the attributes within creator_settings_form * update the flash error * refactor: require and permit parameters * chore: use booleans, set defaults and validate the form * spec: update all the creator_settings tests * chore: remove comment * refactor: use self * feat: aggregate failures' * chore: remove the logo uploader in the controller * refactor: update error handling * feat: update the wasy the controller handles success and error * chore: remove the resource errors * feat: show flash message on new line * fix: use a redirect so that we can get back to /new * refactor: pass these values through as they seem to be caching whne setting them as default * chore: change default values * spec: update tests * Fix CreatorSettingsForm specs * fix: use a boolean for public * spec: add another test for the success var * fix: radio button labels to correspond + cyress specs * spec: update based on new changes * spec: update the params and the expected output * spec: update the comments and status * feat: no need for the initialize as we use Active Record Attributes * feat: update the tac and coc to be persisted when ticked * fix: amend spec * blank space * Message Co-authored-by: Michael Kohl <me@citizen428.net>
29 lines
1.3 KiB
Ruby
29 lines
1.3 KiB
Ruby
module Settings
|
|
# Basic UX settings that can be overridden 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 :index_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: true
|
|
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
|