general: divide service_view template in common blocks (#11206)

This commit is contained in:
Frédéric Péters 2016-06-05 19:53:41 +02:00
parent 78e998eb05
commit 72ae98d529
20 changed files with 117 additions and 228 deletions

View File

@ -1,15 +1,7 @@
{% extends "passerelle/manage/service_view.html" %}
{% load i18n passerelle %}
{% block content %}
<p>
Service URL : {{ object.service_url }}
</p>
<div>
<h3>{% trans 'Endpoints' %}</h3>
{% block endpoints %}
<p>
{% blocktrans %}
The API is a partial view of <a href="http://wiki.openstreetmap.org/wiki/Nominatim">Nominatim</a>
@ -24,19 +16,10 @@ format.
<li>{% trans 'Reverse geocoding:' %} <a href="reverse?lat=48.833708&amp;lon=2.323349&amp;format=json"
>{{ site_base_uri }}{{ object.get_absolute_url }}reverse</a>?lat=<i>lat</i>&amp;lon=<i>lon</i>&amp;format=json</li>
</ul>
</div>
{% if perms.base.view_accessright %}
<div>
<h3>{% trans "Security" %}</h3>
{% endblock %}
{% block security %}
<p>
{% trans 'Accessing the listings is open.' %}
</p>
</div>
{% endif %}
</div>
{% endblock %}

View File

@ -1,21 +1,19 @@
{% extends "passerelle/manage/service_view.html" %}
{% load i18n passerelle %}
{% block content %}
{% block description %}
<p>
Service URL : {{ object.service_url }}
</p>
{% endblock %}
<div>
<h3>{% trans 'Endpoints' %}</h3>
{% block endpoints %}
<ul>
<li>{% trans 'Listing resources:' %} <a
>{{ site_base_uri }}{% url 'bdp-resources' slug=object.slug resources='resources' %}</a> (GET)</li>
<li>{% trans 'Creating a new user:' %} <a
>{{ site_base_uri }}{% url 'bdp-post-adherent' slug=object.slug %}</a> (POST)</li>
</ul>
</div>
<div>
<h3>{% trans 'Examples' %}</h3>
@ -38,18 +36,11 @@ Service URL : {{ object.service_url }}
</li>
</ul>
</div>
{% endblock %}
{% if perms.base.view_accessright %}
<div>
<h3>{% trans "Security" %}</h3>
{% block security %}
<p>
{% trans 'Accessing is limited to the following API users:' %}
</p>
{% access_rights_table resource=object permission='can_access' %}
{% endif %}
</div>
{% endblock %}

View File

@ -1,31 +1,22 @@
{% extends "passerelle/manage/service_view.html" %}
{% load i18n passerelle %}
{% block content %}
{% block description %}
<p>
Service URL : {{ object.url }}
</p>
{% endblock %}
<div>
<h3>{% trans 'Endpoints' %}</h3>
{% block endpoints %}
<ul>
<li>{% trans 'Register:' %} <a href="{% url 'choosit-register' slug=object.slug %}"
>{{ site_base_uri }}{% url 'choosit-register' slug=object.slug %}</a> (POST)</li>
</ul>
</div>
{% if perms.base.view_accessright %}
<div>
<h3>{% trans "Security" %}</h3>
{% endblock %}
{% block security %}
<p>
{% trans 'Accessing the listings is open, but posting requests is limited to the following API users:' %}
</p>
{% access_rights_table resource=object permission='can_post_request' %}
{% endif %}
</div>
{% endblock %}

View File

@ -1,14 +1,13 @@
{% extends "passerelle/manage/service_view.html" %}
{% load i18n passerelle %}
{% block content %}
{% block description %}
<p>
Server: {{ object.server }}
</p>
{% endblock %}
<div>
<h3>{% trans 'Endpoints' %}</h3>
{% block endpoints %}
<ul>
<li>{% trans 'Listing all sets:' %} <a href="{% url 'clicrdv-interventionsets' slug=object.slug %}"
>{{ site_base_uri }}{% url 'clicrdv-interventionsets' slug=object.slug %}</a></li>
@ -25,19 +24,12 @@ Server: {{ object.server }}
<li>{% trans 'Cancelling an appointment:' %} <a
>{{ site_base_uri }}{% url 'clicrdv-view' slug=object.slug %}<i>&lt;appointment_id&gt;</i>/cancel</a></li>
</ul>
</div>
{% if perms.base.view_accessright %}
<div>
<h3>{% trans "Security" %}</h3>
{% endblock %}
{% block security %}
<p>
{% trans 'Accessing the listings is open, but creation and cancellation of appointments requests is limited to the following API users:' %}
</p>
{% access_rights_table resource=object permission='can_manage_appointment' %}
{% endif %}
</div>
{% endblock %}

View File

@ -3,10 +3,11 @@
{% block content %}
<div>
<h3>{% trans 'Endpoints' %}</h3>
<ul>
{% block description %}
{% endblock %}
{% block endpoints %}
<ul>
<li>{% trans "Check user's family link:" %}
<a>{{ site_base_uri }}{% url 'concerto-view' slug=object.slug %}<i>familylink</i>/&lt;family_id&gt;</i>/<i>&lt;secret&gt;</i></a>
</li>
@ -36,19 +37,11 @@
POST on <a>{{ site_base_uri }}{% url 'concerto-view' slug=object.slug %}<i>invoice/&lt;invoice_id&gt;/&lt;invoice_hash&gt;</i></a> with the 'status' in the payload
</li>
</ul>
</div>
{% if perms.base.view_accessright %}
<div>
<h3>{% trans "Security" %}</h3>
{% endblock %}
{% block security %}
<p>
{% trans 'Accessing is limited to the following API users:' %}
</p>
{% access_rights_table resource=object permission='can_use_connector' %}
{% endif %}
</div>
{% endblock %}

View File

@ -1,11 +1,8 @@
{% extends "passerelle/manage/service_view.html" %}
{% load i18n passerelle %}
{% block content %}
<p>
Service URL : {{ object.service_url }}
</p>
{% block description %}
{{ block.super }}
{% if missing_phpserialize or missing_soappy %}
<div class="errors">
@ -15,9 +12,9 @@ Service URL : {{ object.service_url }}
</p>
</div>
{% endif %}
{% endblock %}
<div>
<h3>{% trans 'Endpoints' %}</h3>
{% block endpoints %}
<ul>
<li>{% trans 'Listing communes:' %} <a href="{% url 'generic-endpoint' connector="gdc" slug=object.slug endpoint="communes" %}"
>{{ site_base_uri }}{% url 'generic-endpoint' connector="gdc" slug=object.slug endpoint="communes" %}</a></li>
@ -28,19 +25,11 @@ Service URL : {{ object.service_url }}
<li>{% trans 'Posting a new request:' %} <a href="{% url 'gdc-post' slug=object.slug %}"
>{{ site_base_uri }}{% url 'gdc-post' slug=object.slug %}</a> (POST)</li>
</ul>
</div>
{% if perms.base.view_accessright %}
<div>
<h3>{% trans "Security" %}</h3>
{% endblock %}
{% block security %}
<p>
{% trans 'Accessing the listings is open, but posting requests is limited to the following API users:' %}
</p>
{% access_rights_table resource=object permission='can_post_request' %}
{% endif %}
</div>
{% endblock %}

View File

@ -1,8 +1,7 @@
{% extends "passerelle/manage/service_view.html" %}
{% load i18n passerelle %}
{% block content %}
{% block description %}
<p>
{% trans 'Pastell URL:' %} {{ object.url }}
</p>
@ -26,19 +25,12 @@
{% endif %}
(<a rel="popup" href="{% url 'pastell-fields' slug=object.slug %}">{% trans 'edit' %}</a>)
{% endif %}
{% endblock %}
{% if perms.base.view_accessright %}
<div>
<h3>{% trans "Security" %}</h3>
{% block security %}
<p>
{% trans 'Posting documents is limited to the following API users:' %}
</p>
{% access_rights_table resource=object permission='can_post_document' %}
{% endif %}
</div>
{% endblock %}

View File

@ -145,6 +145,10 @@ class BaseResource(models.Model):
return reverse('delete-connector',
kwargs={'connector': self.get_connector_slug(), 'slug': self.slug})
def get_description_fields(self):
return [(x, getattr(self, x.name, None)) for x in self._meta.get_fields() if x.name not in (
'id', 'title', 'slug', 'description', 'log_level', 'users')]
class AccessRight(models.Model):
codename = models.CharField(max_length=100, verbose_name='codename')

View File

@ -1,11 +1,10 @@
{% extends "passerelle/manage/service_view.html" %}
{% load i18n passerelle %}
{% block content %}
<div>
<h3>{% trans 'Endpoints' %}</h3>
{% block description %}
{% endblock %}
{% block endpoints %}
<ul>
<li>{% trans 'Check WS availability:' %} <a href="{% url 'agoraplus-ping' slug=object.slug %}"
>{{ site_base_uri }}{% url 'agoraplus-ping' slug=object.slug %}</a>[?debug]</li>
@ -203,12 +202,10 @@
<li><em>content_type</em> {% trans 'document must have this content-type' %}</li>
</ul>
</li>
</div>
{% if perms.base.view_accessright %}
<div>
<h3>{% trans "Security" %}</h3>
</ul>
{% endblock %}
{% block security %}
<p>
{% trans 'Access is limited to the following API users:' %}
</p>
@ -218,9 +215,4 @@
{% trans 'Sas access is limited to the following API users:' %}
</p>
{% access_rights_table resource=object permission='can_access_sas' %}
{% endif %}
</div>
{% endblock %}

View File

@ -1,10 +1,10 @@
{% extends "passerelle/manage/service_view.html" %}
{% load i18n passerelle %}
{% block content %}
{% block description %}
{% endblock %}
<div>
<h3>{% trans 'Endpoints' %}</h3>
{% block endpoints %}
<ul>
<li>{% trans 'Dump database (debug):' %} <a href="{% url 'fake-family-dump' slug=object.slug %}"
>{{ site_base_uri }}{% url 'fake-family-dump' slug=object.slug %}</a></li>
@ -18,8 +18,6 @@
>{{ site_base_uri }}{% url 'fake-family-key' slug=object.slug key='key' %}?NameID=...</a></li>
<em>key</em> = <em>adults</em>, <em>children</em>, …
</ul>
</div>
<div>
<h3>Contents</h3>
@ -67,19 +65,12 @@
</tbody>
</table>
</div>
{% endpoints %}
{% if perms.base.view_accessright %}
<div>
<h3>{% trans "Security" %}</h3>
{% block security %}
<p>
{% trans 'Access is limited to the following API users:' %}
</p>
{% access_rights_table resource=object permission='can_access' %}
{% endif %}
</div>
{% endblock %}

View File

@ -1,10 +1,10 @@
{% extends "passerelle/manage/service_view.html" %}
{% load i18n passerelle %}
{% block content %}
{% block description %}
{% endblock %}
<div>
<h3>{% trans 'Endpoints' %}</h3>
{% block endpoints %}
<ul>
<li>{% trans 'Check WS availability:' %} <a href="{% url 'iparapheur-ping' slug=object.slug %}"
>{{ site_base_uri }}{% url 'iparapheur-ping' slug=object.slug %}</a>[?debug]</li>
@ -44,19 +44,11 @@
<em>5e6fc120-f2f7-4dfa-91d0-44414205a2b9</em> - file id
</li>
</ul>
</div>
{% if perms.base.view_accessright %}
<div>
<h3>{% trans "Security" %}</h3>
{% endblock %}
{% block security %}
<p>
{% trans 'Access is limited to the following API users:' %}
</p>
{% access_rights_table resource=object permission='can_access' %}
{% endif %}
</div>
{% endblock %}

View File

@ -1,29 +1,21 @@
{% extends "passerelle/manage/service_view.html" %}
{% load i18n passerelle %}
{% block content %}
{% block description %}
{% endblock %}
<div>
<h3>{% trans 'Endpoints' %}</h3>
{% block endpoints %}
<ul>
<li>{% trans 'Check WSDL availability:' %} <a href="{% url 'maarch-ping' slug=object.slug %}"
>{{ site_base_uri }}{% url 'maarch-ping' slug=object.slug %}</a>[?debug]</li>
<li>{% trans 'Store a resource:' %} POST <a href="{% url 'maarch-resource' slug=object.slug %}"
>{{ site_base_uri }}{% url 'maarch-resource' slug=object.slug %}</a> (payload: JSON w.c.s. formdata)</li>
</ul>
</div>
{% if perms.base.view_accessright %}
<div>
<h3>{% trans "Security" %}</h3>
{% endblock %}
{% block security %}
<p>
{% trans 'Access is limited to the following API users:' %}
</p>
{% access_rights_table resource=object permission='can_access' %}
{% endif %}
</div>
{% endblock %}

View File

@ -1,10 +1,10 @@
{% extends "passerelle/manage/service_view.html" %}
{% load i18n passerelle %}
{% block content %}
{% block description %}
{% endblock %}
<div>
<h3>{% trans 'Endpoints' %}</h3>
{% block endpoints %}
<ul>
<li>{% trans 'Get newsletters:' %}
{% url 'meyzieu-newsletters-types' slug=object.slug as types_url %}
@ -27,13 +27,12 @@
<ul>
</ul>
</li>
{% if perms.base.view_accessright %}
<div>
<h3>{% trans "Security" %}</h3>
</ul>
{% endblock %}
{% block security %}
<p>
{% trans 'Access is limited to the following API users:' %}
</p>
{% access_rights_table resource=object permission='can_access' %}
{% endif %}
</div>
{% endblock %}

View File

@ -1,29 +1,21 @@
{% extends "passerelle/manage/service_view.html" %}
{% load i18n passerelle %}
{% block content %}
{% block description %}
{% endblock %}
<div>
<h3>{% trans 'Endpoints' %}</h3>
{% block endpoints %}
<ul>
<li>{% trans 'Check WSDL availability:' %} <a href="{% url 'seisin-by-email-ping' slug=object.slug %}"
>{{ site_base_uri }}{% url 'seisin-by-email-ping' slug=object.slug %}</a>[?debug]</li>
<li>{% trans 'Send a resource by email:' %} POST <a href="{% url 'seisin-by-email-resource' slug=object.slug %}"
>{{ site_base_uri }}{% url 'seisin-by-email-resource' slug=object.slug %}</a> (payload: JSON w.c.s. formdata)</li>
</ul>
</div>
{% if perms.base.view_accessright %}
<div>
<h3>{% trans "Security" %}</h3>
{% endblock %}
{% block security %}
<p>
{% trans 'Access is limited to the following API users:' %}
</p>
{% access_rights_table resource=object permission='can_access' %}
{% endif %}
</div>
{% endblock %}

View File

@ -1,10 +1,10 @@
{% extends "passerelle/manage/service_view.html" %}
{% load i18n passerelle %}
{% block content %}
{% block description %}
{% endblock %}
<div>
<h3>{% trans 'Endpoints' %}</h3>
{% block endpoints %}
<ul>
<li>
{%url 'solis-apa-integration' slug=object.slug as integration %}
@ -62,19 +62,11 @@
</ul>
</li>
</ul>
</div>
{% if perms.base.view_accessright %}
<div>
<h3>{% trans "Security" %}</h3>
{% endblock %}
{% block security %}
<p>
{% trans 'Access is limited to the following API users:' %}
</p>
{% access_rights_table resource=object permission='can_access' %}
{% endif %}
</div>
{% endblock %}

View File

@ -1,8 +1,10 @@
{% extends "passerelle/manage/service_view.html" %}
{% load i18n passerelle %}
{% block content %}
{% block description %}
{% endblock %}
{% block endpoints %}
<ul>
<li>{% trans 'Get invoice history list:' %}
{% url 'stub-invoices-invoices-history' slug=object.slug as invoices_history_url %}
@ -26,19 +28,11 @@
<a href="{{ payment_url }}">{{ site_base_uri }}{{ payment_url }}?NameID=...</a>
</li>
</ul>
</div>
{% if perms.base.view_accessright %}
<div>
<h3>{% trans "Security" %}</h3>
{% endblock %}
{% block security %}
<p>
{% trans 'Access is limited to the following API users:' %}
</p>
{% access_rights_table resource=object permission='can_access' %}
{% endif %}
</div>
{% endblock %}

View File

@ -1,10 +1,10 @@
{% extends "passerelle/manage/service_view.html" %}
{% load i18n passerelle %}
{% block content %}
{% block description %}
{% endblock %}
<div>
<h3>{% trans 'Endpoints' %}</h3>
{% block endpoints %}
<h4>{% trans "Family related" %}</h4>
<ul>
<li>{% trans 'Check WSDL availability:' %} <a href="{% url 'teamnet-axel-ping' slug=object.slug %}"
@ -59,19 +59,11 @@
</a>
</li>
</ul>
</div>
{% if perms.base.view_accessright %}
<div>
<h3>{% trans "Security" %}</h3>
{% endblock %}
{% block security %}
<p>
{% trans 'Access is limited to the following API users:' %}
</p>
{% access_rights_table resource=object permission='can_access' %}
{% endif %}
</div>
{% endblock %}

View File

@ -1,27 +1,21 @@
{% extends "passerelle/manage/service_view.html" %}
{% load i18n passerelle %}
{% block content %}
<div>
<h3>{% trans 'Endpoints' %}</h3>
{% block description %}
{% endblock %}
{% block endpoints %}
<ul>
<li>{% trans 'Call started' %} <a href="{% url 'tlmcom-call-start' slug=object.slug %}?caller=%2B3392323232&amp;callee=102"
>{{ site_base_uri }}{% url 'tlmcom-call-start' slug=object.slug %}?caller=+3392323232&amp;callee=102</a></li>
<li>{% trans 'Call stopped:' %} <a href="{% url 'tlmcom-call-stop' slug=object.slug %}?caller=%2B3392323232&amp;callee=102"
>{{ site_base_uri }}{% url 'tlmcom-call-stop' slug=object.slug %}?caller=+3392323232&amp;callee=102</a></li>
</ul>
</div>
{% if perms.base.view_accessright %}
<div>
<h3>{% trans "Security" %}</h3>
{% endblock %}
{% block security %}
<p>
{% trans 'Access is limited to the following API users:' %}
</p>
{% access_rights_table resource=object permission='can_access' %}
</div>
{% endif %}
{% endblock %}

View File

@ -2,7 +2,6 @@
{% load i18n passerelle %}
{% block content %}
<div>
{% if perms.base.view_accessright %}
<div>

View File

@ -18,7 +18,32 @@
{% block content %}
<div>
<div id="description">
{% block description %}
<p>
{{object.description}}
</p>
{% for field, value in object.get_description_fields %}
{% if value %}
<p>{{field.verbose_name}}{% trans ":" %} {{value}}</p>
{% endif %}
{% endfor %}
{% endblock %}
</div>
<div id="endpoints">
<h3>{% trans 'Endpoints' %}</h3>
{% block endpoints %}
{% endblock %}
</div>
<div id="security">
{% if perms.base.view_accessright %}
<h3>{% trans "Security" %}</h3>
{% block security %}
{% endblock %}
{% endif %}
</div>
{% endblock %}