Remove the buttons from modal templates

Remove the button definitions from modal templates, and use the
new horizon's mechanism of specifying the button labels instead.

Change-Id: I2963148d725510abbdaeddc7d585b9c769e21a45
This commit is contained in:
Radomir Dopieralski
2014-10-14 14:33:21 +02:00
parent 03e1425aa8
commit 1be9630fd1
11 changed files with 8 additions and 44 deletions

View File

@@ -19,8 +19,3 @@
<p>{% trans "Modify different properties of an image." %}</p>
</div>
{% endblock %}
{% block modal-footer %}
<input class="btn btn-primary pull-right" type="submit" value="{% trans "Update Image" %}" />
<a href="{% url 'horizon:infrastructure:images:index' %}" class="btn btn-default secondary cancel close">{% trans "Cancel" %}</a>
{% endblock %}

View File

@@ -105,6 +105,7 @@ class UpdateView(views.UpdateView):
template_name = 'infrastructure/images/update.html'
form_class = forms.UpdateImageForm
success_url = reverse_lazy('horizon:infrastructure:images:index')
submit_label = _("Update Image")
@memoized.memoized_method
def get_object(self):

View File

@@ -10,11 +10,3 @@
{% block modal-body %}
{% include "formset_table/menu_formset.html" with formset=form form_template="infrastructure/nodes/_nodes_formset_form.html" %}
{% endblock %}
{% block modal-footer %}
<input class="btn btn-primary pull-right" type="submit"
value="{% trans "Register Nodes" %}" />
<a href="{% url 'horizon:infrastructure:nodes:index' %}"
class="btn secondary cancel close">{% trans "Cancel" %}</a>
{% endblock %}

View File

@@ -12,13 +12,3 @@
{% block modal-body %}
{% include "horizon/common/_form_fields.html" %}
{% endblock %}
{% block modal-footer %}
<button class="btn btn-primary pull-right" type="submit">
<i class="fa fa-upload"></i>
{% trans "Upload" %}
</button>
<a href="{% url 'horizon:infrastructure:nodes:index' %}"
class="btn secondary cancel close">{% trans "Cancel" %}</a>
{% endblock %}

View File

@@ -47,6 +47,7 @@ class RegisterView(horizon_forms.ModalFormView):
template_name = 'infrastructure/nodes/register.html'
success_url = reverse_lazy(
'horizon:infrastructure:nodes:index')
submit_label = _("Register Nodes")
def get_data(self):
return []
@@ -77,6 +78,7 @@ class UploadView(horizon_forms.ModalFormView):
template_name = 'infrastructure/nodes/upload.html'
success_url = reverse_lazy(
'horizon:infrastructure:nodes:index')
submit_label = _("Upload Nodes")
def post(self, request, *args, **kwargs):
# This form's POST is handled in RegisterView.

View File

@@ -236,6 +236,7 @@ class IndexView(horizon.forms.ModalFormView, StackMixin):
class DeployConfirmationView(horizon.forms.ModalFormView, StackMixin):
form_class = forms.DeployOvercloud
template_name = 'infrastructure/overview/deploy_confirmation.html'
submit_label = _("Deploy")
def get_context_data(self, **kwargs):
context = super(DeployConfirmationView,
@@ -253,6 +254,7 @@ class DeployConfirmationView(horizon.forms.ModalFormView, StackMixin):
class UndeployConfirmationView(horizon.forms.ModalFormView, StackMixin):
form_class = forms.UndeployOvercloud
template_name = 'infrastructure/overview/undeploy_confirmation.html'
submit_label = _("Undeploy")
def get_success_url(self):
return reverse(INDEX_URL)
@@ -272,6 +274,7 @@ class UndeployConfirmationView(horizon.forms.ModalFormView, StackMixin):
class PostDeployInitView(horizon.forms.ModalFormView, StackMixin):
form_class = forms.PostDeployInit
template_name = 'infrastructure/overview/post_deploy_init.html'
submit_label = _("Initialize")
def get_success_url(self):
return reverse(INDEX_URL)

View File

@@ -24,9 +24,3 @@
</p>
</div>
{% endblock %}
{% block modal-footer %}
<input class="btn btn-primary" type="submit" value="{% trans "Save Configuration" %}" />
<a href="{% url 'horizon:infrastructure:parameters:index' %}" class="btn secondary cancel close">{% trans "Cancel" %}</a>
{% endblock %}
{% load form_helpers %}

View File

@@ -13,6 +13,7 @@
# under the License.
from django.core.urlresolvers import reverse_lazy
from django.utils.translation import ugettext_lazy as _
import horizon.forms
from horizon import tabs as horizon_tabs
@@ -25,6 +26,7 @@ class ServiceConfigView(horizon.forms.ModalFormView):
template_name = "infrastructure/parameters/service_config.html"
form_class = forms.EditServiceConfig
success_url = reverse_lazy('horizon:infrastructure:parameters:index')
submit_label = _("Save Configuration")
def get_initial(self):
plan = api.tuskar.Plan.get_the_plan(self.request)

View File

@@ -19,8 +19,3 @@
<p>{% trans "This operation cannot be undone. Are you sure you want to do that?" %}</p>
</div>
{% endblock %}
{% block modal-footer %}
<input class="btn btn-primary" type="submit" value="{% trans "Deploy" %}" />
<a href="{% url 'horizon:infrastructure:overview:index' %}" class="btn secondary cancel close">{% trans "Cancel" %}</a>
{% endblock %}

View File

@@ -20,8 +20,3 @@
</fieldset>
</div>
{% endblock %}
{% block modal-footer %}
<input class="btn btn-primary" type="submit" value="{% trans "Initialize" %}" />
<a href="{% url 'horizon:infrastructure:overview:index' %}" class="btn secondary cancel close">{% trans "Cancel" %}</a>
{% endblock %}

View File

@@ -18,8 +18,3 @@
</fieldset>
</div>
{% endblock %}
{% block modal-footer %}
<input class="btn btn-primary" type="submit" value="{% trans "Undeploy" %}" />
<a href="{% url 'horizon:infrastructure:overview:index' %}" class="btn secondary cancel close">{% trans "Cancel" %}</a>
{% endblock %}