{% extends "eventum_admin.html" %}

{% block title %}Welcome to Eventum{% endblock %}
{% block pagetitle %}Welcome to Eventum{% endblock %}

{% block topbarclass %}full{% endblock %}

{% block css %}
{{ super() }}
<link rel="stylesheet" type="text/css" href="{{ url_for('eventum.static', filename='css/lib/plus.css') }}">
{% endblock %}

{% block fonts %}
<link href="//fonts.googleapis.com/css?family=Roboto" rel="stylesheet" type="text/css">
{% endblock %}

{% block js %}
{{ super() }}
<script type="text/javascript">
(function() {
    var po = document.createElement('script');
    po.type = 'text/javascript'; po.async = true;
    po.src = '//apis.google.com/js/client:plusone.js?onload=render';
    var s = document.getElementsByTagName('script')[0];
    s.parentNode.insertBefore(po, s);
})();

function render() {
    gapi.signin.render('plus-button', {
        'clientid': '{{ client_id }}',
        'cookiepolicy': 'single_host_origin',
        'requestvisibleactions': 'http://schemas.google.com/AddActivity',
        'scope': 'https://www.googleapis.com/auth/plus.login https://www.googleapis.com/auth/plus.profile.emails.read',
        'redirecturi':"oauth2callback",
        {% if reauthorize %}
        'explanation-of-this-tag':"https://developers.google.com/+/web/signin/server-side-flow#step_6_send_the_authorization_code_to_the_server",
        'approvalprompt':"force",
        {% endif %}
        'accesstype':"offline",
        'cookiepolicy':"single_host_origin",
        'callback':"onSignInCallback"
    });
}
</script>
{% endblock %}

{% block content %}
<div id="gSignInWrapper">
    <div id="plus-button-wrapper">
        <div id="plus-button" class="customGPlusSignIn">
            <span class="plus-icon"></span>
            <span class="plus-text">Sign In</span>
        </div>
    </div>
    <ul id="errors">
        <li class="error hidden" id="not-whitelisted">
            <h4>Not Whitelisted</h4>
            <p>Your email address "<span id="email"></span>" has not been whitelisted in Eventum.  Please contact the system administator to add your email.</p>
            <p class="retry"><a href="/admin/disconnect" class="button">Log out</a> to try again.</p>
        </li>
        <li class="error hidden" id="unknown-error">
            <h4 id="error-msg">Unknown Error</h4>
            <p>We ran into a problem logging you in.  If the problem persists, try disabling AdBlock.</p>
            <p class="retry"><a href="/admin/disconnect" class="button">Log out</a> to try again.</p>
        </li>
    </ul>
</div>
<!-- Run check if logged in automatically on page load -->
<script type="text/javascript">var STATE = "{{ state }}", NEXT = "{{ next }}";</script>
<script type="text/javascript" src="{{url_for('eventum.static', filename='js/auth/plus.js') }}"></script>
{% endblock %}
