Work on provider manager and UI

This commit is contained in:
2020-10-18 19:36:26 +03:00
parent c8b2ef77e6
commit 45d50a1bff
11 changed files with 219 additions and 63 deletions

View File

@ -0,0 +1,22 @@
{% extends 'YtManagerApp/controls/modal.html' %}
{% load crispy_forms_tags %}
{% block modal_title %}
{{ provider.name }} configuration
{% endblock modal_title %}
{% block modal_content %}
<form action="{% url 'modal_provider_config' provider.id %}" method="post">
{% csrf_token %}
{{ block.super }}
</form>
{% endblock %}
{% block modal_body %}
{{ form | crispy }}
{% endblock modal_body %}
{% block modal_footer %}
<input class="btn btn-primary" type="submit" value="Save">
<input class="btn btn-secondary" type="button" value="Cancel" data-dismiss="modal" aria-label="Cancel">
{% endblock modal_footer %}

View File

@ -3,34 +3,48 @@
{% block body %}
<div class="row">
{% for provider in providers %}
{% if provider.is_configured %}
<div class="provider-wrapper col-2">
<button class="btn btn-light ">
<img class="provider-logo"
src="{% static provider.image_src %}"
title="{{ provider.name }}">
</button>
</div>
{% endif %}
{% endfor %}
{% if have_unconfigured %}
<div class="provider-wrapper col-2 dropdown">
<button id="btnAddProvider"
class="btn btn-light"
type="button"
data-toggle="dropdown"
aria-haspopup="true" aria-expanded="false">
<span class="provider-logo typcn typcn-plus"
title="Add provider">
</span>
</button>
</div>
{% endif %}
</div>
{% if have_configured %}
<section>
<h3>Configured providers</h3>
<div class="row">
{% for provider in providers %}
{% if provider.is_configured %}
<div class="provider-wrapper col-2">
<button class="btn btn-light"
data-modal="modal"
data-modal-url="{% url 'modal_provider_config' provider.id %}">
<img class="provider-logo"
src="{% static provider.image_src %}"
title="{{ provider.name }}">
{% if provider.has_error %}
<span class="typcn typcn-warning provider-status text-warning"></span>
{% else %}
<span class="typcn typcn-tick provider-status text-success"></span>
{% endif %}
</button>
</div>
{% endif %}
{% endfor %}
</div>
</section>
{% endif %}
{% if have_unconfigured %}
<h3>Not configured</h3>
<div class="row">
{% for provider in providers %}
{% if not provider.is_configured %}
<div class="provider-wrapper col-2">
<button class="btn btn-light"
data-modal="modal"
data-modal-url="{% url 'modal_provider_config' provider.id %}">
<img class="provider-logo"
src="{% static provider.image_src %}"
title="{{ provider.name }}">
</button>
</div>
{% endif %}
{% endfor %}
</div>
{% endif %}
{% endblock %}