Commit 0916757e authored by ibuler's avatar ibuler

[Bugfix] 修复一些bug

parent 0b299344
......@@ -47,12 +47,9 @@
{% block custom_foot_js %}
<script>
$(document).ready(function () {
$('.select2').select2();
{# $("#id_tags").select2({#}
{# tags: true,#}
{# maximumSelectionLength: 8 //最多能够选择的个数#}
{# //closeOnSelect: false#}
{# });#}
$('.select2').select2({
allowClear: true
});
})
</script>
{% endblock %}
\ No newline at end of file
......@@ -35,7 +35,7 @@
<th class="text-center">{% trans 'Env' %}</th>
<th class="text-center">{% trans 'Hardware' %}</th>
<th class="text-center">{% trans 'Active' %}</th>
<th class="text-center">{% trans 'Connective' %}</th>
<th class="text-center">{% trans 'Reachable' %}</th>
<th class="text-center">{% trans 'Action' %}</th>
</tr>
</thead>
......
......@@ -2,6 +2,7 @@
from django import template
from django.utils import timezone
from django.utils.translation import gettext as _
from django.utils.html import escape
register = template.Library()
......@@ -67,3 +68,18 @@ def ts_to_date(ts):
@register.filter
def to_html(s):
return escape(s).replace('\n', '<br />')
@register.filter
def time_util_with_seconds(date_from, date_to):
if date_from and date_to:
delta = date_to - date_from
seconds = delta.seconds
if seconds < 60:
return '{} s'.format(seconds)
elif seconds < 60*60:
return '{} m'.format(seconds//60)
else:
return '{} h'.format(seconds//3600)
else:
return ''
......@@ -14,7 +14,8 @@ class AssetPermissionForm(forms.ModelForm):
queryset=User.objects.exclude(role=User.ROLE_APP),
widget=forms.SelectMultiple(
attrs={'class': 'select2', 'data-placeholder': _('Select users')},
)
),
label=_("User")
)
class Meta:
......
......@@ -3,9 +3,9 @@
{% load static %}
{% load bootstrap3 %}
{% block custom_head_css_js %}
<link href="{% static "css/plugins/select2/select2.min.css" %}" rel="stylesheet">
<script src="{% static "js/plugins/select2/select2.full.min.js" %}"></script>
<link href="{% static "css/plugins/datepicker/datepicker3.css" %}" rel="stylesheet">
<link href="{% static 'css/plugins/select2/select2.min.css' %}" rel="stylesheet">
<script src="{% static 'js/plugins/select2/select2.full.min.js' %}"></script>
<link href="{% static 'css/plugins/datepicker/datepicker3.css' %}" rel="stylesheet">
{% endblock %}
{% block content %}
......
......@@ -37,11 +37,16 @@
$(document).ready(function () {
})
.on('click', '#switch_admin', function () {
setCookie("IN_ADMIN_PAGE", "Yes");
window.location = "/"
setTimeout(function () {
setCookie("IN_ADMIN_PAGE", "Yes");
window.location = "/"
}, 100)
})
.on('click', '#switch_user', function () {
setCookie("IN_ADMIN_PAGE", "No");
window.location = "/"
setTimeout(function () {
console.log("Set to No");
setCookie("IN_ADMIN_PAGE", "No");
window.location = "/"
}, 100);
})
</script>
......@@ -2,6 +2,7 @@
{% load i18n %}
{% load static %}
{% load terminal_tags %}
{% load common_tags %}
{% block custom_head_css_js %}
<link href="{% static 'css/plugins/datepicker/datepicker3.css' %}" rel="stylesheet">
<link href="{% static "css/plugins/select2/select2.min.css" %}" rel="stylesheet">
......@@ -91,7 +92,7 @@
<td class="text-center">{{ session.id | get_session_command_amount }}</td>
<td class="text-center">{{ session.date_start }}</td>
<td class="text-center">{{ session.date_end|timeuntil:session.date_start }}</td>
<td class="text-center">{{ session.date_start|time_util_with_seconds:session.date_end }}</td>
<td>
{% if session.is_finished %}
<a onclick="window.open('/luna/replay/{{ session.id }}','luna', 'height=600, width=800, top=0, left=0, toolbar=no, menubar=no, scrollbars=no, location=no, status=no')" class="btn btn-xs btn-warning btn-replay" >{% trans "Replay" %}</a>
......
......@@ -21,9 +21,9 @@
<li class="active">
<a href="{% url 'users:user-group-detail' pk=user_group.id %}" class="text-center"><i class="fa fa-laptop"></i> {% trans 'User group detail' %} </a>
</li>
<li>
<a href="{% url 'users:user-group-granted-asset' pk=user_group.id %}" class="text-center"><i class="fa fa-cubes"></i> {% trans 'Asset granted' %}</a>
</li>
{# <li>#}
{# <a href="{% url 'users:user-group-granted-asset' pk=user_group.id %}" class="text-center"><i class="fa fa-cubes"></i> {% trans 'Asset granted' %}</a>#}
{# </li>#}
<li class="pull-right">
<a class="btn btn-outline btn-default" href="{% url 'users:user-group-update' pk=user_group.id %}"><i class="fa fa-edit"></i>Update</a>
</li>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment