Update templates regarding changes in horizon

* Application wizard template hasn't got a wizard_create template
* Templates and views were updated regarding changes in horizon
* Use horizon modal form template instead of customized one
* Fix padding at app wizard header

Change-Id: If3f70ed2359e8d6a229f40ca36000993b29a2286
Closes-Bug: #1459221
This commit is contained in:
Ekaterina Chernova 2015-05-27 17:26:04 +03:00
parent f278e40a40
commit 258067fd54
20 changed files with 70 additions and 169 deletions

View File

@ -13,7 +13,7 @@
# under the License.
from django.core.urlresolvers import reverse_lazy
from django.utils.translation import ugettext_lazy as _
from horizon.forms import views
from horizon import tables as horizon_tables
@ -36,6 +36,11 @@ class CategoriesView(horizon_tables.DataTableView):
class AddCategoryView(views.ModalFormView):
form_class = forms.AddCategoryForm
form_id = 'add_category_form'
modal_header = _('Add Category')
template_name = 'categories/add.html'
context_object_name = 'category'
page_title = _('Add Application Category')
success_url = reverse_lazy('horizon:murano:categories:index')
submit_label = _('Add')
submit_url = reverse_lazy('horizon:murano:categories:add')

View File

@ -58,7 +58,7 @@ class CreateEnvironmentForm(horizon_forms.SelfHandlingForm):
return False
class EditEnvironmentView(horizon_forms.SelfHandlingForm):
class EditEnvironmentForm(horizon_forms.SelfHandlingForm):
name = forms.CharField(label="Environment Name",
validators=NAME_VALIDATORS,

View File

@ -119,8 +119,13 @@ class DetailServiceView(tabs.TabbedTableView):
class CreateEnvironmentView(views.ModalFormView):
form_class = env_forms.CreateEnvironmentForm
form_id = 'create_environment_form'
modal_header = _('Create Environment')
template_name = 'environments/create.html'
page_title = _('Create Environment')
context_object_name = 'environment'
submit_label = _('Create')
submit_url = reverse_lazy('horizon:murano:environments:create_environment')
def get_form(self, form_class):
if 'next' in self.request.GET:
@ -139,15 +144,20 @@ class CreateEnvironmentView(views.ModalFormView):
class EditEnvironmentView(views.ModalFormView):
form_class = env_forms.EditEnvironmentView
form_class = env_forms.EditEnvironmentForm
form_id = 'update_environment_form'
modal_header = _('Edit Environment')
template_name = 'environments/update.html'
context_object_name = 'environment'
page_title = _('Edit Environment')
submit_url = 'horizon:murano:environments:update_environment'
submit_label = _('Edit')
success_url = reverse_lazy('horizon:murano:environments:index')
def get_context_data(self, **kwargs):
context = super(EditEnvironmentView, self).get_context_data(**kwargs)
env_id = getattr(self.get_object(), 'id')
context["env_id"] = env_id
context['env_id'] = env_id
context['submit_url'] = reverse(self.submit_url, args=(env_id,))
return context
@memoized.memoized_method

View File

@ -46,6 +46,11 @@ class MarkedImagesView(horizon_tables.DataTableView):
class MarkImageView(views.ModalFormView):
form_class = forms.MarkImageForm
form_id = 'mark_murano_image_form'
modal_header = _('Add Murano Metadata')
template_name = 'images/mark.html'
context_object_name = 'image'
page_title = _("Update Image")
success_url = reverse_lazy('horizon:murano:images:index')
submit_label = _('Mark Image')
submit_url = reverse_lazy('horizon:murano:images:mark_image')

View File

@ -434,10 +434,6 @@ h3.link .caret {
}
}
.modal-header.ui-draggable-handle {
padding: 0 15px;
}
.modal-header img {
margin-top: -7px;
}

View File

@ -1,30 +1,14 @@
{% extends 'common/_modal_form.html' %}
{% extends 'horizon/common/_modal_form.html' %}
{% load i18n %}
{% load url from future %}
{% block form_id %}add_category_form{% endblock %}
{% block form_attrs %}enctype='multipart/form-data'{% endblock %}
{% block form_action %}{% url 'horizon:murano:categories:add' %}{% endblock %}
{% block modal-header %}{% trans 'Add Application Category' %}{% endblock %}
{% block modal_id %}add_category_form{% endblock %}
{% block modal-body %}
<div class='left'>
<fieldset>
{% include 'horizon/common/_form_fields.html' %}
</fieldset>
</div>
<div class='right'>
{% block modal-body-right %}
<h3>{% trans 'Description:' %}</h3>
<p>{% trans 'Add new category to the application catalog. ' %}</p>
<p>
<strong>{% trans 'Name' %}:</strong>
{% blocktrans %}Provide desired name for a new category{% endblocktrans %}
<strong>{% trans 'Name' %}:</strong>
{% blocktrans %}Provide desired name for a new
category{% endblocktrans %}
</p>
</div>
{% endblock %}
{% block modal-footer %}
<input class='btn btn-primary pull-right' type='submit' value='{% trans 'Add' %}' />
<a href="{% url 'horizon:murano:categories:index' %}" class="btn secondary cancel close">{% trans "Cancel" %}</a>
{% endblock %}

View File

@ -1,10 +1,6 @@
{% extends 'base.html' %}
{% load i18n %}
{% block title %}{% trans "Add category" %}{% endblock %}
{% block page_header %}
{% include 'horizon/common/_page_header.html' with title=_('Add Category') %}
{% endblock page_header %}
{% block title %}{% trans "Add Category" %}{% endblock %}
{% block main %}
{% include 'categories/_add.html' %}

View File

@ -1,36 +0,0 @@
<div id="{% block modal_id %}{% endblock %}" data-backdrop="static" class="{% block modal_class %}{% if hide %}modal{% else %}static_page{% endif %}{% endblock %}">
<div class="{% if hide %}modal-dialog{% endif %}">
<div class="{% if hide %}modal-content{% endif %}">
<div class="modal-header">
{% if hide %}<a href="#" class="close" data-dismiss="modal">&times;</a>{% endif %}
<h3>{% block modal-header %}{% endblock %}</h3>
{% block steps-list %}{% endblock %}
</div>
{% if table %}
<div class="modal-body">
{{ table.render }}
</div>
<hr />
{% endif %}
<form id="{% block form_id %}{% endblock %}"
ng-controller="{% block ng_controller %}DummyCtrl{% endblock %}"
name="{% block form_name %}{% endblock %}"
autocomplete="{% block autocomplete %}{% endblock %}"
class="{% block form_class %}{% endblock %}"
action="{% block form_action %}{% endblock %}"
method="{% block form-method %}POST{% endblock %}"
{% if add_to_field %}data-add-to-field="{{ add_to_field }}"{% endif %} {% block form_attrs %}{% endblock %}>{% csrf_token %}
<div class="modal-body clearfix">
{% block modal-body %}
<fieldset>
{% include "horizon/common/_form_fields.html" %}
</fieldset>
{% endblock %}
</div>
<div class="modal-footer">{% block modal-footer %}{% endblock %}</div>
</form>
</div>
</div>
</div>
{% block modal-js %}
{% endblock %}

View File

@ -1,17 +1,15 @@
{% extends 'common/_modal_form.html' %}
{% extends 'horizon/common/_modal_form.html' %}
{% load i18n %}
{% load url from future %}
{% block form_id %}create_environment_form{% endblock %}
{% block form_attrs %}enctype='multipart/form-data'{% endblock %}
{% block form_action %}{% url 'horizon:murano:environments:create_environment' %}{% endblock %}
{% block modal-header %}{% trans 'Create Environment' %}{% endblock %}
{% block modal_id %}create_environment_form{% endblock %}
{% block modal-body %}
{% include "environments/_fields.html" %}
{% endblock %}
{% block modal-footer %}
<input class='btn btn-primary pull-right' type='submit' value='{% trans 'Create' %}' />
<a href='{% url 'horizon:murano:environments:index' %}' class='btn secondary cancel close'>{% trans 'Cancel' %}</a>
{% block modal-body-right %}
<h3>{% trans 'Description:' %}</h3>
<p>
<strong>{% trans 'Environment Name' %}:</strong>
{% blocktrans %}Create a name for the environment{% endblocktrans %}
</p>
<p>
{% blocktrans %} An environment is a collection of instances that
are meant to operate under similar conditions.{% endblocktrans %}
</p>
{% endblock %}

View File

@ -1,19 +0,0 @@
{% load i18n %}
<div class='left'>
<fieldset>
{% include 'horizon/common/_form_fields.html' %}
</fieldset>
</div>
<div class='right'>
<h3>{% trans 'Description:' %}</h3>
<p>
<strong>{% trans 'Environment Name' %}:</strong>
{% blocktrans %}Create a name for the environment{% endblocktrans %}
</p>
<p>
{% blocktrans %} An environment is a collection of instances that
are meant to operate under similar conditions.{% endblocktrans %}
</p>
</div>

View File

@ -1,17 +1 @@
{% extends 'common/_modal_form.html' %}
{% load i18n %}
{% load url from future %}
{% block form_id %}update_environment_form{% endblock %}
{% block form_attrs %}enctype='multipart/form-data'{% endblock %}
{% block form_action %}{% url 'horizon:murano:environments:update_environment' env_id %}{% endblock %}
{% block modal-header %}{% trans 'Edit Environment' %}{% endblock %}
{% block modal_id %}update_environment_form{% endblock %}
{% block modal-body %}
{% include "environments/_fields.html" %}
{% endblock %}
{% block modal-footer %}
<input class='btn btn-primary pull-right' type='submit' value='{% trans 'Edit' %}' />
<a href="{% url 'horizon:murano:environments:index' %}" class="btn secondary cancel close">{% trans "Cancel" %}</a>
{% endblock %}
{% include 'environments/_create.html' %}

View File

@ -2,10 +2,6 @@
{% load i18n %}
{% block title %}{% trans "Create Environment" %}{% endblock %}
{% block page_header %}
{% include "horizon/common/_page_header.html" with title=_("Create Environment") %}
{% endblock page_header %}
{% block main %}
{% include 'environments/_create.html' %}
{% endblock %}

View File

@ -2,11 +2,6 @@
{% load i18n %}
{% block title %}{% trans "Edit Environment" %}{% endblock %}
{% block page_header %}
{% include "horizon/common/_page_header.html" with title=_("Edit Environment") %}
{% endblock page_header %}
{% block main %}
{% include 'environments/_update.html' %}
{% endblock %}

View File

@ -1,37 +1,23 @@
{% extends 'common/_modal_form.html' %}
{% extends 'horizon/common/_modal_form.html' %}
{% load i18n %}
{% load url from future %}
{% block form_id %}mark_murano_image_form{% endblock %}
{% block form_attrs %}enctype='multipart/form-data'{% endblock %}
{% block form_action %}{% url 'horizon:murano:images:mark_image' %}{% endblock %}
{% block modal-header %}{% trans 'Mark Image' %}{% endblock %}
{% block modal_id %}mark_murano_image_form{% endblock %}
{% block modal-body %}
<div class='left'>
<fieldset>
{% include 'horizon/common/_form_fields.html' %}
</fieldset>
</div>
<div class='right'>
{% block modal-body-right %}
<h3>{% trans 'Description:' %}</h3>
<p>{% trans 'Mark an image with Murano specific metadata to be added to the selected image.' %}</p>
<p>
<strong>{% trans 'Image' %}:</strong>
{% blocktrans %}Select an image registered in Glance Image Services.{% endblocktrans %}
<strong>{% trans 'Image' %}:</strong>
{% blocktrans %}Select an image registered in Glance Image
Services.{% endblocktrans %}
</p>
<p>
<strong>{% trans 'Image Title' %}:</strong>
<strong>{% trans 'Image Title' %}:</strong>
{% blocktrans %}Create a title for an image.{% endblocktrans %}
</p>
<p>
<strong>{% trans 'Image Type' %}:</strong>
{% blocktrans %}Select an image type supported by Murano.{% endblocktrans %}
<strong>{% trans 'Image Type' %}:</strong>
{% blocktrans %}Select an image type supported by
Murano.{% endblocktrans %}
</p>
</div>
{% endblock %}
{% block modal-footer %}
<input class='btn btn-primary pull-right' type='submit' value='{% trans 'Mark' %}' />
<a href="{% url 'horizon:murano:images:index' %}" class="btn secondary cancel close">{% trans "Cancel" %}</a>
{% endblock %}

View File

@ -2,10 +2,6 @@
{% load i18n %}
{% block title %}{% trans "Mark Image" %}{% endblock %}
{% block page_header %}
{% include 'horizon/common/_page_header.html' with title=_('Mark image with Metadata') %}
{% endblock page_header %}
{% block main %}
{% include 'images/_mark.html' %}
{% endblock %}

View File

@ -1,4 +1,4 @@
{% extends 'common/_modal_form.html' %}
{% extends 'horizon/common/_modal_form.html' %}
{% load i18n %}
{% load url from future %}
@ -7,16 +7,10 @@
{% block modal-header %}{% trans 'Modify Package' %}{% endblock %}
{% block modal_id %}modify_package_modal{% endblock %}
{% block modal-body %}
<div class='left'>
<fieldset>
{% include 'horizon/common/_form_fields.html' %}
</fieldset>
</div>
<div class='right'>
{% block modal-body-right %}
{% include 'packages/_package_params.html' %}
<p>{% blocktrans %}<strong>Categories</strong> Select up to multiple categories for a package.{% endblocktrans %}</p>
</div>
{% endblock %}
{% block modal-footer %}

View File

@ -1,6 +1,6 @@
{% extends "common/_modal_form.html" %}
{% extends "horizon/common/_modal_form.html" %}
{% load i18n humanize %}
{% load url from future %} {# fix for django 1.4.9 on CentOS #}
{% load url from future %}
{% block form_action %}
{% url 'horizon:murano:catalog:add' app_id environment_id do_redirect drop_wm_form %}
{% endblock %}

View File

@ -0,0 +1,11 @@
{% extends 'base.html' %}
{% load i18n %}
{% block title %}{% trans "Add Application" %}{% endblock %}
{% block page_header %}
{% include "horizon/common/_page_header.html" with title=_("Add Application") %}
{% endblock page_header %}
{% block main %}
{% include 'services/_wizard_create.html' %}
{% endblock %}

View File

@ -288,7 +288,7 @@ class ImageTestCase(PackageBase):
self.select_from_list('image', self.image.id)
self.fill_field(by.By.ID, 'id_title', self.image_title)
self.select_from_list('type', 'linux')
self.select_and_click_element('Mark')
self.select_and_click_element('Mark Image')
self.check_element_on_page(by.By.XPATH,
consts.TestImage.format(self.image_title))

View File

@ -109,7 +109,7 @@ class TestSuiteImage(base.ImageTestCase):
new_title = 'RenamedImage ' + str(time.time())
self.fill_field(by.By.ID, 'id_title', new_title)
self.select_from_list('type', 'linux')
self.select_and_click_element('Mark')
self.select_and_click_element('Mark Image')
self.check_element_on_page(by.By.XPATH, c.TestImage.format(new_title))
self.repair_image()