Sha256: 5b5cfab35add9ddf92a709133de46bc48d1867ccfe4dab6a20d1648addb3833d

Contents?: true

Size: 762 Bytes

Versions: 15

Compression:

Stored size: 762 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.html.erb").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

15 entries across 15 versions & 1 rubygems

Version Path
camaleon_cms-2.4.5.3 app/models/camaleon_cms/theme.rb
camaleon_cms-2.4.5.2 app/models/camaleon_cms/theme.rb
camaleon_cms-2.4.5.1 app/models/camaleon_cms/theme.rb
camaleon_cms-2.4.5 app/models/camaleon_cms/theme.rb
camaleon_cms-2.4.4.7 app/models/camaleon_cms/theme.rb
camaleon_cms-2.4.4.6 app/models/camaleon_cms/theme.rb
camaleon_cms-2.4.4.5 app/models/camaleon_cms/theme.rb
camaleon_cms-2.4.4.4 app/models/camaleon_cms/theme.rb
camaleon_cms-2.4.4.3 app/models/camaleon_cms/theme.rb
camaleon_cms-2.4.4.2 app/models/camaleon_cms/theme.rb
camaleon_cms-2.4.4.1 app/models/camaleon_cms/theme.rb
camaleon_cms-2.4.4 app/models/camaleon_cms/theme.rb
camaleon_cms-2.4.3.13 app/models/camaleon_cms/theme.rb
camaleon_cms-2.4.3.12 app/models/camaleon_cms/theme.rb
camaleon_cms-2.4.3.11 app/models/camaleon_cms/theme.rb