Commit 2d0244f9 by Máhonfai Bálint

Success message on group import and other UI adjustments

parent 12282eb8
Pipeline #1437 passed with stage
in 0 seconds
{% load crispy_forms_tags %}
{% load i18n %}
<p class="text-muted">
{% trans "Import a previously exported group from the user store." %}
</p>
<form method="POST" action="{% url "dashboard.views.group-import" %}">
{% csrf_token %}
{% crispy form %}
......
......@@ -17,7 +17,7 @@
</div>
<div class="list-group-item list-group-footer text-right">
<div class="row">
<div class="col-xs-5">
<div class="col-xs-6">
<form action="{% url "dashboard.views.group-list" %}" method="GET" id="dashboard-group-search-form">
<div class="input-group input-group-sm">
<input name="s" type="text" class="form-control" placeholder="{% trans "Search..." %}" />
......@@ -27,7 +27,7 @@
</div>
</form>
</div>
<div class="col-xs-7 text-right">
<div class="col-xs-6 text-right">
<a class="btn btn-primary btn-xs" href="{% url "dashboard.views.group-list" %}">
<i class="fa fa-chevron-circle-right"></i>
{% if more_groups > 0 %}
......@@ -40,8 +40,8 @@
{% trans "list" %}
{% endif %}
</a>
<a class="btn btn-success btn-xs group-create" href="{% url "dashboard.views.group-create" %}"><i class="fa fa-plus-circle"></i> {% trans "new" %} </a>
<a class="btn btn-success btn-xs group-import" href="{% url "dashboard.views.group-import" %}"><i class="fa fa-upload"></i> {% trans "import" %} </a>
<a class="btn btn-success btn-xs group-create" href="{% url "dashboard.views.group-create" %}" title="{% trans "new" %}"><i class="fa fa-plus-circle"></i></a>
<a class="btn btn-success btn-xs group-import" href="{% url "dashboard.views.group-import" %}" title="{% trans "import" %}"><i class="fa fa-download"></i></a>
</div>
</div>
</div>
......
......@@ -417,12 +417,18 @@ class GroupImportView(LoginRequiredMixin, TemplateView):
if profile is None:
raise SuspiciousOperation()
success_message = _("Group successfully imported.")
if request.is_ajax():
response = {
'message': success_message,
'redirect': profile.get_absolute_url()
}
return HttpResponse(
json.dumps({'redirect': profile.get_absolute_url()}),
json.dumps(response),
content_type="application/json"
)
else:
messages.success(request, success_message)
return redirect(profile.get_absolute_url())
else:
return self.get(request, form, *args, **kwargs)
......
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 sign in to comment