Skip to content

Commit

Permalink
Final cherry pick fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
angusmcleod committed Jun 15, 2022
1 parent 3136b77 commit 7cf99f2
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
8 changes: 3 additions & 5 deletions app/controllers/custom_wizard/wizard.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class CustomWizard::WizardController < ::ActionController::Base
include CanonicalURL::ControllerExtensions
include GlobalPath

prepend_view_path(Rails.root.join('plugins', 'discourse-custom-wizard', 'views'))
prepend_view_path(Rails.root.join('plugins', 'discourse-custom-wizard', 'app', 'views'))
layout :set_wizard_layout

before_action :preload_wizard_json
Expand Down Expand Up @@ -47,10 +47,8 @@ def skip
result = { success: 'OK' }

if current_user && wizard.can_access?
submission = wizard.current_submission

if submission.present? && submission.redirect_to
result.merge!(redirect_to: submission.redirect_to)
if redirect_to = wizard.current_submission&.redirect_to
result.merge!(redirect_to: redirect_to)
end

wizard.cleanup_on_skip!
Expand Down
18 changes: 18 additions & 0 deletions plugin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,24 @@ def process_require_tree_discourse_directive(path = ".")
end
end

## Override necessary due to 'assets/javascripts/wizard', particularly its tests.
def each_globbed_asset
if @path
root_path = "#{File.dirname(@path)}/assets/javascripts/discourse"

Dir.glob(["#{root_path}/**/*"]).sort.each do |f|
f_str = f.to_s
if File.directory?(f)
yield [f, true]
elsif f_str.end_with?(".js.es6") || f_str.end_with?(".hbs") || f_str.end_with?(".hbr")
yield [f, false]
elsif transpile_js && f_str.end_with?(".js")
yield [f, false]
end
end
end
end

after_initialize do
%w[
../lib/custom_wizard/engine.rb
Expand Down

0 comments on commit 7cf99f2

Please sign in to comment.