Class: Appearance

Inherits:
MainClusterwide::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 ResetOnUnionError

ResetOnUnionError::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, #local_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!, #updated_cached_html_for

Methods included from CacheableAttributes

#cache!

Methods inherited from ApplicationRecord

cached_column_list, #create_or_load_association, declarative_enum, default_select_columns, id_in, id_not_in, iid_in, pluck_primary_key, primary_key_in, #readable_by?, safe_ensure_unique, safe_find_or_create_by, safe_find_or_create_by!, #to_ability_name, underscore, where_exists, where_not_exists, with_fast_read_statement_timeout, without_order

Methods included from SensitiveSerializableHash

#serializable_hash

Class Method Details

.current_without_cacheObject

Overrides CacheableAttributes.current_without_cache



65
66
67
# File 'app/models/appearance.rb', line 65

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



69
70
71
72
73
# File 'app/models/appearance.rb', line 69

def single_appearance_row
  if self.class.any?
    errors.add(:base, _('Only 1 appearances row can exist'))
  end
end