Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix CLP top-bar assets not linked to asset_host when configured #2320

Merged
merged 2 commits into from Jul 22, 2016
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions app/controllers/landing_page_controller.rb
Expand Up @@ -250,6 +250,7 @@ def render_landing_page(default_locale:, locale_param:, structure:)
sections: denormalizer.to_tree(structure, root: "composition"),
community_context: community_context(request, landing_page_locale),
feature_flags: FeatureFlagHelper.feature_flags,
asset_host: APP_CONFIG.asset_host,
}
end

Expand Down
7 changes: 4 additions & 3 deletions app/views/landing_page/landing_page.erb
Expand Up @@ -129,9 +129,10 @@
<%= javascripts[:translations] %>
</script>

<%= stylesheet_link_tag 'app-bundle' %>
<%= javascript_include_tag 'vendor-bundle' %>
<%= javascript_include_tag 'app-bundle' %>
<% asset_host = local_assigns.key?(:asset_host) ? asset_host : nil %>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if asset_host can not be found? Assets are served from rails?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the link to the asset will be /assets/something, so served from the same domain as the app.

Copy link
Contributor

@lyyder lyyder Jul 22, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<%= stylesheet_link_tag asset_path('app-bundle', type: :stylesheet, host: asset_host) %>
<%= javascript_include_tag asset_path('vendor-bundle', type: :javascript, host: asset_host) %>
<%= javascript_include_tag asset_path('app-bundle', type: :javascript, host: asset_host) %>

<%= render partial: "topbar",
locals: {props: topbar[:props],
Expand Down