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.
This commit is contained in:
parent
8ef649588b
commit
7ce0968a52
10 changed files with 17 additions and 16 deletions
|
@ -50,7 +50,7 @@
|
||||||
#= require_directory ./ci
|
#= require_directory ./ci
|
||||||
#= require_directory ./commit
|
#= require_directory ./commit
|
||||||
#= require_directory ./extensions
|
#= require_directory ./extensions
|
||||||
#= require_directory ./lib
|
#= require_directory ./lib/.
|
||||||
#= require_directory ./u2f
|
#= require_directory ./u2f
|
||||||
#= require_directory .
|
#= require_directory .
|
||||||
#= require fuzzaldrin-plus
|
#= 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
|
# It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
||||||
# the compiled file.
|
# the compiled file.
|
||||||
#
|
#
|
||||||
#= require Chart
|
|
||||||
#= require_tree .
|
#= require_tree .
|
||||||
|
|
1
app/assets/javascripts/lib/chart/application.js.coffee
Normal file
1
app/assets/javascripts/lib/chart/application.js.coffee
Normal file
|
@ -0,0 +1 @@
|
||||||
|
#= require Chart
|
1
app/assets/javascripts/lib/d3/application.js.coffee
Normal file
1
app/assets/javascripts/lib/d3/application.js.coffee
Normal file
|
@ -0,0 +1 @@
|
||||||
|
#= require d3
|
3
app/assets/javascripts/lib/raphael/application.js.coffee
Normal file
3
app/assets/javascripts/lib/raphael/application.js.coffee
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
#= require raphael
|
||||||
|
#= require g.raphael
|
||||||
|
#= require g.bar
|
|
@ -1,8 +1,2 @@
|
||||||
# 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 .
|
#= require_tree .
|
||||||
|
|
|
@ -30,11 +30,8 @@
|
||||||
|
|
||||||
= javascript_include_tag "application", integrity: true
|
= javascript_include_tag "application", integrity: true
|
||||||
|
|
||||||
-# FIXME: SRI doesn't apply to the dynamically-generated per-page
|
- if :page_specific_javascripts
|
||||||
-# JavaScript due to a bug in sprockets-rails.
|
= yield :page_specific_javascripts
|
||||||
-# See https://github.com/rails/sprockets-rails/issues/359
|
|
||||||
- if page_specific_javascripts
|
|
||||||
= javascript_include_tag page_specific_javascripts, {"data-turbolinks-track" => true}
|
|
||||||
|
|
||||||
= csrf_meta_tags
|
= csrf_meta_tags
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
.nav-links.sub-nav
|
.nav-links.sub-nav
|
||||||
%ul{ class: (container_class) }
|
%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
|
= nav_link(action: :show) do
|
||||||
= link_to 'Contributors', namespace_project_graph_path
|
= link_to 'Contributors', namespace_project_graph_path
|
||||||
= nav_link(action: :commits) do
|
= nav_link(action: :commits) do
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
- page_title "Network", @ref
|
- 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 "projects/commits/head"
|
||||||
= render "head"
|
= render "head"
|
||||||
%div{ class: (container_class) }
|
%div{ class: (container_class) }
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
- page_title @user.name
|
- page_title @user.name
|
||||||
- page_description @user.bio
|
- 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)
|
- header_title @user.name, user_path(@user)
|
||||||
- @no_container = true
|
- @no_container = true
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue