{% extends "basic/layout.html" %}

{% set theme_css_files = [] %}

{% set theme_css_files = theme_css_files + [
    '_static/skuid.css',
    '_static/bootstrap.css'
  ]
%}

{% set css_files = css_files + theme_css_files %}

{% set script_files = script_files + [
    '_static/js/jquery-1.11.0.min.js',
    '_static/js/jquery-fix.js',
    '_static/js/bootstrap.js',
    '_static/js/skuid-sphinx.js'
  ]
%}

{%- set render_sidebar = (not embedded) and (not theme_nosidebar|tobool) and sidebars %}

{%- set bs_content_width = render_sidebar and "9" or "12"%}

{%- block doctype -%}
<!DOCTYPE html>
{%- endblock %}

{% macro navBar() %}
  {% include "navbar.html" %}
{% endmacro %}

{%- macro globalSidebar() %}
    {%- if render_sidebar %}

    <div class="sidebar-global" role="complementary">
      {%- for sidebartemplate in sidebars %}
        <div class="version-and-toc sticky-sidebar">
          {%- include 'version-select.html' %}
          {%- include 'globaltoc.html' %}
        </div>
      {%- endfor %}
    </div>

    {%- endif %}
{%- endmacro %}

{%- macro localSidebar() %}
    {%- if render_sidebar %}
    <div class="sidebar-local" role="complementary">
      {%- for sidebartemplate in sidebars %}
        {%- include 'localtoc.html' %}
      {%- endfor %}
    </div>
    {%- endif %}
{%- endmacro %}

{%- block extrahead %}
<meta charset='utf-8'>
<meta http-equiv='X-UA-Compatible' content='IE=edge,chrome=1'>
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1'>
<meta name="apple-mobile-web-app-capable" content="yes">
<script src="https://use.fontawesome.com/685baec918.js"></script>

{% if theme_analytics_id %}
<!-- Google Analytics -->
<script>
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');

  ga('create', '{{theme_analytics_id}}', 'auto');
  ga('create', '{{theme_analytics_id_docs}}', 'auto', 'docsTracker');
  ga('require', 'GTM-5BPVR8V');
  ga('send', 'pageview');
  ga('docsTracker.send', 'pageview');
</script>
{% endif %}

{% if theme_marketo_id %}
<script type="text/javascript">
  (function() {
    var didInit = false;
    function initMunchkin() {
      if(didInit === false) {
        didInit = true;
        Munchkin.init('{{ theme_marketo_id }}');
      }
    }
    var s = document.createElement('script');
    s.type = 'text/javascript';
    s.async = true;
    s.src = '//munchkin.marketo.net/munchkin.js';
    s.onreadystatechange = function() {
      if (this.readyState == 'complete' || this.readyState == 'loaded') {
        initMunchkin();
      }
    };
    s.onload = initMunchkin;
    document.getElementsByTagName('head')[0].appendChild(s);
  })();
</script>
<!-- Marketo UTM magic -->
<script type="text/javascript" src="https://www.skuid.com/wp-content/mu-plugins/core-plugin/resources/js/utms.js"></script>
{% endif %}

<link href="https://fonts.googleapis.com/css?family=Roboto:400,400i,500,500i" rel="stylesheet">

{% endblock %}

{# Silence the sidebar's, relbar's #}
{% block header %}{% endblock %}
{% block relbar1 %}{% endblock %}
{% block relbar2 %}{% endblock %}
{% block sidebarsourcelink %}{% endblock %}

{%- block content %}


<div id="app">
{{ navBar() }}
  {% if pagename == 'index' %}
  {% else %}
  {% if parents|length>=0 %}

    <nav aria-label="Breadcrumb" class="breadcrumb-nav" >
        <div class="nav-container">
        <ol>
          {%- for parent in parents %}
          <li><a class="breadcrumb" href="{{ parent.link|e }}">{{ parent.title }}</a></li>
          {%- endfor %}
          <li><p aria-current="page" class="breadcrumb title">{{ title }}</p></li>
        </ol>
      </div>
    </nav>
  {% endif %}

{% endif %}
{% if pagename == 'index' %}
    {% include 'landingpage.html' %}
{% else %}
  <div id="page-container" class="container">
    {% block sidebar1 %}{{ globalSidebar() }}{% endblock %}
    {% block sidebar2 %}{{ localSidebar() }}{% endblock %}
    <div id="main">
      <div id="mobile-global" aria-hidden="true">
        {% include 'mobile-globaltoc.html' %}
      </div>
      <div id="mobile-local" class="hide" aria-hidden="true">
        {% include 'mobile-localtoc.html' %}
      </div>
      {% block body %}
      {% endblock %}
    </div>
  </div>
{% endif %}
<!-- Algolia -->
<script src="https://cdn.jsdelivr.net/algoliasearch/3/algoliasearch.min.js"></script>
<script src="https://cdn.jsdelivr.net/autocomplete.js/0/autocomplete.min.js"></script>

<!-- Algolia template-->
<script>
  var client = algoliasearch('61R1U0YAQZ', '66f6a5ab961e9853c48afa683d800f92');
  var index = client.initIndex('{{theme_search_version_index}}');
  autocomplete('#navbar-search', { hint: false, debug: true }, [
    {
      source: autocomplete.sources.hits(index, { hitsPerPage: 5 }),
      displayKey: 'my_attribute',
      templates: {
        suggestion: function(suggestion) {
          var sugTemplate = `<p class="hit-name"><a href="${suggestion.url}">${suggestion._highlightResult.hierarchy.lvl1.value}</a></p><p class="hit-text">${suggestion._highlightResult.content.value}</p>`
          return sugTemplate;
      }
    }
  }
  ]).on('autocomplete:selected', function(event, suggestion, dataset) {
      if (isLatest == true) {
        fixedURL = suggestion.url.replace(/docs.skuid.com\/.*?\//,"docs.skuid.com/latest/");
        location.href = fixedURL
      } else {
            fixedURL = suggestion.url.replace(/docs.skuid.com\/.*?\//,"docs.skuid.com/v{{ theme_version }}/");
            location.href = fixedURL;
      }
  });
</script>

<!-- Version warning -->

<script type="text/html" id="version-warning">
  <div class="version-warning-box">
      <div class="version-warning-header"> <i class="fa fa-exclamation-triangle" aria-hidden="true"></i>
 Heads up!</div>
      <div class="version-warning-text">
        <p>If you selected this iteration of our documentation, you’re on an older version of Skuid and don’t have access to useful features available in the latest version. <a href="https://www.skuid.com/releases/salesforce/">Time to upgrade!</a></p>
        <p>Using <b>Skuid Platform</b>? <a href="https://docs.skuid.com" title="Go to latest" id="goToLatest">See the latest version of our docs.</a></p>
      </div>
    </div>
  </div>
</script>

{%- endblock %}

{%- block footer %}
  <footer>
    {% include "footer.html" %}
  </footer>
</div>
{%- endblock %}



