{% extends "soc/base.html" %}
{% comment %}
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
{% endcomment %}

{% block scripts %}
{% if site_settings.feed_url %}
    <script type="text/javascript" src="http://www.google.com/jsapi"></script>
    <script type="text/javascript" src="/soc/content/js/blog.js"></script>
    <script type="text/javascript">

    google.load("feeds", "1");

    function initialize() {
      var blog = new BlogPreview(document.getElementById("blog"));
      blog.show("{{ site_settings.feed_url }}");
    }
    google.setOnLoadCallback(initialize);

    </script>
{% endif %}
{% endblock %}

{% block page_title %}
{% if site_document %}
{{ site_document.title }}
{% else %}
Default Title
{% endif %}
{% endblock %}

{% block header_title %}
{% if site_document %}
{{ site_document.title }}
{% else %}
Default Header
{% endif %}
{% endblock %}

{% block body %}
    {% if site_document %}
    {{ site_document.content|safe }}
    {% else %}
This is the default site home page that can be configured via the <a href="/site/home/edit">Site Settings</a> interface.  
The <a href="/site/home/edit">Site Settings</a> interface also provides a mechanism to select a feed to be displayed here.
You need to sign in as site Developer in order to change <a href="/site/home/edit">Site Settings</a>.
    {% endif %}
    {% if site_settings.feed_url %}
    <div id="blog"></div>
    {% endif %}
{% endblock %}