Skip to content

Commit

Permalink
Fix Dashboard UI for use with Oscar 3, bumps Oscar requirement
Browse files Browse the repository at this point in the history
  • Loading branch information
rodolfotorres02 committed Mar 12, 2021
1 parent 6cea8a0 commit 4874e3f
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 51 deletions.
95 changes: 54 additions & 41 deletions oscar_promotions/templates/oscar_promotions/dashboard/form.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@
{% block body_class %}{{ block.super }} create-page promotions{% endblock %}

{% block breadcrumbs %}
<ul class="breadcrumb">
<li>
<a href="{% url 'dashboard:index' %}">{% trans "Dashboard" %}</a>
</li>
<li>
<a href="{% url 'oscar_promotions_dashboard:promotion-list' %}">{% trans "Content blocks" %}</a>
</li>
<li class="active">{{ heading }}</li>
</ul>
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item">
<a href="{% url 'dashboard:index' %}">{% trans "Dashboard" %}</a>
</li>
<li class="breadcrumb-item"><a
href="{% url 'oscar_promotions_dashboard:promotion-list' %}">{% trans "Content blocks" %}</a></li>
<li class="breadcrumb-item active">{{ heading }}</li>
</ol>
</nav>
{% endblock %}

{% block headertext %}
Expand All @@ -25,18 +26,25 @@
<div class="table-header">
<h2>{% trans "Content block" %}</h2>
</div>
<div class="tab-pane active">
<div class="card card-body category-details">
<form method="post" enctype="multipart/form-data" class="well form-stacked wysiwyg">
{% csrf_token %}
{% include "oscar/dashboard/partials/form_fields.html" with form=form %}

<form method="post" enctype="multipart/form-data" class="well form-stacked wysiwyg">
{% csrf_token %}
{% include "oscar/dashboard/partials/form_fields.html" with form=form %}
{% block inlines %} {% endblock %}

{% block inlines %} {% endblock %}

<div class="form-actions">
<button type="submit" class="btn btn-primary" data-loading-text="{% trans 'Saving...' %}">{% trans "Save" %}</button>
{% trans "or" %} <a href="{% url 'oscar_promotions_dashboard:promotion-list' %}">{% trans "cancel" %}</a>
<div class="form-actions">
<button type="submit" class="btn btn-primary"
data-loading-text="{% trans 'Saving...' %}">{% trans "Save" %}</button>
{% trans "or" %} <a
href="{% url 'oscar_promotions_dashboard:promotion-list' %}">{% trans "cancel" %}</a>
</div>
</form>
</div>
</form>
</div>



{% endblock %}

Expand All @@ -45,31 +53,35 @@ <h2>{% trans "Content block" %}</h2>
<caption>{% trans "Pages displaying this content blocks" %}</caption>
{% if links %}
<thead>
<tr>
<th>{% trans "Page URL" %}</th>
<th>{% trans "Position on page" %}</th>
<th>{% trans "Actions" %}</th>
</tr>
<tr>
<th>{% trans "Page URL" %}</th>
<th>{% trans "Position on page" %}</th>
<th>{% trans "Actions" %}</th>
</tr>
</thead>
<tbody>
{% for link in links %}
<tr>
<td><a href="{{ link.page_url }}">{{ link.page_url }}</a></td>
<td>{{ link.position }}</td>
<td>
<form method="post" >
{% csrf_token %}
<input type="hidden" name="action" value="remove_from_page" />
<input type="hidden" name="pagepromotion_id" value="{{ link.id }}" />
<a href="{% url 'oscar_promotions_dashboard:promotion-list-by-url' path=link.page_url %}" class="btn btn-info">{% trans "View all blocks on this page" %}</a>
<button class="btn btn-default" type="submit" data-loading-text="{% trans 'Removing...' %}">{% trans "Remove from page" %}</button>
</form>
</td>
</tr>
{% endfor %}
{% for link in links %}
<tr>
<td><a href="{{ link.page_url }}">{{ link.page_url }}</a></td>
<td>{{ link.position }}</td>
<td>
<form method="post">
{% csrf_token %}
<input type="hidden" name="action" value="remove_from_page"/>
<input type="hidden" name="pagepromotion_id" value="{{ link.id }}"/>
<a href="{% url 'oscar_promotions_dashboard:promotion-list-by-url' path=link.page_url %}"
class="btn btn-info">{% trans "View all blocks on this page" %}</a>
<button class="btn btn-default" type="submit"
data-loading-text="{% trans 'Removing...' %}">{% trans "Remove from page" %}</button>
</form>
</td>
</tr>
{% endfor %}
</tbody>
{% else %}
<tr><td>{% trans "This promotion is not displayed anywhere at the moment." %}</td></tr>
<tr>
<td>{% trans "This promotion is not displayed anywhere at the moment." %}</td>
</tr>
{% endif %}
</table>
<div class="table-header">
Expand All @@ -78,9 +90,10 @@ <h3>{% trans "Add to a page" %}</h3>
<div class="well">
<form method="post" class="form-stacked">
{% csrf_token %}
<input type="hidden" name="action" value="add_to_page" />
<input type="hidden" name="action" value="add_to_page"/>
{% include "oscar/dashboard/partials/form_fields.html" with form=link_form %}
<button type="submit" class="btn btn-success" data-loading-text="{% trans 'Adding...' %}">{% trans "Add to page" %}</button>
<button type="submit" class="btn btn-success"
data-loading-text="{% trans 'Adding...' %}">{% trans "Add to page" %}</button>
</form>
</div>
{% endif %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,26 @@ <h1>{% trans "Content blocks" %}</h1>
{% endblock header %}

{% block breadcrumbs %}
<ul class="breadcrumb">
<li>
<a href="{% url 'dashboard:index' %}">{% trans "Dashboard" %}</a>
</li>
<li class="active">{% trans "Content blocks" %}</li>
</ul>
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item">
<a href="{% url 'dashboard:index' %}">{% trans "Dashboard" %}</a>
</li>
<li class="breadcrumb-item active">{% trans "Content blocks" %}</li>
</ol>
</nav>
{% endblock %}

{% block dashboard_content %}
<div class="table-header">
<h3><i class="icon-folder-close icon-large"></i>{% trans "Create a new content block" %}</h3>
</div>
<div class="well">
<form action="{% url 'oscar_promotions_dashboard:promotion-create-redirect' %}" method="get" class="form-inline">
<div class="well card card-body bg-light">
<form action="{% url 'oscar_promotions_dashboard:promotion-create-redirect' %}" method="get"
class="form-inline">
{% include "oscar/dashboard/partials/form_fields_inline.html" with form=select_form %}
<button type="submit" class="btn btn-primary" data-loading-text="{% trans 'Creating...' %}"><i class="icon-plus"></i> {% trans "Create block" %}</button>
<button type="submit" class="btn btn-primary" data-loading-text="{% trans 'Creating...' %}"><i
class="icon-plus"></i> {% trans "Create block" %}</button>
</form>
</div>

Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
django-oscar>=2.0,<2.1
django-oscar>=2.0,<=3.0
coverage==5.3
django-webtest==1.9.7
pytest-django>=3.7,<4.2
Expand Down

0 comments on commit 4874e3f

Please sign in to comment.