mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-26 13:46:22 +00:00
no cambiar el diseño si es personalizado
This commit is contained in:
parent
a1d240d406
commit
e3ca85d5b2
2 changed files with 7 additions and 1 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue