summaryrefslogtreecommitdiff
path: root/app/helpers/webpack_helper.rb
diff options
context:
space:
mode:
authorJacob Schatz <jschatz@gitlab.com>2018-02-16 20:12:01 +0000
committerJacob Schatz <jschatz@gitlab.com>2018-02-16 20:12:01 +0000
commitb236348388c46c0550ec6844df35ec2689c4060b (patch)
treee1adf536398251ced2ff059e921d87b1d3a8c980 /app/helpers/webpack_helper.rb
parent8462e229a2fb9a6411a73c363e05fba959535502 (diff)
parentb63674e2c677bdbfc40b89d06af86771a807f6d1 (diff)
downloadgitlab-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.rb15
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)