{%- extends 'classic/index.html.j2' -%}

{%- block html_head -%}
{{ super() }}
<meta name="viewport" content="width=device-width, initial-scale=1">
<script type="text/javascript">
function hide_unhide(name) {
    var checks = document.querySelectorAll("input.custom_block_"+name);
    for (check of checks) {
        check.checked = !check.checked;
    }
}
</script>
{%- endblock html_head -%}

{%- block html_head_css -%}
{{ super() }}
{{ resources.include_css("static/custom.css") }}
{%- if nb.metadata.extra_css_file is defined -%}
<style>@import '{{ nb.metadata.extra_css_file }}'</style>
{%- endif -%}
{%- endblock html_head_css -%}

{%- block body_header -%}
{{ super() }}
    <h1 id="main-title">{{ nb.metadata.course_title }}</h1>
{%- endblock body_header -%}

{% block body_footer %}
{{ super() }}
{% endblock body_footer %}

{% block markdowncell %}
<div class="cell border-box-sizing text_cell rendered{% if cell.custom_class %} {{ cell.custom_class }}{% endif %}">
{%- if cell.metadata.custom_block is defined -%}
<input type="checkbox" id="custom_block{{ cell.metadata.custom_block.id }}" class="custom_block_checkbox custom_block_{{ cell.metadata.custom_block.name }}" checked>
<div class="prompt custom_block_prompt">
    <img src="{{ cell.metadata.custom_block.image }}" class="icon" onclick="hide_unhide('{{ cell.metadata.custom_block.name }}')">
</div>
{%- elif resources.global_content_filter.include_input_prompt-%}
    {{ self.empty_in_prompt() }}
{%- endif -%}
<div class="inner_cell{% if cell.metadata.custom_block is defined %} collapsible custom_block_{{ cell.metadata.custom_block.name }}{%- endif -%}">
<div class="text_cell_render border-box-sizing rendered_html">
{{ cell.source  | markdown2html | strip_files_prefix }}
</div>
</div>
</div>
{% endblock markdowncell %}

{% block in_prompt -%}
<div class="prompt input_prompt">
    {%- if cell.metadata.writefile is defined -%}
        {{ cell.metadata.writefile }}
    {%- elif cell.metadata.runcommand is defined -%}
        $
    {%- elif cell.execution_count is defined -%}
        In&nbsp;[{{ cell.execution_count|replace(None, "&nbsp;") }}]:
    {%- else -%}
        In&nbsp;[&nbsp;]:
    {%- endif -%}
</div>
{%- endblock in_prompt %}
