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

{% set theme_css_files = [] %}

{% set theme_css_files = theme_css_files + [
    '_static/skuid.css',
    '_static/skuid-ink-icons.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"%}

{%- macro globalSidebar() %}
    {%- if render_sidebar %}
    <div class="sidebar-global" role="complementary">
      {%- for sidebartemplate in sidebars %}
        <div class="version-and-toc sticky-sidebar">
          <div class="version-dropdowns">
            {%- include 'version-select.html' %}
            {%- include 'version-select-api.html' %}
          </div>
          {%- 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 doctype -%}
<!DOCTYPE html>
{%- endblock %}
{% macro navBar() %}
  {% include "navbar.html" %}
{% 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">
    {% if theme_noindex %}
      <meta name="robots" content="noindex">
    {% endif %}
    <script src="https://use.fontawesome.com/685baec918.js"></script>
    <link href="https://fonts.googleapis.com/css?family=Roboto:300,300i,400,400i,700" rel="stylesheet">
{% 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 %}

<!-- Intercom -->
{% if theme_intercom_id %}
  {%- include 'intercom-messenger.html' %}
{% endif %}

{% if theme_hubspot_id %}
  {% include "hubspot.html" %}
{% endif %}

<!-- Fullstory -->
{% if theme_fullstory_id %}
  {% include "fullstory.html" %}
{% endif %}

{% 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}}');
      var autocompleteDebug
      if (docs.env == 'local') {
        autocompleteDebug = true
      } else {
        autocompleteDebug = false
      }
      autocomplete('#navbar-search', { hint: false, debug: autocompleteDebug }, [
        {
          source: autocomplete.sources.hits(index, { hitsPerPage: 5 }),
          displayKey: 'my_attribute',
          templates: {
            header: `<div id="moreResults">Press <strong>Enter</strong> to see all results.</div>`,
            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) {
          // For local search results
          if (docs.env == 'local') {
            fixedURL = suggestion.url.replace(/https:\/\/docs.skuid.com\/.*?\/.*?\//, window.location.origin + "/");
          } else {
            if (isLatest == true) {
              fixedURL = suggestion.url.replace(/docs.skuid.com\/.*?\//,"docs.skuid.com/latest/");
            } else {
              if (isLatest == false) {
                if (docs.apiVerNum){
                  fixedURL = suggestion.url.replace(/docs.skuid.com\/.*?\//,"docs.skuid.com/v{{ theme_version }}/v{{theme_api_version}}/");
                } else {
                  fixedURL = suggestion.url.replace(/docs.skuid.com\/.*?\//,"docs.skuid.com/v{{ theme_version }}/");
                }
              }
            }
          }
          location.href = fixedURL
      })
      .on('autocomplete:cursorchanged', function() {
        $('#moreResults').html('Press <strong>Enter</strong> to go to result.')
      })
      .on('autocomplete:cursorremoved',function() {
          $('#moreResults').html('Press <strong>Enter</strong> to see all results.')
      });
    </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>

<!-- Pre-release warning -->

    <script type="text/html" id="version-prerelease">
      <div class="version-prerelease-box">
          <div class="version-prerelease-header"> <i class="fa fa-wrench" aria-hidden="true"></i>
     Heads up!</div>
          <div class="version-prerelease-text">
            <p>You are viewing pre-release documentation for the next update of Skuid.</p>
            <p><b>Features may change, and these docs may be updated at any time.</b>
          </div>
        </div>
      </div>
    </script>

{%- endblock %}

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



