1
0
mirror of https://github.com/tabler/tabler.git synced 2026-07-27 05:24:38 +04:00

charts code in footer, capture_global tag

This commit is contained in:
codecalm
2019-10-25 19:12:31 +02:00
committed by Alex Safian
parent 86a85250bc
commit 82026108e0
7 changed files with 48 additions and 4 deletions
+2 -1
View File
@@ -91,7 +91,8 @@
"dependencies": {
"apexcharts": "3.10.0",
"autosize": "4.0.2",
"bootstrap": "twbs/bootstrap#8d56c19",
"bootstrap": "twbs/bootstrap#9ee9b8a",
"chart.js": "^2.8.0",
"imask": "5.2.1",
"jquery": "3.4.1",
"jqvmap": "1.5.1",
+3 -1
View File
@@ -7,6 +7,7 @@
"selectize/dist/js/standalone/selectize.min.js",
"apexcharts/dist/apexcharts.min.js",
"chart.js/dist/Chart.min.js",
"jqvmap/dist/jquery.vmap.min.js",
"jqvmap/dist/maps/jquery.vmap.world.js",
"jqvmap/dist/maps/jquery.vmap.usa.js",
@@ -16,6 +17,7 @@
],
"css": [
"jqvmap/dist/jqvmap.min.css",
"selectize/dist/css/selectize.css"
"selectize/dist/css/selectize.css",
"chart.js/dist/Chart.min.css"
]
}
+2
View File
@@ -1,3 +1,4 @@
{% capture_global scripts %}
{% removeemptylines %}
{% assign data = site.data.charts[include.chart-id] %}
@@ -127,3 +128,4 @@ document.addEventListener("DOMContentLoaded", function(event) {
</script>
{% endif %}
{% endremoveemptylines %}
{% endcapture_global %}
+1 -1
View File
@@ -17,7 +17,7 @@
{% assign link = include.link | default: false %}
{% assign el = 'span' %}
{% if link %}{% assign el = 'a' %}{% endif %}
<{{ el }} class="avatar{% if include['size'] %} avatar-{{ include['size'] }}{% endif %}{% if include.thumb %} avatar-thumb{% endif %}{% if include.class %} {{ include.class }}{% endif %}{% if include.shape %} {{ include.shape }}{% endif %}{% if include.color %} bg-{{ include.color }}-lt{% endif %}"{% if src %} style="background-image: url({{ site.base }}{{ src }})"{% endif %}>{% if include.status %}
<{{ el }} class="avatar{% if include['size'] %} avatar-{{ include['size'] }}{% endif %}{% if include.thumb %} avatar-thumb{% endif %}{% if include.class %} {{ include.class }}{% endif %}{% if include.shape %} {{ include.shape }}{% endif %}{% if include.color %} bg-{{ include.color }}-lt{% endif %}"{% if src %} style="background-image: url({{ site.base }}/{{ src }})"{% endif %}>{% if include.status %}
<span class="badge bg-{{ include.status }}">{% if include.status-text %}{{ include.status-text }}{% elsif include.status-icon %}{% include ui/icon.html icon=include.status-icon class="avatar-status-icon" %}{% endif %}</span>
{% endif %}{% if placeholder %}{{ placeholder }}{% elsif include.icon %} {% include ui/icon.html icon=include.icon class="avatar-icon" %}{% endif %}</{{ el }}>
{% endremoveemptylines %}
+2
View File
@@ -44,6 +44,8 @@
{% endif %}
{% endif %}
{{ site.capture_global.scripts }}
<script>document.body.style.display = 'block';</script>
</body>
</html>
-1
View File
@@ -22,5 +22,4 @@ module Jekyll
Jekyll::Hooks.register :documents, :pre_render do |doc, jekyll|
jekyll.site['base'] = get_dir(doc.relative_path)
end
end
+38
View File
@@ -0,0 +1,38 @@
module Jekyll
module Tags
class CaptureGlobal < Liquid::Block
def initialize(tag_name, text, tokens)
super
@text = text.strip
end
def render(context)
if $capture_global[@text] === nil
$capture_global[@text] = '';
end
$capture_global[@text] += super.strip + "\n\n"
''
end
end
end
Jekyll::Hooks.register :site, :after_init do |page, jekyll|
$capture_global = {}
end
Jekyll::Hooks.register :pages, :pre_render do |page, jekyll|
jekyll.site['capture_global'] = $capture_global
end
Jekyll::Hooks.register :pages, :post_render do |page, jekyll|
$capture_global = {}
end
end
Liquid::Template.register_tag('capture_global', Jekyll::Tags::CaptureGlobal)