Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Dashboard UI for use with Oscar 3, bumps Oscar requirement #46

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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==6.3
django-webtest==1.9.7
pytest-django>=3.7,<4.5
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@
'Development Status :: 4 - Beta',
'Environment :: Web Environment',
'Framework :: Django',
'Framework :: Django :: 2.0',
'Framework :: Django :: 3.0',
'Intended Audience :: Developers',
'License :: OSI Approved :: BSD License',
'Operating System :: Unix',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
],
install_requires=['django>=1.11,<2.3', 'django-oscar>=2.0'],
install_requires=['django>=2.2,<3.2', 'django-oscar>=3.0'],
)