Commit 7ce0968a authored by Connor Shea's avatar Connor Shea

Re-implement page-specific JS in a better way.

This makes larger libraries more cacheable and will allow us to use SRI with the dynamically included libraries.
parent 8ef64958
......@@ -50,7 +50,7 @@
#= require_directory ./ci
#= require_directory ./commit
#= require_directory ./extensions
#= require_directory ./lib
#= require_directory ./lib/.
#= require_directory ./u2f
#= require_directory .
#= require fuzzaldrin-plus
......
......@@ -4,5 +4,4 @@
# It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
# the compiled file.
#
#= require Chart
#= require_tree .
#= require raphael
#= require g.raphael
#= require g.bar
# This is a manifest file that'll be compiled into including all the files listed below.
# Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
# be included in the compiled file accessible from http://example.com/assets/application.js
# It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
# the compiled file.
#
#= require d3
#= require_tree .
......@@ -30,11 +30,8 @@
= javascript_include_tag "application", integrity: true
-# FIXME: SRI doesn't apply to the dynamically-generated per-page
-# JavaScript due to a bug in sprockets-rails.
-# See https://github.com/rails/sprockets-rails/issues/359
- if page_specific_javascripts
= javascript_include_tag page_specific_javascripts, {"data-turbolinks-track" => true}
- if :page_specific_javascripts
= yield :page_specific_javascripts
= csrf_meta_tags
......
.nav-links.sub-nav
%ul{ class: (container_class) }
- page_specific_javascripts asset_path("graphs/application.js")
- content_for :page_specific_javascripts do
= javascript_include_tag 'lib/chart/application.js', {integrity: true, "data-turbolinks-track" => true}
= javascript_include_tag 'graphs/application.js', {integrity: true, "data-turbolinks-track" => true}
= nav_link(action: :show) do
= link_to 'Contributors', namespace_project_graph_path
= nav_link(action: :commits) do
......
- page_title "Network", @ref
- page_specific_javascripts asset_path("network/application.js")
- content_for :page_specific_javascripts do
= javascript_include_tag 'lib/raphael/application.js', {integrity: true, "data-turbolinks-track" => true}
= javascript_include_tag 'network/application.js', {integrity: true, "data-turbolinks-track" => true}
= render "projects/commits/head"
= render "head"
%div{ class: (container_class) }
......
- page_title @user.name
- page_description @user.bio
- page_specific_javascripts asset_path("users/application.js")
- content_for :page_specific_javascripts do
= javascript_include_tag 'lib/d3/application.js', {integrity: true, "data-turbolinks-track" => true}
= javascript_include_tag 'users/application.js', {integrity: true, "data-turbolinks-track" => true}
- header_title @user.name, user_path(@user)
- @no_container = true
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment