Spiegel von
https://github.com/paviliondev/discourse-custom-wizard.git
synchronisiert 2024-11-12 21:22:54 +01:00
Name fallback is actually a bit confusing
Dieser Commit ist enthalten in:
Ursprung
9d16940b83
Commit
099880a85b
2 geänderte Dateien mit 3 neuen und 13 gelöschten Zeilen
|
@ -1,7 +1,7 @@
|
||||||
class CustomWizard::WizardController < ::ApplicationController
|
class CustomWizard::WizardController < ::ApplicationController
|
||||||
prepend_view_path(Rails.root.join('plugins', 'discourse-custom-wizard', 'views'))
|
prepend_view_path(Rails.root.join('plugins', 'discourse-custom-wizard', 'views'))
|
||||||
layout 'wizard'
|
layout 'wizard'
|
||||||
|
|
||||||
before_action :ensure_logged_in
|
before_action :ensure_logged_in
|
||||||
helper_method :wizard_page_title
|
helper_method :wizard_page_title
|
||||||
|
|
||||||
|
|
|
@ -40,18 +40,8 @@ class CustomWizard::Builder
|
||||||
def self.build_post(template, user, data)
|
def self.build_post(template, user, data)
|
||||||
post = template.gsub(/u\{(.*?)\}/) do |match|
|
post = template.gsub(/u\{(.*?)\}/) do |match|
|
||||||
result = ''
|
result = ''
|
||||||
|
result = user.send($1) if USER_FIELDS.include?($1)
|
||||||
if USER_FIELDS.include?($1)
|
result = user.user_profile.send($1) if PROFILE_FIELDS.include?($1)
|
||||||
result = user.send($1)
|
|
||||||
if result.blank? && $1 === 'name'
|
|
||||||
result = user.send('username')
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
if PROFILE_FIELDS.include?($1)
|
|
||||||
result = user.user_profile.send($1)
|
|
||||||
end
|
|
||||||
|
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
post.gsub!(/w\{(.*?)\}/) { |match| data[$1.to_sym] }
|
post.gsub!(/w\{(.*?)\}/) { |match| data[$1.to_sym] }
|
||||||
|
|
Laden …
In neuem Issue referenzieren