Class: Appearance

Inherits:
ApplicationRecord show all
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

WithUploads::FILE_UPLOADERS

Constants included from CacheMarkdownField

CacheMarkdownField::INVALIDATED_BY

Constants inherited from ApplicationRecord

ApplicationRecord::MAX_PLUCK

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

Instance Method Summary collapse

Methods included from WithUploads

#retrieve_upload

Methods included from FastDestroyAll::Helpers

#perform_fast_destroy

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

#cache!

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

#serializable_hash

Class Method Details

.current_without_cacheObject

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_pathObject



93
94
95
# File 'app/models/appearance.rb', line 93

def favicon_path
  logo_system_path(favicon, 'favicon')
end

#header_logo_pathObject



89
90
91
# File 'app/models/appearance.rb', line 89

def header_logo_path
  logo_system_path(, 'header_logo')
end

#logo_pathObject



81
82
83
# File 'app/models/appearance.rb', line 81

def logo_path
  logo_system_path(, 'logo')
end

#pwa_icon_pathObject



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

Returns:

  • (Boolean)


101
102
103
# File 'app/models/appearance.rb', line 101

def show_footer?
  footer_message.present?
end

#show_header?Boolean

Returns:

  • (Boolean)


97
98
99
# File 'app/models/appearance.rb', line 97

def show_header?
  header_message.present?
end

#single_appearance_rowObject



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_keyObject



105
106
107
# File 'app/models/appearance.rb', line 105

def uploads_sharding_key
  {}
end