5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-22 19:26:21 +00:00

no cambiar el diseño si es personalizado

This commit is contained in:
f 2020-06-25 16:37:34 -03:00
parent a1d240d406
commit e3ca85d5b2
2 changed files with 7 additions and 1 deletions

View file

@ -8,6 +8,8 @@
class Design < ApplicationRecord
extend Mobility
NO_THEMES = %w[sutty-theme-none sutty-theme-custom].freeze
translates :name, type: :string, locale_accessors: true
translates :description, type: :text, locale_accessors: true
@ -16,4 +18,8 @@ class Design < ApplicationRecord
validates :name, presence: true, uniqueness: true
validates :gem, presence: true, uniqueness: true
validates :description, presence: true
def no_theme?
NO_THEMES.include? gem
end
end

View file

@ -414,7 +414,7 @@ class Site < ApplicationRecord
# TODO: Guardar la configuración también, quizás aprovechando algún
# método de ActiveRecord para que lance un salvado recursivo.
def sync_attributes_with_config!
config.theme = design.gem unless design.gem == 'sutty-theme-custom'
config.theme = design.gem unless design.no_theme?
config.description = description
config.title = title
config.url = url