Sha256: 8aa3eb9b334f57a038cbbf3789b7e59dc118471942f4268fd66b040d3f6c7bdb

Contents?: true

Size: 753 Bytes

Versions: 26

Compression:

Stored size: 753 Bytes

Contents

class CamaleonCms::Theme < CamaleonCms::TermTaxonomy
  # attrs:
  #   slug => plugin key
  cama_define_common_relationships('Theme')
  belongs_to :site, class_name: "CamaleonCms::Site", foreign_key: :parent_id

  default_scope { where(taxonomy: :theme) }

  before_validation :fix_name
  before_destroy :destroy_custom_fields

  # return theme settings configured in config.json
  def settings
    PluginRoutes.theme_info(self.slug)
  end

  # return the path to the settings file for current theme
  def settings_file
    File.join(self.settings["path"], "views/admin/settings").to_s
  end

  private
  def fix_name
    self.name = self.slug unless self.name.present?
  end

  def destroy_custom_fields
    self.get_field_groups.destroy_all
  end

end

Version data entries

26 entries across 26 versions & 2 rubygems

Version Path
camaleon_cms-2.5.3.1 app/models/camaleon_cms/theme.rb
camaleon_cms-2.5.3 app/models/camaleon_cms/theme.rb
camaleon_cms-2.5.2 app/models/camaleon_cms/theme.rb
camaleon_cms_rails6-2.5.0 app/models/camaleon_cms/theme.rb
camaleon_cms-2.5.1 app/models/camaleon_cms/theme.rb
camaleon_cms-2.5.0 app/models/camaleon_cms/theme.rb
camaleon_cms-2.4.6.9 app/models/camaleon_cms/theme.rb
camaleon_cms-2.4.6.8 app/models/camaleon_cms/theme.rb
camaleon_cms-2.4.6.7 app/models/camaleon_cms/theme.rb
camaleon_cms-2.4.6.6 app/models/camaleon_cms/theme.rb
camaleon_cms-2.4.6.5 app/models/camaleon_cms/theme.rb
camaleon_cms-2.4.6.4 app/models/camaleon_cms/theme.rb
camaleon_cms-2.4.6.3 app/models/camaleon_cms/theme.rb
camaleon_cms-2.4.6.2 app/models/camaleon_cms/theme.rb
camaleon_cms-2.4.6.1 app/models/camaleon_cms/theme.rb
camaleon_cms-2.4.6.0 app/models/camaleon_cms/theme.rb
camaleon_cms-2.4.5.14 app/models/camaleon_cms/theme.rb
camaleon_cms-2.4.5.13 app/models/camaleon_cms/theme.rb
camaleon_cms-2.4.5.12 app/models/camaleon_cms/theme.rb
camaleon_cms-2.4.5.11 app/models/camaleon_cms/theme.rb