2019-07-17 22:18:48 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
# El diseño de un sitio es la plantilla/tema. En este modelo cargamos
|
|
|
|
# las propiedades para poder verlas desde el panel y elegir un diseño
|
|
|
|
# para el sitio.
|
|
|
|
#
|
|
|
|
# TODO: Agregar captura de pantalla con ActiveStorage
|
|
|
|
class Design < ApplicationRecord
|
|
|
|
extend Mobility
|
|
|
|
|
2020-06-25 19:37:34 +00:00
|
|
|
NO_THEMES = %w[sutty-theme-none sutty-theme-custom].freeze
|
|
|
|
|
2019-07-17 22:18:48 +00:00
|
|
|
translates :name, type: :string, locale_accessors: true
|
|
|
|
translates :description, type: :text, locale_accessors: true
|
2020-08-11 21:52:53 +00:00
|
|
|
translates :credits, type: :text, locale_accessors: true
|
2019-07-17 22:18:48 +00:00
|
|
|
|
|
|
|
has_many :sites
|
|
|
|
|
|
|
|
validates :name, presence: true, uniqueness: true
|
|
|
|
validates :gem, presence: true, uniqueness: true
|
|
|
|
validates :description, presence: true
|
2020-06-25 19:37:34 +00:00
|
|
|
|
2021-05-29 16:25:06 +00:00
|
|
|
# Trae todos los temas disponibles.
|
|
|
|
scope :available_themes, -> { where.not(gem: NO_THEMES).pluck(:gem) }
|
|
|
|
|
2020-06-25 19:37:34 +00:00
|
|
|
def no_theme?
|
|
|
|
NO_THEMES.include? gem
|
|
|
|
end
|
2019-07-17 22:18:48 +00:00
|
|
|
end
|