diff options
author | Jacob Schatz <jschatz@gitlab.com> | 2018-02-16 20:12:01 +0000 |
---|---|---|
committer | Jacob Schatz <jschatz@gitlab.com> | 2018-02-16 20:12:01 +0000 |
commit | b236348388c46c0550ec6844df35ec2689c4060b (patch) | |
tree | e1adf536398251ced2ff059e921d87b1d3a8c980 /app/helpers/webpack_helper.rb | |
parent | 8462e229a2fb9a6411a73c363e05fba959535502 (diff) | |
parent | b63674e2c677bdbfc40b89d06af86771a807f6d1 (diff) | |
download | gitlab-ce-b236348388c46c0550ec6844df35ec2689c4060b.tar.gz |
Merge branch 'fix-more-dispatcher-stuff' into 'master'
Remove more route-based chunks from dispatcher.js
See merge request gitlab-org/gitlab-ce!16901
Diffstat (limited to 'app/helpers/webpack_helper.rb')
-rw-r--r-- | app/helpers/webpack_helper.rb | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/app/helpers/webpack_helper.rb b/app/helpers/webpack_helper.rb index 9d071f2d59a..8bcced70d63 100644 --- a/app/helpers/webpack_helper.rb +++ b/app/helpers/webpack_helper.rb @@ -7,17 +7,24 @@ module WebpackHelper def webpack_controller_bundle_tags bundles = [] - segments = [*controller.controller_path.split('/'), controller.action_name].compact - until segments.empty? + action = case controller.action_name + when 'create' then 'new' + when 'update' then 'edit' + else controller.action_name + end + + route = [*controller.controller_path.split('/'), action].compact + + until route.empty? begin - asset_paths = gitlab_webpack_asset_paths("pages.#{segments.join('.')}", extension: 'js') + asset_paths = gitlab_webpack_asset_paths("pages.#{route.join('.')}", extension: 'js') bundles.unshift(*asset_paths) rescue Webpack::Rails::Manifest::EntryPointMissingError # no bundle exists for this path end - segments.pop + route.pop end javascript_include_tag(*bundles) |