Compare commits
No commits in common. "17e0497ed86b5b198a5a22fa0d1747d604365144" and "8cd3605d48bffdad062d607ff28be9fa9ef7b896" have entirely different histories.
17e0497ed8
...
8cd3605d48
|
@ -14,8 +14,7 @@ class CustomContextMixin(ContextMixin):
|
||||||
context = super().get_context_data(**kwargs)
|
context = super().get_context_data(**kwargs)
|
||||||
# generate services menu items
|
# generate services menu items
|
||||||
services_menu = [
|
services_menu = [
|
||||||
{'icon': 'home', 'pattern_name': 'musician:dashboard', 'title': _('Dashboard')},
|
{'icon': 'globe-europe', 'pattern_name': 'musician:dashboard', 'title': _('Domains')},
|
||||||
{'icon': 'globe-europe', 'pattern_name': 'musician:domain-list', 'title': _('Domains')},
|
|
||||||
{'icon': 'envelope', 'pattern_name': 'musician:address-list', 'title': _('Mails')},
|
{'icon': 'envelope', 'pattern_name': 'musician:address-list', 'title': _('Mails')},
|
||||||
{'icon': 'mail-bulk', 'pattern_name': 'musician:mailing-lists', 'title': _('Mailing lists')},
|
{'icon': 'mail-bulk', 'pattern_name': 'musician:mailing-lists', 'title': _('Mailing lists')},
|
||||||
{'icon': 'database', 'pattern_name': 'musician:database-list', 'title': _('Databases')},
|
{'icon': 'database', 'pattern_name': 'musician:database-list', 'title': _('Databases')},
|
||||||
|
|
|
@ -9,7 +9,7 @@ def getsetting(name):
|
||||||
|
|
||||||
# provide a default value allowing to overwrite it for each type of account
|
# provide a default value allowing to overwrite it for each type of account
|
||||||
def allowed_resources_default_factory():
|
def allowed_resources_default_factory():
|
||||||
return {'mailbox': 2, 'database': 1, 'account': 2, 'nextcloud': 2,}
|
return {'mailbox': 2}
|
||||||
|
|
||||||
DEFAULTS = {
|
DEFAULTS = {
|
||||||
# allowed resources limit hardcoded because cannot be retrieved from the API.
|
# allowed resources limit hardcoded because cannot be retrieved from the API.
|
||||||
|
@ -21,17 +21,11 @@ DEFAULTS = {
|
||||||
# 'disk': 1024,
|
# 'disk': 1024,
|
||||||
# 'traffic': 2048,
|
# 'traffic': 2048,
|
||||||
'mailbox': 2,
|
'mailbox': 2,
|
||||||
'database': 1,
|
|
||||||
'account': 2,
|
|
||||||
'nextcloud': 2,
|
|
||||||
},
|
},
|
||||||
'ASSOCIATION': {
|
'ASSOCIATION': {
|
||||||
# 'disk': 5 * 1024,
|
# 'disk': 5 * 1024,
|
||||||
# 'traffic': 20 * 1024,
|
# 'traffic': 20 * 1024,
|
||||||
'mailbox': 10,
|
'mailbox': 10,
|
||||||
'database': 1,
|
|
||||||
'account': 8,
|
|
||||||
'nextcloud': 10,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
|
|
|
@ -157,7 +157,7 @@ h1.service-name {
|
||||||
|
|
||||||
.table.service-list {
|
.table.service-list {
|
||||||
margin-top: 2rem;
|
margin-top: 2rem;
|
||||||
/* table-layout: fixed; */
|
table-layout: fixed;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** TODO update theme instead of overriding **/
|
/** TODO update theme instead of overriding **/
|
||||||
|
@ -276,32 +276,11 @@ h1.service-name {
|
||||||
font-weight: 900;
|
font-weight: 900;
|
||||||
}
|
}
|
||||||
|
|
||||||
.card.resource-usage.resource-database h5.card-title:after {
|
|
||||||
content: "\f1c0";
|
|
||||||
font-weight: 900;
|
|
||||||
}
|
|
||||||
|
|
||||||
.card.resource-usage.resource-notifications h5.card-title:after {
|
.card.resource-usage.resource-notifications h5.card-title:after {
|
||||||
content: "\f0f3";
|
content: "\f0f3";
|
||||||
font-weight: 900;
|
font-weight: 900;
|
||||||
}
|
}
|
||||||
|
|
||||||
.card.resource-usage.resource-domains h5.card-title:after {
|
|
||||||
content: "\f7a2";
|
|
||||||
font-weight: 900;
|
|
||||||
}
|
|
||||||
|
|
||||||
.card.resource-usage.resource-nextcloud h5.card-title:after {
|
|
||||||
content: "\f0c2";
|
|
||||||
font-weight: 900;
|
|
||||||
}
|
|
||||||
|
|
||||||
.card.resource-usage.resource-list h5.card-title:after {
|
|
||||||
content: "\f674";
|
|
||||||
font-weight: 900;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
.card.card-profile .card-header {
|
.card.card-profile .card-header {
|
||||||
background: white;
|
background: white;
|
||||||
border-bottom: none;
|
border-bottom: none;
|
||||||
|
|
|
@ -12,14 +12,13 @@
|
||||||
|
|
||||||
|
|
||||||
<div class="tab-pane fade show active" id="addresses" role="tabpanel" aria-labelledby="addresses-tab">
|
<div class="tab-pane fade show active" id="addresses" role="tabpanel" aria-labelledby="addresses-tab">
|
||||||
<div class="table-responsive">
|
|
||||||
<table class="table service-list">
|
<table class="table service-list">
|
||||||
<!-- <colgroup>
|
<colgroup>
|
||||||
<col span="1" style="width: 25%;">
|
<col span="1" style="width: 25%;">
|
||||||
<col span="1" style="width: 25%;">
|
<col span="1" style="width: 25%;">
|
||||||
<col span="1" style="width: 25%;">
|
<col span="1" style="width: 25%;">
|
||||||
<col span="1" style="width: 25%;">
|
<col span="1" style="width: 25%;">
|
||||||
</colgroup> -->
|
</colgroup>
|
||||||
<thead class="thead-dark">
|
<thead class="thead-dark">
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="col">{% trans "Email" %}</th>
|
<th scope="col">{% trans "Email" %}</th>
|
||||||
|
@ -45,7 +44,6 @@
|
||||||
</tbody>
|
</tbody>
|
||||||
{% include "musician/components/table_paginator.html" %}
|
{% include "musician/components/table_paginator.html" %}
|
||||||
</table>
|
</table>
|
||||||
</div>
|
|
||||||
<a class="btn btn-primary mt-4 mb-4" href="{% url 'musician:address-create' %}">{% trans "New mail address" %}</a>
|
<a class="btn btn-primary mt-4 mb-4" href="{% url 'musician:address-create' %}">{% trans "New mail address" %}</a>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -10,97 +10,157 @@
|
||||||
<p>{% trans "It's the first time you log into the system, welcome on board!" %}</p>
|
<p>{% trans "It's the first time you log into the system, welcome on board!" %}</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<div class="alert alert-secondary" role="alert">
|
|
||||||
{% blocktrans %} The disk space of resources is updated weekly {% endblocktrans %}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Deck account -->
|
|
||||||
<div class="card-deck">
|
<div class="card-deck">
|
||||||
<div class="card resource-usage resource-account">
|
|
||||||
<div class="card-body">
|
|
||||||
<h5 class="card-title">{{ account.verbose_name }}</h5>
|
|
||||||
<div class="text-center">
|
|
||||||
{% if account.data and account.data.used %}
|
|
||||||
{{ account.data.used|floatformat }} {{ account.data.unit }}
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
{% if account.data.progres_bar %}
|
|
||||||
<div class="progress">
|
|
||||||
<div class="progress-bar bg-secondary" style="width: {{ account.data.percent }}%"></div>
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
{% if account.data.alert %}
|
|
||||||
<div class="text-center mt-4">
|
|
||||||
{{ account.data.alert }}
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
<ul class="list-group">
|
|
||||||
{% for name, obj_data in account.objects.items %}
|
|
||||||
<li class="list-group-item d-flex justify-content-between align-items-center">
|
|
||||||
{{ name }}
|
|
||||||
<span class="badge badge-primary badge-pill">{{ obj_data.ac.used }} {{ obj_data.ac.unit }}</span>
|
|
||||||
</li>
|
|
||||||
{% endfor %}
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Deck resources -->
|
|
||||||
<div class="card-deck">
|
|
||||||
|
|
||||||
{% for resource, usage in resource_usage.items %}
|
{% for resource, usage in resource_usage.items %}
|
||||||
<div class="card resource-usage resource-{{ resource }}">
|
<div class="card resource-usage resource-{{ resource }}">
|
||||||
<div class="card-body" data-toggle="collapse" data-target="#collapse-{{ resource }}">
|
<div class="card-body">
|
||||||
<h5 class="card-title">{{ usage.verbose_name }}</h5>
|
<h5 class="card-title">{{ usage.verbose_name }}</h5>
|
||||||
<div class="text-center">
|
{% include "musician/components/usage_progress_bar.html" with detail=usage.data %}
|
||||||
{% if usage.data and usage.data.used %}
|
|
||||||
{{ usage.data.used|floatformat }} {{ usage.data.unit }}
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
{% if usage.data.progres_bar %}
|
|
||||||
<div class="progress">
|
|
||||||
<div class="progress-bar bg-secondary" style="width: {{ usage.data.percent }}%"></div>
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
{% if usage.data.alert %}
|
{% if usage.data.alert %}
|
||||||
<div class="text-center mt-4">
|
<div class="text-center mt-4">
|
||||||
{{ usage.data.alert }}
|
{{ usage.data.alert }}
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="collapse-{{ resource }}" class="collapse">
|
|
||||||
<ul class="list-group">
|
|
||||||
{% for obj_data in usage.objects %}
|
|
||||||
<li class="list-group-item d-flex justify-content-between align-items-center">
|
|
||||||
{{ obj_data }}
|
|
||||||
<span class="badge badge-primary badge-pill">{{ obj_data.used }} {{ obj_data.resource.unit }}</span>
|
|
||||||
</li>
|
|
||||||
{% endfor %}
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
<div class="card resource-usage resource-notifications">
|
||||||
<!-- card domains -->
|
<div class="card-body">
|
||||||
<div class="card resource-usage resource-domains">
|
<h5 class="card-title">{% trans "Notifications" %}</h5>
|
||||||
<div class="card-body" data-toggle="collapse" data-target="#collapse-domains">
|
{% for message in notifications %}
|
||||||
<h5 class="card-title">{% trans "Domains" %}</h5>
|
<p class="card-text">{{ message }}</p>
|
||||||
<div class="text-center">{{ domains|length }} {% trans "Domains" %}</div>
|
{% empty %}
|
||||||
</div>
|
<p class="card-text">{% trans "There is no notifications at this time." %}</p>
|
||||||
<div id="collapse-domains" class="collapse">
|
{% endfor %}
|
||||||
<ul class="list-group">
|
|
||||||
{% for domain in domains %}
|
|
||||||
<li class="list-group-item d-flex justify-content-between align-items-center">
|
|
||||||
{{ domain }}
|
|
||||||
<a href="{% url 'musician:domain-list'%}" rel="noopener noreferrer"><i class="fas fa-external-link-alt"></i></a>
|
|
||||||
</li>
|
|
||||||
{% endfor %}
|
|
||||||
</ul>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
|
|
||||||
|
<h1 class="service-name">{% trans "Your domains and websites" %}</h1>
|
||||||
|
<p class="service-description">{% trans "Dashboard page description." %}</p>
|
||||||
|
|
||||||
|
{% for domain in domains %}
|
||||||
|
<div class="card service-card">
|
||||||
|
<div class="card-header">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md">
|
||||||
|
<strong>{{ domain.name }}</strong>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-8">
|
||||||
|
{% with domain.websites.0 as website %}
|
||||||
|
{% with website.contents.0 as content %}
|
||||||
|
<a href="{% url 'musician:domain-detail' domain.id %}" class="btn btn-primary">{% trans "View DNS records" %}</a>
|
||||||
|
<!-- <button type="button" class="btn text-secondary" data-toggle="modal" data-target="#configDetailsModal"
|
||||||
|
data-domain="{{ domain.name }}" data-website="{{ website|yesno:'true,false' }}" data-webapp-type="{{ content.webapp.type }}" data-root-path="{{ content.path }}"
|
||||||
|
data-url="{% url 'musician:domain-detail' domain.id %}">
|
||||||
|
{% trans "view configuration" %} <strong class="fas fa-tools"></strong>
|
||||||
|
</button> -->
|
||||||
|
{% endwith %}
|
||||||
|
{% endwith %}
|
||||||
|
</div>
|
||||||
|
<div class="col-md text-right">
|
||||||
|
{% comment "@slamora: orchestra doesn't have this information [won't fix] See issue #2" %}
|
||||||
|
{% trans "Expiration date" %}: <strong>{{ domain.expiration_date|date:"SHORT_DATE_FORMAT" }}</strong>
|
||||||
|
{% endcomment %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div><!-- /card-header-->
|
||||||
|
<div class="card-body row text-center">
|
||||||
|
<div class="col-6 col-md-3 col-lg-2 border-right">
|
||||||
|
<h4>{% trans "Mail" %}</h4>
|
||||||
|
<p class="card-text"><i class="fas fa-envelope fa-3x"></i></p>
|
||||||
|
<p class="card-text text-dark">
|
||||||
|
{{ domain.addresses.count }} {% trans "mail addresses created" %}
|
||||||
|
</p>
|
||||||
|
<a class="stretched-link" href="{% url 'musician:address-list' %}?domain={{ domain.id }}"></a>
|
||||||
|
</div>
|
||||||
|
<div class="col-6 col-md-3 col-lg-2 border-right">
|
||||||
|
<h4>{% trans "Mail list" %}</h4>
|
||||||
|
<p class="card-text"><i class="fas fa-mail-bulk fa-3x"></i></p>
|
||||||
|
<a class="stretched-link" href="{% url 'musician:mailing-lists' %}?domain={{ domain.id }}"></a>
|
||||||
|
</div>
|
||||||
|
<div class="col-6 col-md-3 col-lg-2 border-right">
|
||||||
|
<h4>{% trans "Software as a Service" %}</h4>
|
||||||
|
<p class="card-text"><i class="fas fa-fire fa-3x"></i></p>
|
||||||
|
<p class="card-text text-dark">{% trans "Nothing installed" %}</p>
|
||||||
|
<a class="stretched-link" href="{% url 'musician:saas-list' %}?domain={{ domain.id }}"></a>
|
||||||
|
</div>
|
||||||
|
<div class="d-none d-lg-block col-lg-1"></div>
|
||||||
|
<!--
|
||||||
|
<div class="col-6 col-md-3 col-lg-4">
|
||||||
|
<h4>{% trans "Disk usage" %}</h4>
|
||||||
|
<p class="card-text"><i class="fas fa-hdd fa-3x"></i></p>
|
||||||
|
<div class="w-75 m-auto">
|
||||||
|
{% include "musician/components/usage_progress_bar.html" with detail=domain.usage %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
-->
|
||||||
|
<div class="d-none d-lg-block col-lg-1"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
|
<!-- configuration details modal -->
|
||||||
|
<div class="modal fade" id="configDetailsModal" tabindex="-1" role="dialog" aria-labelledby="configDetailsModalLabel" aria-hidden="true">
|
||||||
|
<div class="modal-dialog modal-dialog-centered" role="document">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h5 class="modal-title text-secondary" id="configDetailsModalLabel">{% trans "Configuration details" %}</h5>
|
||||||
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||||
|
<span aria-hidden="true">×</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<div class="domain-ftp pb-3 border-bottom">
|
||||||
|
<h6 class="pl-4 mb-4">{% trans "FTP access:" %}</h6>
|
||||||
|
{# Translators: domain configuration detail modal #}
|
||||||
|
<p>
|
||||||
|
{% blocktrans %}E-mail us at {{ support_email_anchor }} to get details concerning FTP access.{% endblocktrans %}
|
||||||
|
</p>
|
||||||
|
{% comment %}
|
||||||
|
<!-- hidden until API provides FTP information -->
|
||||||
|
<label>{% trans "Username" %}:</label> <span id="config-username" class="font-weight-bold">username</span><br/>
|
||||||
|
<label>{% trans "Password:" %}</label> <span id="config-password" class="font-weight-bold">password</span>
|
||||||
|
{% endcomment %}
|
||||||
|
</div>
|
||||||
|
<div class="domain-website pt-4">
|
||||||
|
<div id="no-website"><h6 class="pl-4">{% trans "No website configured." %}</h6></div>
|
||||||
|
<div id="config-website">
|
||||||
|
<label>{% trans "Root directory:" %}</label> <span id="config-root-path" class="font-weight-bold">root directory</span>
|
||||||
|
<label>{% trans "Type:" %}</label><span id="config-webapp-type" class="font-weight-bold">type</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<a href="#domain-detail" class="btn btn-primary">{% trans "View DNS records" %}</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
|
{% block extrascript %}
|
||||||
|
<script>
|
||||||
|
$('#configDetailsModal').on('show.bs.modal', function (event) {
|
||||||
|
var button = $(event.relatedTarget); // Button that triggered the modal
|
||||||
|
var modal = $(this);
|
||||||
|
|
||||||
|
// Extract info from data-* attributes
|
||||||
|
modal.find('.modal-title').text(button.data('domain'));
|
||||||
|
modal.find('.modal-body #config-webapp-type').text(button.data('webapp-type'));
|
||||||
|
modal.find('.modal-body #config-root-path').text(button.data('root-path'));
|
||||||
|
modal.find('.modal-footer .btn').attr('href', button.data('url'));
|
||||||
|
|
||||||
|
var nowebsite = modal.find('.modal-body #no-website');
|
||||||
|
var websitecfg = modal.find('.modal-body #config-website');
|
||||||
|
if(button.data('website')) {
|
||||||
|
nowebsite.hide();
|
||||||
|
websitecfg.show();
|
||||||
|
} else {
|
||||||
|
nowebsite.show();
|
||||||
|
websitecfg.hide();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
{% endblock %}
|
||||||
|
|
|
@ -8,14 +8,13 @@
|
||||||
|
|
||||||
{% if object_list %}
|
{% if object_list %}
|
||||||
|
|
||||||
<div class="table-responsive">
|
|
||||||
<table class="table service-list">
|
<table class="table service-list">
|
||||||
<!-- <colgroup>
|
<colgroup>
|
||||||
<col span="1" style="width: 25%;">
|
<col span="1" style="width: 25%;">
|
||||||
<col span="1" style="width: 10%;">
|
<col span="1" style="width: 10%;">
|
||||||
<col span="1" style="width: 35%;">
|
<col span="1" style="width: 35%;">
|
||||||
<col span="1" style="width: 30%;">
|
<col span="1" style="width: 30%;">
|
||||||
</colgroup> -->
|
</colgroup>
|
||||||
<thead class="thead-dark">
|
<thead class="thead-dark">
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="col">{% trans "Name" %}</th>
|
<th scope="col">{% trans "Name" %}</th>
|
||||||
|
@ -46,7 +45,6 @@
|
||||||
</tbody>
|
</tbody>
|
||||||
{% include "musician/components/table_paginator.html" %}
|
{% include "musician/components/table_paginator.html" %}
|
||||||
</table>
|
</table>
|
||||||
</div>
|
|
||||||
|
|
||||||
{% else %}
|
{% else %}
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
|
|
@ -2,20 +2,19 @@
|
||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<a class="btn-arrow-left" href="{% url 'musician:domain-list' %}">{% trans "Go back" %}</a>
|
<a class="btn-arrow-left" href="{% url 'musician:dashboard' %}">{% trans "Go back" %}</a>
|
||||||
|
|
||||||
<h1 class="service-name">
|
<h1 class="service-name">
|
||||||
{% trans "DNS settings for" %} <span class="font-weight-light">{{ object.name }}</span>
|
{% trans "DNS settings for" %} <span class="font-weight-light">{{ object.name }}</span>
|
||||||
|
|
||||||
</h1>
|
</h1>
|
||||||
<!-- TODO: muestra solo si tiene permisos para verlo -->
|
|
||||||
<!--
|
|
||||||
{% if object.top %}
|
{% if object.top %}
|
||||||
<div class="mb-4">
|
<div class="mb-4">
|
||||||
<a class="btn btn-sm btn-secondary" href="{% url 'musician:domain-detail' object.top.pk %}">
|
<a class="btn btn-sm btn-secondary" href="{% url 'musician:domain-detail' object.top.pk %}">
|
||||||
{% trans "Go to top level domain" %} <span class="font-weight-bold">{{ object.top.name }}</span></a>
|
{% trans "Go to top level domain" %} <span class="font-weight-bold">{{ object.top.name }}</span></a>
|
||||||
</div>
|
</div>
|
||||||
{% endif %} -->
|
{% endif %}
|
||||||
|
|
||||||
<p class="service-description">{% trans "DNS settings page description." %}</p>
|
<p class="service-description">{% trans "DNS settings page description." %}</p>
|
||||||
|
|
||||||
|
|
|
@ -1,133 +0,0 @@
|
||||||
{% extends "musician/base.html" %}
|
|
||||||
{% load i18n %}
|
|
||||||
|
|
||||||
{% block content %}
|
|
||||||
|
|
||||||
|
|
||||||
<h1 class="service-name">{% trans "Your domains" %}</h1>
|
|
||||||
|
|
||||||
|
|
||||||
{% for domain in domains %}
|
|
||||||
<div class="card service-card">
|
|
||||||
<div class="card-header">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-md">
|
|
||||||
<strong>{{ domain.name }}</strong>
|
|
||||||
</div>
|
|
||||||
<div class="col-md-8">
|
|
||||||
{% with domain.websites.0 as website %}
|
|
||||||
{% with website.contents.0 as content %}
|
|
||||||
<a href="{% url 'musician:domain-detail' domain.id %}" class="btn btn-primary">{% trans "View DNS records" %}</a>
|
|
||||||
<!-- <button type="button" class="btn text-secondary" data-toggle="modal" data-target="#configDetailsModal"
|
|
||||||
data-domain="{{ domain.name }}" data-website="{{ website|yesno:'true,false' }}" data-webapp-type="{{ content.webapp.type }}" data-root-path="{{ content.path }}"
|
|
||||||
data-url="{% url 'musician:domain-detail' domain.id %}">
|
|
||||||
{% trans "view configuration" %} <strong class="fas fa-tools"></strong>
|
|
||||||
</button> -->
|
|
||||||
{% endwith %}
|
|
||||||
{% endwith %}
|
|
||||||
</div>
|
|
||||||
<div class="col-md text-right">
|
|
||||||
{% comment "@slamora: orchestra doesn't have this information [won't fix] See issue #2" %}
|
|
||||||
{% trans "Expiration date" %}: <strong>{{ domain.expiration_date|date:"SHORT_DATE_FORMAT" }}</strong>
|
|
||||||
{% endcomment %}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div><!-- /card-header-->
|
|
||||||
<div class="card-body row text-center">
|
|
||||||
<div class="col-6 col-md-3 col-lg-2 border-right">
|
|
||||||
<h4>{% trans "Mail" %}</h4>
|
|
||||||
<p class="card-text"><i class="fas fa-envelope fa-3x"></i></p>
|
|
||||||
<p class="card-text text-dark">
|
|
||||||
{{ domain.addresses.count }} {% trans "mail addresses created" %}
|
|
||||||
</p>
|
|
||||||
<a class="stretched-link" href="{% url 'musician:address-list' %}?domain={{ domain.id }}"></a>
|
|
||||||
</div>
|
|
||||||
<div class="col-6 col-md-3 col-lg-2 border-right">
|
|
||||||
<h4>{% trans "Mail list" %}</h4>
|
|
||||||
<p class="card-text"><i class="fas fa-mail-bulk fa-3x"></i></p>
|
|
||||||
<a class="stretched-link" href="{% url 'musician:mailing-lists' %}?domain={{ domain.id }}"></a>
|
|
||||||
</div>
|
|
||||||
<div class="col-6 col-md-3 col-lg-2 border-right">
|
|
||||||
<h4>{% trans "Software as a Service" %}</h4>
|
|
||||||
<p class="card-text"><i class="fas fa-fire fa-3x"></i></p>
|
|
||||||
<p class="card-text text-dark">{% trans "Nothing installed" %}</p>
|
|
||||||
<a class="stretched-link" href="{% url 'musician:saas-list' %}?domain={{ domain.id }}"></a>
|
|
||||||
</div>
|
|
||||||
<div class="d-none d-lg-block col-lg-1"></div>
|
|
||||||
<!--
|
|
||||||
<div class="col-6 col-md-3 col-lg-4">
|
|
||||||
<h4>{% trans "Disk usage" %}</h4>
|
|
||||||
<p class="card-text"><i class="fas fa-hdd fa-3x"></i></p>
|
|
||||||
<div class="w-75 m-auto">
|
|
||||||
{% include "musician/components/usage_progress_bar.html" with detail=domain.usage %}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
-->
|
|
||||||
<div class="d-none d-lg-block col-lg-1"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{% endfor %}
|
|
||||||
|
|
||||||
<!-- configuration details modal -->
|
|
||||||
<div class="modal fade" id="configDetailsModal" tabindex="-1" role="dialog" aria-labelledby="configDetailsModalLabel" aria-hidden="true">
|
|
||||||
<div class="modal-dialog modal-dialog-centered" role="document">
|
|
||||||
<div class="modal-content">
|
|
||||||
<div class="modal-header">
|
|
||||||
<h5 class="modal-title text-secondary" id="configDetailsModalLabel">{% trans "Configuration details" %}</h5>
|
|
||||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
|
||||||
<span aria-hidden="true">×</span>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
<div class="modal-body">
|
|
||||||
<div class="domain-ftp pb-3 border-bottom">
|
|
||||||
<h6 class="pl-4 mb-4">{% trans "FTP access:" %}</h6>
|
|
||||||
{# Translators: domain configuration detail modal #}
|
|
||||||
<p>
|
|
||||||
{% blocktrans %}E-mail us at {{ support_email_anchor }} to get details concerning FTP access.{% endblocktrans %}
|
|
||||||
</p>
|
|
||||||
{% comment %}
|
|
||||||
<!-- hidden until API provides FTP information -->
|
|
||||||
<label>{% trans "Username" %}:</label> <span id="config-username" class="font-weight-bold">username</span><br/>
|
|
||||||
<label>{% trans "Password:" %}</label> <span id="config-password" class="font-weight-bold">password</span>
|
|
||||||
{% endcomment %}
|
|
||||||
</div>
|
|
||||||
<div class="domain-website pt-4">
|
|
||||||
<div id="no-website"><h6 class="pl-4">{% trans "No website configured." %}</h6></div>
|
|
||||||
<div id="config-website">
|
|
||||||
<label>{% trans "Root directory:" %}</label> <span id="config-root-path" class="font-weight-bold">root directory</span>
|
|
||||||
<label>{% trans "Type:" %}</label><span id="config-webapp-type" class="font-weight-bold">type</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="modal-footer">
|
|
||||||
<a href="#domain-detail" class="btn btn-primary">{% trans "View DNS records" %}</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endblock %}
|
|
||||||
{% block extrascript %}
|
|
||||||
<script>
|
|
||||||
$('#configDetailsModal').on('show.bs.modal', function (event) {
|
|
||||||
var button = $(event.relatedTarget); // Button that triggered the modal
|
|
||||||
var modal = $(this);
|
|
||||||
|
|
||||||
// Extract info from data-* attributes
|
|
||||||
modal.find('.modal-title').text(button.data('domain'));
|
|
||||||
modal.find('.modal-body #config-webapp-type').text(button.data('webapp-type'));
|
|
||||||
modal.find('.modal-body #config-root-path').text(button.data('root-path'));
|
|
||||||
modal.find('.modal-footer .btn').attr('href', button.data('url'));
|
|
||||||
|
|
||||||
var nowebsite = modal.find('.modal-body #no-website');
|
|
||||||
var websitecfg = modal.find('.modal-body #config-website');
|
|
||||||
if(button.data('website')) {
|
|
||||||
nowebsite.hide();
|
|
||||||
websitecfg.show();
|
|
||||||
} else {
|
|
||||||
nowebsite.show();
|
|
||||||
websitecfg.hide();
|
|
||||||
}
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
{% endblock %}
|
|
|
@ -18,13 +18,13 @@
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="table-responsive">
|
|
||||||
<table class="table service-list">
|
<table class="table service-list">
|
||||||
<!-- <colgroup>
|
<colgroup>
|
||||||
<col span="1" style="width: 25%;">
|
<col span="1" style="width: 25%;">
|
||||||
<col span="1" style="width: 10%;">
|
<col span="1" style="width: 10%;">
|
||||||
<col span="1" style="width: 65%;">
|
<col span="1" style="width: 65%;">
|
||||||
</colgroup> -->
|
</colgroup>
|
||||||
<thead class="thead-dark">
|
<thead class="thead-dark">
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="col">{% trans "Name" %}</th>
|
<th scope="col">{% trans "Name" %}</th>
|
||||||
|
@ -56,7 +56,6 @@
|
||||||
</tbody>
|
</tbody>
|
||||||
{% include "musician/components/table_paginator.html" %}
|
{% include "musician/components/table_paginator.html" %}
|
||||||
</table>
|
</table>
|
||||||
</div>
|
|
||||||
<a class="btn btn-primary mt-4 mb-4" href="{% url 'musician:mailbox-create' %}">{% trans "New mailbox" %}</a>
|
<a class="btn btn-primary mt-4 mb-4" href="{% url 'musician:mailbox-create' %}">{% trans "New mailbox" %}</a>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -9,16 +9,15 @@
|
||||||
<h1 class="service-name">{{ service.verbose_name }}{% if active_domain %} <span class="font-weight-light">{% trans "for" %} {{ active_domain.name }}</span>{% endif %}</h1>
|
<h1 class="service-name">{{ service.verbose_name }}{% if active_domain %} <span class="font-weight-light">{% trans "for" %} {{ active_domain.name }}</span>{% endif %}</h1>
|
||||||
<p class="service-description">{{ service.description }}</p>
|
<p class="service-description">{{ service.description }}</p>
|
||||||
|
|
||||||
<div class="table-responsive">
|
|
||||||
<table class="table service-list">
|
<table class="table service-list">
|
||||||
<!-- <colgroup>
|
<colgroup>
|
||||||
<col span="1" style="width: 13%;">
|
<col span="1" style="width: 13%;">
|
||||||
<col span="1" style="width: 12%;">
|
<col span="1" style="width: 12%;">
|
||||||
<col span="1" style="width: 40%;">
|
<col span="1" style="width: 40%;">
|
||||||
<col span="1" style="width: 15%;">
|
<col span="1" style="width: 15%;">
|
||||||
<col span="1" style="width: 10%;">
|
<col span="1" style="width: 10%;">
|
||||||
<col span="1" style="width: 10%;">
|
<col span="1" style="width: 10%;">
|
||||||
</colgroup> -->
|
</colgroup>
|
||||||
<thead class="thead-dark">
|
<thead class="thead-dark">
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="col">Name</th>
|
<th scope="col">Name</th>
|
||||||
|
@ -48,16 +47,15 @@
|
||||||
<td>{{ resource.admin_email }}</td>
|
<td>{{ resource.admin_email }}</td>
|
||||||
<td><a href="{{ resource.get_absolute_url }}" target="_blank" rel="noopener noreferrer">Mailman <i class="fas fa-external-link-alt"></i></a></td>
|
<td><a href="{{ resource.get_absolute_url }}" target="_blank" rel="noopener noreferrer">Mailman <i class="fas fa-external-link-alt"></i></a></td>
|
||||||
<td class="text-right">
|
<td class="text-right">
|
||||||
<a class="btn btn-outline-warning" role="button" href="{% url 'musician:mailing-update' resource.id %}">
|
<a class="btn btn-outline-warning" href="{% url 'musician:mailing-update' resource.id %}">
|
||||||
<i class="fas fa-tools"></i></a>
|
<i class="fas fa-tools"></i></a>
|
||||||
<a class="btn btn-outline-danger" role="button" href="{% url 'musician:mailing-delete' resource.id %}">
|
<a href="{% url 'musician:mailing-delete' resource.id %}">
|
||||||
<i class="text-danger fas fa-trash"></i></a>
|
<i class="ml-3 text-danger fas fa-trash"></i></a>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
|
||||||
<a class="btn btn-primary mt-4 mb-4" href="{% url 'musician:mailing-create' %}">{% trans "New list" %}</a>
|
<a class="btn btn-primary mt-4 mb-4" href="{% url 'musician:mailing-create' %}">{% trans "New list" %}</a>
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -6,14 +6,13 @@
|
||||||
<h1 class="service-name">{{ service.verbose_name }}</h1>
|
<h1 class="service-name">{{ service.verbose_name }}</h1>
|
||||||
<p class="service-description">{{ service.description }}</p>
|
<p class="service-description">{{ service.description }}</p>
|
||||||
|
|
||||||
<div class="table-responsive">
|
|
||||||
<table class="table service-list">
|
<table class="table service-list">
|
||||||
<!-- <colgroup>
|
<colgroup>
|
||||||
<col span="1" style="width: 35%;">
|
<col span="1" style="width: 35%;">
|
||||||
<col span="1" style="width: 10%;">
|
<col span="1" style="width: 10%;">
|
||||||
<col span="1" style="width: 25%;">
|
<col span="1" style="width: 25%;">
|
||||||
<col span="1" style="width: 30%;">
|
<col span="1" style="width: 30%;">
|
||||||
</colgroup> -->
|
</colgroup>
|
||||||
<thead class="thead-dark">
|
<thead class="thead-dark">
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="col">{% trans "Name" %}</th>
|
<th scope="col">{% trans "Name" %}</th>
|
||||||
|
@ -58,5 +57,5 @@
|
||||||
</tbody>
|
</tbody>
|
||||||
{% include "musician/components/table_paginator.html" %}
|
{% include "musician/components/table_paginator.html" %}
|
||||||
</table>
|
</table>
|
||||||
</div>
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -8,11 +8,11 @@
|
||||||
|
|
||||||
|
|
||||||
<table class="table service-list">
|
<table class="table service-list">
|
||||||
<!-- <colgroup>
|
<colgroup>
|
||||||
<col span="1" style="width: 15%;">
|
<col span="1" style="width: 15%;">
|
||||||
<col span="1" style="width: 25%;">
|
<col span="1" style="width: 25%;">
|
||||||
<col span="1" style="width: 60%;">
|
<col span="1" style="width: 60%;">
|
||||||
</colgroup> -->
|
</colgroup>
|
||||||
<thead class="thead-dark">
|
<thead class="thead-dark">
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="col">{% trans "Username" %}</th>
|
<th scope="col">{% trans "Username" %}</th>
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
{{ description2 }}
|
{{ description2 }}
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<div class="table-responsive">
|
|
||||||
<table class="table service-list">
|
<table class="table service-list">
|
||||||
<colgroup>
|
<colgroup>
|
||||||
<col span="1" style="width: 19%;">
|
<col span="1" style="width: 19%;">
|
||||||
|
@ -52,5 +51,5 @@
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -2,14 +2,14 @@
|
||||||
{% load bootstrap4 i18n %}
|
{% load bootstrap4 i18n %}
|
||||||
|
|
||||||
{% block tabcontent %}
|
{% block tabcontent %}
|
||||||
<div class="table-responsive">
|
|
||||||
<table class="table service-list">
|
<table class="table service-list">
|
||||||
<!-- <colgroup>
|
<colgroup>
|
||||||
<col span="1" style="width: 15%;">
|
<col span="1" style="width: 15%;">
|
||||||
<col span="1" style="width: 25%;">
|
<col span="1" style="width: 25%;">
|
||||||
<col span="1" style="width: 40%;">
|
<col span="1" style="width: 40%;">
|
||||||
<col span="1" style="width: 20%;">
|
<col span="1" style="width: 20%;">
|
||||||
</colgroup> -->
|
</colgroup>
|
||||||
<thead class="thead-dark">
|
<thead class="thead-dark">
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="col">{% trans "Username" %}</th>
|
<th scope="col">{% trans "Username" %}</th>
|
||||||
|
@ -25,14 +25,12 @@
|
||||||
<td>/home/{{ webappuser.account }}/webapps/{{ webappuser.home }}</td>
|
<td>/home/{{ webappuser.account }}/webapps/{{ webappuser.home }}</td>
|
||||||
<td>{{ webappuser.target_server }}</td>
|
<td>{{ webappuser.target_server }}</td>
|
||||||
<td>
|
<td>
|
||||||
<div class="d-flex justify-content-end">
|
<a class="btn btn-outline-warning" href="{% url 'musician:webappuser-password' webappuser.id %}">
|
||||||
<a class="btn btn-outline-warning" href="{% url 'musician:webappuser-password' webappuser.id %}">
|
<i class="fas fa-key"></i> {% trans "Update password" %}</a>
|
||||||
<i class="fas fa-key"></i> {% trans "Update password" %}</a>
|
|
||||||
</div>
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
{{ description }}
|
{{ description }}
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<div class="table-responsive">
|
|
||||||
<table class="table service-list table-hover">
|
<table class="table service-list table-hover">
|
||||||
<colgroup>
|
<colgroup>
|
||||||
<col span="1" style="width: 15%;">
|
<col span="1" style="width: 15%;">
|
||||||
|
@ -102,7 +101,7 @@
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
|
@ -18,7 +18,6 @@ urlpatterns = [
|
||||||
path('auth/logout/', views.LogoutView.as_view(), name='logout'),
|
path('auth/logout/', views.LogoutView.as_view(), name='logout'),
|
||||||
path('dashboard/', views.DashboardView.as_view(), name='dashboard'),
|
path('dashboard/', views.DashboardView.as_view(), name='dashboard'),
|
||||||
|
|
||||||
path('domains/', views.DomainListView.as_view(), name='domain-list'),
|
|
||||||
path('domains/<int:pk>/', views.DomainDetailView.as_view(), name='domain-detail'),
|
path('domains/<int:pk>/', views.DomainDetailView.as_view(), name='domain-detail'),
|
||||||
path('domains/<int:pk>/add-record/', views.DomainAddRecordView.as_view(), name='domain-add-record'),
|
path('domains/<int:pk>/add-record/', views.DomainAddRecordView.as_view(), name='domain-add-record'),
|
||||||
path('domains/<int:pk>/records/<int:record_pk>/update/', views.DomainUpdateRecordView.as_view(), name='domain-update-record'),
|
path('domains/<int:pk>/records/<int:record_pk>/update/', views.DomainUpdateRecordView.as_view(), name='domain-update-record'),
|
||||||
|
|
|
@ -16,10 +16,3 @@ def get_bootstraped_percent(value, total):
|
||||||
bootstraped = min(100, bootstraped)
|
bootstraped = min(100, bootstraped)
|
||||||
|
|
||||||
return bootstraped
|
return bootstraped
|
||||||
|
|
||||||
def get_bootstraped_percent_exact(value, total):
|
|
||||||
try:
|
|
||||||
percent = 100 * float(value)/float(total)
|
|
||||||
except (TypeError, ZeroDivisionError):
|
|
||||||
return 0
|
|
||||||
return int(percent)
|
|
|
@ -24,9 +24,6 @@ from django.views.generic.edit import (CreateView, DeleteView, FormView,
|
||||||
from django.views.generic.list import ListView
|
from django.views.generic.list import ListView
|
||||||
from requests.exceptions import HTTPError
|
from requests.exceptions import HTTPError
|
||||||
|
|
||||||
from django.urls import reverse
|
|
||||||
from django.db.models import Q
|
|
||||||
|
|
||||||
from orchestra import get_version
|
from orchestra import get_version
|
||||||
from orchestra.contrib.bills.models import Bill
|
from orchestra.contrib.bills.models import Bill
|
||||||
from orchestra.contrib.databases.models import Database
|
from orchestra.contrib.databases.models import Database
|
||||||
|
@ -51,7 +48,7 @@ from .models import DatabaseService
|
||||||
from .models import Mailbox as MailboxService
|
from .models import Mailbox as MailboxService
|
||||||
from .models import MailinglistService, SaasService
|
from .models import MailinglistService, SaasService
|
||||||
from .settings import ALLOWED_RESOURCES, MUSICIAN_EDIT_ENABLE_PHP_OPTIONS
|
from .settings import ALLOWED_RESOURCES, MUSICIAN_EDIT_ENABLE_PHP_OPTIONS
|
||||||
from .utils import get_bootstraped_percent, get_bootstraped_percent_exact
|
from .utils import get_bootstraped_percent
|
||||||
|
|
||||||
from .webapps.views import *
|
from .webapps.views import *
|
||||||
from .websites.views import *
|
from .websites.views import *
|
||||||
|
@ -60,7 +57,6 @@ from .lists.views import *
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class DashboardView(CustomContextMixin, UserTokenRequiredMixin, TemplateView):
|
class DashboardView(CustomContextMixin, UserTokenRequiredMixin, TemplateView):
|
||||||
template_name = "musician/dashboard.html"
|
template_name = "musician/dashboard.html"
|
||||||
extra_context = {
|
extra_context = {
|
||||||
|
@ -70,22 +66,7 @@ class DashboardView(CustomContextMixin, UserTokenRequiredMixin, TemplateView):
|
||||||
|
|
||||||
def get_context_data(self, **kwargs):
|
def get_context_data(self, **kwargs):
|
||||||
context = super().get_context_data(**kwargs)
|
context = super().get_context_data(**kwargs)
|
||||||
|
domains = self.orchestra.retrieve_domain_list()
|
||||||
related_resources = self.get_all_resources()
|
|
||||||
|
|
||||||
account = related_resources.filter(resource_id__verbose_name='account-disk').first()
|
|
||||||
account_trafic = related_resources.filter(resource_id__verbose_name='account-traffic').first()
|
|
||||||
|
|
||||||
# TODO: sacar los graficos de alguna manera
|
|
||||||
# url_history_disk = reverse('admin:resources_resourcedata_show_history', args=(account.pk,))
|
|
||||||
# url_history_traffic = reverse('admin:resources_resourcedata_show_history', args=(account_trafic.pk,))
|
|
||||||
|
|
||||||
mailboxes = related_resources.filter(resource_id__verbose_name='mailbox-disk')
|
|
||||||
lists = related_resources.filter(resource_id__verbose_name='list-traffic')
|
|
||||||
databases = related_resources.filter(resource_id__verbose_name='database-disk')
|
|
||||||
nextcloud = related_resources.filter(resource_id__verbose_name='nextcloud-disk')
|
|
||||||
domains = Domain.objects.filter(account_id=self.request.user)
|
|
||||||
|
|
||||||
|
|
||||||
# TODO(@slamora) update when backend supports notifications
|
# TODO(@slamora) update when backend supports notifications
|
||||||
notifications = []
|
notifications = []
|
||||||
|
@ -95,11 +76,7 @@ class DashboardView(CustomContextMixin, UserTokenRequiredMixin, TemplateView):
|
||||||
|
|
||||||
# TODO(@slamora) update when backend provides resource usage data
|
# TODO(@slamora) update when backend provides resource usage data
|
||||||
resource_usage = {
|
resource_usage = {
|
||||||
# 'account': self.get_account_usage(profile_type, account),
|
'mailbox': self.get_mailbox_usage(profile_type),
|
||||||
'mailbox': self.get_resource_usage(profile_type, mailboxes, 'mailbox'),
|
|
||||||
'database': self.get_resource_usage(profile_type, databases, 'database'),
|
|
||||||
'nextcloud': self.get_resource_usage(profile_type, nextcloud, 'nextcloud'),
|
|
||||||
'list': self.get_resource_usage(profile_type, lists, 'Mailman list Traffic'),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
support_email = getattr(settings, "USER_SUPPORT_EMAIL", "suport@pangea.org")
|
support_email = getattr(settings, "USER_SUPPORT_EMAIL", "suport@pangea.org")
|
||||||
|
@ -113,113 +90,33 @@ class DashboardView(CustomContextMixin, UserTokenRequiredMixin, TemplateView):
|
||||||
'resource_usage': resource_usage,
|
'resource_usage': resource_usage,
|
||||||
'notifications': notifications,
|
'notifications': notifications,
|
||||||
"support_email_anchor": support_email_anchor,
|
"support_email_anchor": support_email_anchor,
|
||||||
'account': self.get_account_usage(profile_type, account, account_trafic),
|
|
||||||
})
|
})
|
||||||
|
|
||||||
return context
|
return context
|
||||||
|
|
||||||
def get_all_resources(self):
|
def get_mailbox_usage(self, profile_type):
|
||||||
user = self.request.user
|
allowed_mailboxes = ALLOWED_RESOURCES[profile_type]['mailbox']
|
||||||
resources = Resource.objects.select_related('content_type')
|
total_mailboxes = len(self.orchestra.retrieve_mailbox_list())
|
||||||
resource_models = {r.content_type.model_class(): r.content_type_id for r in resources}
|
mailboxes_left = allowed_mailboxes - total_mailboxes
|
||||||
ct_id = resource_models[user._meta.model]
|
|
||||||
qset = Q(content_type_id=ct_id, object_id=user.id, resource__is_active=True)
|
|
||||||
for field, rel in user._meta.fields_map.items():
|
|
||||||
try:
|
|
||||||
ct_id = resource_models[rel.related_model]
|
|
||||||
except KeyError:
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
manager = getattr(user, field)
|
|
||||||
ids = manager.values_list('id', flat=True)
|
|
||||||
qset = Q(qset) | Q(content_type_id=ct_id, object_id__in=ids, resource__is_active=True)
|
|
||||||
return ResourceData.objects.filter(qset)
|
|
||||||
|
|
||||||
def get_resource_usage(self, profile_type, resource_data, name_resource):
|
|
||||||
limit_rs = 0
|
|
||||||
total_rs = len(resource_data)
|
|
||||||
rs_left = 0
|
|
||||||
alert = ''
|
|
||||||
progres_bar = False
|
|
||||||
|
|
||||||
if ALLOWED_RESOURCES[profile_type].get(name_resource):
|
|
||||||
progres_bar = True
|
|
||||||
limit_rs = ALLOWED_RESOURCES[profile_type][name_resource]
|
|
||||||
rs_left = limit_rs - total_rs
|
|
||||||
|
|
||||||
alert = ''
|
|
||||||
if rs_left < 0:
|
|
||||||
alert = format_html(f"<span class='text-danger'>{rs_left * -1} extra {name_resource}</span>")
|
|
||||||
elif rs_left <= 1:
|
|
||||||
alert = format_html(f"<span class='text-warning'>{rs_left} {name_resource} available</span>")
|
|
||||||
elif rs_left > 1:
|
|
||||||
alert = format_html(f"<span class='text-secondary'>{rs_left} {name_resource} available</span>")
|
|
||||||
return {
|
|
||||||
'verbose_name': _(name_resource.capitalize()),
|
|
||||||
'data': {
|
|
||||||
'progres_bar': progres_bar,
|
|
||||||
'used': total_rs,
|
|
||||||
'total': limit_rs,
|
|
||||||
'alert': alert,
|
|
||||||
'unit': name_resource.capitalize(),
|
|
||||||
'percent': get_bootstraped_percent_exact(total_rs, limit_rs),
|
|
||||||
},
|
|
||||||
'objects': resource_data,
|
|
||||||
}
|
|
||||||
|
|
||||||
def get_account_usage(self, profile_type, account, account_trafic):
|
|
||||||
allowed_size = ALLOWED_RESOURCES[profile_type]['account']
|
|
||||||
total_size = account.used
|
|
||||||
size_left = allowed_size - total_size
|
|
||||||
|
|
||||||
alert = ''
|
alert = ''
|
||||||
if size_left < 0:
|
if mailboxes_left < 0:
|
||||||
alert = format_html(f"<span class='text-danger'>{size_left * -1} {account.unit} extra</span>")
|
alert = format_html("<span class='text-danger'>{} extra mailboxes</span>", mailboxes_left * -1)
|
||||||
elif size_left <= 1:
|
elif mailboxes_left <= 1:
|
||||||
alert = format_html(f"<span class='text-warning'>{size_left} {account.unit} available</span>")
|
alert = format_html("<span class='text-warning'>{} mailbox left</span>", mailboxes_left)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'verbose_name': _('Account'),
|
'verbose_name': _('Mailboxes'),
|
||||||
'data': {
|
'data': {
|
||||||
'progres_bar': True,
|
'used': total_mailboxes,
|
||||||
'used': total_size,
|
'total': allowed_mailboxes,
|
||||||
'total': allowed_size,
|
|
||||||
'alert': alert,
|
'alert': alert,
|
||||||
'unit': 'GiB Size',
|
'unit': 'mailboxes',
|
||||||
'percent': get_bootstraped_percent_exact(total_size, allowed_size),
|
'percent': get_bootstraped_percent(total_mailboxes, allowed_mailboxes),
|
||||||
},
|
|
||||||
'objects': {
|
|
||||||
'size': {'ac': account},
|
|
||||||
'traffic': {'ac': account_trafic}
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class DomainListView(CustomContextMixin, UserTokenRequiredMixin, TemplateView):
|
|
||||||
template_name = "musician/domain_list.html"
|
|
||||||
extra_context = {
|
|
||||||
# Translators: This message appears on the page title
|
|
||||||
'title': _('Domains'),
|
|
||||||
}
|
|
||||||
|
|
||||||
def get_context_data(self, **kwargs):
|
|
||||||
context = super().get_context_data(**kwargs)
|
|
||||||
domains = self.orchestra.retrieve_domain_list()
|
|
||||||
|
|
||||||
support_email = getattr(settings, "USER_SUPPORT_EMAIL", "suport@pangea.org")
|
|
||||||
support_email_anchor = format_html(
|
|
||||||
"<a href='mailto:{}'>{}</a>",
|
|
||||||
support_email,
|
|
||||||
support_email,
|
|
||||||
)
|
|
||||||
context.update({
|
|
||||||
'domains': domains,
|
|
||||||
"support_email_anchor": support_email_anchor,
|
|
||||||
})
|
|
||||||
|
|
||||||
return context
|
|
||||||
|
|
||||||
|
|
||||||
class ProfileView(CustomContextMixin, UserTokenRequiredMixin, TemplateView):
|
class ProfileView(CustomContextMixin, UserTokenRequiredMixin, TemplateView):
|
||||||
template_name = "musician/profile.html"
|
template_name = "musician/profile.html"
|
||||||
extra_context = {
|
extra_context = {
|
||||||
|
|
|
@ -1,144 +0,0 @@
|
||||||
(function($) {
|
|
||||||
'use strict';
|
|
||||||
var SelectBox = {
|
|
||||||
cache: {},
|
|
||||||
init: function(id) {
|
|
||||||
var box = document.getElementById(id);
|
|
||||||
var node;
|
|
||||||
SelectBox.cache[id] = [];
|
|
||||||
var cache = SelectBox.cache[id];
|
|
||||||
var boxOptions = box.options;
|
|
||||||
var boxOptionsLength = boxOptions.length;
|
|
||||||
for (var i = 0, j = boxOptionsLength; i < j; i++) {
|
|
||||||
node = boxOptions[i];
|
|
||||||
cache.push({value: node.value, text: node.text, displayed: 1});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
redisplay: function(id) {
|
|
||||||
// Repopulate HTML select box from cache
|
|
||||||
var box = document.getElementById(id);
|
|
||||||
var node;
|
|
||||||
$(box).empty(); // clear all options
|
|
||||||
var new_options = box.outerHTML.slice(0, -9); // grab just the opening tag
|
|
||||||
var cache = SelectBox.cache[id];
|
|
||||||
for (var i = 0, j = cache.length; i < j; i++) {
|
|
||||||
node = cache[i];
|
|
||||||
if (node.displayed) {
|
|
||||||
var new_option = new Option(node.text, node.value, false, false);
|
|
||||||
// Shows a tooltip when hovering over the option
|
|
||||||
new_option.setAttribute("title", node.text);
|
|
||||||
new_options += new_option.outerHTML;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
new_options += '</select>';
|
|
||||||
box.outerHTML = new_options;
|
|
||||||
},
|
|
||||||
filter: function(id, text) {
|
|
||||||
// Redisplay the HTML select box, displaying only the choices containing ALL
|
|
||||||
// the words in text. (It's an AND search.)
|
|
||||||
var tokens = text.toLowerCase().split(/\s+/);
|
|
||||||
var node, token;
|
|
||||||
var cache = SelectBox.cache[id];
|
|
||||||
for (var i = 0, j = cache.length; i < j; i++) {
|
|
||||||
node = cache[i];
|
|
||||||
node.displayed = 1;
|
|
||||||
var node_text = node.text.toLowerCase();
|
|
||||||
var numTokens = tokens.length;
|
|
||||||
for (var k = 0; k < numTokens; k++) {
|
|
||||||
token = tokens[k];
|
|
||||||
if (node_text.indexOf(token) === -1) {
|
|
||||||
node.displayed = 0;
|
|
||||||
break; // Once the first token isn't found we're done
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
SelectBox.redisplay(id);
|
|
||||||
},
|
|
||||||
delete_from_cache: function(id, value) {
|
|
||||||
var node, delete_index = null;
|
|
||||||
var cache = SelectBox.cache[id];
|
|
||||||
for (var i = 0, j = cache.length; i < j; i++) {
|
|
||||||
node = cache[i];
|
|
||||||
if (node.value === value) {
|
|
||||||
delete_index = i;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
cache.splice(delete_index, 1);
|
|
||||||
},
|
|
||||||
add_to_cache: function(id, option) {
|
|
||||||
SelectBox.cache[id].push({value: option.value, text: option.text, displayed: 1});
|
|
||||||
},
|
|
||||||
cache_contains: function(id, value) {
|
|
||||||
// Check if an item is contained in the cache
|
|
||||||
var node;
|
|
||||||
var cache = SelectBox.cache[id];
|
|
||||||
for (var i = 0, j = cache.length; i < j; i++) {
|
|
||||||
node = cache[i];
|
|
||||||
if (node.value === value) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
},
|
|
||||||
move: function(from, to) {
|
|
||||||
var from_box = document.getElementById(from);
|
|
||||||
var option;
|
|
||||||
var boxOptions = from_box.options;
|
|
||||||
var boxOptionsLength = boxOptions.length;
|
|
||||||
for (var i = 0, j = boxOptionsLength; i < j; i++) {
|
|
||||||
option = boxOptions[i];
|
|
||||||
var option_value = option.value;
|
|
||||||
if (option.selected && SelectBox.cache_contains(from, option_value)) {
|
|
||||||
SelectBox.add_to_cache(to, {value: option_value, text: option.text, displayed: 1});
|
|
||||||
SelectBox.delete_from_cache(from, option_value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
SelectBox.redisplay(from);
|
|
||||||
SelectBox.redisplay(to);
|
|
||||||
},
|
|
||||||
move_all: function(from, to) {
|
|
||||||
var from_box = document.getElementById(from);
|
|
||||||
var option;
|
|
||||||
var boxOptions = from_box.options;
|
|
||||||
var boxOptionsLength = boxOptions.length;
|
|
||||||
for (var i = 0, j = boxOptionsLength; i < j; i++) {
|
|
||||||
option = boxOptions[i];
|
|
||||||
var option_value = option.value;
|
|
||||||
if (SelectBox.cache_contains(from, option_value)) {
|
|
||||||
SelectBox.add_to_cache(to, {value: option_value, text: option.text, displayed: 1});
|
|
||||||
SelectBox.delete_from_cache(from, option_value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
SelectBox.redisplay(from);
|
|
||||||
SelectBox.redisplay(to);
|
|
||||||
},
|
|
||||||
sort: function(id) {
|
|
||||||
SelectBox.cache[id].sort(function(a, b) {
|
|
||||||
a = a.text.toLowerCase();
|
|
||||||
b = b.text.toLowerCase();
|
|
||||||
try {
|
|
||||||
if (a > b) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
if (a < b) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (e) {
|
|
||||||
// silently fail on IE 'unknown' exception
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
} );
|
|
||||||
},
|
|
||||||
select_all: function(id) {
|
|
||||||
var box = document.getElementById(id);
|
|
||||||
var boxOptions = box.options;
|
|
||||||
var boxOptionsLength = boxOptions.length;
|
|
||||||
for (var i = 0; i < boxOptionsLength; i++) {
|
|
||||||
boxOptions[i].selected = 'selected';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
window.SelectBox = SelectBox;
|
|
||||||
})(django.jQuery);
|
|
|
@ -1,246 +0,0 @@
|
||||||
/*global SelectBox, gettext, interpolate, quickElement, SelectFilter*/
|
|
||||||
/*
|
|
||||||
SelectFilter2 - Turns a multiple-select box into a filter interface.
|
|
||||||
|
|
||||||
Requires jQuery, core.js, and SelectBox.js.
|
|
||||||
*/
|
|
||||||
(function($) {
|
|
||||||
'use strict';
|
|
||||||
function findForm(node) {
|
|
||||||
// returns the node of the form containing the given node
|
|
||||||
if (node.tagName.toLowerCase() !== 'form') {
|
|
||||||
return findForm(node.parentNode);
|
|
||||||
}
|
|
||||||
return node;
|
|
||||||
}
|
|
||||||
|
|
||||||
window.SelectFilter = {
|
|
||||||
init: function(field_id, field_name, is_stacked) {
|
|
||||||
if (field_id.match(/__prefix__/)) {
|
|
||||||
// Don't initialize on empty forms.
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var from_box = document.getElementById(field_id);
|
|
||||||
from_box.id += '_from'; // change its ID
|
|
||||||
from_box.className = 'filtered';
|
|
||||||
|
|
||||||
var ps = from_box.parentNode.getElementsByTagName('p');
|
|
||||||
for (var i = 0; i < ps.length; i++) {
|
|
||||||
if (ps[i].className.indexOf("info") !== -1) {
|
|
||||||
// Remove <p class="info">, because it just gets in the way.
|
|
||||||
from_box.parentNode.removeChild(ps[i]);
|
|
||||||
} else if (ps[i].className.indexOf("help") !== -1) {
|
|
||||||
// Move help text up to the top so it isn't below the select
|
|
||||||
// boxes or wrapped off on the side to the right of the add
|
|
||||||
// button:
|
|
||||||
from_box.parentNode.insertBefore(ps[i], from_box.parentNode.firstChild);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// <div class="selector"> or <div class="selector stacked">
|
|
||||||
var selector_div = quickElement('div', from_box.parentNode);
|
|
||||||
selector_div.className = is_stacked ? 'selector stacked' : 'selector';
|
|
||||||
|
|
||||||
// <div class="selector-available">
|
|
||||||
var selector_available = quickElement('div', selector_div);
|
|
||||||
selector_available.className = 'selector-available';
|
|
||||||
var title_available = quickElement('h2', selector_available, interpolate(gettext('Available %s') + ' ', [field_name]));
|
|
||||||
quickElement(
|
|
||||||
'span', title_available, '',
|
|
||||||
'class', 'help help-tooltip help-icon',
|
|
||||||
'title', interpolate(
|
|
||||||
gettext(
|
|
||||||
'This is the list of available %s. You may choose some by ' +
|
|
||||||
'selecting them in the box below and then clicking the ' +
|
|
||||||
'"Choose" arrow between the two boxes.'
|
|
||||||
),
|
|
||||||
[field_name]
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
var filter_p = quickElement('p', selector_available, '', 'id', field_id + '_filter');
|
|
||||||
filter_p.className = 'selector-filter';
|
|
||||||
|
|
||||||
var search_filter_label = quickElement('label', filter_p, '', 'for', field_id + '_input');
|
|
||||||
|
|
||||||
quickElement(
|
|
||||||
'span', search_filter_label, '',
|
|
||||||
'class', 'help-tooltip search-label-icon',
|
|
||||||
'title', interpolate(gettext("Type into this box to filter down the list of available %s."), [field_name])
|
|
||||||
);
|
|
||||||
|
|
||||||
filter_p.appendChild(document.createTextNode(' '));
|
|
||||||
|
|
||||||
var filter_input = quickElement('input', filter_p, '', 'type', 'text', 'placeholder', gettext("Filter"));
|
|
||||||
filter_input.id = field_id + '_input';
|
|
||||||
|
|
||||||
selector_available.appendChild(from_box);
|
|
||||||
var choose_all = quickElement('a', selector_available, gettext('Choose all'), 'title', interpolate(gettext('Click to choose all %s at once.'), [field_name]), 'href', '#', 'id', field_id + '_add_all_link');
|
|
||||||
choose_all.className = 'selector-chooseall';
|
|
||||||
|
|
||||||
// <ul class="selector-chooser">
|
|
||||||
var selector_chooser = quickElement('ul', selector_div);
|
|
||||||
selector_chooser.className = 'selector-chooser';
|
|
||||||
var add_link = quickElement('a', quickElement('li', selector_chooser), gettext('Choose'), 'title', gettext('Choose'), 'href', '#', 'id', field_id + '_add_link');
|
|
||||||
add_link.className = 'selector-add';
|
|
||||||
var remove_link = quickElement('a', quickElement('li', selector_chooser), gettext('Remove'), 'title', gettext('Remove'), 'href', '#', 'id', field_id + '_remove_link');
|
|
||||||
remove_link.className = 'selector-remove';
|
|
||||||
|
|
||||||
// <div class="selector-chosen">
|
|
||||||
var selector_chosen = quickElement('div', selector_div);
|
|
||||||
selector_chosen.className = 'selector-chosen';
|
|
||||||
var title_chosen = quickElement('h2', selector_chosen, interpolate(gettext('Chosen %s') + ' ', [field_name]));
|
|
||||||
quickElement(
|
|
||||||
'span', title_chosen, '',
|
|
||||||
'class', 'help help-tooltip help-icon',
|
|
||||||
'title', interpolate(
|
|
||||||
gettext(
|
|
||||||
'This is the list of chosen %s. You may remove some by ' +
|
|
||||||
'selecting them in the box below and then clicking the ' +
|
|
||||||
'"Remove" arrow between the two boxes.'
|
|
||||||
),
|
|
||||||
[field_name]
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
var to_box = quickElement('select', selector_chosen, '', 'id', field_id + '_to', 'multiple', 'multiple', 'size', from_box.size, 'name', from_box.getAttribute('name'));
|
|
||||||
to_box.className = 'filtered';
|
|
||||||
var clear_all = quickElement('a', selector_chosen, gettext('Remove all'), 'title', interpolate(gettext('Click to remove all chosen %s at once.'), [field_name]), 'href', '#', 'id', field_id + '_remove_all_link');
|
|
||||||
clear_all.className = 'selector-clearall';
|
|
||||||
|
|
||||||
from_box.setAttribute('name', from_box.getAttribute('name') + '_old');
|
|
||||||
|
|
||||||
// Set up the JavaScript event handlers for the select box filter interface
|
|
||||||
var move_selection = function(e, elem, move_func, from, to) {
|
|
||||||
if (elem.className.indexOf('active') !== -1) {
|
|
||||||
move_func(from, to);
|
|
||||||
SelectFilter.refresh_icons(field_id);
|
|
||||||
}
|
|
||||||
e.preventDefault();
|
|
||||||
};
|
|
||||||
choose_all.addEventListener('click', function(e) {
|
|
||||||
move_selection(e, this, SelectBox.move_all, field_id + '_from', field_id + '_to');
|
|
||||||
});
|
|
||||||
add_link.addEventListener('click', function(e) {
|
|
||||||
move_selection(e, this, SelectBox.move, field_id + '_from', field_id + '_to');
|
|
||||||
});
|
|
||||||
remove_link.addEventListener('click', function(e) {
|
|
||||||
move_selection(e, this, SelectBox.move, field_id + '_to', field_id + '_from');
|
|
||||||
});
|
|
||||||
clear_all.addEventListener('click', function(e) {
|
|
||||||
move_selection(e, this, SelectBox.move_all, field_id + '_to', field_id + '_from');
|
|
||||||
});
|
|
||||||
filter_input.addEventListener('keypress', function(e) {
|
|
||||||
SelectFilter.filter_key_press(e, field_id);
|
|
||||||
});
|
|
||||||
filter_input.addEventListener('keyup', function(e) {
|
|
||||||
SelectFilter.filter_key_up(e, field_id);
|
|
||||||
});
|
|
||||||
filter_input.addEventListener('keydown', function(e) {
|
|
||||||
SelectFilter.filter_key_down(e, field_id);
|
|
||||||
});
|
|
||||||
selector_div.addEventListener('change', function(e) {
|
|
||||||
if (e.target.tagName === 'SELECT') {
|
|
||||||
SelectFilter.refresh_icons(field_id);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
selector_div.addEventListener('dblclick', function(e) {
|
|
||||||
if (e.target.tagName === 'OPTION') {
|
|
||||||
if (e.target.closest('select').id === field_id + '_to') {
|
|
||||||
SelectBox.move(field_id + '_to', field_id + '_from');
|
|
||||||
} else {
|
|
||||||
SelectBox.move(field_id + '_from', field_id + '_to');
|
|
||||||
}
|
|
||||||
SelectFilter.refresh_icons(field_id);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
findForm(from_box).addEventListener('submit', function() {
|
|
||||||
SelectBox.select_all(field_id + '_to');
|
|
||||||
});
|
|
||||||
SelectBox.init(field_id + '_from');
|
|
||||||
SelectBox.init(field_id + '_to');
|
|
||||||
// Move selected from_box options to to_box
|
|
||||||
SelectBox.move(field_id + '_from', field_id + '_to');
|
|
||||||
|
|
||||||
if (!is_stacked) {
|
|
||||||
// In horizontal mode, give the same height to the two boxes.
|
|
||||||
var j_from_box = $('#' + field_id + '_from');
|
|
||||||
var j_to_box = $('#' + field_id + '_to');
|
|
||||||
j_to_box.height($(filter_p).outerHeight() + j_from_box.outerHeight());
|
|
||||||
}
|
|
||||||
|
|
||||||
// Initial icon refresh
|
|
||||||
SelectFilter.refresh_icons(field_id);
|
|
||||||
},
|
|
||||||
any_selected: function(field) {
|
|
||||||
var any_selected = false;
|
|
||||||
try {
|
|
||||||
// Temporarily add the required attribute and check validity.
|
|
||||||
// This is much faster in WebKit browsers than the fallback.
|
|
||||||
field.attr('required', 'required');
|
|
||||||
any_selected = field.is(':valid');
|
|
||||||
field.removeAttr('required');
|
|
||||||
} catch (e) {
|
|
||||||
// Browsers that don't support :valid (IE < 10)
|
|
||||||
any_selected = field.find('option:selected').length > 0;
|
|
||||||
}
|
|
||||||
return any_selected;
|
|
||||||
},
|
|
||||||
refresh_icons: function(field_id) {
|
|
||||||
var from = $('#' + field_id + '_from');
|
|
||||||
var to = $('#' + field_id + '_to');
|
|
||||||
// Active if at least one item is selected
|
|
||||||
$('#' + field_id + '_add_link').toggleClass('active', SelectFilter.any_selected(from));
|
|
||||||
$('#' + field_id + '_remove_link').toggleClass('active', SelectFilter.any_selected(to));
|
|
||||||
// Active if the corresponding box isn't empty
|
|
||||||
$('#' + field_id + '_add_all_link').toggleClass('active', from.find('option').length > 0);
|
|
||||||
$('#' + field_id + '_remove_all_link').toggleClass('active', to.find('option').length > 0);
|
|
||||||
},
|
|
||||||
filter_key_press: function(event, field_id) {
|
|
||||||
var from = document.getElementById(field_id + '_from');
|
|
||||||
// don't submit form if user pressed Enter
|
|
||||||
if ((event.which && event.which === 13) || (event.keyCode && event.keyCode === 13)) {
|
|
||||||
from.selectedIndex = 0;
|
|
||||||
SelectBox.move(field_id + '_from', field_id + '_to');
|
|
||||||
from.selectedIndex = 0;
|
|
||||||
event.preventDefault();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
filter_key_up: function(event, field_id) {
|
|
||||||
var from = document.getElementById(field_id + '_from');
|
|
||||||
var temp = from.selectedIndex;
|
|
||||||
SelectBox.filter(field_id + '_from', document.getElementById(field_id + '_input').value);
|
|
||||||
from.selectedIndex = temp;
|
|
||||||
return true;
|
|
||||||
},
|
|
||||||
filter_key_down: function(event, field_id) {
|
|
||||||
var from = document.getElementById(field_id + '_from');
|
|
||||||
// right arrow -- move across
|
|
||||||
if ((event.which && event.which === 39) || (event.keyCode && event.keyCode === 39)) {
|
|
||||||
var old_index = from.selectedIndex;
|
|
||||||
SelectBox.move(field_id + '_from', field_id + '_to');
|
|
||||||
from.selectedIndex = (old_index === from.length) ? from.length - 1 : old_index;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
// down arrow -- wrap around
|
|
||||||
if ((event.which && event.which === 40) || (event.keyCode && event.keyCode === 40)) {
|
|
||||||
from.selectedIndex = (from.length === from.selectedIndex + 1) ? 0 : from.selectedIndex + 1;
|
|
||||||
}
|
|
||||||
// up arrow -- wrap around
|
|
||||||
if ((event.which && event.which === 38) || (event.keyCode && event.keyCode === 38)) {
|
|
||||||
from.selectedIndex = (from.selectedIndex === 0) ? from.length - 1 : from.selectedIndex - 1;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
window.addEventListener('load', function(e) {
|
|
||||||
$('select.selectfilter, select.selectfilterstacked').each(function() {
|
|
||||||
var $el = $(this),
|
|
||||||
data = $el.data();
|
|
||||||
SelectFilter.init($el.attr('id'), data.fieldName, parseInt(data.isStacked, 10));
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
})(django.jQuery);
|
|
|
@ -1,153 +0,0 @@
|
||||||
/*global gettext, interpolate, ngettext*/
|
|
||||||
(function($) {
|
|
||||||
'use strict';
|
|
||||||
var lastChecked;
|
|
||||||
|
|
||||||
$.fn.actions = function(opts) {
|
|
||||||
var options = $.extend({}, $.fn.actions.defaults, opts);
|
|
||||||
var actionCheckboxes = $(this);
|
|
||||||
var list_editable_changed = false;
|
|
||||||
var showQuestion = function() {
|
|
||||||
$(options.acrossClears).hide();
|
|
||||||
$(options.acrossQuestions).show();
|
|
||||||
$(options.allContainer).hide();
|
|
||||||
},
|
|
||||||
showClear = function() {
|
|
||||||
$(options.acrossClears).show();
|
|
||||||
$(options.acrossQuestions).hide();
|
|
||||||
$(options.actionContainer).toggleClass(options.selectedClass);
|
|
||||||
$(options.allContainer).show();
|
|
||||||
$(options.counterContainer).hide();
|
|
||||||
},
|
|
||||||
reset = function() {
|
|
||||||
$(options.acrossClears).hide();
|
|
||||||
$(options.acrossQuestions).hide();
|
|
||||||
$(options.allContainer).hide();
|
|
||||||
$(options.counterContainer).show();
|
|
||||||
},
|
|
||||||
clearAcross = function() {
|
|
||||||
reset();
|
|
||||||
$(options.acrossInput).val(0);
|
|
||||||
$(options.actionContainer).removeClass(options.selectedClass);
|
|
||||||
},
|
|
||||||
checker = function(checked) {
|
|
||||||
if (checked) {
|
|
||||||
showQuestion();
|
|
||||||
} else {
|
|
||||||
reset();
|
|
||||||
}
|
|
||||||
$(actionCheckboxes).prop("checked", checked)
|
|
||||||
.parent().parent().toggleClass(options.selectedClass, checked);
|
|
||||||
},
|
|
||||||
updateCounter = function() {
|
|
||||||
var sel = $(actionCheckboxes).filter(":checked").length;
|
|
||||||
// data-actions-icnt is defined in the generated HTML
|
|
||||||
// and contains the total amount of objects in the queryset
|
|
||||||
var actions_icnt = $('.action-counter').data('actionsIcnt');
|
|
||||||
$(options.counterContainer).html(interpolate(
|
|
||||||
ngettext('%(sel)s of %(cnt)s selected', '%(sel)s of %(cnt)s selected', sel), {
|
|
||||||
sel: sel,
|
|
||||||
cnt: actions_icnt
|
|
||||||
}, true));
|
|
||||||
$(options.allToggle).prop("checked", function() {
|
|
||||||
var value;
|
|
||||||
if (sel === actionCheckboxes.length) {
|
|
||||||
value = true;
|
|
||||||
showQuestion();
|
|
||||||
} else {
|
|
||||||
value = false;
|
|
||||||
clearAcross();
|
|
||||||
}
|
|
||||||
return value;
|
|
||||||
});
|
|
||||||
};
|
|
||||||
// Show counter by default
|
|
||||||
$(options.counterContainer).show();
|
|
||||||
// Check state of checkboxes and reinit state if needed
|
|
||||||
$(this).filter(":checked").each(function(i) {
|
|
||||||
$(this).parent().parent().toggleClass(options.selectedClass);
|
|
||||||
updateCounter();
|
|
||||||
if ($(options.acrossInput).val() === 1) {
|
|
||||||
showClear();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
$(options.allToggle).show().on('click', function() {
|
|
||||||
checker($(this).prop("checked"));
|
|
||||||
updateCounter();
|
|
||||||
});
|
|
||||||
$("a", options.acrossQuestions).on('click', function(event) {
|
|
||||||
event.preventDefault();
|
|
||||||
$(options.acrossInput).val(1);
|
|
||||||
showClear();
|
|
||||||
});
|
|
||||||
$("a", options.acrossClears).on('click', function(event) {
|
|
||||||
event.preventDefault();
|
|
||||||
$(options.allToggle).prop("checked", false);
|
|
||||||
clearAcross();
|
|
||||||
checker(0);
|
|
||||||
updateCounter();
|
|
||||||
});
|
|
||||||
lastChecked = null;
|
|
||||||
$(actionCheckboxes).on('click', function(event) {
|
|
||||||
if (!event) { event = window.event; }
|
|
||||||
var target = event.target ? event.target : event.srcElement;
|
|
||||||
if (lastChecked && $.data(lastChecked) !== $.data(target) && event.shiftKey === true) {
|
|
||||||
var inrange = false;
|
|
||||||
$(lastChecked).prop("checked", target.checked)
|
|
||||||
.parent().parent().toggleClass(options.selectedClass, target.checked);
|
|
||||||
$(actionCheckboxes).each(function() {
|
|
||||||
if ($.data(this) === $.data(lastChecked) || $.data(this) === $.data(target)) {
|
|
||||||
inrange = (inrange) ? false : true;
|
|
||||||
}
|
|
||||||
if (inrange) {
|
|
||||||
$(this).prop("checked", target.checked)
|
|
||||||
.parent().parent().toggleClass(options.selectedClass, target.checked);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
$(target).parent().parent().toggleClass(options.selectedClass, target.checked);
|
|
||||||
lastChecked = target;
|
|
||||||
updateCounter();
|
|
||||||
});
|
|
||||||
$('form#changelist-form table#result_list tr').on('change', 'td:gt(0) :input', function() {
|
|
||||||
list_editable_changed = true;
|
|
||||||
});
|
|
||||||
$('form#changelist-form button[name="index"]').on('click', function(event) {
|
|
||||||
if (list_editable_changed) {
|
|
||||||
return confirm(gettext("You have unsaved changes on individual editable fields. If you run an action, your unsaved changes will be lost."));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
$('form#changelist-form input[name="_save"]').on('click', function(event) {
|
|
||||||
var action_changed = false;
|
|
||||||
$('select option:selected', options.actionContainer).each(function() {
|
|
||||||
if ($(this).val()) {
|
|
||||||
action_changed = true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
if (action_changed) {
|
|
||||||
if (list_editable_changed) {
|
|
||||||
return confirm(gettext("You have selected an action, but you haven't saved your changes to individual fields yet. Please click OK to save. You'll need to re-run the action."));
|
|
||||||
} else {
|
|
||||||
return confirm(gettext("You have selected an action, and you haven't made any changes on individual fields. You're probably looking for the Go button rather than the Save button."));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
/* Setup plugin defaults */
|
|
||||||
$.fn.actions.defaults = {
|
|
||||||
actionContainer: "div.actions",
|
|
||||||
counterContainer: "span.action-counter",
|
|
||||||
allContainer: "div.actions span.all",
|
|
||||||
acrossInput: "div.actions input.select-across",
|
|
||||||
acrossQuestions: "div.actions span.question",
|
|
||||||
acrossClears: "div.actions span.clear",
|
|
||||||
allToggle: "#action-toggle",
|
|
||||||
selectedClass: "selected"
|
|
||||||
};
|
|
||||||
$(document).ready(function() {
|
|
||||||
var $actionsEls = $('tr input.action-select');
|
|
||||||
if ($actionsEls.length > 0) {
|
|
||||||
$actionsEls.actions();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
})(django.jQuery);
|
|
|
@ -1,7 +0,0 @@
|
||||||
(function(a){var f;a.fn.actions=function(e){var b=a.extend({},a.fn.actions.defaults,e),g=a(this),k=!1,l=function(){a(b.acrossClears).hide();a(b.acrossQuestions).show();a(b.allContainer).hide()},m=function(){a(b.acrossClears).show();a(b.acrossQuestions).hide();a(b.actionContainer).toggleClass(b.selectedClass);a(b.allContainer).show();a(b.counterContainer).hide()},n=function(){a(b.acrossClears).hide();a(b.acrossQuestions).hide();a(b.allContainer).hide();a(b.counterContainer).show()},p=function(){n();
|
|
||||||
a(b.acrossInput).val(0);a(b.actionContainer).removeClass(b.selectedClass)},q=function(c){c?l():n();a(g).prop("checked",c).parent().parent().toggleClass(b.selectedClass,c)},h=function(){var c=a(g).filter(":checked").length,d=a(".action-counter").data("actionsIcnt");a(b.counterContainer).html(interpolate(ngettext("%(sel)s of %(cnt)s selected","%(sel)s of %(cnt)s selected",c),{sel:c,cnt:d},!0));a(b.allToggle).prop("checked",function(){if(c===g.length){var a=!0;l()}else a=!1,p();return a})};a(b.counterContainer).show();
|
|
||||||
a(this).filter(":checked").each(function(c){a(this).parent().parent().toggleClass(b.selectedClass);h();1===a(b.acrossInput).val()&&m()});a(b.allToggle).show().on("click",function(){q(a(this).prop("checked"));h()});a("a",b.acrossQuestions).on("click",function(c){c.preventDefault();a(b.acrossInput).val(1);m()});a("a",b.acrossClears).on("click",function(c){c.preventDefault();a(b.allToggle).prop("checked",!1);p();q(0);h()});f=null;a(g).on("click",function(c){c||(c=window.event);var d=c.target?c.target:
|
|
||||||
c.srcElement;if(f&&a.data(f)!==a.data(d)&&!0===c.shiftKey){var e=!1;a(f).prop("checked",d.checked).parent().parent().toggleClass(b.selectedClass,d.checked);a(g).each(function(){if(a.data(this)===a.data(f)||a.data(this)===a.data(d))e=e?!1:!0;e&&a(this).prop("checked",d.checked).parent().parent().toggleClass(b.selectedClass,d.checked)})}a(d).parent().parent().toggleClass(b.selectedClass,d.checked);f=d;h()});a("form#changelist-form table#result_list tr").on("change","td:gt(0) :input",function(){k=!0});
|
|
||||||
a('form#changelist-form button[name="index"]').on("click",function(a){if(k)return confirm(gettext("You have unsaved changes on individual editable fields. If you run an action, your unsaved changes will be lost."))});a('form#changelist-form input[name="_save"]').on("click",function(c){var d=!1;a("select option:selected",b.actionContainer).each(function(){a(this).val()&&(d=!0)});if(d)return k?confirm(gettext("You have selected an action, but you haven't saved your changes to individual fields yet. Please click OK to save. You'll need to re-run the action.")):
|
|
||||||
confirm(gettext("You have selected an action, and you haven't made any changes on individual fields. You're probably looking for the Go button rather than the Save button."))})};a.fn.actions.defaults={actionContainer:"div.actions",counterContainer:"span.action-counter",allContainer:"div.actions span.all",acrossInput:"div.actions input.select-across",acrossQuestions:"div.actions span.question",acrossClears:"div.actions span.clear",allToggle:"#action-toggle",selectedClass:"selected"};a(document).ready(function(){var e=
|
|
||||||
a("tr input.action-select");0<e.length&&e.actions()})})(django.jQuery);
|
|
|
@ -1,423 +0,0 @@
|
||||||
/*global Calendar, findPosX, findPosY, getStyle, get_format, gettext, gettext_noop, interpolate, ngettext, quickElement*/
|
|
||||||
// Inserts shortcut buttons after all of the following:
|
|
||||||
// <input type="text" class="vDateField">
|
|
||||||
// <input type="text" class="vTimeField">
|
|
||||||
(function() {
|
|
||||||
'use strict';
|
|
||||||
var DateTimeShortcuts = {
|
|
||||||
calendars: [],
|
|
||||||
calendarInputs: [],
|
|
||||||
clockInputs: [],
|
|
||||||
clockHours: {
|
|
||||||
default_: [
|
|
||||||
[gettext_noop('Now'), -1],
|
|
||||||
[gettext_noop('Midnight'), 0],
|
|
||||||
[gettext_noop('6 a.m.'), 6],
|
|
||||||
[gettext_noop('Noon'), 12],
|
|
||||||
[gettext_noop('6 p.m.'), 18]
|
|
||||||
]
|
|
||||||
},
|
|
||||||
dismissClockFunc: [],
|
|
||||||
dismissCalendarFunc: [],
|
|
||||||
calendarDivName1: 'calendarbox', // name of calendar <div> that gets toggled
|
|
||||||
calendarDivName2: 'calendarin', // name of <div> that contains calendar
|
|
||||||
calendarLinkName: 'calendarlink', // name of the link that is used to toggle
|
|
||||||
clockDivName: 'clockbox', // name of clock <div> that gets toggled
|
|
||||||
clockLinkName: 'clocklink', // name of the link that is used to toggle
|
|
||||||
shortCutsClass: 'datetimeshortcuts', // class of the clock and cal shortcuts
|
|
||||||
timezoneWarningClass: 'timezonewarning', // class of the warning for timezone mismatch
|
|
||||||
timezoneOffset: 0,
|
|
||||||
init: function() {
|
|
||||||
var body = document.getElementsByTagName('body')[0];
|
|
||||||
var serverOffset = body.getAttribute('data-admin-utc-offset');
|
|
||||||
if (serverOffset) {
|
|
||||||
var localOffset = new Date().getTimezoneOffset() * -60;
|
|
||||||
DateTimeShortcuts.timezoneOffset = localOffset - serverOffset;
|
|
||||||
}
|
|
||||||
|
|
||||||
var inputs = document.getElementsByTagName('input');
|
|
||||||
for (var i = 0; i < inputs.length; i++) {
|
|
||||||
var inp = inputs[i];
|
|
||||||
if (inp.getAttribute('type') === 'text' && inp.className.match(/vTimeField/)) {
|
|
||||||
DateTimeShortcuts.addClock(inp);
|
|
||||||
DateTimeShortcuts.addTimezoneWarning(inp);
|
|
||||||
}
|
|
||||||
else if (inp.getAttribute('type') === 'text' && inp.className.match(/vDateField/)) {
|
|
||||||
DateTimeShortcuts.addCalendar(inp);
|
|
||||||
DateTimeShortcuts.addTimezoneWarning(inp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
// Return the current time while accounting for the server timezone.
|
|
||||||
now: function() {
|
|
||||||
var body = document.getElementsByTagName('body')[0];
|
|
||||||
var serverOffset = body.getAttribute('data-admin-utc-offset');
|
|
||||||
if (serverOffset) {
|
|
||||||
var localNow = new Date();
|
|
||||||
var localOffset = localNow.getTimezoneOffset() * -60;
|
|
||||||
localNow.setTime(localNow.getTime() + 1000 * (serverOffset - localOffset));
|
|
||||||
return localNow;
|
|
||||||
} else {
|
|
||||||
return new Date();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
// Add a warning when the time zone in the browser and backend do not match.
|
|
||||||
addTimezoneWarning: function(inp) {
|
|
||||||
var warningClass = DateTimeShortcuts.timezoneWarningClass;
|
|
||||||
var timezoneOffset = DateTimeShortcuts.timezoneOffset / 3600;
|
|
||||||
|
|
||||||
// Only warn if there is a time zone mismatch.
|
|
||||||
if (!timezoneOffset) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check if warning is already there.
|
|
||||||
if (inp.parentNode.querySelectorAll('.' + warningClass).length) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var message;
|
|
||||||
if (timezoneOffset > 0) {
|
|
||||||
message = ngettext(
|
|
||||||
'Note: You are %s hour ahead of server time.',
|
|
||||||
'Note: You are %s hours ahead of server time.',
|
|
||||||
timezoneOffset
|
|
||||||
);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
timezoneOffset *= -1;
|
|
||||||
message = ngettext(
|
|
||||||
'Note: You are %s hour behind server time.',
|
|
||||||
'Note: You are %s hours behind server time.',
|
|
||||||
timezoneOffset
|
|
||||||
);
|
|
||||||
}
|
|
||||||
message = interpolate(message, [timezoneOffset]);
|
|
||||||
|
|
||||||
var warning = document.createElement('span');
|
|
||||||
warning.className = warningClass;
|
|
||||||
warning.textContent = message;
|
|
||||||
inp.parentNode.appendChild(document.createElement('br'));
|
|
||||||
inp.parentNode.appendChild(warning);
|
|
||||||
},
|
|
||||||
// Add clock widget to a given field
|
|
||||||
addClock: function(inp) {
|
|
||||||
var num = DateTimeShortcuts.clockInputs.length;
|
|
||||||
DateTimeShortcuts.clockInputs[num] = inp;
|
|
||||||
DateTimeShortcuts.dismissClockFunc[num] = function() { DateTimeShortcuts.dismissClock(num); return true; };
|
|
||||||
|
|
||||||
// Shortcut links (clock icon and "Now" link)
|
|
||||||
var shortcuts_span = document.createElement('span');
|
|
||||||
shortcuts_span.className = DateTimeShortcuts.shortCutsClass;
|
|
||||||
inp.parentNode.insertBefore(shortcuts_span, inp.nextSibling);
|
|
||||||
var now_link = document.createElement('a');
|
|
||||||
now_link.setAttribute('href', "#");
|
|
||||||
now_link.textContent = gettext('Now');
|
|
||||||
now_link.addEventListener('click', function(e) {
|
|
||||||
e.preventDefault();
|
|
||||||
DateTimeShortcuts.handleClockQuicklink(num, -1);
|
|
||||||
});
|
|
||||||
var clock_link = document.createElement('a');
|
|
||||||
clock_link.setAttribute('href', '#');
|
|
||||||
clock_link.id = DateTimeShortcuts.clockLinkName + num;
|
|
||||||
clock_link.addEventListener('click', function(e) {
|
|
||||||
e.preventDefault();
|
|
||||||
// avoid triggering the document click handler to dismiss the clock
|
|
||||||
e.stopPropagation();
|
|
||||||
DateTimeShortcuts.openClock(num);
|
|
||||||
});
|
|
||||||
|
|
||||||
quickElement(
|
|
||||||
'span', clock_link, '',
|
|
||||||
'class', 'clock-icon',
|
|
||||||
'title', gettext('Choose a Time')
|
|
||||||
);
|
|
||||||
shortcuts_span.appendChild(document.createTextNode('\u00A0'));
|
|
||||||
shortcuts_span.appendChild(now_link);
|
|
||||||
shortcuts_span.appendChild(document.createTextNode('\u00A0|\u00A0'));
|
|
||||||
shortcuts_span.appendChild(clock_link);
|
|
||||||
|
|
||||||
// Create clock link div
|
|
||||||
//
|
|
||||||
// Markup looks like:
|
|
||||||
// <div id="clockbox1" class="clockbox module">
|
|
||||||
// <h2>Choose a time</h2>
|
|
||||||
// <ul class="timelist">
|
|
||||||
// <li><a href="#">Now</a></li>
|
|
||||||
// <li><a href="#">Midnight</a></li>
|
|
||||||
// <li><a href="#">6 a.m.</a></li>
|
|
||||||
// <li><a href="#">Noon</a></li>
|
|
||||||
// <li><a href="#">6 p.m.</a></li>
|
|
||||||
// </ul>
|
|
||||||
// <p class="calendar-cancel"><a href="#">Cancel</a></p>
|
|
||||||
// </div>
|
|
||||||
|
|
||||||
var clock_box = document.createElement('div');
|
|
||||||
clock_box.style.display = 'none';
|
|
||||||
clock_box.style.position = 'absolute';
|
|
||||||
clock_box.className = 'clockbox module';
|
|
||||||
clock_box.setAttribute('id', DateTimeShortcuts.clockDivName + num);
|
|
||||||
document.body.appendChild(clock_box);
|
|
||||||
clock_box.addEventListener('click', function(e) { e.stopPropagation(); });
|
|
||||||
|
|
||||||
quickElement('h2', clock_box, gettext('Choose a time'));
|
|
||||||
var time_list = quickElement('ul', clock_box);
|
|
||||||
time_list.className = 'timelist';
|
|
||||||
// The list of choices can be overridden in JavaScript like this:
|
|
||||||
// DateTimeShortcuts.clockHours.name = [['3 a.m.', 3]];
|
|
||||||
// where name is the name attribute of the <input>.
|
|
||||||
var name = typeof DateTimeShortcuts.clockHours[inp.name] === 'undefined' ? 'default_' : inp.name;
|
|
||||||
DateTimeShortcuts.clockHours[name].forEach(function(element) {
|
|
||||||
var time_link = quickElement('a', quickElement('li', time_list), gettext(element[0]), 'href', '#');
|
|
||||||
time_link.addEventListener('click', function(e) {
|
|
||||||
e.preventDefault();
|
|
||||||
DateTimeShortcuts.handleClockQuicklink(num, element[1]);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
var cancel_p = quickElement('p', clock_box);
|
|
||||||
cancel_p.className = 'calendar-cancel';
|
|
||||||
var cancel_link = quickElement('a', cancel_p, gettext('Cancel'), 'href', '#');
|
|
||||||
cancel_link.addEventListener('click', function(e) {
|
|
||||||
e.preventDefault();
|
|
||||||
DateTimeShortcuts.dismissClock(num);
|
|
||||||
});
|
|
||||||
|
|
||||||
document.addEventListener('keyup', function(event) {
|
|
||||||
if (event.which === 27) {
|
|
||||||
// ESC key closes popup
|
|
||||||
DateTimeShortcuts.dismissClock(num);
|
|
||||||
event.preventDefault();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
openClock: function(num) {
|
|
||||||
var clock_box = document.getElementById(DateTimeShortcuts.clockDivName + num);
|
|
||||||
var clock_link = document.getElementById(DateTimeShortcuts.clockLinkName + num);
|
|
||||||
|
|
||||||
// Recalculate the clockbox position
|
|
||||||
// is it left-to-right or right-to-left layout ?
|
|
||||||
if (getStyle(document.body, 'direction') !== 'rtl') {
|
|
||||||
clock_box.style.left = findPosX(clock_link) + 17 + 'px';
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// since style's width is in em, it'd be tough to calculate
|
|
||||||
// px value of it. let's use an estimated px for now
|
|
||||||
// TODO: IE returns wrong value for findPosX when in rtl mode
|
|
||||||
// (it returns as it was left aligned), needs to be fixed.
|
|
||||||
clock_box.style.left = findPosX(clock_link) - 110 + 'px';
|
|
||||||
}
|
|
||||||
clock_box.style.top = Math.max(0, findPosY(clock_link) - 30) + 'px';
|
|
||||||
|
|
||||||
// Show the clock box
|
|
||||||
clock_box.style.display = 'block';
|
|
||||||
document.addEventListener('click', DateTimeShortcuts.dismissClockFunc[num]);
|
|
||||||
},
|
|
||||||
dismissClock: function(num) {
|
|
||||||
document.getElementById(DateTimeShortcuts.clockDivName + num).style.display = 'none';
|
|
||||||
document.removeEventListener('click', DateTimeShortcuts.dismissClockFunc[num]);
|
|
||||||
},
|
|
||||||
handleClockQuicklink: function(num, val) {
|
|
||||||
var d;
|
|
||||||
if (val === -1) {
|
|
||||||
d = DateTimeShortcuts.now();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
d = new Date(1970, 1, 1, val, 0, 0, 0);
|
|
||||||
}
|
|
||||||
DateTimeShortcuts.clockInputs[num].value = d.strftime(get_format('TIME_INPUT_FORMATS')[0]);
|
|
||||||
DateTimeShortcuts.clockInputs[num].focus();
|
|
||||||
DateTimeShortcuts.dismissClock(num);
|
|
||||||
},
|
|
||||||
// Add calendar widget to a given field.
|
|
||||||
addCalendar: function(inp) {
|
|
||||||
var num = DateTimeShortcuts.calendars.length;
|
|
||||||
|
|
||||||
DateTimeShortcuts.calendarInputs[num] = inp;
|
|
||||||
DateTimeShortcuts.dismissCalendarFunc[num] = function() { DateTimeShortcuts.dismissCalendar(num); return true; };
|
|
||||||
|
|
||||||
// Shortcut links (calendar icon and "Today" link)
|
|
||||||
var shortcuts_span = document.createElement('span');
|
|
||||||
shortcuts_span.className = DateTimeShortcuts.shortCutsClass;
|
|
||||||
inp.parentNode.insertBefore(shortcuts_span, inp.nextSibling);
|
|
||||||
var today_link = document.createElement('a');
|
|
||||||
today_link.setAttribute('href', '#');
|
|
||||||
today_link.appendChild(document.createTextNode(gettext('Today')));
|
|
||||||
today_link.addEventListener('click', function(e) {
|
|
||||||
e.preventDefault();
|
|
||||||
DateTimeShortcuts.handleCalendarQuickLink(num, 0);
|
|
||||||
});
|
|
||||||
var cal_link = document.createElement('a');
|
|
||||||
cal_link.setAttribute('href', '#');
|
|
||||||
cal_link.id = DateTimeShortcuts.calendarLinkName + num;
|
|
||||||
cal_link.addEventListener('click', function(e) {
|
|
||||||
e.preventDefault();
|
|
||||||
// avoid triggering the document click handler to dismiss the calendar
|
|
||||||
e.stopPropagation();
|
|
||||||
DateTimeShortcuts.openCalendar(num);
|
|
||||||
});
|
|
||||||
quickElement(
|
|
||||||
'span', cal_link, '',
|
|
||||||
'class', 'date-icon',
|
|
||||||
'title', gettext('Choose a Date')
|
|
||||||
);
|
|
||||||
shortcuts_span.appendChild(document.createTextNode('\u00A0'));
|
|
||||||
shortcuts_span.appendChild(today_link);
|
|
||||||
shortcuts_span.appendChild(document.createTextNode('\u00A0|\u00A0'));
|
|
||||||
shortcuts_span.appendChild(cal_link);
|
|
||||||
|
|
||||||
// Create calendarbox div.
|
|
||||||
//
|
|
||||||
// Markup looks like:
|
|
||||||
//
|
|
||||||
// <div id="calendarbox3" class="calendarbox module">
|
|
||||||
// <h2>
|
|
||||||
// <a href="#" class="link-previous">‹</a>
|
|
||||||
// <a href="#" class="link-next">›</a> February 2003
|
|
||||||
// </h2>
|
|
||||||
// <div class="calendar" id="calendarin3">
|
|
||||||
// <!-- (cal) -->
|
|
||||||
// </div>
|
|
||||||
// <div class="calendar-shortcuts">
|
|
||||||
// <a href="#">Yesterday</a> | <a href="#">Today</a> | <a href="#">Tomorrow</a>
|
|
||||||
// </div>
|
|
||||||
// <p class="calendar-cancel"><a href="#">Cancel</a></p>
|
|
||||||
// </div>
|
|
||||||
var cal_box = document.createElement('div');
|
|
||||||
cal_box.style.display = 'none';
|
|
||||||
cal_box.style.position = 'absolute';
|
|
||||||
cal_box.className = 'calendarbox module';
|
|
||||||
cal_box.setAttribute('id', DateTimeShortcuts.calendarDivName1 + num);
|
|
||||||
document.body.appendChild(cal_box);
|
|
||||||
cal_box.addEventListener('click', function(e) { e.stopPropagation(); });
|
|
||||||
|
|
||||||
// next-prev links
|
|
||||||
var cal_nav = quickElement('div', cal_box);
|
|
||||||
var cal_nav_prev = quickElement('a', cal_nav, '<', 'href', '#');
|
|
||||||
cal_nav_prev.className = 'calendarnav-previous';
|
|
||||||
cal_nav_prev.addEventListener('click', function(e) {
|
|
||||||
e.preventDefault();
|
|
||||||
DateTimeShortcuts.drawPrev(num);
|
|
||||||
});
|
|
||||||
|
|
||||||
var cal_nav_next = quickElement('a', cal_nav, '>', 'href', '#');
|
|
||||||
cal_nav_next.className = 'calendarnav-next';
|
|
||||||
cal_nav_next.addEventListener('click', function(e) {
|
|
||||||
e.preventDefault();
|
|
||||||
DateTimeShortcuts.drawNext(num);
|
|
||||||
});
|
|
||||||
|
|
||||||
// main box
|
|
||||||
var cal_main = quickElement('div', cal_box, '', 'id', DateTimeShortcuts.calendarDivName2 + num);
|
|
||||||
cal_main.className = 'calendar';
|
|
||||||
DateTimeShortcuts.calendars[num] = new Calendar(DateTimeShortcuts.calendarDivName2 + num, DateTimeShortcuts.handleCalendarCallback(num));
|
|
||||||
DateTimeShortcuts.calendars[num].drawCurrent();
|
|
||||||
|
|
||||||
// calendar shortcuts
|
|
||||||
var shortcuts = quickElement('div', cal_box);
|
|
||||||
shortcuts.className = 'calendar-shortcuts';
|
|
||||||
var day_link = quickElement('a', shortcuts, gettext('Yesterday'), 'href', '#');
|
|
||||||
day_link.addEventListener('click', function(e) {
|
|
||||||
e.preventDefault();
|
|
||||||
DateTimeShortcuts.handleCalendarQuickLink(num, -1);
|
|
||||||
});
|
|
||||||
shortcuts.appendChild(document.createTextNode('\u00A0|\u00A0'));
|
|
||||||
day_link = quickElement('a', shortcuts, gettext('Today'), 'href', '#');
|
|
||||||
day_link.addEventListener('click', function(e) {
|
|
||||||
e.preventDefault();
|
|
||||||
DateTimeShortcuts.handleCalendarQuickLink(num, 0);
|
|
||||||
});
|
|
||||||
shortcuts.appendChild(document.createTextNode('\u00A0|\u00A0'));
|
|
||||||
day_link = quickElement('a', shortcuts, gettext('Tomorrow'), 'href', '#');
|
|
||||||
day_link.addEventListener('click', function(e) {
|
|
||||||
e.preventDefault();
|
|
||||||
DateTimeShortcuts.handleCalendarQuickLink(num, +1);
|
|
||||||
});
|
|
||||||
|
|
||||||
// cancel bar
|
|
||||||
var cancel_p = quickElement('p', cal_box);
|
|
||||||
cancel_p.className = 'calendar-cancel';
|
|
||||||
var cancel_link = quickElement('a', cancel_p, gettext('Cancel'), 'href', '#');
|
|
||||||
cancel_link.addEventListener('click', function(e) {
|
|
||||||
e.preventDefault();
|
|
||||||
DateTimeShortcuts.dismissCalendar(num);
|
|
||||||
});
|
|
||||||
document.addEventListener('keyup', function(event) {
|
|
||||||
if (event.which === 27) {
|
|
||||||
// ESC key closes popup
|
|
||||||
DateTimeShortcuts.dismissCalendar(num);
|
|
||||||
event.preventDefault();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
openCalendar: function(num) {
|
|
||||||
var cal_box = document.getElementById(DateTimeShortcuts.calendarDivName1 + num);
|
|
||||||
var cal_link = document.getElementById(DateTimeShortcuts.calendarLinkName + num);
|
|
||||||
var inp = DateTimeShortcuts.calendarInputs[num];
|
|
||||||
|
|
||||||
// Determine if the current value in the input has a valid date.
|
|
||||||
// If so, draw the calendar with that date's year and month.
|
|
||||||
if (inp.value) {
|
|
||||||
var format = get_format('DATE_INPUT_FORMATS')[0];
|
|
||||||
var selected = inp.value.strptime(format);
|
|
||||||
var year = selected.getUTCFullYear();
|
|
||||||
var month = selected.getUTCMonth() + 1;
|
|
||||||
var re = /\d{4}/;
|
|
||||||
if (re.test(year.toString()) && month >= 1 && month <= 12) {
|
|
||||||
DateTimeShortcuts.calendars[num].drawDate(month, year, selected);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Recalculate the clockbox position
|
|
||||||
// is it left-to-right or right-to-left layout ?
|
|
||||||
if (getStyle(document.body, 'direction') !== 'rtl') {
|
|
||||||
cal_box.style.left = findPosX(cal_link) + 17 + 'px';
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// since style's width is in em, it'd be tough to calculate
|
|
||||||
// px value of it. let's use an estimated px for now
|
|
||||||
// TODO: IE returns wrong value for findPosX when in rtl mode
|
|
||||||
// (it returns as it was left aligned), needs to be fixed.
|
|
||||||
cal_box.style.left = findPosX(cal_link) - 180 + 'px';
|
|
||||||
}
|
|
||||||
cal_box.style.top = Math.max(0, findPosY(cal_link) - 75) + 'px';
|
|
||||||
|
|
||||||
cal_box.style.display = 'block';
|
|
||||||
document.addEventListener('click', DateTimeShortcuts.dismissCalendarFunc[num]);
|
|
||||||
},
|
|
||||||
dismissCalendar: function(num) {
|
|
||||||
document.getElementById(DateTimeShortcuts.calendarDivName1 + num).style.display = 'none';
|
|
||||||
document.removeEventListener('click', DateTimeShortcuts.dismissCalendarFunc[num]);
|
|
||||||
},
|
|
||||||
drawPrev: function(num) {
|
|
||||||
DateTimeShortcuts.calendars[num].drawPreviousMonth();
|
|
||||||
},
|
|
||||||
drawNext: function(num) {
|
|
||||||
DateTimeShortcuts.calendars[num].drawNextMonth();
|
|
||||||
},
|
|
||||||
handleCalendarCallback: function(num) {
|
|
||||||
var format = get_format('DATE_INPUT_FORMATS')[0];
|
|
||||||
// the format needs to be escaped a little
|
|
||||||
format = format.replace('\\', '\\\\')
|
|
||||||
.replace('\r', '\\r')
|
|
||||||
.replace('\n', '\\n')
|
|
||||||
.replace('\t', '\\t')
|
|
||||||
.replace("'", "\\'");
|
|
||||||
return function(y, m, d) {
|
|
||||||
DateTimeShortcuts.calendarInputs[num].value = new Date(y, m - 1, d).strftime(format);
|
|
||||||
DateTimeShortcuts.calendarInputs[num].focus();
|
|
||||||
document.getElementById(DateTimeShortcuts.calendarDivName1 + num).style.display = 'none';
|
|
||||||
};
|
|
||||||
},
|
|
||||||
handleCalendarQuickLink: function(num, offset) {
|
|
||||||
var d = DateTimeShortcuts.now();
|
|
||||||
d.setDate(d.getDate() + offset);
|
|
||||||
DateTimeShortcuts.calendarInputs[num].value = d.strftime(get_format('DATE_INPUT_FORMATS')[0]);
|
|
||||||
DateTimeShortcuts.calendarInputs[num].focus();
|
|
||||||
DateTimeShortcuts.dismissCalendar(num);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
window.addEventListener('load', DateTimeShortcuts.init);
|
|
||||||
window.DateTimeShortcuts = DateTimeShortcuts;
|
|
||||||
})();
|
|
|
@ -1,181 +0,0 @@
|
||||||
/*global SelectBox, interpolate*/
|
|
||||||
// Handles related-objects functionality: lookup link for raw_id_fields
|
|
||||||
// and Add Another links.
|
|
||||||
|
|
||||||
(function($) {
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
// IE doesn't accept periods or dashes in the window name, but the element IDs
|
|
||||||
// we use to generate popup window names may contain them, therefore we map them
|
|
||||||
// to allowed characters in a reversible way so that we can locate the correct
|
|
||||||
// element when the popup window is dismissed.
|
|
||||||
function id_to_windowname(text) {
|
|
||||||
text = text.replace(/\./g, '__dot__');
|
|
||||||
text = text.replace(/\-/g, '__dash__');
|
|
||||||
return text;
|
|
||||||
}
|
|
||||||
|
|
||||||
function windowname_to_id(text) {
|
|
||||||
text = text.replace(/__dot__/g, '.');
|
|
||||||
text = text.replace(/__dash__/g, '-');
|
|
||||||
return text;
|
|
||||||
}
|
|
||||||
|
|
||||||
function showAdminPopup(triggeringLink, name_regexp, add_popup) {
|
|
||||||
var name = triggeringLink.id.replace(name_regexp, '');
|
|
||||||
name = id_to_windowname(name);
|
|
||||||
var href = triggeringLink.href;
|
|
||||||
if (add_popup) {
|
|
||||||
if (href.indexOf('?') === -1) {
|
|
||||||
href += '?_popup=1';
|
|
||||||
} else {
|
|
||||||
href += '&_popup=1';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
var win = window.open(href, name, 'height=500,width=800,resizable=yes,scrollbars=yes');
|
|
||||||
win.focus();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
function showRelatedObjectLookupPopup(triggeringLink) {
|
|
||||||
return showAdminPopup(triggeringLink, /^lookup_/, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
function dismissRelatedLookupPopup(win, chosenId) {
|
|
||||||
var name = windowname_to_id(win.name);
|
|
||||||
var elem = document.getElementById(name);
|
|
||||||
if (elem.className.indexOf('vManyToManyRawIdAdminField') !== -1 && elem.value) {
|
|
||||||
elem.value += ',' + chosenId;
|
|
||||||
} else {
|
|
||||||
document.getElementById(name).value = chosenId;
|
|
||||||
}
|
|
||||||
win.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
function showRelatedObjectPopup(triggeringLink) {
|
|
||||||
return showAdminPopup(triggeringLink, /^(change|add|delete)_/, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
function updateRelatedObjectLinks(triggeringLink) {
|
|
||||||
var $this = $(triggeringLink);
|
|
||||||
var siblings = $this.nextAll('.view-related, .change-related, .delete-related');
|
|
||||||
if (!siblings.length) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var value = $this.val();
|
|
||||||
if (value) {
|
|
||||||
siblings.each(function() {
|
|
||||||
var elm = $(this);
|
|
||||||
elm.attr('href', elm.attr('data-href-template').replace('__fk__', value));
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
siblings.removeAttr('href');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function dismissAddRelatedObjectPopup(win, newId, newRepr) {
|
|
||||||
var name = windowname_to_id(win.name);
|
|
||||||
var elem = document.getElementById(name);
|
|
||||||
if (elem) {
|
|
||||||
var elemName = elem.nodeName.toUpperCase();
|
|
||||||
if (elemName === 'SELECT') {
|
|
||||||
elem.options[elem.options.length] = new Option(newRepr, newId, true, true);
|
|
||||||
} else if (elemName === 'INPUT') {
|
|
||||||
if (elem.className.indexOf('vManyToManyRawIdAdminField') !== -1 && elem.value) {
|
|
||||||
elem.value += ',' + newId;
|
|
||||||
} else {
|
|
||||||
elem.value = newId;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Trigger a change event to update related links if required.
|
|
||||||
$(elem).trigger('change');
|
|
||||||
} else {
|
|
||||||
var toId = name + "_to";
|
|
||||||
var o = new Option(newRepr, newId);
|
|
||||||
SelectBox.add_to_cache(toId, o);
|
|
||||||
SelectBox.redisplay(toId);
|
|
||||||
}
|
|
||||||
win.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
function dismissChangeRelatedObjectPopup(win, objId, newRepr, newId) {
|
|
||||||
var id = windowname_to_id(win.name).replace(/^edit_/, '');
|
|
||||||
var selectsSelector = interpolate('#%s, #%s_from, #%s_to', [id, id, id]);
|
|
||||||
var selects = $(selectsSelector);
|
|
||||||
selects.find('option').each(function() {
|
|
||||||
if (this.value === objId) {
|
|
||||||
this.textContent = newRepr;
|
|
||||||
this.value = newId;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
selects.next().find('.select2-selection__rendered').each(function() {
|
|
||||||
// The element can have a clear button as a child.
|
|
||||||
// Use the lastChild to modify only the displayed value.
|
|
||||||
this.lastChild.textContent = newRepr;
|
|
||||||
this.title = newRepr;
|
|
||||||
});
|
|
||||||
win.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
function dismissDeleteRelatedObjectPopup(win, objId) {
|
|
||||||
var id = windowname_to_id(win.name).replace(/^delete_/, '');
|
|
||||||
var selectsSelector = interpolate('#%s, #%s_from, #%s_to', [id, id, id]);
|
|
||||||
var selects = $(selectsSelector);
|
|
||||||
selects.find('option').each(function() {
|
|
||||||
if (this.value === objId) {
|
|
||||||
$(this).remove();
|
|
||||||
}
|
|
||||||
}).trigger('change');
|
|
||||||
win.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Global for testing purposes
|
|
||||||
window.id_to_windowname = id_to_windowname;
|
|
||||||
window.windowname_to_id = windowname_to_id;
|
|
||||||
|
|
||||||
window.showRelatedObjectLookupPopup = showRelatedObjectLookupPopup;
|
|
||||||
window.dismissRelatedLookupPopup = dismissRelatedLookupPopup;
|
|
||||||
window.showRelatedObjectPopup = showRelatedObjectPopup;
|
|
||||||
window.updateRelatedObjectLinks = updateRelatedObjectLinks;
|
|
||||||
window.dismissAddRelatedObjectPopup = dismissAddRelatedObjectPopup;
|
|
||||||
window.dismissChangeRelatedObjectPopup = dismissChangeRelatedObjectPopup;
|
|
||||||
window.dismissDeleteRelatedObjectPopup = dismissDeleteRelatedObjectPopup;
|
|
||||||
|
|
||||||
// Kept for backward compatibility
|
|
||||||
window.showAddAnotherPopup = showRelatedObjectPopup;
|
|
||||||
window.dismissAddAnotherPopup = dismissAddRelatedObjectPopup;
|
|
||||||
|
|
||||||
$(document).ready(function() {
|
|
||||||
$("a[data-popup-opener]").on('click', function(event) {
|
|
||||||
event.preventDefault();
|
|
||||||
opener.dismissRelatedLookupPopup(window, $(this).data("popup-opener"));
|
|
||||||
});
|
|
||||||
$('body').on('click', '.related-widget-wrapper-link', function(e) {
|
|
||||||
e.preventDefault();
|
|
||||||
if (this.href) {
|
|
||||||
var event = $.Event('django:show-related', {href: this.href});
|
|
||||||
$(this).trigger(event);
|
|
||||||
if (!event.isDefaultPrevented()) {
|
|
||||||
showRelatedObjectPopup(this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
$('body').on('change', '.related-widget-wrapper select', function(e) {
|
|
||||||
var event = $.Event('django:update-related');
|
|
||||||
$(this).trigger(event);
|
|
||||||
if (!event.isDefaultPrevented()) {
|
|
||||||
updateRelatedObjectLinks(this);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
$('.related-widget-wrapper select').trigger('change');
|
|
||||||
$('body').on('click', '.related-lookup', function(e) {
|
|
||||||
e.preventDefault();
|
|
||||||
var event = $.Event('django:lookup-related');
|
|
||||||
$(this).trigger(event);
|
|
||||||
if (!event.isDefaultPrevented()) {
|
|
||||||
showRelatedObjectLookupPopup(this);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
})(django.jQuery);
|
|
|
@ -1,37 +0,0 @@
|
||||||
(function($) {
|
|
||||||
'use strict';
|
|
||||||
var init = function($element, options) {
|
|
||||||
var settings = $.extend({
|
|
||||||
ajax: {
|
|
||||||
data: function(params) {
|
|
||||||
return {
|
|
||||||
term: params.term,
|
|
||||||
page: params.page
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}, options);
|
|
||||||
$element.select2(settings);
|
|
||||||
};
|
|
||||||
|
|
||||||
$.fn.djangoAdminSelect2 = function(options) {
|
|
||||||
var settings = $.extend({}, options);
|
|
||||||
$.each(this, function(i, element) {
|
|
||||||
var $element = $(element);
|
|
||||||
init($element, settings);
|
|
||||||
});
|
|
||||||
return this;
|
|
||||||
};
|
|
||||||
|
|
||||||
$(function() {
|
|
||||||
// Initialize all autocomplete widgets except the one in the template
|
|
||||||
// form used when a new formset is added.
|
|
||||||
$('.admin-autocomplete').not('[name*=__prefix__]').djangoAdminSelect2();
|
|
||||||
});
|
|
||||||
|
|
||||||
$(document).on('formset:added', (function() {
|
|
||||||
return function(event, $newFormset) {
|
|
||||||
return $newFormset.find('.admin-autocomplete').djangoAdminSelect2();
|
|
||||||
};
|
|
||||||
})(this));
|
|
||||||
}(django.jQuery));
|
|
|
@ -1,208 +0,0 @@
|
||||||
/*global gettext, pgettext, get_format, quickElement, removeChildren*/
|
|
||||||
/*
|
|
||||||
calendar.js - Calendar functions by Adrian Holovaty
|
|
||||||
depends on core.js for utility functions like removeChildren or quickElement
|
|
||||||
*/
|
|
||||||
|
|
||||||
(function() {
|
|
||||||
'use strict';
|
|
||||||
// CalendarNamespace -- Provides a collection of HTML calendar-related helper functions
|
|
||||||
var CalendarNamespace = {
|
|
||||||
monthsOfYear: [
|
|
||||||
gettext('January'),
|
|
||||||
gettext('February'),
|
|
||||||
gettext('March'),
|
|
||||||
gettext('April'),
|
|
||||||
gettext('May'),
|
|
||||||
gettext('June'),
|
|
||||||
gettext('July'),
|
|
||||||
gettext('August'),
|
|
||||||
gettext('September'),
|
|
||||||
gettext('October'),
|
|
||||||
gettext('November'),
|
|
||||||
gettext('December')
|
|
||||||
],
|
|
||||||
daysOfWeek: [
|
|
||||||
pgettext('one letter Sunday', 'S'),
|
|
||||||
pgettext('one letter Monday', 'M'),
|
|
||||||
pgettext('one letter Tuesday', 'T'),
|
|
||||||
pgettext('one letter Wednesday', 'W'),
|
|
||||||
pgettext('one letter Thursday', 'T'),
|
|
||||||
pgettext('one letter Friday', 'F'),
|
|
||||||
pgettext('one letter Saturday', 'S')
|
|
||||||
],
|
|
||||||
firstDayOfWeek: parseInt(get_format('FIRST_DAY_OF_WEEK')),
|
|
||||||
isLeapYear: function(year) {
|
|
||||||
return (((year % 4) === 0) && ((year % 100) !== 0 ) || ((year % 400) === 0));
|
|
||||||
},
|
|
||||||
getDaysInMonth: function(month, year) {
|
|
||||||
var days;
|
|
||||||
if (month === 1 || month === 3 || month === 5 || month === 7 || month === 8 || month === 10 || month === 12) {
|
|
||||||
days = 31;
|
|
||||||
}
|
|
||||||
else if (month === 4 || month === 6 || month === 9 || month === 11) {
|
|
||||||
days = 30;
|
|
||||||
}
|
|
||||||
else if (month === 2 && CalendarNamespace.isLeapYear(year)) {
|
|
||||||
days = 29;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
days = 28;
|
|
||||||
}
|
|
||||||
return days;
|
|
||||||
},
|
|
||||||
draw: function(month, year, div_id, callback, selected) { // month = 1-12, year = 1-9999
|
|
||||||
var today = new Date();
|
|
||||||
var todayDay = today.getDate();
|
|
||||||
var todayMonth = today.getMonth() + 1;
|
|
||||||
var todayYear = today.getFullYear();
|
|
||||||
var todayClass = '';
|
|
||||||
|
|
||||||
// Use UTC functions here because the date field does not contain time
|
|
||||||
// and using the UTC function variants prevent the local time offset
|
|
||||||
// from altering the date, specifically the day field. For example:
|
|
||||||
//
|
|
||||||
// ```
|
|
||||||
// var x = new Date('2013-10-02');
|
|
||||||
// var day = x.getDate();
|
|
||||||
// ```
|
|
||||||
//
|
|
||||||
// The day variable above will be 1 instead of 2 in, say, US Pacific time
|
|
||||||
// zone.
|
|
||||||
var isSelectedMonth = false;
|
|
||||||
if (typeof selected !== 'undefined') {
|
|
||||||
isSelectedMonth = (selected.getUTCFullYear() === year && (selected.getUTCMonth() + 1) === month);
|
|
||||||
}
|
|
||||||
|
|
||||||
month = parseInt(month);
|
|
||||||
year = parseInt(year);
|
|
||||||
var calDiv = document.getElementById(div_id);
|
|
||||||
removeChildren(calDiv);
|
|
||||||
var calTable = document.createElement('table');
|
|
||||||
quickElement('caption', calTable, CalendarNamespace.monthsOfYear[month - 1] + ' ' + year);
|
|
||||||
var tableBody = quickElement('tbody', calTable);
|
|
||||||
|
|
||||||
// Draw days-of-week header
|
|
||||||
var tableRow = quickElement('tr', tableBody);
|
|
||||||
for (var i = 0; i < 7; i++) {
|
|
||||||
quickElement('th', tableRow, CalendarNamespace.daysOfWeek[(i + CalendarNamespace.firstDayOfWeek) % 7]);
|
|
||||||
}
|
|
||||||
|
|
||||||
var startingPos = new Date(year, month - 1, 1 - CalendarNamespace.firstDayOfWeek).getDay();
|
|
||||||
var days = CalendarNamespace.getDaysInMonth(month, year);
|
|
||||||
|
|
||||||
var nonDayCell;
|
|
||||||
|
|
||||||
// Draw blanks before first of month
|
|
||||||
tableRow = quickElement('tr', tableBody);
|
|
||||||
for (i = 0; i < startingPos; i++) {
|
|
||||||
nonDayCell = quickElement('td', tableRow, ' ');
|
|
||||||
nonDayCell.className = "nonday";
|
|
||||||
}
|
|
||||||
|
|
||||||
function calendarMonth(y, m) {
|
|
||||||
function onClick(e) {
|
|
||||||
e.preventDefault();
|
|
||||||
callback(y, m, this.textContent);
|
|
||||||
}
|
|
||||||
return onClick;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Draw days of month
|
|
||||||
var currentDay = 1;
|
|
||||||
for (i = startingPos; currentDay <= days; i++) {
|
|
||||||
if (i % 7 === 0 && currentDay !== 1) {
|
|
||||||
tableRow = quickElement('tr', tableBody);
|
|
||||||
}
|
|
||||||
if ((currentDay === todayDay) && (month === todayMonth) && (year === todayYear)) {
|
|
||||||
todayClass = 'today';
|
|
||||||
} else {
|
|
||||||
todayClass = '';
|
|
||||||
}
|
|
||||||
|
|
||||||
// use UTC function; see above for explanation.
|
|
||||||
if (isSelectedMonth && currentDay === selected.getUTCDate()) {
|
|
||||||
if (todayClass !== '') {
|
|
||||||
todayClass += " ";
|
|
||||||
}
|
|
||||||
todayClass += "selected";
|
|
||||||
}
|
|
||||||
|
|
||||||
var cell = quickElement('td', tableRow, '', 'class', todayClass);
|
|
||||||
var link = quickElement('a', cell, currentDay, 'href', '#');
|
|
||||||
link.addEventListener('click', calendarMonth(year, month));
|
|
||||||
currentDay++;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Draw blanks after end of month (optional, but makes for valid code)
|
|
||||||
while (tableRow.childNodes.length < 7) {
|
|
||||||
nonDayCell = quickElement('td', tableRow, ' ');
|
|
||||||
nonDayCell.className = "nonday";
|
|
||||||
}
|
|
||||||
|
|
||||||
calDiv.appendChild(calTable);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// Calendar -- A calendar instance
|
|
||||||
function Calendar(div_id, callback, selected) {
|
|
||||||
// div_id (string) is the ID of the element in which the calendar will
|
|
||||||
// be displayed
|
|
||||||
// callback (string) is the name of a JavaScript function that will be
|
|
||||||
// called with the parameters (year, month, day) when a day in the
|
|
||||||
// calendar is clicked
|
|
||||||
this.div_id = div_id;
|
|
||||||
this.callback = callback;
|
|
||||||
this.today = new Date();
|
|
||||||
this.currentMonth = this.today.getMonth() + 1;
|
|
||||||
this.currentYear = this.today.getFullYear();
|
|
||||||
if (typeof selected !== 'undefined') {
|
|
||||||
this.selected = selected;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Calendar.prototype = {
|
|
||||||
drawCurrent: function() {
|
|
||||||
CalendarNamespace.draw(this.currentMonth, this.currentYear, this.div_id, this.callback, this.selected);
|
|
||||||
},
|
|
||||||
drawDate: function(month, year, selected) {
|
|
||||||
this.currentMonth = month;
|
|
||||||
this.currentYear = year;
|
|
||||||
|
|
||||||
if(selected) {
|
|
||||||
this.selected = selected;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.drawCurrent();
|
|
||||||
},
|
|
||||||
drawPreviousMonth: function() {
|
|
||||||
if (this.currentMonth === 1) {
|
|
||||||
this.currentMonth = 12;
|
|
||||||
this.currentYear--;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
this.currentMonth--;
|
|
||||||
}
|
|
||||||
this.drawCurrent();
|
|
||||||
},
|
|
||||||
drawNextMonth: function() {
|
|
||||||
if (this.currentMonth === 12) {
|
|
||||||
this.currentMonth = 1;
|
|
||||||
this.currentYear++;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
this.currentMonth++;
|
|
||||||
}
|
|
||||||
this.drawCurrent();
|
|
||||||
},
|
|
||||||
drawPreviousYear: function() {
|
|
||||||
this.currentYear--;
|
|
||||||
this.drawCurrent();
|
|
||||||
},
|
|
||||||
drawNextYear: function() {
|
|
||||||
this.currentYear++;
|
|
||||||
this.drawCurrent();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
window.Calendar = Calendar;
|
|
||||||
window.CalendarNamespace = CalendarNamespace;
|
|
||||||
})();
|
|
|
@ -1,13 +0,0 @@
|
||||||
(function($) {
|
|
||||||
'use strict';
|
|
||||||
$(function() {
|
|
||||||
$('.cancel-link').on('click', function(e) {
|
|
||||||
e.preventDefault();
|
|
||||||
if (window.location.search.indexOf('&_popup=1') === -1) {
|
|
||||||
window.history.back(); // Go back if not a popup.
|
|
||||||
} else {
|
|
||||||
window.close(); // Otherwise, close the popup.
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
})(django.jQuery);
|
|
|
@ -1,20 +0,0 @@
|
||||||
/*global showAddAnotherPopup, showRelatedObjectLookupPopup showRelatedObjectPopup updateRelatedObjectLinks*/
|
|
||||||
|
|
||||||
(function($) {
|
|
||||||
'use strict';
|
|
||||||
$(document).ready(function() {
|
|
||||||
var modelName = $('#django-admin-form-add-constants').data('modelName');
|
|
||||||
$('body').on('click', '.add-another', function(e) {
|
|
||||||
e.preventDefault();
|
|
||||||
var event = $.Event('django:add-another-related');
|
|
||||||
$(this).trigger(event);
|
|
||||||
if (!event.isDefaultPrevented()) {
|
|
||||||
showAddAnotherPopup(this);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
if (modelName) {
|
|
||||||
$('form#' + modelName + '_form :input:visible:enabled:first').focus();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
})(django.jQuery);
|
|
|
@ -1,55 +0,0 @@
|
||||||
/*global gettext*/
|
|
||||||
(function() {
|
|
||||||
'use strict';
|
|
||||||
var closestElem = function(elem, tagName) {
|
|
||||||
if (elem.nodeName === tagName.toUpperCase()) {
|
|
||||||
return elem;
|
|
||||||
}
|
|
||||||
if (elem.parentNode.nodeName === 'BODY') {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return elem.parentNode && closestElem(elem.parentNode, tagName);
|
|
||||||
};
|
|
||||||
|
|
||||||
window.addEventListener('load', function() {
|
|
||||||
// Add anchor tag for Show/Hide link
|
|
||||||
var fieldsets = document.querySelectorAll('fieldset.collapse');
|
|
||||||
for (var i = 0; i < fieldsets.length; i++) {
|
|
||||||
var elem = fieldsets[i];
|
|
||||||
// Don't hide if fields in this fieldset have errors
|
|
||||||
if (elem.querySelectorAll('div.errors').length === 0) {
|
|
||||||
elem.classList.add('collapsed');
|
|
||||||
var h2 = elem.querySelector('h2');
|
|
||||||
var link = document.createElement('a');
|
|
||||||
link.setAttribute('id', 'fieldsetcollapser' + i);
|
|
||||||
link.setAttribute('class', 'collapse-toggle');
|
|
||||||
link.setAttribute('href', '#');
|
|
||||||
link.textContent = gettext('Show');
|
|
||||||
h2.appendChild(document.createTextNode(' ('));
|
|
||||||
h2.appendChild(link);
|
|
||||||
h2.appendChild(document.createTextNode(')'));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Add toggle to hide/show anchor tag
|
|
||||||
var toggleFunc = function(ev) {
|
|
||||||
if (ev.target.matches('.collapse-toggle')) {
|
|
||||||
ev.preventDefault();
|
|
||||||
ev.stopPropagation();
|
|
||||||
var fieldset = closestElem(ev.target, 'fieldset');
|
|
||||||
if (fieldset.classList.contains('collapsed')) {
|
|
||||||
// Show
|
|
||||||
ev.target.textContent = gettext('Hide');
|
|
||||||
fieldset.classList.remove('collapsed');
|
|
||||||
} else {
|
|
||||||
// Hide
|
|
||||||
ev.target.textContent = gettext('Show');
|
|
||||||
fieldset.classList.add('collapsed');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
var inlineDivs = document.querySelectorAll('fieldset.module');
|
|
||||||
for (i = 0; i < inlineDivs.length; i++) {
|
|
||||||
inlineDivs[i].addEventListener('click', toggleFunc);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
})();
|
|
|
@ -1,3 +0,0 @@
|
||||||
(function(){var e=function(b,a){return b.nodeName===a.toUpperCase()?b:"BODY"===b.parentNode.nodeName?null:b.parentNode&&e(b.parentNode,a)};window.addEventListener("load",function(){for(var b=document.querySelectorAll("fieldset.collapse"),a=0;a<b.length;a++){var c=b[a];if(0===c.querySelectorAll("div.errors").length){c.classList.add("collapsed");c=c.querySelector("h2");var d=document.createElement("a");d.setAttribute("id","fieldsetcollapser"+a);d.setAttribute("class","collapse-toggle");d.setAttribute("href",
|
|
||||||
"#");d.textContent=gettext("Show");c.appendChild(document.createTextNode(" ("));c.appendChild(d);c.appendChild(document.createTextNode(")"))}}b=function(a){if(a.target.matches(".collapse-toggle")){a.preventDefault();a.stopPropagation();var b=e(a.target,"fieldset");b.classList.contains("collapsed")?(a.target.textContent=gettext("Hide"),b.classList.remove("collapsed")):(a.target.textContent=gettext("Show"),b.classList.add("collapsed"))}};c=document.querySelectorAll("fieldset.module");for(a=0;a<c.length;a++)c[a].addEventListener("click",
|
|
||||||
b)})})();
|
|
|
@ -1,212 +0,0 @@
|
||||||
// Core javascript helper functions
|
|
||||||
|
|
||||||
// basic browser identification & version
|
|
||||||
var isOpera = (navigator.userAgent.indexOf("Opera") >= 0) && parseFloat(navigator.appVersion);
|
|
||||||
var isIE = ((document.all) && (!isOpera)) && parseFloat(navigator.appVersion.split("MSIE ")[1].split(";")[0]);
|
|
||||||
|
|
||||||
// quickElement(tagType, parentReference [, textInChildNode, attribute, attributeValue ...]);
|
|
||||||
function quickElement() {
|
|
||||||
'use strict';
|
|
||||||
var obj = document.createElement(arguments[0]);
|
|
||||||
if (arguments[2]) {
|
|
||||||
var textNode = document.createTextNode(arguments[2]);
|
|
||||||
obj.appendChild(textNode);
|
|
||||||
}
|
|
||||||
var len = arguments.length;
|
|
||||||
for (var i = 3; i < len; i += 2) {
|
|
||||||
obj.setAttribute(arguments[i], arguments[i + 1]);
|
|
||||||
}
|
|
||||||
arguments[1].appendChild(obj);
|
|
||||||
return obj;
|
|
||||||
}
|
|
||||||
|
|
||||||
// "a" is reference to an object
|
|
||||||
function removeChildren(a) {
|
|
||||||
'use strict';
|
|
||||||
while (a.hasChildNodes()) {
|
|
||||||
a.removeChild(a.lastChild);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
// Find-position functions by PPK
|
|
||||||
// See https://www.quirksmode.org/js/findpos.html
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
function findPosX(obj) {
|
|
||||||
'use strict';
|
|
||||||
var curleft = 0;
|
|
||||||
if (obj.offsetParent) {
|
|
||||||
while (obj.offsetParent) {
|
|
||||||
curleft += obj.offsetLeft - ((isOpera) ? 0 : obj.scrollLeft);
|
|
||||||
obj = obj.offsetParent;
|
|
||||||
}
|
|
||||||
// IE offsetParent does not include the top-level
|
|
||||||
if (isIE && obj.parentElement) {
|
|
||||||
curleft += obj.offsetLeft - obj.scrollLeft;
|
|
||||||
}
|
|
||||||
} else if (obj.x) {
|
|
||||||
curleft += obj.x;
|
|
||||||
}
|
|
||||||
return curleft;
|
|
||||||
}
|
|
||||||
|
|
||||||
function findPosY(obj) {
|
|
||||||
'use strict';
|
|
||||||
var curtop = 0;
|
|
||||||
if (obj.offsetParent) {
|
|
||||||
while (obj.offsetParent) {
|
|
||||||
curtop += obj.offsetTop - ((isOpera) ? 0 : obj.scrollTop);
|
|
||||||
obj = obj.offsetParent;
|
|
||||||
}
|
|
||||||
// IE offsetParent does not include the top-level
|
|
||||||
if (isIE && obj.parentElement) {
|
|
||||||
curtop += obj.offsetTop - obj.scrollTop;
|
|
||||||
}
|
|
||||||
} else if (obj.y) {
|
|
||||||
curtop += obj.y;
|
|
||||||
}
|
|
||||||
return curtop;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// Date object extensions
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
(function() {
|
|
||||||
'use strict';
|
|
||||||
Date.prototype.getTwelveHours = function() {
|
|
||||||
var hours = this.getHours();
|
|
||||||
if (hours === 0) {
|
|
||||||
return 12;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return hours <= 12 ? hours : hours - 12;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
Date.prototype.getTwoDigitMonth = function() {
|
|
||||||
return (this.getMonth() < 9) ? '0' + (this.getMonth() + 1) : (this.getMonth() + 1);
|
|
||||||
};
|
|
||||||
|
|
||||||
Date.prototype.getTwoDigitDate = function() {
|
|
||||||
return (this.getDate() < 10) ? '0' + this.getDate() : this.getDate();
|
|
||||||
};
|
|
||||||
|
|
||||||
Date.prototype.getTwoDigitTwelveHour = function() {
|
|
||||||
return (this.getTwelveHours() < 10) ? '0' + this.getTwelveHours() : this.getTwelveHours();
|
|
||||||
};
|
|
||||||
|
|
||||||
Date.prototype.getTwoDigitHour = function() {
|
|
||||||
return (this.getHours() < 10) ? '0' + this.getHours() : this.getHours();
|
|
||||||
};
|
|
||||||
|
|
||||||
Date.prototype.getTwoDigitMinute = function() {
|
|
||||||
return (this.getMinutes() < 10) ? '0' + this.getMinutes() : this.getMinutes();
|
|
||||||
};
|
|
||||||
|
|
||||||
Date.prototype.getTwoDigitSecond = function() {
|
|
||||||
return (this.getSeconds() < 10) ? '0' + this.getSeconds() : this.getSeconds();
|
|
||||||
};
|
|
||||||
|
|
||||||
Date.prototype.getHourMinute = function() {
|
|
||||||
return this.getTwoDigitHour() + ':' + this.getTwoDigitMinute();
|
|
||||||
};
|
|
||||||
|
|
||||||
Date.prototype.getHourMinuteSecond = function() {
|
|
||||||
return this.getTwoDigitHour() + ':' + this.getTwoDigitMinute() + ':' + this.getTwoDigitSecond();
|
|
||||||
};
|
|
||||||
|
|
||||||
Date.prototype.getFullMonthName = function() {
|
|
||||||
return typeof window.CalendarNamespace === "undefined"
|
|
||||||
? this.getTwoDigitMonth()
|
|
||||||
: window.CalendarNamespace.monthsOfYear[this.getMonth()];
|
|
||||||
};
|
|
||||||
|
|
||||||
Date.prototype.strftime = function(format) {
|
|
||||||
var fields = {
|
|
||||||
B: this.getFullMonthName(),
|
|
||||||
c: this.toString(),
|
|
||||||
d: this.getTwoDigitDate(),
|
|
||||||
H: this.getTwoDigitHour(),
|
|
||||||
I: this.getTwoDigitTwelveHour(),
|
|
||||||
m: this.getTwoDigitMonth(),
|
|
||||||
M: this.getTwoDigitMinute(),
|
|
||||||
p: (this.getHours() >= 12) ? 'PM' : 'AM',
|
|
||||||
S: this.getTwoDigitSecond(),
|
|
||||||
w: '0' + this.getDay(),
|
|
||||||
x: this.toLocaleDateString(),
|
|
||||||
X: this.toLocaleTimeString(),
|
|
||||||
y: ('' + this.getFullYear()).substr(2, 4),
|
|
||||||
Y: '' + this.getFullYear(),
|
|
||||||
'%': '%'
|
|
||||||
};
|
|
||||||
var result = '', i = 0;
|
|
||||||
while (i < format.length) {
|
|
||||||
if (format.charAt(i) === '%') {
|
|
||||||
result = result + fields[format.charAt(i + 1)];
|
|
||||||
++i;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
result = result + format.charAt(i);
|
|
||||||
}
|
|
||||||
++i;
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
};
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
// String object extensions
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
String.prototype.pad_left = function(pad_length, pad_string) {
|
|
||||||
var new_string = this;
|
|
||||||
for (var i = 0; new_string.length < pad_length; i++) {
|
|
||||||
new_string = pad_string + new_string;
|
|
||||||
}
|
|
||||||
return new_string;
|
|
||||||
};
|
|
||||||
|
|
||||||
String.prototype.strptime = function(format) {
|
|
||||||
var split_format = format.split(/[.\-/]/);
|
|
||||||
var date = this.split(/[.\-/]/);
|
|
||||||
var i = 0;
|
|
||||||
var day, month, year;
|
|
||||||
while (i < split_format.length) {
|
|
||||||
switch (split_format[i]) {
|
|
||||||
case "%d":
|
|
||||||
day = date[i];
|
|
||||||
break;
|
|
||||||
case "%m":
|
|
||||||
month = date[i] - 1;
|
|
||||||
break;
|
|
||||||
case "%Y":
|
|
||||||
year = date[i];
|
|
||||||
break;
|
|
||||||
case "%y":
|
|
||||||
year = date[i];
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
++i;
|
|
||||||
}
|
|
||||||
// Create Date object from UTC since the parsed value is supposed to be
|
|
||||||
// in UTC, not local time. Also, the calendar uses UTC functions for
|
|
||||||
// date extraction.
|
|
||||||
return new Date(Date.UTC(year, month, day));
|
|
||||||
};
|
|
||||||
|
|
||||||
})();
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
// Get the computed style for and element
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
function getStyle(oElm, strCssRule) {
|
|
||||||
'use strict';
|
|
||||||
var strValue = "";
|
|
||||||
if(document.defaultView && document.defaultView.getComputedStyle) {
|
|
||||||
strValue = document.defaultView.getComputedStyle(oElm, "").getPropertyValue(strCssRule);
|
|
||||||
}
|
|
||||||
else if(oElm.currentStyle) {
|
|
||||||
strCssRule = strCssRule.replace(/\-(\w)/g, function(strMatch, p1) {
|
|
||||||
return p1.toUpperCase();
|
|
||||||
});
|
|
||||||
strValue = oElm.currentStyle[strCssRule];
|
|
||||||
}
|
|
||||||
return strValue;
|
|
||||||
}
|
|
|
@ -1,298 +0,0 @@
|
||||||
/*global DateTimeShortcuts, SelectFilter*/
|
|
||||||
/**
|
|
||||||
* Django admin inlines
|
|
||||||
*
|
|
||||||
* Based on jQuery Formset 1.1
|
|
||||||
* @author Stanislaus Madueke (stan DOT madueke AT gmail DOT com)
|
|
||||||
* @requires jQuery 1.2.6 or later
|
|
||||||
*
|
|
||||||
* Copyright (c) 2009, Stanislaus Madueke
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* Spiced up with Code from Zain Memon's GSoC project 2009
|
|
||||||
* and modified for Django by Jannis Leidel, Travis Swicegood and Julien Phalip.
|
|
||||||
*
|
|
||||||
* Licensed under the New BSD License
|
|
||||||
* See: https://opensource.org/licenses/bsd-license.php
|
|
||||||
*/
|
|
||||||
(function($) {
|
|
||||||
'use strict';
|
|
||||||
$.fn.formset = function(opts) {
|
|
||||||
var options = $.extend({}, $.fn.formset.defaults, opts);
|
|
||||||
var $this = $(this);
|
|
||||||
var $parent = $this.parent();
|
|
||||||
var updateElementIndex = function(el, prefix, ndx) {
|
|
||||||
var id_regex = new RegExp("(" + prefix + "-(\\d+|__prefix__))");
|
|
||||||
var replacement = prefix + "-" + ndx;
|
|
||||||
if ($(el).prop("for")) {
|
|
||||||
$(el).prop("for", $(el).prop("for").replace(id_regex, replacement));
|
|
||||||
}
|
|
||||||
if (el.id) {
|
|
||||||
el.id = el.id.replace(id_regex, replacement);
|
|
||||||
}
|
|
||||||
if (el.name) {
|
|
||||||
el.name = el.name.replace(id_regex, replacement);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
var totalForms = $("#id_" + options.prefix + "-TOTAL_FORMS").prop("autocomplete", "off");
|
|
||||||
var nextIndex = parseInt(totalForms.val(), 10);
|
|
||||||
var maxForms = $("#id_" + options.prefix + "-MAX_NUM_FORMS").prop("autocomplete", "off");
|
|
||||||
// only show the add button if we are allowed to add more items,
|
|
||||||
// note that max_num = None translates to a blank string.
|
|
||||||
var showAddButton = maxForms.val() === '' || (maxForms.val() - totalForms.val()) > 0;
|
|
||||||
$this.each(function(i) {
|
|
||||||
$(this).not("." + options.emptyCssClass).addClass(options.formCssClass);
|
|
||||||
});
|
|
||||||
if ($this.length && showAddButton) {
|
|
||||||
var addButton = options.addButton;
|
|
||||||
if (addButton === null) {
|
|
||||||
if ($this.prop("tagName") === "TR") {
|
|
||||||
// If forms are laid out as table rows, insert the
|
|
||||||
// "add" button in a new table row:
|
|
||||||
var numCols = this.eq(-1).children().length;
|
|
||||||
$parent.append('<tr class="' + options.addCssClass + '"><td colspan="' + numCols + '"><a href="#">' + options.addText + "</a></tr>");
|
|
||||||
addButton = $parent.find("tr:last a");
|
|
||||||
} else {
|
|
||||||
// Otherwise, insert it immediately after the last form:
|
|
||||||
$this.filter(":last").after('<div class="' + options.addCssClass + '"><a href="#">' + options.addText + "</a></div>");
|
|
||||||
addButton = $this.filter(":last").next().find("a");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
addButton.on('click', function(e) {
|
|
||||||
e.preventDefault();
|
|
||||||
var template = $("#" + options.prefix + "-empty");
|
|
||||||
var row = template.clone(true);
|
|
||||||
row.removeClass(options.emptyCssClass)
|
|
||||||
.addClass(options.formCssClass)
|
|
||||||
.attr("id", options.prefix + "-" + nextIndex);
|
|
||||||
if (row.is("tr")) {
|
|
||||||
// If the forms are laid out in table rows, insert
|
|
||||||
// the remove button into the last table cell:
|
|
||||||
row.children(":last").append('<div><a class="' + options.deleteCssClass + '" href="#">' + options.deleteText + "</a></div>");
|
|
||||||
} else if (row.is("ul") || row.is("ol")) {
|
|
||||||
// If they're laid out as an ordered/unordered list,
|
|
||||||
// insert an <li> after the last list item:
|
|
||||||
row.append('<li><a class="' + options.deleteCssClass + '" href="#">' + options.deleteText + "</a></li>");
|
|
||||||
} else {
|
|
||||||
// Otherwise, just insert the remove button as the
|
|
||||||
// last child element of the form's container:
|
|
||||||
row.children(":first").append('<span><a class="' + options.deleteCssClass + '" href="#">' + options.deleteText + "</a></span>");
|
|
||||||
}
|
|
||||||
row.find("*").each(function() {
|
|
||||||
updateElementIndex(this, options.prefix, totalForms.val());
|
|
||||||
});
|
|
||||||
// Insert the new form when it has been fully edited
|
|
||||||
row.insertBefore($(template));
|
|
||||||
// Update number of total forms
|
|
||||||
$(totalForms).val(parseInt(totalForms.val(), 10) + 1);
|
|
||||||
nextIndex += 1;
|
|
||||||
// Hide add button in case we've hit the max, except we want to add infinitely
|
|
||||||
if ((maxForms.val() !== '') && (maxForms.val() - totalForms.val()) <= 0) {
|
|
||||||
addButton.parent().hide();
|
|
||||||
}
|
|
||||||
// The delete button of each row triggers a bunch of other things
|
|
||||||
row.find("a." + options.deleteCssClass).on('click', function(e1) {
|
|
||||||
e1.preventDefault();
|
|
||||||
// Remove the parent form containing this button:
|
|
||||||
row.remove();
|
|
||||||
nextIndex -= 1;
|
|
||||||
// If a post-delete callback was provided, call it with the deleted form:
|
|
||||||
if (options.removed) {
|
|
||||||
options.removed(row);
|
|
||||||
}
|
|
||||||
$(document).trigger('formset:removed', [row, options.prefix]);
|
|
||||||
// Update the TOTAL_FORMS form count.
|
|
||||||
var forms = $("." + options.formCssClass);
|
|
||||||
$("#id_" + options.prefix + "-TOTAL_FORMS").val(forms.length);
|
|
||||||
// Show add button again once we drop below max
|
|
||||||
if ((maxForms.val() === '') || (maxForms.val() - forms.length) > 0) {
|
|
||||||
addButton.parent().show();
|
|
||||||
}
|
|
||||||
// Also, update names and ids for all remaining form controls
|
|
||||||
// so they remain in sequence:
|
|
||||||
var i, formCount;
|
|
||||||
var updateElementCallback = function() {
|
|
||||||
updateElementIndex(this, options.prefix, i);
|
|
||||||
};
|
|
||||||
for (i = 0, formCount = forms.length; i < formCount; i++) {
|
|
||||||
updateElementIndex($(forms).get(i), options.prefix, i);
|
|
||||||
$(forms.get(i)).find("*").each(updateElementCallback);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
// If a post-add callback was supplied, call it with the added form:
|
|
||||||
if (options.added) {
|
|
||||||
options.added(row);
|
|
||||||
}
|
|
||||||
$(document).trigger('formset:added', [row, options.prefix]);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return this;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* Setup plugin defaults */
|
|
||||||
$.fn.formset.defaults = {
|
|
||||||
prefix: "form", // The form prefix for your django formset
|
|
||||||
addText: "add another", // Text for the add link
|
|
||||||
deleteText: "remove", // Text for the delete link
|
|
||||||
addCssClass: "add-row", // CSS class applied to the add link
|
|
||||||
deleteCssClass: "delete-row", // CSS class applied to the delete link
|
|
||||||
emptyCssClass: "empty-row", // CSS class applied to the empty row
|
|
||||||
formCssClass: "dynamic-form", // CSS class applied to each form in a formset
|
|
||||||
added: null, // Function called each time a new form is added
|
|
||||||
removed: null, // Function called each time a form is deleted
|
|
||||||
addButton: null // Existing add button to use
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
// Tabular inlines ---------------------------------------------------------
|
|
||||||
$.fn.tabularFormset = function(selector, options) {
|
|
||||||
var $rows = $(this);
|
|
||||||
var alternatingRows = function(row) {
|
|
||||||
$(selector).not(".add-row").removeClass("row1 row2")
|
|
||||||
.filter(":even").addClass("row1").end()
|
|
||||||
.filter(":odd").addClass("row2");
|
|
||||||
};
|
|
||||||
|
|
||||||
var reinitDateTimeShortCuts = function() {
|
|
||||||
// Reinitialize the calendar and clock widgets by force
|
|
||||||
if (typeof DateTimeShortcuts !== "undefined") {
|
|
||||||
$(".datetimeshortcuts").remove();
|
|
||||||
DateTimeShortcuts.init();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
var updateSelectFilter = function() {
|
|
||||||
// If any SelectFilter widgets are a part of the new form,
|
|
||||||
// instantiate a new SelectFilter instance for it.
|
|
||||||
if (typeof SelectFilter !== 'undefined') {
|
|
||||||
$('.selectfilter').each(function(index, value) {
|
|
||||||
var namearr = value.name.split('-');
|
|
||||||
SelectFilter.init(value.id, namearr[namearr.length - 1], false);
|
|
||||||
});
|
|
||||||
$('.selectfilterstacked').each(function(index, value) {
|
|
||||||
var namearr = value.name.split('-');
|
|
||||||
SelectFilter.init(value.id, namearr[namearr.length - 1], true);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
var initPrepopulatedFields = function(row) {
|
|
||||||
row.find('.prepopulated_field').each(function() {
|
|
||||||
var field = $(this),
|
|
||||||
input = field.find('input, select, textarea'),
|
|
||||||
dependency_list = input.data('dependency_list') || [],
|
|
||||||
dependencies = [];
|
|
||||||
$.each(dependency_list, function(i, field_name) {
|
|
||||||
dependencies.push('#' + row.find('.field-' + field_name).find('input, select, textarea').attr('id'));
|
|
||||||
});
|
|
||||||
if (dependencies.length) {
|
|
||||||
input.prepopulate(dependencies, input.attr('maxlength'));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
$rows.formset({
|
|
||||||
prefix: options.prefix,
|
|
||||||
addText: options.addText,
|
|
||||||
formCssClass: "dynamic-" + options.prefix,
|
|
||||||
deleteCssClass: "inline-deletelink",
|
|
||||||
deleteText: options.deleteText,
|
|
||||||
emptyCssClass: "empty-form",
|
|
||||||
removed: alternatingRows,
|
|
||||||
added: function(row) {
|
|
||||||
initPrepopulatedFields(row);
|
|
||||||
reinitDateTimeShortCuts();
|
|
||||||
updateSelectFilter();
|
|
||||||
alternatingRows(row);
|
|
||||||
},
|
|
||||||
addButton: options.addButton
|
|
||||||
});
|
|
||||||
|
|
||||||
return $rows;
|
|
||||||
};
|
|
||||||
|
|
||||||
// Stacked inlines ---------------------------------------------------------
|
|
||||||
$.fn.stackedFormset = function(selector, options) {
|
|
||||||
var $rows = $(this);
|
|
||||||
var updateInlineLabel = function(row) {
|
|
||||||
$(selector).find(".inline_label").each(function(i) {
|
|
||||||
var count = i + 1;
|
|
||||||
$(this).html($(this).html().replace(/(#\d+)/g, "#" + count));
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
var reinitDateTimeShortCuts = function() {
|
|
||||||
// Reinitialize the calendar and clock widgets by force, yuck.
|
|
||||||
if (typeof DateTimeShortcuts !== "undefined") {
|
|
||||||
$(".datetimeshortcuts").remove();
|
|
||||||
DateTimeShortcuts.init();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
var updateSelectFilter = function() {
|
|
||||||
// If any SelectFilter widgets were added, instantiate a new instance.
|
|
||||||
if (typeof SelectFilter !== "undefined") {
|
|
||||||
$(".selectfilter").each(function(index, value) {
|
|
||||||
var namearr = value.name.split('-');
|
|
||||||
SelectFilter.init(value.id, namearr[namearr.length - 1], false);
|
|
||||||
});
|
|
||||||
$(".selectfilterstacked").each(function(index, value) {
|
|
||||||
var namearr = value.name.split('-');
|
|
||||||
SelectFilter.init(value.id, namearr[namearr.length - 1], true);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
var initPrepopulatedFields = function(row) {
|
|
||||||
row.find('.prepopulated_field').each(function() {
|
|
||||||
var field = $(this),
|
|
||||||
input = field.find('input, select, textarea'),
|
|
||||||
dependency_list = input.data('dependency_list') || [],
|
|
||||||
dependencies = [];
|
|
||||||
$.each(dependency_list, function(i, field_name) {
|
|
||||||
dependencies.push('#' + row.find('.form-row .field-' + field_name).find('input, select, textarea').attr('id'));
|
|
||||||
});
|
|
||||||
if (dependencies.length) {
|
|
||||||
input.prepopulate(dependencies, input.attr('maxlength'));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
$rows.formset({
|
|
||||||
prefix: options.prefix,
|
|
||||||
addText: options.addText,
|
|
||||||
formCssClass: "dynamic-" + options.prefix,
|
|
||||||
deleteCssClass: "inline-deletelink",
|
|
||||||
deleteText: options.deleteText,
|
|
||||||
emptyCssClass: "empty-form",
|
|
||||||
removed: updateInlineLabel,
|
|
||||||
added: function(row) {
|
|
||||||
initPrepopulatedFields(row);
|
|
||||||
reinitDateTimeShortCuts();
|
|
||||||
updateSelectFilter();
|
|
||||||
updateInlineLabel(row);
|
|
||||||
},
|
|
||||||
addButton: options.addButton
|
|
||||||
});
|
|
||||||
|
|
||||||
return $rows;
|
|
||||||
};
|
|
||||||
|
|
||||||
$(document).ready(function() {
|
|
||||||
$(".js-inline-admin-formset").each(function() {
|
|
||||||
var data = $(this).data(),
|
|
||||||
inlineOptions = data.inlineFormset,
|
|
||||||
selector;
|
|
||||||
switch(data.inlineType) {
|
|
||||||
case "stacked":
|
|
||||||
selector = inlineOptions.name + "-group .inline-related";
|
|
||||||
$(selector).stackedFormset(selector, inlineOptions.options);
|
|
||||||
break;
|
|
||||||
case "tabular":
|
|
||||||
selector = inlineOptions.name + "-group .tabular.inline-related tbody:first > tr";
|
|
||||||
$(selector).tabularFormset(selector, inlineOptions.options);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
})(django.jQuery);
|
|
|
@ -1,13 +0,0 @@
|
||||||
var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.findInternal=function(b,d,a){b instanceof String&&(b=String(b));for(var c=b.length,f=0;f<c;f++){var g=b[f];if(d.call(a,g,f,b))return{i:f,v:g}}return{i:-1,v:void 0}};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(b,d,a){b!=Array.prototype&&b!=Object.prototype&&(b[d]=a.value)};
|
|
||||||
$jscomp.getGlobal=function(b){return"undefined"!=typeof window&&window===b?b:"undefined"!=typeof global&&null!=global?global:b};$jscomp.global=$jscomp.getGlobal(this);$jscomp.polyfill=function(b,d,a,c){if(d){a=$jscomp.global;b=b.split(".");for(c=0;c<b.length-1;c++){var f=b[c];f in a||(a[f]={});a=a[f]}b=b[b.length-1];c=a[b];d=d(c);d!=c&&null!=d&&$jscomp.defineProperty(a,b,{configurable:!0,writable:!0,value:d})}};
|
|
||||||
$jscomp.polyfill("Array.prototype.find",function(b){return b?b:function(b,a){return $jscomp.findInternal(this,b,a).v}},"es6","es3");
|
|
||||||
(function(b){b.fn.formset=function(d){var a=b.extend({},b.fn.formset.defaults,d),c=b(this);d=c.parent();var f=function(a,e,d){var c=new RegExp("("+e+"-(\\d+|__prefix__))");e=e+"-"+d;b(a).prop("for")&&b(a).prop("for",b(a).prop("for").replace(c,e));a.id&&(a.id=a.id.replace(c,e));a.name&&(a.name=a.name.replace(c,e))},g=b("#id_"+a.prefix+"-TOTAL_FORMS").prop("autocomplete","off"),h=parseInt(g.val(),10),e=b("#id_"+a.prefix+"-MAX_NUM_FORMS").prop("autocomplete","off"),m=""===e.val()||0<e.val()-g.val();
|
|
||||||
c.each(function(e){b(this).not("."+a.emptyCssClass).addClass(a.formCssClass)});if(c.length&&m){var l=a.addButton;null===l&&("TR"===c.prop("tagName")?(c=this.eq(-1).children().length,d.append('<tr class="'+a.addCssClass+'"><td colspan="'+c+'"><a href="#">'+a.addText+"</a></tr>"),l=d.find("tr:last a")):(c.filter(":last").after('<div class="'+a.addCssClass+'"><a href="#">'+a.addText+"</a></div>"),l=c.filter(":last").next().find("a")));l.on("click",function(d){d.preventDefault();d=b("#"+a.prefix+"-empty");
|
|
||||||
var c=d.clone(!0);c.removeClass(a.emptyCssClass).addClass(a.formCssClass).attr("id",a.prefix+"-"+h);c.is("tr")?c.children(":last").append('<div><a class="'+a.deleteCssClass+'" href="#">'+a.deleteText+"</a></div>"):c.is("ul")||c.is("ol")?c.append('<li><a class="'+a.deleteCssClass+'" href="#">'+a.deleteText+"</a></li>"):c.children(":first").append('<span><a class="'+a.deleteCssClass+'" href="#">'+a.deleteText+"</a></span>");c.find("*").each(function(){f(this,a.prefix,g.val())});c.insertBefore(b(d));
|
|
||||||
b(g).val(parseInt(g.val(),10)+1);h+=1;""!==e.val()&&0>=e.val()-g.val()&&l.parent().hide();c.find("a."+a.deleteCssClass).on("click",function(d){d.preventDefault();c.remove();--h;a.removed&&a.removed(c);b(document).trigger("formset:removed",[c,a.prefix]);d=b("."+a.formCssClass);b("#id_"+a.prefix+"-TOTAL_FORMS").val(d.length);(""===e.val()||0<e.val()-d.length)&&l.parent().show();var m,g=function(){f(this,a.prefix,k)};var k=0;for(m=d.length;k<m;k++)f(b(d).get(k),a.prefix,k),b(d.get(k)).find("*").each(g)});
|
|
||||||
a.added&&a.added(c);b(document).trigger("formset:added",[c,a.prefix])})}return this};b.fn.formset.defaults={prefix:"form",addText:"add another",deleteText:"remove",addCssClass:"add-row",deleteCssClass:"delete-row",emptyCssClass:"empty-row",formCssClass:"dynamic-form",added:null,removed:null,addButton:null};b.fn.tabularFormset=function(d,a){var c=b(this),f=function(a){b(d).not(".add-row").removeClass("row1 row2").filter(":even").addClass("row1").end().filter(":odd").addClass("row2")},g=function(){"undefined"!==
|
|
||||||
typeof SelectFilter&&(b(".selectfilter").each(function(b,a){b=a.name.split("-");SelectFilter.init(a.id,b[b.length-1],!1)}),b(".selectfilterstacked").each(function(b,a){b=a.name.split("-");SelectFilter.init(a.id,b[b.length-1],!0)}))},h=function(a){a.find(".prepopulated_field").each(function(){var c=b(this).find("input, select, textarea"),d=c.data("dependency_list")||[],e=[];b.each(d,function(b,c){e.push("#"+a.find(".field-"+c).find("input, select, textarea").attr("id"))});e.length&&c.prepopulate(e,
|
|
||||||
c.attr("maxlength"))})};c.formset({prefix:a.prefix,addText:a.addText,formCssClass:"dynamic-"+a.prefix,deleteCssClass:"inline-deletelink",deleteText:a.deleteText,emptyCssClass:"empty-form",removed:f,added:function(a){h(a);"undefined"!==typeof DateTimeShortcuts&&(b(".datetimeshortcuts").remove(),DateTimeShortcuts.init());g();f(a)},addButton:a.addButton});return c};b.fn.stackedFormset=function(d,a){var c=b(this),f=function(a){b(d).find(".inline_label").each(function(a){a+=1;b(this).html(b(this).html().replace(/(#\d+)/g,
|
|
||||||
"#"+a))})},g=function(){"undefined"!==typeof SelectFilter&&(b(".selectfilter").each(function(a,b){a=b.name.split("-");SelectFilter.init(b.id,a[a.length-1],!1)}),b(".selectfilterstacked").each(function(a,b){a=b.name.split("-");SelectFilter.init(b.id,a[a.length-1],!0)}))},h=function(a){a.find(".prepopulated_field").each(function(){var c=b(this).find("input, select, textarea"),d=c.data("dependency_list")||[],e=[];b.each(d,function(b,c){e.push("#"+a.find(".form-row .field-"+c).find("input, select, textarea").attr("id"))});
|
|
||||||
e.length&&c.prepopulate(e,c.attr("maxlength"))})};c.formset({prefix:a.prefix,addText:a.addText,formCssClass:"dynamic-"+a.prefix,deleteCssClass:"inline-deletelink",deleteText:a.deleteText,emptyCssClass:"empty-form",removed:f,added:function(a){h(a);"undefined"!==typeof DateTimeShortcuts&&(b(".datetimeshortcuts").remove(),DateTimeShortcuts.init());g();f(a)},addButton:a.addButton});return c};b(document).ready(function(){b(".js-inline-admin-formset").each(function(){var d=b(this).data(),a=d.inlineFormset;
|
|
||||||
switch(d.inlineType){case "stacked":d=a.name+"-group .inline-related";b(d).stackedFormset(d,a.options);break;case "tabular":d=a.name+"-group .tabular.inline-related tbody:first > tr",b(d).tabularFormset(d,a.options)}})})})(django.jQuery);
|
|
|
@ -1,8 +0,0 @@
|
||||||
/*global django:true, jQuery:false*/
|
|
||||||
/* Puts the included jQuery into our own namespace using noConflict and passing
|
|
||||||
* it 'true'. This ensures that the included jQuery doesn't pollute the global
|
|
||||||
* namespace (i.e. this preserves pre-existing values for both window.$ and
|
|
||||||
* window.jQuery).
|
|
||||||
*/
|
|
||||||
var django = django || {};
|
|
||||||
django.jQuery = jQuery.noConflict(true);
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,16 +0,0 @@
|
||||||
/*global opener */
|
|
||||||
(function() {
|
|
||||||
'use strict';
|
|
||||||
var initData = JSON.parse(document.getElementById('django-admin-popup-response-constants').dataset.popupResponse);
|
|
||||||
switch(initData.action) {
|
|
||||||
case 'change':
|
|
||||||
opener.dismissChangeRelatedObjectPopup(window, initData.value, initData.obj, initData.new_value);
|
|
||||||
break;
|
|
||||||
case 'delete':
|
|
||||||
opener.dismissDeleteRelatedObjectPopup(window, initData.value);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
opener.dismissAddRelatedObjectPopup(window, initData.value, initData.obj);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
})();
|
|
|
@ -1,42 +0,0 @@
|
||||||
/*global URLify*/
|
|
||||||
(function($) {
|
|
||||||
'use strict';
|
|
||||||
$.fn.prepopulate = function(dependencies, maxLength, allowUnicode) {
|
|
||||||
/*
|
|
||||||
Depends on urlify.js
|
|
||||||
Populates a selected field with the values of the dependent fields,
|
|
||||||
URLifies and shortens the string.
|
|
||||||
dependencies - array of dependent fields ids
|
|
||||||
maxLength - maximum length of the URLify'd string
|
|
||||||
allowUnicode - Unicode support of the URLify'd string
|
|
||||||
*/
|
|
||||||
return this.each(function() {
|
|
||||||
var prepopulatedField = $(this);
|
|
||||||
|
|
||||||
var populate = function() {
|
|
||||||
// Bail if the field's value has been changed by the user
|
|
||||||
if (prepopulatedField.data('_changed')) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var values = [];
|
|
||||||
$.each(dependencies, function(i, field) {
|
|
||||||
field = $(field);
|
|
||||||
if (field.val().length > 0) {
|
|
||||||
values.push(field.val());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
prepopulatedField.val(URLify(values.join(' '), maxLength, allowUnicode));
|
|
||||||
};
|
|
||||||
|
|
||||||
prepopulatedField.data('_changed', false);
|
|
||||||
prepopulatedField.on('change', function() {
|
|
||||||
prepopulatedField.data('_changed', true);
|
|
||||||
});
|
|
||||||
|
|
||||||
if (!prepopulatedField.val()) {
|
|
||||||
$(dependencies.join(',')).on('keyup change focus', populate);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
})(django.jQuery);
|
|
|
@ -1 +0,0 @@
|
||||||
(function(b){b.fn.prepopulate=function(d,f,g){return this.each(function(){var a=b(this),h=function(){if(!a.data("_changed")){var e=[];b.each(d,function(a,c){c=b(c);0<c.val().length&&e.push(c.val())});a.val(URLify(e.join(" "),f,g))}};a.data("_changed",!1);a.on("change",function(){a.data("_changed",!0)});if(!a.val())b(d.join(",")).on("keyup change focus",h)})}})(django.jQuery);
|
|
|
@ -1,10 +0,0 @@
|
||||||
(function($) {
|
|
||||||
'use strict';
|
|
||||||
var fields = $('#django-admin-prepopulated-fields-constants').data('prepopulatedFields');
|
|
||||||
$.each(fields, function(index, field) {
|
|
||||||
$('.empty-form .form-row .field-' + field.name + ', .empty-form.form-row .field-' + field.name).addClass('prepopulated_field');
|
|
||||||
$(field.id).data('dependency_list', field.dependency_list).prepopulate(
|
|
||||||
field.dependency_ids, field.maxLength, field.allowUnicode
|
|
||||||
);
|
|
||||||
});
|
|
||||||
})(django.jQuery);
|
|
|
@ -1,106 +0,0 @@
|
||||||
(function() {
|
|
||||||
'use strict';
|
|
||||||
var timeParsePatterns = [
|
|
||||||
// 9
|
|
||||||
{
|
|
||||||
re: /^\d{1,2}$/i,
|
|
||||||
handler: function(bits) {
|
|
||||||
if (bits[0].length === 1) {
|
|
||||||
return '0' + bits[0] + ':00';
|
|
||||||
} else {
|
|
||||||
return bits[0] + ':00';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
// 13:00
|
|
||||||
{
|
|
||||||
re: /^\d{2}[:.]\d{2}$/i,
|
|
||||||
handler: function(bits) {
|
|
||||||
return bits[0].replace('.', ':');
|
|
||||||
}
|
|
||||||
},
|
|
||||||
// 9:00
|
|
||||||
{
|
|
||||||
re: /^\d[:.]\d{2}$/i,
|
|
||||||
handler: function(bits) {
|
|
||||||
return '0' + bits[0].replace('.', ':');
|
|
||||||
}
|
|
||||||
},
|
|
||||||
// 3 am / 3 a.m. / 3am
|
|
||||||
{
|
|
||||||
re: /^(\d+)\s*([ap])(?:.?m.?)?$/i,
|
|
||||||
handler: function(bits) {
|
|
||||||
var hour = parseInt(bits[1]);
|
|
||||||
if (hour === 12) {
|
|
||||||
hour = 0;
|
|
||||||
}
|
|
||||||
if (bits[2].toLowerCase() === 'p') {
|
|
||||||
if (hour === 12) {
|
|
||||||
hour = 0;
|
|
||||||
}
|
|
||||||
return (hour + 12) + ':00';
|
|
||||||
} else {
|
|
||||||
if (hour < 10) {
|
|
||||||
return '0' + hour + ':00';
|
|
||||||
} else {
|
|
||||||
return hour + ':00';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
// 3.30 am / 3:15 a.m. / 3.00am
|
|
||||||
{
|
|
||||||
re: /^(\d+)[.:](\d{2})\s*([ap]).?m.?$/i,
|
|
||||||
handler: function(bits) {
|
|
||||||
var hour = parseInt(bits[1]);
|
|
||||||
var mins = parseInt(bits[2]);
|
|
||||||
if (mins < 10) {
|
|
||||||
mins = '0' + mins;
|
|
||||||
}
|
|
||||||
if (hour === 12) {
|
|
||||||
hour = 0;
|
|
||||||
}
|
|
||||||
if (bits[3].toLowerCase() === 'p') {
|
|
||||||
if (hour === 12) {
|
|
||||||
hour = 0;
|
|
||||||
}
|
|
||||||
return (hour + 12) + ':' + mins;
|
|
||||||
} else {
|
|
||||||
if (hour < 10) {
|
|
||||||
return '0' + hour + ':' + mins;
|
|
||||||
} else {
|
|
||||||
return hour + ':' + mins;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
// noon
|
|
||||||
{
|
|
||||||
re: /^no/i,
|
|
||||||
handler: function(bits) {
|
|
||||||
return '12:00';
|
|
||||||
}
|
|
||||||
},
|
|
||||||
// midnight
|
|
||||||
{
|
|
||||||
re: /^mid/i,
|
|
||||||
handler: function(bits) {
|
|
||||||
return '00:00';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
];
|
|
||||||
|
|
||||||
function parseTimeString(s) {
|
|
||||||
for (var i = 0; i < timeParsePatterns.length; i++) {
|
|
||||||
var re = timeParsePatterns[i].re;
|
|
||||||
var handler = timeParsePatterns[i].handler;
|
|
||||||
var bits = re.exec(s);
|
|
||||||
if (bits) {
|
|
||||||
return handler(bits);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return s;
|
|
||||||
}
|
|
||||||
|
|
||||||
window.parseTimeString = parseTimeString;
|
|
||||||
})();
|
|
|
@ -1,195 +0,0 @@
|
||||||
/*global XRegExp*/
|
|
||||||
(function() {
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
var LATIN_MAP = {
|
|
||||||
'À': 'A', 'Á': 'A', 'Â': 'A', 'Ã': 'A', 'Ä': 'A', 'Å': 'A', 'Æ': 'AE',
|
|
||||||
'Ç': 'C', 'È': 'E', 'É': 'E', 'Ê': 'E', 'Ë': 'E', 'Ì': 'I', 'Í': 'I',
|
|
||||||
'Î': 'I', 'Ï': 'I', 'Ð': 'D', 'Ñ': 'N', 'Ò': 'O', 'Ó': 'O', 'Ô': 'O',
|
|
||||||
'Õ': 'O', 'Ö': 'O', 'Ő': 'O', 'Ø': 'O', 'Ù': 'U', 'Ú': 'U', 'Û': 'U',
|
|
||||||
'Ü': 'U', 'Ű': 'U', 'Ý': 'Y', 'Þ': 'TH', 'Ÿ': 'Y', 'ß': 'ss', 'à': 'a',
|
|
||||||
'á': 'a', 'â': 'a', 'ã': 'a', 'ä': 'a', 'å': 'a', 'æ': 'ae', 'ç': 'c',
|
|
||||||
'è': 'e', 'é': 'e', 'ê': 'e', 'ë': 'e', 'ì': 'i', 'í': 'i', 'î': 'i',
|
|
||||||
'ï': 'i', 'ð': 'd', 'ñ': 'n', 'ò': 'o', 'ó': 'o', 'ô': 'o', 'õ': 'o',
|
|
||||||
'ö': 'o', 'ő': 'o', 'ø': 'o', 'ù': 'u', 'ú': 'u', 'û': 'u', 'ü': 'u',
|
|
||||||
'ű': 'u', 'ý': 'y', 'þ': 'th', 'ÿ': 'y'
|
|
||||||
};
|
|
||||||
var LATIN_SYMBOLS_MAP = {
|
|
||||||
'©': '(c)'
|
|
||||||
};
|
|
||||||
var GREEK_MAP = {
|
|
||||||
'α': 'a', 'β': 'b', 'γ': 'g', 'δ': 'd', 'ε': 'e', 'ζ': 'z', 'η': 'h',
|
|
||||||
'θ': '8', 'ι': 'i', 'κ': 'k', 'λ': 'l', 'μ': 'm', 'ν': 'n', 'ξ': '3',
|
|
||||||
'ο': 'o', 'π': 'p', 'ρ': 'r', 'σ': 's', 'τ': 't', 'υ': 'y', 'φ': 'f',
|
|
||||||
'χ': 'x', 'ψ': 'ps', 'ω': 'w', 'ά': 'a', 'έ': 'e', 'ί': 'i', 'ό': 'o',
|
|
||||||
'ύ': 'y', 'ή': 'h', 'ώ': 'w', 'ς': 's', 'ϊ': 'i', 'ΰ': 'y', 'ϋ': 'y',
|
|
||||||
'ΐ': 'i', 'Α': 'A', 'Β': 'B', 'Γ': 'G', 'Δ': 'D', 'Ε': 'E', 'Ζ': 'Z',
|
|
||||||
'Η': 'H', 'Θ': '8', 'Ι': 'I', 'Κ': 'K', 'Λ': 'L', 'Μ': 'M', 'Ν': 'N',
|
|
||||||
'Ξ': '3', 'Ο': 'O', 'Π': 'P', 'Ρ': 'R', 'Σ': 'S', 'Τ': 'T', 'Υ': 'Y',
|
|
||||||
'Φ': 'F', 'Χ': 'X', 'Ψ': 'PS', 'Ω': 'W', 'Ά': 'A', 'Έ': 'E', 'Ί': 'I',
|
|
||||||
'Ό': 'O', 'Ύ': 'Y', 'Ή': 'H', 'Ώ': 'W', 'Ϊ': 'I', 'Ϋ': 'Y'
|
|
||||||
};
|
|
||||||
var TURKISH_MAP = {
|
|
||||||
'ş': 's', 'Ş': 'S', 'ı': 'i', 'İ': 'I', 'ç': 'c', 'Ç': 'C', 'ü': 'u',
|
|
||||||
'Ü': 'U', 'ö': 'o', 'Ö': 'O', 'ğ': 'g', 'Ğ': 'G'
|
|
||||||
};
|
|
||||||
var ROMANIAN_MAP = {
|
|
||||||
'ă': 'a', 'î': 'i', 'ș': 's', 'ț': 't', 'â': 'a',
|
|
||||||
'Ă': 'A', 'Î': 'I', 'Ș': 'S', 'Ț': 'T', 'Â': 'A'
|
|
||||||
};
|
|
||||||
var RUSSIAN_MAP = {
|
|
||||||
'а': 'a', 'б': 'b', 'в': 'v', 'г': 'g', 'д': 'd', 'е': 'e', 'ё': 'yo',
|
|
||||||
'ж': 'zh', 'з': 'z', 'и': 'i', 'й': 'j', 'к': 'k', 'л': 'l', 'м': 'm',
|
|
||||||
'н': 'n', 'о': 'o', 'п': 'p', 'р': 'r', 'с': 's', 'т': 't', 'у': 'u',
|
|
||||||
'ф': 'f', 'х': 'h', 'ц': 'c', 'ч': 'ch', 'ш': 'sh', 'щ': 'sh', 'ъ': '',
|
|
||||||
'ы': 'y', 'ь': '', 'э': 'e', 'ю': 'yu', 'я': 'ya',
|
|
||||||
'А': 'A', 'Б': 'B', 'В': 'V', 'Г': 'G', 'Д': 'D', 'Е': 'E', 'Ё': 'Yo',
|
|
||||||
'Ж': 'Zh', 'З': 'Z', 'И': 'I', 'Й': 'J', 'К': 'K', 'Л': 'L', 'М': 'M',
|
|
||||||
'Н': 'N', 'О': 'O', 'П': 'P', 'Р': 'R', 'С': 'S', 'Т': 'T', 'У': 'U',
|
|
||||||
'Ф': 'F', 'Х': 'H', 'Ц': 'C', 'Ч': 'Ch', 'Ш': 'Sh', 'Щ': 'Sh', 'Ъ': '',
|
|
||||||
'Ы': 'Y', 'Ь': '', 'Э': 'E', 'Ю': 'Yu', 'Я': 'Ya'
|
|
||||||
};
|
|
||||||
var UKRAINIAN_MAP = {
|
|
||||||
'Є': 'Ye', 'І': 'I', 'Ї': 'Yi', 'Ґ': 'G', 'є': 'ye', 'і': 'i',
|
|
||||||
'ї': 'yi', 'ґ': 'g'
|
|
||||||
};
|
|
||||||
var CZECH_MAP = {
|
|
||||||
'č': 'c', 'ď': 'd', 'ě': 'e', 'ň': 'n', 'ř': 'r', 'š': 's', 'ť': 't',
|
|
||||||
'ů': 'u', 'ž': 'z', 'Č': 'C', 'Ď': 'D', 'Ě': 'E', 'Ň': 'N', 'Ř': 'R',
|
|
||||||
'Š': 'S', 'Ť': 'T', 'Ů': 'U', 'Ž': 'Z'
|
|
||||||
};
|
|
||||||
var SLOVAK_MAP = {
|
|
||||||
'á': 'a', 'ä': 'a', 'č': 'c', 'ď': 'd', 'é': 'e', 'í': 'i', 'ľ': 'l',
|
|
||||||
'ĺ': 'l', 'ň': 'n', 'ó': 'o', 'ô': 'o', 'ŕ': 'r', 'š': 's', 'ť': 't',
|
|
||||||
'ú': 'u', 'ý': 'y', 'ž': 'z',
|
|
||||||
'Á': 'a', 'Ä': 'A', 'Č': 'C', 'Ď': 'D', 'É': 'E', 'Í': 'I', 'Ľ': 'L',
|
|
||||||
'Ĺ': 'L', 'Ň': 'N', 'Ó': 'O', 'Ô': 'O', 'Ŕ': 'R', 'Š': 'S', 'Ť': 'T',
|
|
||||||
'Ú': 'U', 'Ý': 'Y', 'Ž': 'Z'
|
|
||||||
};
|
|
||||||
var POLISH_MAP = {
|
|
||||||
'ą': 'a', 'ć': 'c', 'ę': 'e', 'ł': 'l', 'ń': 'n', 'ó': 'o', 'ś': 's',
|
|
||||||
'ź': 'z', 'ż': 'z',
|
|
||||||
'Ą': 'A', 'Ć': 'C', 'Ę': 'E', 'Ł': 'L', 'Ń': 'N', 'Ó': 'O', 'Ś': 'S',
|
|
||||||
'Ź': 'Z', 'Ż': 'Z'
|
|
||||||
};
|
|
||||||
var LATVIAN_MAP = {
|
|
||||||
'ā': 'a', 'č': 'c', 'ē': 'e', 'ģ': 'g', 'ī': 'i', 'ķ': 'k', 'ļ': 'l',
|
|
||||||
'ņ': 'n', 'š': 's', 'ū': 'u', 'ž': 'z',
|
|
||||||
'Ā': 'A', 'Č': 'C', 'Ē': 'E', 'Ģ': 'G', 'Ī': 'I', 'Ķ': 'K', 'Ļ': 'L',
|
|
||||||
'Ņ': 'N', 'Š': 'S', 'Ū': 'U', 'Ž': 'Z'
|
|
||||||
};
|
|
||||||
var ARABIC_MAP = {
|
|
||||||
'أ': 'a', 'ب': 'b', 'ت': 't', 'ث': 'th', 'ج': 'g', 'ح': 'h', 'خ': 'kh', 'د': 'd',
|
|
||||||
'ذ': 'th', 'ر': 'r', 'ز': 'z', 'س': 's', 'ش': 'sh', 'ص': 's', 'ض': 'd', 'ط': 't',
|
|
||||||
'ظ': 'th', 'ع': 'aa', 'غ': 'gh', 'ف': 'f', 'ق': 'k', 'ك': 'k', 'ل': 'l', 'م': 'm',
|
|
||||||
'ن': 'n', 'ه': 'h', 'و': 'o', 'ي': 'y'
|
|
||||||
};
|
|
||||||
var LITHUANIAN_MAP = {
|
|
||||||
'ą': 'a', 'č': 'c', 'ę': 'e', 'ė': 'e', 'į': 'i', 'š': 's', 'ų': 'u',
|
|
||||||
'ū': 'u', 'ž': 'z',
|
|
||||||
'Ą': 'A', 'Č': 'C', 'Ę': 'E', 'Ė': 'E', 'Į': 'I', 'Š': 'S', 'Ų': 'U',
|
|
||||||
'Ū': 'U', 'Ž': 'Z'
|
|
||||||
};
|
|
||||||
var SERBIAN_MAP = {
|
|
||||||
'ђ': 'dj', 'ј': 'j', 'љ': 'lj', 'њ': 'nj', 'ћ': 'c', 'џ': 'dz',
|
|
||||||
'đ': 'dj', 'Ђ': 'Dj', 'Ј': 'j', 'Љ': 'Lj', 'Њ': 'Nj', 'Ћ': 'C',
|
|
||||||
'Џ': 'Dz', 'Đ': 'Dj'
|
|
||||||
};
|
|
||||||
var AZERBAIJANI_MAP = {
|
|
||||||
'ç': 'c', 'ə': 'e', 'ğ': 'g', 'ı': 'i', 'ö': 'o', 'ş': 's', 'ü': 'u',
|
|
||||||
'Ç': 'C', 'Ə': 'E', 'Ğ': 'G', 'İ': 'I', 'Ö': 'O', 'Ş': 'S', 'Ü': 'U'
|
|
||||||
};
|
|
||||||
var GEORGIAN_MAP = {
|
|
||||||
'ა': 'a', 'ბ': 'b', 'გ': 'g', 'დ': 'd', 'ე': 'e', 'ვ': 'v', 'ზ': 'z',
|
|
||||||
'თ': 't', 'ი': 'i', 'კ': 'k', 'ლ': 'l', 'მ': 'm', 'ნ': 'n', 'ო': 'o',
|
|
||||||
'პ': 'p', 'ჟ': 'j', 'რ': 'r', 'ს': 's', 'ტ': 't', 'უ': 'u', 'ფ': 'f',
|
|
||||||
'ქ': 'q', 'ღ': 'g', 'ყ': 'y', 'შ': 'sh', 'ჩ': 'ch', 'ც': 'c', 'ძ': 'dz',
|
|
||||||
'წ': 'w', 'ჭ': 'ch', 'ხ': 'x', 'ჯ': 'j', 'ჰ': 'h'
|
|
||||||
};
|
|
||||||
|
|
||||||
var ALL_DOWNCODE_MAPS = [
|
|
||||||
LATIN_MAP,
|
|
||||||
LATIN_SYMBOLS_MAP,
|
|
||||||
GREEK_MAP,
|
|
||||||
TURKISH_MAP,
|
|
||||||
ROMANIAN_MAP,
|
|
||||||
RUSSIAN_MAP,
|
|
||||||
UKRAINIAN_MAP,
|
|
||||||
CZECH_MAP,
|
|
||||||
SLOVAK_MAP,
|
|
||||||
POLISH_MAP,
|
|
||||||
LATVIAN_MAP,
|
|
||||||
ARABIC_MAP,
|
|
||||||
LITHUANIAN_MAP,
|
|
||||||
SERBIAN_MAP,
|
|
||||||
AZERBAIJANI_MAP,
|
|
||||||
GEORGIAN_MAP
|
|
||||||
];
|
|
||||||
|
|
||||||
var Downcoder = {
|
|
||||||
'Initialize': function() {
|
|
||||||
if (Downcoder.map) { // already made
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Downcoder.map = {};
|
|
||||||
Downcoder.chars = [];
|
|
||||||
for (var i = 0; i < ALL_DOWNCODE_MAPS.length; i++) {
|
|
||||||
var lookup = ALL_DOWNCODE_MAPS[i];
|
|
||||||
for (var c in lookup) {
|
|
||||||
if (lookup.hasOwnProperty(c)) {
|
|
||||||
Downcoder.map[c] = lookup[c];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (var k in Downcoder.map) {
|
|
||||||
if (Downcoder.map.hasOwnProperty(k)) {
|
|
||||||
Downcoder.chars.push(k);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Downcoder.regex = new RegExp(Downcoder.chars.join('|'), 'g');
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
function downcode(slug) {
|
|
||||||
Downcoder.Initialize();
|
|
||||||
return slug.replace(Downcoder.regex, function(m) {
|
|
||||||
return Downcoder.map[m];
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function URLify(s, num_chars, allowUnicode) {
|
|
||||||
// changes, e.g., "Petty theft" to "petty-theft"
|
|
||||||
// remove all these words from the string before urlifying
|
|
||||||
if (!allowUnicode) {
|
|
||||||
s = downcode(s);
|
|
||||||
}
|
|
||||||
var hasUnicodeChars = /[^\u0000-\u007f]/.test(s);
|
|
||||||
// Remove English words only if the string contains ASCII (English)
|
|
||||||
// characters.
|
|
||||||
if (!hasUnicodeChars) {
|
|
||||||
var removeList = [
|
|
||||||
"a", "an", "as", "at", "before", "but", "by", "for", "from",
|
|
||||||
"is", "in", "into", "like", "of", "off", "on", "onto", "per",
|
|
||||||
"since", "than", "the", "this", "that", "to", "up", "via",
|
|
||||||
"with"
|
|
||||||
];
|
|
||||||
var r = new RegExp('\\b(' + removeList.join('|') + ')\\b', 'gi');
|
|
||||||
s = s.replace(r, '');
|
|
||||||
}
|
|
||||||
// if downcode doesn't hit, the char will be stripped here
|
|
||||||
if (allowUnicode) {
|
|
||||||
// Keep Unicode letters including both lowercase and uppercase
|
|
||||||
// characters, whitespace, and dash; remove other characters.
|
|
||||||
s = XRegExp.replace(s, XRegExp('[^-_\\p{L}\\p{N}\\s]', 'g'), '');
|
|
||||||
} else {
|
|
||||||
s = s.replace(/[^-\w\s]/g, ''); // remove unneeded chars
|
|
||||||
}
|
|
||||||
s = s.replace(/^\s+|\s+$/g, ''); // trim leading/trailing spaces
|
|
||||||
s = s.replace(/[-\s]+/g, '-'); // convert spaces to hyphens
|
|
||||||
s = s.substring(0, num_chars); // trim to first num_chars chars
|
|
||||||
s = s.replace(/-+$/g, ''); // trim any trailing hyphens
|
|
||||||
return s.toLowerCase(); // convert to lowercase
|
|
||||||
}
|
|
||||||
window.URLify = URLify;
|
|
||||||
})();
|
|
|
@ -1,20 +0,0 @@
|
||||||
Copyright JS Foundation and other contributors, https://js.foundation/
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining
|
|
||||||
a copy of this software and associated documentation files (the
|
|
||||||
"Software"), to deal in the Software without restriction, including
|
|
||||||
without limitation the rights to use, copy, modify, merge, publish,
|
|
||||||
distribute, sublicense, and/or sell copies of the Software, and to
|
|
||||||
permit persons to whom the Software is furnished to do so, subject to
|
|
||||||
the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be
|
|
||||||
included in all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
||||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
||||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
||||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
||||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
||||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
||||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
|
@ -1,21 +0,0 @@
|
||||||
The MIT License (MIT)
|
|
||||||
|
|
||||||
Copyright (c) 2012-2015 Kevin Brown, Igor Vaynberg, and Select2 contributors
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in
|
|
||||||
all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
THE SOFTWARE.
|
|
|
@ -1,3 +0,0 @@
|
||||||
/*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
|
|
||||||
|
|
||||||
(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/ar",[],function(){return{errorLoading:function(){return"لا يمكن تحميل النتائج"},inputTooLong:function(e){var t=e.input.length-e.maximum,n="الرجاء حذف "+t+" عناصر";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="الرجاء إضافة "+t+" عناصر";return n},loadingMore:function(){return"جاري تحميل نتائج إضافية..."},maximumSelected:function(e){var t="تستطيع إختيار "+e.maximum+" بنود فقط";return t},noResults:function(){return"لم يتم العثور على أي نتائج"},searching:function(){return"جاري البحث…"}}}),{define:e.define,require:e.require}})();
|
|
|
@ -1,3 +0,0 @@
|
||||||
/*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
|
|
||||||
|
|
||||||
(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/az",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum;return t+" simvol silin"},inputTooShort:function(e){var t=e.minimum-e.input.length;return t+" simvol daxil edin"},loadingMore:function(){return"Daha çox nəticə yüklənir…"},maximumSelected:function(e){return"Sadəcə "+e.maximum+" element seçə bilərsiniz"},noResults:function(){return"Nəticə tapılmadı"},searching:function(){return"Axtarılır…"}}}),{define:e.define,require:e.require}})();
|
|
|
@ -1,3 +0,0 @@
|
||||||
/*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
|
|
||||||
|
|
||||||
(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/bg",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n="Моля въведете с "+t+" по-малко символ";return t>1&&(n+="a"),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Моля въведете още "+t+" символ";return t>1&&(n+="a"),n},loadingMore:function(){return"Зареждат се още…"},maximumSelected:function(e){var t="Можете да направите до "+e.maximum+" ";return e.maximum>1?t+="избора":t+="избор",t},noResults:function(){return"Няма намерени съвпадения"},searching:function(){return"Търсене…"}}}),{define:e.define,require:e.require}})();
|
|
|
@ -1,3 +0,0 @@
|
||||||
/*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
|
|
||||||
|
|
||||||
(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/ca",[],function(){return{errorLoading:function(){return"La càrrega ha fallat"},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Si us plau, elimina "+t+" car";return t==1?n+="àcter":n+="àcters",n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Si us plau, introdueix "+t+" car";return t==1?n+="àcter":n+="àcters",n},loadingMore:function(){return"Carregant més resultats…"},maximumSelected:function(e){var t="Només es pot seleccionar "+e.maximum+" element";return e.maximum!=1&&(t+="s"),t},noResults:function(){return"No s'han trobat resultats"},searching:function(){return"Cercant…"}}}),{define:e.define,require:e.require}})();
|
|
|
@ -1,3 +0,0 @@
|
||||||
/*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
|
|
||||||
|
|
||||||
(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/cs",[],function(){function e(e,t){switch(e){case 2:return t?"dva":"dvě";case 3:return"tři";case 4:return"čtyři"}return""}return{errorLoading:function(){return"Výsledky nemohly být načteny."},inputTooLong:function(t){var n=t.input.length-t.maximum;return n==1?"Prosím zadejte o jeden znak méně":n<=4?"Prosím zadejte o "+e(n,!0)+" znaky méně":"Prosím zadejte o "+n+" znaků méně"},inputTooShort:function(t){var n=t.minimum-t.input.length;return n==1?"Prosím zadejte ještě jeden znak":n<=4?"Prosím zadejte ještě další "+e(n,!0)+" znaky":"Prosím zadejte ještě dalších "+n+" znaků"},loadingMore:function(){return"Načítají se další výsledky…"},maximumSelected:function(t){var n=t.maximum;return n==1?"Můžete zvolit jen jednu položku":n<=4?"Můžete zvolit maximálně "+e(n,!1)+" položky":"Můžete zvolit maximálně "+n+" položek"},noResults:function(){return"Nenalezeny žádné položky"},searching:function(){return"Vyhledávání…"}}}),{define:e.define,require:e.require}})();
|
|
|
@ -1,3 +0,0 @@
|
||||||
/*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
|
|
||||||
|
|
||||||
(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/da",[],function(){return{errorLoading:function(){return"Resultaterne kunne ikke indlæses."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Angiv venligst "+t+" tegn mindre";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Angiv venligst "+t+" tegn mere";return n},loadingMore:function(){return"Indlæser flere resultater…"},maximumSelected:function(e){var t="Du kan kun vælge "+e.maximum+" emne";return e.maximum!=1&&(t+="r"),t},noResults:function(){return"Ingen resultater fundet"},searching:function(){return"Søger…"}}}),{define:e.define,require:e.require}})();
|
|
|
@ -1,3 +0,0 @@
|
||||||
/*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
|
|
||||||
|
|
||||||
(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/de",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum;return"Bitte "+t+" Zeichen weniger eingeben"},inputTooShort:function(e){var t=e.minimum-e.input.length;return"Bitte "+t+" Zeichen mehr eingeben"},loadingMore:function(){return"Lade mehr Ergebnisse…"},maximumSelected:function(e){var t="Sie können nur "+e.maximum+" Eintr";return e.maximum===1?t+="ag":t+="äge",t+=" auswählen",t},noResults:function(){return"Keine Übereinstimmungen gefunden"},searching:function(){return"Suche…"}}}),{define:e.define,require:e.require}})();
|
|
|
@ -1,3 +0,0 @@
|
||||||
/*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
|
|
||||||
|
|
||||||
(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/el",[],function(){return{errorLoading:function(){return"Τα αποτελέσματα δεν μπόρεσαν να φορτώσουν."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Παρακαλώ διαγράψτε "+t+" χαρακτήρ";return t==1&&(n+="α"),t!=1&&(n+="ες"),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Παρακαλώ συμπληρώστε "+t+" ή περισσότερους χαρακτήρες";return n},loadingMore:function(){return"Φόρτωση περισσότερων αποτελεσμάτων…"},maximumSelected:function(e){var t="Μπορείτε να επιλέξετε μόνο "+e.maximum+" επιλογ";return e.maximum==1&&(t+="ή"),e.maximum!=1&&(t+="ές"),t},noResults:function(){return"Δεν βρέθηκαν αποτελέσματα"},searching:function(){return"Αναζήτηση…"}}}),{define:e.define,require:e.require}})();
|
|
|
@ -1,3 +0,0 @@
|
||||||
/*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
|
|
||||||
|
|
||||||
(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/en",[],function(){return{errorLoading:function(){return"The results could not be loaded."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Please delete "+t+" character";return t!=1&&(n+="s"),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Please enter "+t+" or more characters";return n},loadingMore:function(){return"Loading more results…"},maximumSelected:function(e){var t="You can only select "+e.maximum+" item";return e.maximum!=1&&(t+="s"),t},noResults:function(){return"No results found"},searching:function(){return"Searching…"}}}),{define:e.define,require:e.require}})();
|
|
|
@ -1,3 +0,0 @@
|
||||||
/*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
|
|
||||||
|
|
||||||
(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/es",[],function(){return{errorLoading:function(){return"La carga falló"},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Por favor, elimine "+t+" car";return t==1?n+="ácter":n+="acteres",n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Por favor, introduzca "+t+" car";return t==1?n+="ácter":n+="acteres",n},loadingMore:function(){return"Cargando más resultados…"},maximumSelected:function(e){var t="Sólo puede seleccionar "+e.maximum+" elemento";return e.maximum!=1&&(t+="s"),t},noResults:function(){return"No se encontraron resultados"},searching:function(){return"Buscando…"}}}),{define:e.define,require:e.require}})();
|
|
|
@ -1,3 +0,0 @@
|
||||||
/*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
|
|
||||||
|
|
||||||
(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/et",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n="Sisesta "+t+" täht";return t!=1&&(n+="e"),n+=" vähem",n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Sisesta "+t+" täht";return t!=1&&(n+="e"),n+=" rohkem",n},loadingMore:function(){return"Laen tulemusi…"},maximumSelected:function(e){var t="Saad vaid "+e.maximum+" tulemus";return e.maximum==1?t+="e":t+="t",t+=" valida",t},noResults:function(){return"Tulemused puuduvad"},searching:function(){return"Otsin…"}}}),{define:e.define,require:e.require}})();
|
|
|
@ -1,3 +0,0 @@
|
||||||
/*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
|
|
||||||
|
|
||||||
(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/eu",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n="Idatzi ";return t==1?n+="karaktere bat":n+=t+" karaktere",n+=" gutxiago",n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Idatzi ";return t==1?n+="karaktere bat":n+=t+" karaktere",n+=" gehiago",n},loadingMore:function(){return"Emaitza gehiago kargatzen…"},maximumSelected:function(e){return e.maximum===1?"Elementu bakarra hauta dezakezu":e.maximum+" elementu hauta ditzakezu soilik"},noResults:function(){return"Ez da bat datorrenik aurkitu"},searching:function(){return"Bilatzen…"}}}),{define:e.define,require:e.require}})();
|
|
|
@ -1,3 +0,0 @@
|
||||||
/*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
|
|
||||||
|
|
||||||
(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/fa",[],function(){return{errorLoading:function(){return"امکان بارگذاری نتایج وجود ندارد."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="لطفاً "+t+" کاراکتر را حذف نمایید";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="لطفاً تعداد "+t+" کاراکتر یا بیشتر وارد نمایید";return n},loadingMore:function(){return"در حال بارگذاری نتایج بیشتر..."},maximumSelected:function(e){var t="شما تنها میتوانید "+e.maximum+" آیتم را انتخاب نمایید";return t},noResults:function(){return"هیچ نتیجهای یافت نشد"},searching:function(){return"در حال جستجو..."}}}),{define:e.define,require:e.require}})();
|
|
|
@ -1,3 +0,0 @@
|
||||||
/*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
|
|
||||||
|
|
||||||
(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/fi",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum;return"Ole hyvä ja anna "+t+" merkkiä vähemmän"},inputTooShort:function(e){var t=e.minimum-e.input.length;return"Ole hyvä ja anna "+t+" merkkiä lisää"},loadingMore:function(){return"Ladataan lisää tuloksia…"},maximumSelected:function(e){return"Voit valita ainoastaan "+e.maximum+" kpl"},noResults:function(){return"Ei tuloksia"},searching:function(){}}}),{define:e.define,require:e.require}})();
|
|
|
@ -1,3 +0,0 @@
|
||||||
/*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
|
|
||||||
|
|
||||||
(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/fr",[],function(){return{errorLoading:function(){return"Les résultats ne peuvent pas être chargés."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Supprimez "+t+" caractère";return t!==1&&(n+="s"),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Saisissez "+t+" caractère";return t!==1&&(n+="s"),n},loadingMore:function(){return"Chargement de résultats supplémentaires…"},maximumSelected:function(e){var t="Vous pouvez seulement sélectionner "+e.maximum+" élément";return e.maximum!==1&&(t+="s"),t},noResults:function(){return"Aucun résultat trouvé"},searching:function(){return"Recherche en cours…"}}}),{define:e.define,require:e.require}})();
|
|
|
@ -1,3 +0,0 @@
|
||||||
/*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
|
|
||||||
|
|
||||||
(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/gl",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n="Elimine ";return t===1?n+="un carácter":n+=t+" caracteres",n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Engada ";return t===1?n+="un carácter":n+=t+" caracteres",n},loadingMore:function(){return"Cargando máis resultados…"},maximumSelected:function(e){var t="Só pode ";return e.maximum===1?t+="un elemento":t+=e.maximum+" elementos",t},noResults:function(){return"Non se atoparon resultados"},searching:function(){return"Buscando…"}}}),{define:e.define,require:e.require}})();
|
|
|
@ -1,3 +0,0 @@
|
||||||
/*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
|
|
||||||
|
|
||||||
(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/he",[],function(){return{errorLoading:function(){return"שגיאה בטעינת התוצאות"},inputTooLong:function(e){var t=e.input.length-e.maximum,n="נא למחוק ";return t===1?n+="תו אחד":n+=t+" תווים",n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="נא להכניס ";return t===1?n+="תו אחד":n+=t+" תווים",n+=" או יותר",n},loadingMore:function(){return"טוען תוצאות נוספות…"},maximumSelected:function(e){var t="באפשרותך לבחור עד ";return e.maximum===1?t+="פריט אחד":t+=e.maximum+" פריטים",t},noResults:function(){return"לא נמצאו תוצאות"},searching:function(){return"מחפש…"}}}),{define:e.define,require:e.require}})();
|
|
|
@ -1,3 +0,0 @@
|
||||||
/*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
|
|
||||||
|
|
||||||
(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/hi",[],function(){return{errorLoading:function(){return"परिणामों को लोड नहीं किया जा सका।"},inputTooLong:function(e){var t=e.input.length-e.maximum,n=t+" अक्षर को हटा दें";return t>1&&(n=t+" अक्षरों को हटा दें "),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="कृपया "+t+" या अधिक अक्षर दर्ज करें";return n},loadingMore:function(){return"अधिक परिणाम लोड हो रहे है..."},maximumSelected:function(e){var t="आप केवल "+e.maximum+" आइटम का चयन कर सकते हैं";return t},noResults:function(){return"कोई परिणाम नहीं मिला"},searching:function(){return"खोज रहा है..."}}}),{define:e.define,require:e.require}})();
|
|
|
@ -1,3 +0,0 @@
|
||||||
/*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
|
|
||||||
|
|
||||||
(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/hr",[],function(){function e(e){var t=" "+e+" znak";return e%10<5&&e%10>0&&(e%100<5||e%100>19)?e%10>1&&(t+="a"):t+="ova",t}return{errorLoading:function(){return"Preuzimanje nije uspjelo."},inputTooLong:function(t){var n=t.input.length-t.maximum;return"Unesite "+e(n)},inputTooShort:function(t){var n=t.minimum-t.input.length;return"Unesite još "+e(n)},loadingMore:function(){return"Učitavanje rezultata…"},maximumSelected:function(e){return"Maksimalan broj odabranih stavki je "+e.maximum},noResults:function(){return"Nema rezultata"},searching:function(){return"Pretraga…"}}}),{define:e.define,require:e.require}})();
|
|
|
@ -1,3 +0,0 @@
|
||||||
/*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
|
|
||||||
|
|
||||||
(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/hu",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum;return"Túl hosszú. "+t+" karakterrel több, mint kellene."},inputTooShort:function(e){var t=e.minimum-e.input.length;return"Túl rövid. Még "+t+" karakter hiányzik."},loadingMore:function(){return"Töltés…"},maximumSelected:function(e){return"Csak "+e.maximum+" elemet lehet kiválasztani."},noResults:function(){return"Nincs találat."},searching:function(){return"Keresés…"}}}),{define:e.define,require:e.require}})();
|
|
|
@ -1,3 +0,0 @@
|
||||||
/*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
|
|
||||||
|
|
||||||
(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/id",[],function(){return{errorLoading:function(){return"Data tidak boleh diambil."},inputTooLong:function(e){var t=e.input.length-e.maximum;return"Hapuskan "+t+" huruf"},inputTooShort:function(e){var t=e.minimum-e.input.length;return"Masukkan "+t+" huruf lagi"},loadingMore:function(){return"Mengambil data…"},maximumSelected:function(e){return"Anda hanya dapat memilih "+e.maximum+" pilihan"},noResults:function(){return"Tidak ada data yang sesuai"},searching:function(){return"Mencari…"}}}),{define:e.define,require:e.require}})();
|
|
|
@ -1,3 +0,0 @@
|
||||||
/*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
|
|
||||||
|
|
||||||
(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/is",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n="Vinsamlegast styttið texta um "+t+" staf";return t<=1?n:n+"i"},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Vinsamlegast skrifið "+t+" staf";return t>1&&(n+="i"),n+=" í viðbót",n},loadingMore:function(){return"Sæki fleiri niðurstöður…"},maximumSelected:function(e){return"Þú getur aðeins valið "+e.maximum+" atriði"},noResults:function(){return"Ekkert fannst"},searching:function(){return"Leita…"}}}),{define:e.define,require:e.require}})();
|
|
|
@ -1,3 +0,0 @@
|
||||||
/*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
|
|
||||||
|
|
||||||
(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/it",[],function(){return{errorLoading:function(){return"I risultati non possono essere caricati."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Per favore cancella "+t+" caratter";return t!==1?n+="i":n+="e",n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Per favore inserisci "+t+" o più caratteri";return n},loadingMore:function(){return"Caricando più risultati…"},maximumSelected:function(e){var t="Puoi selezionare solo "+e.maximum+" element";return e.maximum!==1?t+="i":t+="o",t},noResults:function(){return"Nessun risultato trovato"},searching:function(){return"Sto cercando…"}}}),{define:e.define,require:e.require}})();
|
|
|
@ -1,3 +0,0 @@
|
||||||
/*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
|
|
||||||
|
|
||||||
(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/ja",[],function(){return{errorLoading:function(){return"結果が読み込まれませんでした"},inputTooLong:function(e){var t=e.input.length-e.maximum,n=t+" 文字を削除してください";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="少なくとも "+t+" 文字を入力してください";return n},loadingMore:function(){return"読み込み中…"},maximumSelected:function(e){var t=e.maximum+" 件しか選択できません";return t},noResults:function(){return"対象が見つかりません"},searching:function(){return"検索しています…"}}}),{define:e.define,require:e.require}})();
|
|
|
@ -1,3 +0,0 @@
|
||||||
/*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
|
|
||||||
|
|
||||||
(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/km",[],function(){return{errorLoading:function(){return"មិនអាចទាញយកទិន្នន័យ"},inputTooLong:function(e){var t=e.input.length-e.maximum,n="សូមលុបចេញ "+t+" អក្សរ";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="សូមបញ្ចូល"+t+" អក្សរ រឺ ច្រើនជាងនេះ";return n},loadingMore:function(){return"កំពុងទាញយកទិន្នន័យបន្ថែម..."},maximumSelected:function(e){var t="អ្នកអាចជ្រើសរើសបានតែ "+e.maximum+" ជម្រើសប៉ុណ្ណោះ";return t},noResults:function(){return"មិនមានលទ្ធផល"},searching:function(){return"កំពុងស្វែងរក..."}}}),{define:e.define,require:e.require}})();
|
|
|
@ -1,3 +0,0 @@
|
||||||
/*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
|
|
||||||
|
|
||||||
(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/ko",[],function(){return{errorLoading:function(){return"결과를 불러올 수 없습니다."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="너무 깁니다. "+t+" 글자 지워주세요.";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="너무 짧습니다. "+t+" 글자 더 입력해주세요.";return n},loadingMore:function(){return"불러오는 중…"},maximumSelected:function(e){var t="최대 "+e.maximum+"개까지만 선택 가능합니다.";return t},noResults:function(){return"결과가 없습니다."},searching:function(){return"검색 중…"}}}),{define:e.define,require:e.require}})();
|
|
|
@ -1,3 +0,0 @@
|
||||||
/*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
|
|
||||||
|
|
||||||
(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/lt",[],function(){function e(e,t,n,r){return e%10===1&&(e%100<11||e%100>19)?t:e%10>=2&&e%10<=9&&(e%100<11||e%100>19)?n:r}return{inputTooLong:function(t){var n=t.input.length-t.maximum,r="Pašalinkite "+n+" simbol";return r+=e(n,"į","ius","ių"),r},inputTooShort:function(t){var n=t.minimum-t.input.length,r="Įrašykite dar "+n+" simbol";return r+=e(n,"į","ius","ių"),r},loadingMore:function(){return"Kraunama daugiau rezultatų…"},maximumSelected:function(t){var n="Jūs galite pasirinkti tik "+t.maximum+" element";return n+=e(t.maximum,"ą","us","ų"),n},noResults:function(){return"Atitikmenų nerasta"},searching:function(){return"Ieškoma…"}}}),{define:e.define,require:e.require}})();
|
|
|
@ -1,3 +0,0 @@
|
||||||
/*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
|
|
||||||
|
|
||||||
(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/lv",[],function(){function e(e,t,n,r){return e===11?t:e%10===1?n:r}return{inputTooLong:function(t){var n=t.input.length-t.maximum,r="Lūdzu ievadiet par "+n;return r+=" simbol"+e(n,"iem","u","iem"),r+" mazāk"},inputTooShort:function(t){var n=t.minimum-t.input.length,r="Lūdzu ievadiet vēl "+n;return r+=" simbol"+e(n,"us","u","us"),r},loadingMore:function(){return"Datu ielāde…"},maximumSelected:function(t){var n="Jūs varat izvēlēties ne vairāk kā "+t.maximum;return n+=" element"+e(t.maximum,"us","u","us"),n},noResults:function(){return"Sakritību nav"},searching:function(){return"Meklēšana…"}}}),{define:e.define,require:e.require}})();
|
|
|
@ -1,3 +0,0 @@
|
||||||
/*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
|
|
||||||
|
|
||||||
(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/mk",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n="Ве молиме внесете "+e.maximum+" помалку карактер";return e.maximum!==1&&(n+="и"),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Ве молиме внесете уште "+e.maximum+" карактер";return e.maximum!==1&&(n+="и"),n},loadingMore:function(){return"Вчитување резултати…"},maximumSelected:function(e){var t="Можете да изберете само "+e.maximum+" ставк";return e.maximum===1?t+="а":t+="и",t},noResults:function(){return"Нема пронајдено совпаѓања"},searching:function(){return"Пребарување…"}}}),{define:e.define,require:e.require}})();
|
|
|
@ -1,3 +0,0 @@
|
||||||
/*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
|
|
||||||
|
|
||||||
(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/ms",[],function(){return{errorLoading:function(){return"Keputusan tidak berjaya dimuatkan."},inputTooLong:function(e){var t=e.input.length-e.maximum;return"Sila hapuskan "+t+" aksara"},inputTooShort:function(e){var t=e.minimum-e.input.length;return"Sila masukkan "+t+" atau lebih aksara"},loadingMore:function(){return"Sedang memuatkan keputusan…"},maximumSelected:function(e){return"Anda hanya boleh memilih "+e.maximum+" pilihan"},noResults:function(){return"Tiada padanan yang ditemui"},searching:function(){return"Mencari…"}}}),{define:e.define,require:e.require}})();
|
|
|
@ -1,3 +0,0 @@
|
||||||
/*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
|
|
||||||
|
|
||||||
(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/nb",[],function(){return{errorLoading:function(){return"Kunne ikke hente resultater."},inputTooLong:function(e){var t=e.input.length-e.maximum;return"Vennligst fjern "+t+" tegn"},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Vennligst skriv inn ";return t>1?n+=" flere tegn":n+=" tegn til",n},loadingMore:function(){return"Laster flere resultater…"},maximumSelected:function(e){return"Du kan velge maks "+e.maximum+" elementer"},noResults:function(){return"Ingen treff"},searching:function(){return"Søker…"}}}),{define:e.define,require:e.require}})();
|
|
|
@ -1,3 +0,0 @@
|
||||||
/*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
|
|
||||||
|
|
||||||
(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/nl",[],function(){return{errorLoading:function(){return"De resultaten konden niet worden geladen."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Gelieve "+t+" karakters te verwijderen";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Gelieve "+t+" of meer karakters in te voeren";return n},loadingMore:function(){return"Meer resultaten laden…"},maximumSelected:function(e){var t=e.maximum==1?"kan":"kunnen",n="Er "+t+" maar "+e.maximum+" item";return e.maximum!=1&&(n+="s"),n+=" worden geselecteerd",n},noResults:function(){return"Geen resultaten gevonden…"},searching:function(){return"Zoeken…"}}}),{define:e.define,require:e.require}})();
|
|
|
@ -1,3 +0,0 @@
|
||||||
/*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
|
|
||||||
|
|
||||||
(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/pl",[],function(){var e=["znak","znaki","znaków"],t=["element","elementy","elementów"],n=function(t,n){if(t===1)return n[0];if(t>1&&t<=4)return n[1];if(t>=5)return n[2]};return{errorLoading:function(){return"Nie można załadować wyników."},inputTooLong:function(t){var r=t.input.length-t.maximum;return"Usuń "+r+" "+n(r,e)},inputTooShort:function(t){var r=t.minimum-t.input.length;return"Podaj przynajmniej "+r+" "+n(r,e)},loadingMore:function(){return"Trwa ładowanie…"},maximumSelected:function(e){return"Możesz zaznaczyć tylko "+e.maximum+" "+n(e.maximum,t)},noResults:function(){return"Brak wyników"},searching:function(){return"Trwa wyszukiwanie…"}}}),{define:e.define,require:e.require}})();
|
|
|
@ -1,3 +0,0 @@
|
||||||
/*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
|
|
||||||
|
|
||||||
(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/pt-BR",[],function(){return{errorLoading:function(){return"Os resultados não puderam ser carregados."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Apague "+t+" caracter";return t!=1&&(n+="es"),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Digite "+t+" ou mais caracteres";return n},loadingMore:function(){return"Carregando mais resultados…"},maximumSelected:function(e){var t="Você só pode selecionar "+e.maximum+" ite";return e.maximum==1?t+="m":t+="ns",t},noResults:function(){return"Nenhum resultado encontrado"},searching:function(){return"Buscando…"}}}),{define:e.define,require:e.require}})();
|
|
|
@ -1,3 +0,0 @@
|
||||||
/*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
|
|
||||||
|
|
||||||
(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/pt",[],function(){return{errorLoading:function(){return"Os resultados não puderam ser carregados."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Por favor apague "+t+" ";return n+=t!=1?"caracteres":"carácter",n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Introduza "+t+" ou mais caracteres";return n},loadingMore:function(){return"A carregar mais resultados…"},maximumSelected:function(e){var t="Apenas pode seleccionar "+e.maximum+" ";return t+=e.maximum!=1?"itens":"item",t},noResults:function(){return"Sem resultados"},searching:function(){return"A procurar…"}}}),{define:e.define,require:e.require}})();
|
|
|
@ -1,3 +0,0 @@
|
||||||
/*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
|
|
||||||
|
|
||||||
(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/ro",[],function(){return{errorLoading:function(){return"Rezultatele nu au putut fi incărcate."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Vă rugăm să ștergeți"+t+" caracter";return t!==1&&(n+="e"),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Vă rugăm să introduceți "+t+"sau mai multe caractere";return n},loadingMore:function(){return"Se încarcă mai multe rezultate…"},maximumSelected:function(e){var t="Aveți voie să selectați cel mult "+e.maximum;return t+=" element",e.maximum!==1&&(t+="e"),t},noResults:function(){return"Nu au fost găsite rezultate"},searching:function(){return"Căutare…"}}}),{define:e.define,require:e.require}})();
|
|
|
@ -1,3 +0,0 @@
|
||||||
/*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
|
|
||||||
|
|
||||||
(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/ru",[],function(){function e(e,t,n,r){return e%10<5&&e%10>0&&e%100<5||e%100>20?e%10>1?n:t:r}return{errorLoading:function(){return"Невозможно загрузить результаты"},inputTooLong:function(t){var n=t.input.length-t.maximum,r="Пожалуйста, введите на "+n+" символ";return r+=e(n,"","a","ов"),r+=" меньше",r},inputTooShort:function(t){var n=t.minimum-t.input.length,r="Пожалуйста, введите еще хотя бы "+n+" символ";return r+=e(n,"","a","ов"),r},loadingMore:function(){return"Загрузка данных…"},maximumSelected:function(t){var n="Вы можете выбрать не более "+t.maximum+" элемент";return n+=e(t.maximum,"","a","ов"),n},noResults:function(){return"Совпадений не найдено"},searching:function(){return"Поиск…"}}}),{define:e.define,require:e.require}})();
|
|
|
@ -1,3 +0,0 @@
|
||||||
/*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
|
|
||||||
|
|
||||||
(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/sk",[],function(){var e={2:function(e){return e?"dva":"dve"},3:function(){return"tri"},4:function(){return"štyri"}};return{inputTooLong:function(t){var n=t.input.length-t.maximum;return n==1?"Prosím, zadajte o jeden znak menej":n>=2&&n<=4?"Prosím, zadajte o "+e[n](!0)+" znaky menej":"Prosím, zadajte o "+n+" znakov menej"},inputTooShort:function(t){var n=t.minimum-t.input.length;return n==1?"Prosím, zadajte ešte jeden znak":n<=4?"Prosím, zadajte ešte ďalšie "+e[n](!0)+" znaky":"Prosím, zadajte ešte ďalších "+n+" znakov"},loadingMore:function(){return"Loading more results…"},maximumSelected:function(t){return t.maximum==1?"Môžete zvoliť len jednu položku":t.maximum>=2&&t.maximum<=4?"Môžete zvoliť najviac "+e[t.maximum](!1)+" položky":"Môžete zvoliť najviac "+t.maximum+" položiek"},noResults:function(){return"Nenašli sa žiadne položky"},searching:function(){return"Vyhľadávanie…"}}}),{define:e.define,require:e.require}})();
|
|
|
@ -1,3 +0,0 @@
|
||||||
/*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
|
|
||||||
|
|
||||||
(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/sr-Cyrl",[],function(){function e(e,t,n,r){return e%10==1&&e%100!=11?t:e%10>=2&&e%10<=4&&(e%100<12||e%100>14)?n:r}return{errorLoading:function(){return"Преузимање није успело."},inputTooLong:function(t){var n=t.input.length-t.maximum,r="Обришите "+n+" симбол";return r+=e(n,"","а","а"),r},inputTooShort:function(t){var n=t.minimum-t.input.length,r="Укуцајте бар још "+n+" симбол";return r+=e(n,"","а","а"),r},loadingMore:function(){return"Преузимање још резултата…"},maximumSelected:function(t){var n="Можете изабрати само "+t.maximum+" ставк";return n+=e(t.maximum,"у","е","и"),n},noResults:function(){return"Ништа није пронађено"},searching:function(){return"Претрага…"}}}),{define:e.define,require:e.require}})();
|
|
|
@ -1,3 +0,0 @@
|
||||||
/*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
|
|
||||||
|
|
||||||
(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/sr",[],function(){function e(e,t,n,r){return e%10==1&&e%100!=11?t:e%10>=2&&e%10<=4&&(e%100<12||e%100>14)?n:r}return{errorLoading:function(){return"Preuzimanje nije uspelo."},inputTooLong:function(t){var n=t.input.length-t.maximum,r="Obrišite "+n+" simbol";return r+=e(n,"","a","a"),r},inputTooShort:function(t){var n=t.minimum-t.input.length,r="Ukucajte bar još "+n+" simbol";return r+=e(n,"","a","a"),r},loadingMore:function(){return"Preuzimanje još rezultata…"},maximumSelected:function(t){var n="Možete izabrati samo "+t.maximum+" stavk";return n+=e(t.maximum,"u","e","i"),n},noResults:function(){return"Ništa nije pronađeno"},searching:function(){return"Pretraga…"}}}),{define:e.define,require:e.require}})();
|
|
|
@ -1,3 +0,0 @@
|
||||||
/*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
|
|
||||||
|
|
||||||
(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/sv",[],function(){return{errorLoading:function(){return"Resultat kunde inte laddas."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="Vänligen sudda ut "+t+" tecken";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Vänligen skriv in "+t+" eller fler tecken";return n},loadingMore:function(){return"Laddar fler resultat…"},maximumSelected:function(e){var t="Du kan max välja "+e.maximum+" element";return t},noResults:function(){return"Inga träffar"},searching:function(){return"Söker…"}}}),{define:e.define,require:e.require}})();
|
|
|
@ -1,3 +0,0 @@
|
||||||
/*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
|
|
||||||
|
|
||||||
(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/th",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n="โปรดลบออก "+t+" ตัวอักษร";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="โปรดพิมพ์เพิ่มอีก "+t+" ตัวอักษร";return n},loadingMore:function(){return"กำลังค้นข้อมูลเพิ่ม…"},maximumSelected:function(e){var t="คุณสามารถเลือกได้ไม่เกิน "+e.maximum+" รายการ";return t},noResults:function(){return"ไม่พบข้อมูล"},searching:function(){return"กำลังค้นข้อมูล…"}}}),{define:e.define,require:e.require}})();
|
|
|
@ -1,3 +0,0 @@
|
||||||
/*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
|
|
||||||
|
|
||||||
(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/tr",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n=t+" karakter daha girmelisiniz";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="En az "+t+" karakter daha girmelisiniz";return n},loadingMore:function(){return"Daha fazla…"},maximumSelected:function(e){var t="Sadece "+e.maximum+" seçim yapabilirsiniz";return t},noResults:function(){return"Sonuç bulunamadı"},searching:function(){return"Aranıyor…"}}}),{define:e.define,require:e.require}})();
|
|
|
@ -1,3 +0,0 @@
|
||||||
/*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
|
|
||||||
|
|
||||||
(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/uk",[],function(){function e(e,t,n,r){return e%100>10&&e%100<15?r:e%10===1?t:e%10>1&&e%10<5?n:r}return{errorLoading:function(){return"Неможливо завантажити результати"},inputTooLong:function(t){var n=t.input.length-t.maximum;return"Будь ласка, видаліть "+n+" "+e(t.maximum,"літеру","літери","літер")},inputTooShort:function(e){var t=e.minimum-e.input.length;return"Будь ласка, введіть "+t+" або більше літер"},loadingMore:function(){return"Завантаження інших результатів…"},maximumSelected:function(t){return"Ви можете вибрати лише "+t.maximum+" "+e(t.maximum,"пункт","пункти","пунктів")},noResults:function(){return"Нічого не знайдено"},searching:function(){return"Пошук…"}}}),{define:e.define,require:e.require}})();
|
|
|
@ -1,3 +0,0 @@
|
||||||
/*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
|
|
||||||
|
|
||||||
(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/vi",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n="Vui lòng nhập ít hơn "+t+" ký tự";return t!=1&&(n+="s"),n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="Vui lòng nhập nhiều hơn "+t+' ký tự"';return n},loadingMore:function(){return"Đang lấy thêm kết quả…"},maximumSelected:function(e){var t="Chỉ có thể chọn được "+e.maximum+" lựa chọn";return t},noResults:function(){return"Không tìm thấy kết quả"},searching:function(){return"Đang tìm…"}}}),{define:e.define,require:e.require}})();
|
|
|
@ -1,3 +0,0 @@
|
||||||
/*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
|
|
||||||
|
|
||||||
(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/zh-CN",[],function(){return{errorLoading:function(){return"无法载入结果。"},inputTooLong:function(e){var t=e.input.length-e.maximum,n="请删除"+t+"个字符";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="请再输入至少"+t+"个字符";return n},loadingMore:function(){return"载入更多结果…"},maximumSelected:function(e){var t="最多只能选择"+e.maximum+"个项目";return t},noResults:function(){return"未找到结果"},searching:function(){return"搜索中…"}}}),{define:e.define,require:e.require}})();
|
|
|
@ -1,3 +0,0 @@
|
||||||
/*! Select2 4.0.3 | https://github.com/select2/select2/blob/master/LICENSE.md */
|
|
||||||
|
|
||||||
(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/zh-TW",[],function(){return{inputTooLong:function(e){var t=e.input.length-e.maximum,n="請刪掉"+t+"個字元";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="請再輸入"+t+"個字元";return n},loadingMore:function(){return"載入中…"},maximumSelected:function(e){var t="你只能選擇最多"+e.maximum+"項";return t},noResults:function(){return"沒有找到相符的項目"},searching:function(){return"搜尋中…"}}}),{define:e.define,require:e.require}})();
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
|
@ -1,21 +0,0 @@
|
||||||
The MIT License
|
|
||||||
|
|
||||||
Copyright (c) 2007-2012 Steven Levithan <http://xregexp.com/>
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in
|
|
||||||
all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
THE SOFTWARE.
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue