diff options
author | Matthew Lemon <y@yulqen.org> | 2024-05-15 18:25:01 +0100 |
---|---|---|
committer | Matthew Lemon <y@yulqen.org> | 2024-05-15 18:25:01 +0100 |
commit | 6ef5e1a50e29938f5bdb852f20e2f8be6ea2bc95 (patch) | |
tree | f98bde54251080bdf7f8b5cde3f3e9d020bea7b4 /pyblackbird_cc | |
parent | e2127b11df6aa712d532b6aeabd9a33e405ddc75 (diff) |
Adds an admin bar to resources page and moves some stuff to home
Diffstat (limited to 'pyblackbird_cc')
-rw-r--r-- | pyblackbird_cc/resources/urls.py | 2 | ||||
-rw-r--r-- | pyblackbird_cc/templates/base.html | 3 | ||||
-rw-r--r-- | pyblackbird_cc/templates/pages/home.html | 63 | ||||
-rw-r--r-- | pyblackbird_cc/templates/resources/resource_list.html | 152 |
4 files changed, 118 insertions, 102 deletions
diff --git a/pyblackbird_cc/resources/urls.py b/pyblackbird_cc/resources/urls.py index 86b3f4d..ad5741f 100644 --- a/pyblackbird_cc/resources/urls.py +++ b/pyblackbird_cc/resources/urls.py @@ -4,7 +4,7 @@ from . import views app_name = "resources" urlpatterns = [ - path("", views.index, name="index"), + path("", views.index, name="resource_list"), path("create/", views.create_resource, name="create_resource"), path("resource/<int:resource_id>", views.resource_detail, name="resource_detail"), path( diff --git a/pyblackbird_cc/templates/base.html b/pyblackbird_cc/templates/base.html index e3dfa46..2f4c469 100644 --- a/pyblackbird_cc/templates/base.html +++ b/pyblackbird_cc/templates/base.html @@ -75,6 +75,9 @@ <a href="https://joannalemon.etsy.com/" target="_blank">Etsy</a> </div> <div class="col"> + <a href="{% url "resources:resource_list" %}">Resources</a> + </div> + <div class="col"> <a href="https://blog.joannalemon.com" target="_blank">Blog</a> </div> </div> diff --git a/pyblackbird_cc/templates/pages/home.html b/pyblackbird_cc/templates/pages/home.html index 94d9808..deb6278 100644 --- a/pyblackbird_cc/templates/pages/home.html +++ b/pyblackbird_cc/templates/pages/home.html @@ -1 +1,64 @@ {% extends "base.html" %} + +{% load static %} + +{% block content %} + <div class="container"> + <div class="row"> + <div class="col my-3 text-center rounded p-5"> + <h1 class="display-5">High quality educational resources</h1> + <div class="row"> + <div class="col my-5 text-center"> + <h2 class="display-6">Stuff and intro text</h2> + </div> + </div> + </div> + <div class="row"> + <div class="col mb-5"> + <div class="d-flex justify-content-between align-content-center"> + <img class="mx-2" src="{% static "images/placeholder.png" %}" alt="PLACEHOLDER" /> + <img class="mx-2" src="{% static "images/placeholder.png" %}" alt="PLACEHOLDER" /> + <img class="mx-2" src="{% static "images/placeholder.png" %}" alt="PLACEHOLDER" /> + </div> + </div> + </div> + <div class="row"> + <div class="col-3 py-3 m-4 bg-white border border-1 rounded"> + <h5>Welcome!</h5> + <p> + I love to make clear and colourful resources and can't resist using rainbow colours + which so often help make learning visually clearer. I'd love to know what you think of + what you download, don't hesitate to let me know if you have any suggestions or requests... + I am also available to tutor younger learners online via Sherpa! + </p> + </div> + <div class="col py-3 m-4 bg-white border border-1 rounded"> + <h2 class="text-primary">Subscriptions available now!</h2> + <p> + I love to make clear and colourful resources and can't resist using rainbow colours + which so often help make learning visually clearer. I'd love to know what you think of + what you download, don't hesitate to let me know if you have any suggestions or requests... + I am also available to tutor younger learners online via Sherpa! + </p> + <h4>What is available?</h4> + <ul class="list-group"> + <li class="list-group-item">Full access to all resources (over 250 resources)</li> + <li class="list-group-item">Customised resources upon request</li> + <li class="list-group-item">New resources coming online all the time</li> + </ul> + <a href="#" class="btn btn-primary my-3">Subscribe now</a> + </div> + </div> + </div> + <div class="row"> + <div class="col my-5 text-center"> + <h1 class="display-2">Featured resources</h1> + </div> + <div class="row"> + <div class="col my-5 text-center"> + <h2 class="display-5">These are my latest resources. They are great!</h2> + </div> + </div> + </div> + </div> +{% endblock content %} diff --git a/pyblackbird_cc/templates/resources/resource_list.html b/pyblackbird_cc/templates/resources/resource_list.html index 8d053ff..5efd9bd 100644 --- a/pyblackbird_cc/templates/resources/resource_list.html +++ b/pyblackbird_cc/templates/resources/resource_list.html @@ -6,117 +6,67 @@ Joanna Lemon Resources - Resource List {% endblock title %} {% block content %} - <div class="container"> - <div class="row"> + {% if request.user.is_authenticated and request.user.is_staff %} + <div class="row bg-white p-4 rounded border border-success border-opacity-25"> + <h5 class="text-decoration-underline">Admin bar</h5> + <p> + Only you will see this bar - normal users will not see it. It allows us to + include buttons for adding new resources, etc. + </p> <div class="col"> <div class="d-flex flex-row justify-content-between"> - {% if request.user.is_authenticated and request.user.is_staff %} - <div> - <a class="btn btn-primary" href="{% url 'resources:create_resource' %} ">Add a new resource</a> - </div> - <div>Logged in as {{ request.user.email }}</div> - <div> - <form action="{% url 'account_logout' %}" method="post"> - {% csrf_token %} - <button type="submit">Log out</button> - </form> - </div> - {% endif %} - </div> - </div> - </div> - <div class="row"> - <div class="col my-3 text-center rounded p-5"> - <h1 class="display-5">High quality educational resources</h1> - <div class="row"> - <div class="col my-5 text-center"> - <h2 class="display-6">Stuff and intro text</h2> + <div> + <a class="btn btn-primary" href="{% url 'resources:create_resource' %} ">Add a new resource</a> </div> - </div> - </div> - <div class="row"> - <div class="col mb-5"> - <div class="d-flex justify-content-between align-content-center"> - <img class="mx-2" src="{% static "images/placeholder.png" %}" alt="PLACEHOLDER" /> - <img class="mx-2" src="{% static "images/placeholder.png" %}" alt="PLACEHOLDER" /> - <img class="mx-2" src="{% static "images/placeholder.png" %}" alt="PLACEHOLDER" /> + <div class="bg-danger p-2 text-dark bg-white border border-1 border-danger"> + Logged in as + <strong>{{ request.user.email }}</strong> </div> - </div> - </div> - <div class="row"> - <div class="col-3 py-3 m-4 bg-white border border-1 rounded"> - <h5>Welcome!</h5> - <p> - I love to make clear and colourful resources and can't resist using rainbow colours - which so often help make learning visually clearer. I'd love to know what you think of - what you download, don't hesitate to let me know if you have any suggestions or requests... - I am also available to tutor younger learners online via Sherpa! - </p> - </div> - <div class="col py-3 m-4 bg-white border border-1 rounded"> - <h2 class="text-primary">Subscriptions available now!</h2> - <p> - I love to make clear and colourful resources and can't resist using rainbow colours - which so often help make learning visually clearer. I'd love to know what you think of - what you download, don't hesitate to let me know if you have any suggestions or requests... - I am also available to tutor younger learners online via Sherpa! - </p> - <h4>What is available?</h4> - <ul class="list-group"> - <li class="list-group-item">Full access to all resources (over 250 resources)</li> - <li class="list-group-item">Customised resources upon request</li> - <li class="list-group-item">New resources coming online all the time</li> - </ul> - <a href="#" class="btn btn-primary my-3">Subscribe now</a> - </div> - </div> - <div class="row"> - <div class="col my-5 text-center"> - <h1 class="display-2">Featured resources</h1> - </div> - <div class="row"> - <div class="col my-5 text-center"> - <h2 class="display-5">These are my latest resources. They are great!</h2> + <div> + <form action="{% url 'account_logout' %}" method="post"> + {% csrf_token %} + <button type="submit" class="btn btn-primary">Log out</button> + </form> </div> </div> </div> - <div class="row my-4"> - <div class="col"> - {% if resource_list %} - <div class="d-flex flex-row justify-content-between flex-wrap"> - {% for resource in resource_list %} - <div class="card mx-2 mt-2" style="width: 22rem;"> - <div class="card-header position-relative"> - <div class="text-success"> - Featured - <!-- <span class="position-absolute top-0 start-100 translate-middle badge rounded-pill bg-danger">£5.99!</span> --> - </div> + </div> + {% endif %} + <div class="row my-4"> + <div class="col"> + {% if resource_list %} + <div class="d-flex flex-row justify-content-between flex-wrap"> + {% for resource in resource_list %} + <div class="card mx-2 mt-2" style="width: 22rem;"> + <div class="card-header position-relative"> + <div class="text-success"> + Featured + <!-- <span class="position-absolute top-0 start-100 translate-middle badge rounded-pill bg-danger">£5.99!</span> --> + </div> + </div> + <img class="card-img-top" + src="{{ resource.thumbnail_urls|first }}" + alt="{{ resource.thumbnail_filename }}" /> + <div class="card-body"> + <h5 class="card-title">{{ resource.name }}</h5> + <div class="d-flex flex-row justify-content-start align-content-center"> + <div> + <span class="badge bg-danger me-2">{{ resource.main_resource_category_name }}</span> </div> - <img class="card-img-top" - src="{{ resource.thumbnail_urls|first }}" - alt="{{ resource.thumbnail_filename }}" /> - <div class="card-body"> - <h5 class="card-title">{{ resource.name }}</h5> - <div class="d-flex flex-row justify-content-start align-content-center"> - <div> - <span class="badge bg-danger me-2">{{ resource.main_resource_category_name }}</span> - </div> - <div> - <span class="badge bg-secondary me-2">{{ resource.age_range }}</span> - </div> - </div> - <p class="card-text my-3">{{ resource.description }}</p> - <a href="{% url 'resources:resource_detail' resource_id=resource.id %}" - class="btn btn-primary">Details</a> + <div> + <span class="badge bg-secondary me-2">{{ resource.age_range }}</span> </div> </div> - {% endfor %} + <p class="card-text my-3">{{ resource.description }}</p> + <a href="{% url 'resources:resource_detail' resource_id=resource.id %}" + class="btn btn-primary">Details</a> + </div> </div> - {% else %} - <p>There are no resources</p> - {% endif %} + {% endfor %} </div> - </div> + {% else %} + <p>There are no resources</p> + {% endif %} </div> - {% endblock content %} -</div> + </div> +{% endblock content %} |