mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
UX: Wiggle invalid form elements. Don't allow a site title of Discourse
This commit is contained in:
@@ -30,7 +30,11 @@ class Wizard
|
||||
step.add_field(id: 'site_description', type: 'text', required: true, value: SiteSetting.site_description)
|
||||
|
||||
step.on_update do |updater|
|
||||
updater.apply_settings(:title, :site_description)
|
||||
updater.ensure_changed(:title)
|
||||
|
||||
if updater.errors.blank?
|
||||
updater.apply_settings(:title, :site_description)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
@@ -39,6 +39,10 @@ class Wizard
|
||||
errors.add(id, e.message)
|
||||
end
|
||||
|
||||
def ensure_changed(id)
|
||||
errors.add(id, '') if @fields[id] == SiteSetting.defaults[id]
|
||||
end
|
||||
|
||||
def apply_settings(*ids)
|
||||
ids.each {|id| apply_setting(id)}
|
||||
end
|
||||
|
Reference in New Issue
Block a user