Class: Appearance
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- Appearance
- Includes:
- CacheMarkdownField, CacheableAttributes, WithUploads
- Defined in:
- app/models/appearance.rb
Constant Summary collapse
- ALLOWED_PWA_ICON_SCALER_WIDTHS =
[192, 512].freeze
Constants included from WithUploads
Constants included from CacheMarkdownField
CacheMarkdownField::INVALIDATED_BY
Constants inherited from ApplicationRecord
Constants included from HasCheckConstraints
HasCheckConstraints::NOT_NULL_CHECK_PATTERN
Constants included from ResetOnColumnErrors
ResetOnColumnErrors::MAX_RESET_PERIOD
Instance Attribute Summary
Attributes included from CacheMarkdownField
#skip_markdown_cache_validation
Class Method Summary collapse
-
.current_without_cache ⇒ Object
Overrides CacheableAttributes.current_without_cache.
Instance Method Summary collapse
- #favicon_path ⇒ Object
- #header_logo_path ⇒ Object
- #logo_path ⇒ Object
- #pwa_icon_path ⇒ Object
- #pwa_icon_path_scaled(width) ⇒ Object
- #show_footer? ⇒ Boolean
- #show_header? ⇒ Boolean
- #single_appearance_row ⇒ Object
- #uploads_sharding_key ⇒ Object
Methods included from WithUploads
Methods included from FastDestroyAll::Helpers
Methods included from AfterCommitQueue
#run_after_commit, #run_after_commit_or_now
Methods included from CacheMarkdownField
#attribute_invalidated?, #banzai_render_context, #cached_html_for, #cached_html_up_to_date?, #can_cache_field?, #invalidated_markdown_cache?, #latest_cached_markdown_version, #mentionable_attributes_changed?, #mentioned_filtered_user_ids_for, #parent_user, #refresh_markdown_cache, #refresh_markdown_cache!, #rendered_field_content, #skip_project_check?, #store_mentions!, #store_mentions?, #store_mentions_after_commit?, #updated_cached_html_for
Methods included from CacheableAttributes
Methods inherited from ApplicationRecord
===, cached_column_list, #create_or_load_association, current_transaction, declarative_enum, default_select_columns, delete_all_returning, #deleted_from_database?, id_in, id_not_in, iid_in, nullable_column?, primary_key_in, #readable_by?, safe_ensure_unique, safe_find_or_create_by, safe_find_or_create_by!, sharding_keys, #to_ability_name, underscore, where_exists, where_not_exists, with_fast_read_statement_timeout, without_order
Methods included from ResetOnColumnErrors
#reset_on_union_error, #reset_on_unknown_attribute_error
Methods included from Gitlab::SensitiveSerializableHash
Class Method Details
.current_without_cache ⇒ Object
Overrides CacheableAttributes.current_without_cache
67 68 69 |
# File 'app/models/appearance.rb', line 67 def self.current_without_cache first end |
Instance Method Details
#favicon_path ⇒ Object
93 94 95 |
# File 'app/models/appearance.rb', line 93 def favicon_path logo_system_path(favicon, 'favicon') end |
#header_logo_path ⇒ Object
89 90 91 |
# File 'app/models/appearance.rb', line 89 def header_logo_path logo_system_path(header_logo, 'header_logo') end |
#logo_path ⇒ Object
81 82 83 |
# File 'app/models/appearance.rb', line 81 def logo_path logo_system_path(logo, 'logo') end |
#pwa_icon_path ⇒ Object
85 86 87 |
# File 'app/models/appearance.rb', line 85 def pwa_icon_path logo_system_path(pwa_icon, 'pwa_icon') end |
#pwa_icon_path_scaled(width) ⇒ Object
75 76 77 78 79 |
# File 'app/models/appearance.rb', line 75 def pwa_icon_path_scaled(width) return unless pwa_icon_path.present? pwa_icon_path + "?width=#{width}" end |
#show_footer? ⇒ Boolean
101 102 103 |
# File 'app/models/appearance.rb', line 101 def .present? end |
#show_header? ⇒ Boolean
97 98 99 |
# File 'app/models/appearance.rb', line 97 def show_header? .present? end |
#single_appearance_row ⇒ Object
71 72 73 |
# File 'app/models/appearance.rb', line 71 def single_appearance_row errors.add(:base, _('Only 1 appearances row can exist')) if self.class.any? end |
#uploads_sharding_key ⇒ Object
105 106 107 |
# File 'app/models/appearance.rb', line 105 def uploads_sharding_key {} end |