5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-25 13:06:22 +00:00
panel/app/models/design.rb

27 lines
759 B
Ruby
Raw Permalink Normal View History

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
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
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
def no_theme?
NO_THEMES.include? gem
end
2019-07-17 22:18:48 +00:00
end