← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1351438] [NEW] Code repetition in modal body and footer

 

Public bug reported:

The modal code below is very common and we see it repeated in many templates.
This makes refactoring a nightmare and can introduce human errors in many different areas.

{% block modal-body %}
<div class="left">
    <fieldset>
    {% include "horizon/common/_form_fields.html" %}
    </fieldset>
</div>
<div class="right">
    <h3>{% trans "Description:" %}</h3>
    <p>{% trans "Choose the rule you want to remove." %}</p>
</div>
{% endblock %}

{% block modal-footer %}
  <input class="btn btn-primary pull-right" type="submit" value="{% trans "Some value" %}" />
  <a href="{% url 'url' %}" class="btn btn-default secondary cancel close">{% trans "Cancel" %}</a>
{% endblock %}

We need to provide a block for replacing the right side of the body, and a way to pass in values for the modal footer.
This would reduce code footprint and make the code less error-prone.

** Affects: horizon
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Dashboard (Horizon).
https://bugs.launchpad.net/bugs/1351438

Title:
  Code repetition in modal body and footer

Status in OpenStack Dashboard (Horizon):
  New

Bug description:
  The modal code below is very common and we see it repeated in many templates.
  This makes refactoring a nightmare and can introduce human errors in many different areas.

  {% block modal-body %}
  <div class="left">
      <fieldset>
      {% include "horizon/common/_form_fields.html" %}
      </fieldset>
  </div>
  <div class="right">
      <h3>{% trans "Description:" %}</h3>
      <p>{% trans "Choose the rule you want to remove." %}</p>
  </div>
  {% endblock %}

  {% block modal-footer %}
    <input class="btn btn-primary pull-right" type="submit" value="{% trans "Some value" %}" />
    <a href="{% url 'url' %}" class="btn btn-default secondary cancel close">{% trans "Cancel" %}</a>
  {% endblock %}

  We need to provide a block for replacing the right side of the body, and a way to pass in values for the modal footer.
  This would reduce code footprint and make the code less error-prone.

To manage notifications about this bug go to:
https://bugs.launchpad.net/horizon/+bug/1351438/+subscriptions


Follow ups

References