Clean modal forms in Identity Groups
Refactoring identity groups modals. Based on merged patch: https://review.openstack.org/#/c/123472/ Change-Id: I186ed2c31222b1f4a0afef34bfa5d8022eac1740 Partially-Implements: blueprint form-template-to-view Partially-Closes-Bug: #1350953
This commit is contained in:
parent
4a0f781610
commit
489f02cc20
|
@ -1,25 +1,7 @@
|
|||
{% extends "horizon/common/_modal_form.html" %}
|
||||
{% load i18n %}
|
||||
{% load url from future %}
|
||||
|
||||
{% block form_id %}create_group_form{% endblock %}
|
||||
{% block form_action %}{% url 'horizon:identity:groups:create' %}{% endblock %}
|
||||
|
||||
{% block modal-header %}{% trans "Create Group" %}{% endblock %}
|
||||
|
||||
{% block modal-body %}
|
||||
<div class="left">
|
||||
<fieldset>
|
||||
{% include "horizon/common/_form_fields.html" %}
|
||||
</fieldset>
|
||||
</div>
|
||||
<div class="right">
|
||||
<h3>{% trans "Description:" %}</h3>
|
||||
<p>{% trans "Groups are used to manage access and assign roles to multiple users at once. After creating the group, edit the group to add users." %}</p>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block modal-footer %}
|
||||
<input class="btn btn-primary pull-right" type="submit" value="{% trans "Create Group" %}" />
|
||||
<a href="{% url 'horizon:identity:groups:index' %}" class="btn btn-default secondary cancel close">{% trans "Cancel" %}</a>
|
||||
{% block modal-body-right %}
|
||||
<h3>{% trans "Description:" %}</h3>
|
||||
<p>{% trans "Groups are used to manage access and assign roles to multiple users at once. After creating the group, edit the group to add users." %}</p>
|
||||
{% endblock %}
|
||||
|
|
|
@ -1,25 +1,7 @@
|
|||
{% extends "horizon/common/_modal_form.html" %}
|
||||
{% load i18n %}
|
||||
{% load url from future %}
|
||||
|
||||
{% block form_id %}update_group_form{% endblock %}
|
||||
{% block form_action %}{% url 'horizon:identity:groups:update' group.id %}{% endblock %}
|
||||
|
||||
{% block modal-header %}{% trans "Update Group" %}{% endblock %}
|
||||
|
||||
{% block modal-body %}
|
||||
<div class="left">
|
||||
<fieldset>
|
||||
{% include "horizon/common/_form_fields.html" %}
|
||||
</fieldset>
|
||||
</div>
|
||||
<div class="right">
|
||||
<h3>{% trans "Description:" %}</h3>
|
||||
<p>{% trans "Groups are used to manage access and assign roles to multiple users at once. Edit the group to add users." %}</p>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block modal-footer %}
|
||||
<input class="btn btn-primary pull-right" type="submit" value="{% trans "Update Group" %}" />
|
||||
<a href="{% url 'horizon:identity:groups:index' %}" class="btn btn-default secondary cancel close">{% trans "Cancel" %}</a>
|
||||
{% block modal-body-right %}
|
||||
<h3>{% trans "Description:" %}</h3>
|
||||
<p>{% trans "Groups are used to manage access and assign roles to multiple users at once. Edit the group to add users." %}</p>
|
||||
{% endblock %}
|
||||
|
|
|
@ -54,14 +54,22 @@ class IndexView(tables.DataTableView):
|
|||
|
||||
|
||||
class CreateView(forms.ModalFormView):
|
||||
form_class = project_forms.CreateGroupForm
|
||||
template_name = constants.GROUPS_CREATE_VIEW_TEMPLATE
|
||||
modal_header = _("Create Group")
|
||||
form_id = "create_group_form"
|
||||
form_class = project_forms.CreateGroupForm
|
||||
submit_url = "horizon:identity:groups:create"
|
||||
submit_label = _("Create Group")
|
||||
success_url = reverse_lazy(constants.GROUPS_INDEX_URL)
|
||||
|
||||
|
||||
class UpdateView(forms.ModalFormView):
|
||||
form_class = project_forms.UpdateGroupForm
|
||||
template_name = constants.GROUPS_UPDATE_VIEW_TEMPLATE
|
||||
modal_header = _("Update Group")
|
||||
form_id = "update_group_form"
|
||||
form_class = project_forms.UpdateGroupForm
|
||||
submit_url = "horizon:identity:groups:update"
|
||||
submit_label = _("Update Group")
|
||||
success_url = reverse_lazy(constants.GROUPS_INDEX_URL)
|
||||
|
||||
@memoized.memoized_method
|
||||
|
@ -77,7 +85,8 @@ class UpdateView(forms.ModalFormView):
|
|||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super(UpdateView, self).get_context_data(**kwargs)
|
||||
context['group'] = self.get_object()
|
||||
args = (self.get_object().id,)
|
||||
context['submit_url'] = reverse(self.submit_url, args=args)
|
||||
return context
|
||||
|
||||
def get_initial(self):
|
||||
|
|
Loading…
Reference in New Issue