{# Admin site customizations. #}
{% extends "admin/base.html" %}
{% load i18n %}
 
{% block title %}{{ title }} | {% trans 'AWX Admin' %}{% endblock %}

{% block extrastyle %}
{{ block.super }}
<link href="{{ STATIC_URL }}img/favicon.ico" rel="shortcut icon" />
<style type="text/css">
/* Heading and button background colors. */
#header
{
  background: #171717 !important;
}
.module h2,
#content-related .module h2,
.module caption,
.inline-group h2,
.button.default
{
  background: #171717 !important;
}
input[type="submit"].default,
.submit-row input.default
{
  background: #51a351 !important;
}
body
{
  background-color: #f5f5f5;
}
body h1, body h2, body h3 {
  color: #333;
}

/* Heading and button foreground colors. */
#branding h1
{
  color: white !important;
  margin: 0;
  padding-top: 4px;
  text-transform: uppercase;
  font-weight: normal;
}
#branding h1 img {
  height: 48px;
  width: auto;
  margin: -10px 8px -6px -2px;
}
#user-tools {
  padding-top: 1em;
}
.module h2,
.module h2 a,
#content-related .module h2,
.module caption,
.inline-group h2,
a.section,
a.section:link,
a.section:visited,
a.section:hover,
.button.default,
input[type="submit"].default,
.submit-row input.default
{
  color: white !important;
}

/* Link color. */
a,
a:link,
a:visited,
#changelist-filter a:hover,
a:hover
{
  color: #2773ae;
}

/* Button border color. */
.selector h2
{
  border-color: #171717 !important;
}
body .button.default,
body input[type="submit"].default,
body .submit-row input.default
{
  border: 1px solid #51a351;
  border-color: #7c7 #383 #383 #7c7;
}
#header {
  color: #ddd;
  border-bottom: none;
}
#header a:hover {
  color: #2078be;
  text-decoration: none;
}

/* Object Tools */
body .object-tools li {
  background: #888;
  border-radius: 8px;
}
body .object-tools li:hover {
  background: #aaa;
}
body .object-tools a:link,
body .object-tools a:visited,
body .object-tools a:hover,
body .object-tools li:hover a {
  background: transparent;
  text-decoration: none;
}
body .object-tools a.viewsitelink,
body .object-tools a.golink,
body .object-tools a.addlink {
  background: transparent;
  padding-right: 10px;
}
body .object-tools a.viewsitelink:hover,
body .object-tools a.golink:hover,
body .object-tools a.addlink:hover  {
  background: transparent;
}
body .object-tools a.viewsitelink:after,
body .object-tools a.golink:after {
  content: " \27a1";
}
body .object-tools a.addlink:after {
  content: " +";
}

a:hover,
a.section:hover
{
  text-decoration: underline;
}

tr.row1 {
  background-color: #f5f5f5;
}

ul.messagelist li {
  background-color: #ccddee;
}
.errornote {
  border-color: #b22222 !important;
  color: #b22222 !important;
  background-color: #fdc !important;
}
.errorlist li {
  border-color: #b22222 !important;
  background-color: #d24242 !important;
}
.errors {
  background-color: #fdc !important;
}
.errors input,
.errors select,
.errors textarea {
  border: 1px solid #b22222 !important;
}
pre.json-display, pre.result-display {
  display: inline-block;
  margin: 0;
  padding: 0;
  font-size: 0.9em;
}
pre.result-display {
  width: 75%;
  border: 1px solid #ccc;
  background: #444;
  color: #eee;
  max-height: 300px;
  overflow: auto;
}
#job_host_summaries-group table td.original p {
  display: none
}
#job_host_summaries-group table tr.has_original td {
  padding-top: 5px;
}
</style>
{% endblock %}

{% block extrahead %}
{{ block.super }}
{% endblock %}

{% block blockbots %}
{{ block.super }}
<script type="text/javascript">
var django = django || {};
if (django.jQuery) {
  (function($) {
    window.refreshJobStatus = function() {
      var status = $('.field-status p').text();
      if (status == 'Running' || status == 'Pending') {
        var url = '{{ request.path }}';
        $.get(url, function(data) {
          var selectors = [
            '.form-row.field-status',
            '.field-get_result_stdout_display pre',
            '.field-get_result_stderr_display pre',
            '.field-get_result_traceback_display pre',
            '.field-get_result_stdout_display pre',
            '#job_host_summaries-group',
            '#job_events-group',
          ]
          $.each(selectors, function(index, selector) {
            $(selector).html($(data).find(selector).html());
          });
          setTimeout('window.refreshJobStatus()', 5000);
        });
      }
    }
    // Update playbook list based on project selected.
    function onProjectChange() {
      var project_pk = $('select[name="project"]').val() || 0;
      $('select[name="playbook"] span option').unwrap();
      $('select[name="playbook"] option:not(.project-' + project_pk + '):not([value=""])').wrap('<span/>');
    }
    $(function() {
      $('select[name="project"]').each(onProjectChange).change(onProjectChange);
    })
    setTimeout('window.refreshJobStatus()', 2000);
  })(django.jQuery);
}
</script>
{% endblock %}

{% block branding %}
<h1 id="site-name"><img class="logo" src="{{ STATIC_URL }}img/logo.png">{% block branding_title %}{% trans 'AWX Admin' %}{% endblock %}</h1>
{% endblock %}

{% block userlinks %}
{{ block.super }}
{% endblock %}

{% block nav-global %}
{% if user.is_active and user.is_staff and not is_popup %}
{# Placeholder for version/hostname info. #}
{% endif %}
{{ block.super }}
{% endblock %}

{% block content_title %}
{{ block.super }}
{% endblock %}
