Sha256: 6b6e420e4808b0df878e29515c9aa3295d65ed986ccfbeb80aeacd9b9a5f5b1d

Contents?: true

Size: 784 Bytes

Versions: 1

Compression:

Stored size: 784 Bytes

Contents

module CamaleonCms
  class 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(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 = slug if name.blank?
    end

    def destroy_custom_fields
      get_field_groups.destroy_all
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
camaleon_cms-2.6.0 app/models/camaleon_cms/theme.rb