Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Add Page templates

Pacu2ecd1f58889bc
diff --git a/templates/dashboard/page/form.html b/templates/dashboard/page/form.html
new file mode 100644
index 0000000000..9b406ef2a9
--- /dev/null
+++ b/templates/dashboard/page/form.html
@@ -0,0 +1,95 @@
+{% extends "dashboard/base.html" %}
+{% load i18n %}
+{% load materializecss %}
+{% load staticfiles %}
+
+{% block page_title %}{% if page.pk %}{{ page }}{% else %}{% trans 'Add new page' %}{% endif %} - {% trans 'CMS' %} - {{ block.super }}{% endblock %}
+
+{% block title %}{% if page.pk %}{{ page }}{% else %}{% trans 'Add new page' %}{% endif %} - {{ block.super }}{% endblock %}
+
+{% block body_class %}body-page{% endblock %}
+
+{% block header_menu %}
+ {% url "dashboard:page-list" as url %}
+ {% include "dashboard/includes/_back-link.html" with url=url %}
+{% endblock %}
+
+{% block breadcrumbs %}
+ <ul class="breadcrumbs breadcrumbs--with-menu">
+ <li><a href="{% url 'dashboard:page-list' %}" class="breadcrumbs--ellipsed-item">{% trans "Pages" %}</a></li>
+ <li><span class="breadcrumbs--ellipsed-item">{% if page.pk %}{{ page }}{% else %}{% trans 'Add new page' %}{% endif %}</span></li>
+ </ul>
+{% endblock %}
+
+{% block header_extra %}
+ {% if page.pk %}
+ <a class="dropdown-button" href="#" data-activates="context-menu" data-constrainwidth="false">
+ <svg data-src="{% static "images/more_icon.svg" %}" width="25px" height="25px" />
+ </a>
+ <ul id="context-menu" class="dropdown-content">
+ <li>
+ <a href="{{ page.get_absolute_url }}">{% trans 'View on site' %}</a>
+ </li>
+ <li>
+ <a href="#base-modal" data-href="{% url 'dashboard:page-delete' pk=page.pk %}"
+ class="modal-trigger-custom">
+ {% trans "Remove page" %}
+ </a>
+ </li>
+ </ul>
+ {% endif %}
+{% endblock %}
+
+{% block menu_cms_class %} active{% endblock %}
+
+{% block content %}
+ <form method="post" enctype="multipart/form-data">
+ {% csrf_token %}
+ {{ redirect_form }}
+ <div class="row">
+ <div class="col s12 l8">
+ {{ form.title|materializecss }}
+ {{ form.content|materializecss }}
+ {{ form.javascript|materializecss }}
+ {{ form.head_tags|materializecss }}
+ </div>
+ <div class="col s12 l4">
+ {{ form.status|materializecss }}
+ {{ form.url|materializecss }}
+ {{ form.meta_tags|materializecss:"input-field s12" }}
+ {{ form.meta_description|materializecss:"input-field s12" }}
+ </div>
+ </div>
+
+ <div class="row">
+ <div class="col s12 l8">
+ <h4 class="light">{% trans "Upload page assets" %}</h4>
+ {{ asset_formset.management_form }}
+ {% for form in asset_formset %}
+ <div class="item">
+ {{ form|materializecss }}
+ </div>
+ {% endfor %}
+ </div>
+
+ </div>
+
+ <div class="row">
+ <div class="col s12">
+ <div class="left">
+ <button type="button" class="btn green small-padding" value="Add More" id="add_more">
+ {% trans "Add more files" %}</button>
+ </div>
+ <div class="right">
+ {% if page.pk %}
+ <a href="{% url 'dashboard:page-list' %}" class="btn-flat">{% trans "Cancel" %}</a>
+ <button type="submit" class="btn submit-stay">{% trans "Save and continue editing" %}</button>
+ <button type="submit" class="btn">{% trans "Save" %}</button>
+ {% else %}
+ <a href="{% url 'dashboard:page-list' %}" class="btn-flat">{% trans "Cancel" %}</a>
+ <button type="submit" class="btn submit-stay">{% trans "Create" %}</button>
+ {% endif %}
+ </div>
+ </div>
+ </form>
+{% endblock %}
diff --git a/templates/dashboard/page/list.html b/templates/dashboard/page/list.html
new file mode 100644
index 0000000000..4bb729e402
--- /dev/null
+++ b/templates/dashboard/page/list.html
@@ -0,0 +1,68 @@
+{% extends "dashboard/base.html" %}
+{% load i18n %}
+{% load embed_video_tags %}
+{% load staticfiles %}
+
+{% block page_title %}{% trans "Pages" %} - {{ block.super }}{% endblock %}
+
+{% block title %}{% trans "Pages" %} - {{ block.super }}{% endblock %}
+
+{% block body_class %}body-page{% endblock %}
+
+{% block header_extra %}
+ <div class="fixed-action-btn">
+ <a class="btn-fab btn-floating btn-large waves-effect waves-light teal modal-trigger"
+ href="{% url 'dashboard:page-add' %}"
+ title="{% trans "Add page page" %}">
+ <svg data-src="{% static "images/add_icon.svg" %}" width="30px" height="30px" />
+ </a>
+ </div>
+{% endblock %}
+
+{% block breadcrumbs %}
+ <ul class="breadcrumbs">
+ <li>{% trans "Pages" %}</li>
+ </ul>
+{% endblock %}
+
+{% block menu_cms_class %} active{% endblock %}
+
+{% block content %}
+ <div class="row">
+ <div class="col s12">
+ {% if pages %}
+ <div class="card">
+ <div class="data-table-container">
+ <table class="bordered hoverable responsive data-table">
+ <thead>
+ <tr>
+ <th>{% trans "Title" %}</th>
+ <th>{% trans "Url" %}</th>
+ <th>{% trans "Created at" %}</th>
+ </tr>
+ </thead>
+ <tbody>
+ {% for page in pages %}
+ <tr>
+ <td>
+ <a href="{% url 'dashboard:page-edit' pk=page.pk %}">{{ page }}</a>
+ </td>
+ <td>
+ <a href="{{ page.get_absolute_url }}">{{ page.get_absolute_url }}</a>
+ </td>
+ <td>
+ {{ page.created }}
+ </td>
+ </tr>
+ {% endfor %}
+ </tbody>
+ </table>
+ </div>
+ </div>
+ {% include "dashboard/includes/_pagination.html" with page_obj=pages %}
+ {% else %}
+ <p>{% trans "No pages found." %}</p>
+ {% endif %}
+ </div>
+ </div>
+{% endblock %}
diff --git a/templates/dashboard/page/modal-delete.html b/templates/dashboard/page/modal-delete.html
new file mode 100644
index 0000000000..03c3b93005
--- /dev/null
+++ b/templates/dashboard/page/modal-delete.html
@@ -0,0 +1,22 @@
+{% load i18n %}
+
+<form action="{% url "dashboard:page-delete" pk=page.pk %}" method="post">
+ {% csrf_token %}
+ <div class="modal-content">
+ <div class="row">
+ <div class="col s12">
+ <h5>{% trans "Are you sure?" %}</h5>
+ </div>
+ </div>
+ <p>
+ {% blocktrans with page=page %}
+ Are you sure you want to delete the page {{ page }}?
+ {% endblocktrans %}
+ </p>
+ </div>
+
+ <div class="modal-footer">
+ <button type="submit" class="modal-action btn-flat blue-text">{% trans "Delete" %}</button>
+ <a href="#" class="modal-action modal-close btn-flat blue-text">{% trans "Cancel" %}</a>
+ </div>
+</form>