<|start_filename|>sentry_hipchat_ac/templates/sentry_hipchat_ac/assign_event.html<|end_filename|>
{% extends "sentry_hipchat_ac/layout.html"  %}
{% load sentry_helpers %}
{% block body %}
  <script>
    function openEvent(id) {
      var token = $('meta[name="token"]').attr('value');
      var params = 'signed_request=' + encodeURIComponent(token) + '&event=' + id;
      document.location.search = params;
    }

    AP.register({
      "message.sentry.assign-event": function(message) {
        openEvent(message.metadata.event);
      }
    });

    {% if dismiss_dialog %}
      AP.require('dialog', function(dialog) {
        dialog.close();
      });
    {% endif %}

    // don't ask ...
    $(function() {
      $('#assignee-select').on('change', function(e) {
        $('#assigned-to-field').val(this.value);
      });
    });
  </script>
  {% if event %}
  <div class="aui-page-panel" style="margin-top: 0;">
    <div class="aui-page-panel-inner">
      <section class="aui-panel-inner-content" style="padding: 20px 0">
        {% if assigned_to %}
          <div class="dialog-header">
            <h3>Currently assigned: {{ assigned_to.user.get_display_name }}</h3>
          </div>
        {% endif %}
        <form class="aui" action="" method="post">
          {% csrf_token %}
          <input type=hidden name=assigned_to id="assigned-to-field">
          <div class="field-group">
            <label for="assignee-select">Assign to user</label>
            <aui-select
              id="assignee-select"
              name="assignee"
              no-empty-value
              placeholder="Assign to user">
              {% for member in member_list %}
              <aui-option value="{{ member.id }}">{{ member.get_display_name }}</aui-option>
              {% endfor %}
            </aui-select>
            <button type="submit" class="aui-button aui-button-primary" name="assign">Assign</button>
            {% if assigned_to %}
            <button type="submit" class="aui-button" name="deassign">Deassign</button>
            {% endif %}
          </div>
        </form>
      <section>
    </div>
  </div>
  {% endif %}
{% endblock %}


<|start_filename|>Makefile<|end_filename|>
develop:
	pip install -e .
	pip install "file://`pwd`#egg=sentry-hipchat[test]"

test: develop
	py.test


<|start_filename|>sentry_hipchat_ac/templates/sentry_hipchat_ac/configure.html<|end_filename|>
{% extends "sentry_hipchat_ac/configure_layout.html" %}
{% block body %}
  {% if tenant.auth_user %}
    <h3>Authorization</h3>
    <p>
      This room is authenticated as <strong>{{ tenant.auth_user.username }}</strong> and
      was authorized to have access to the following organizations:
      {% for org in available_orgs %}
        <strong>{{ org.name }}</strong>{% if not forloop.last %},{% endif %}
      {% endfor %}
      &nbsp; (<a href="{% url 'sentry-hipchat-ac-sign-out' %}?signed_request={{ context.signed_request }}">Deauthorize</a>)
    <h3>Notifications</h3>
    <p>
      Select the projects you want to notifications from:
    <form action="" method="post">
      {% csrf_token %}
      <div class="generic-list">
        {{ project_select_form.projects }}
      </div>
      <button type="submit" class="btn">Save changes</button>
    </form>
  {% else %}
    <p class="intro">
      Welcome to Sentry for Hipchat. Before we can get going, you need to
      associate this Hipchat room with a Sentry account.
    {% if current_user.is_authenticated %}
    <p>
      You are currently signed in as <strong>{{ current_user.username }}</strong>.
      <a href="{% url 'sentry-logout' %}">Change user?</a>
    <h3>Choose which organizations the integration will have access to:</h3>
    <form action="" method="post">
      {% csrf_token %}
      <div class="generic-list">
        {{ grant_form.orgs.errors }}
        {{ grant_form.orgs }}
      </div>
      <button type="submit" class="btn">Grant access</button>
    </form>
    {% else %}
    <p>
      <a href="{% url 'sentry-login' %}" class="btn centered">Connect with Sentry</a>
    </p>
    {% endif %}
  {% endif %}
{% endblock %}
