mirror of
https://github.com/TandoorRecipes/recipes.git
synced 2026-01-03 13:19:16 -05:00
join and leave spaces
This commit is contained in:
@@ -304,19 +304,19 @@
|
||||
<a class="dropdown-item" href="{% url 'admin:index' %}"><i
|
||||
class="fas fa-user-shield fa-fw"></i> {% trans 'Admin' %}</a>
|
||||
{% endif %}
|
||||
{% if request.user.is_authenticated and request.user.userspace_set.all|length > 1 %}
|
||||
{% if request.user.is_authenticated %}
|
||||
<div class="dropdown-divider"></div>
|
||||
<h6 class="dropdown-header">{% trans 'Your Spaces' %}</h6>
|
||||
{% for us in request.user.userspace_set.all %}
|
||||
<a class="dropdown-item" href="{% url 'view_switch_space' us.space.id %}">
|
||||
{% if us.active %}
|
||||
<i class="far fa-dot-circle fa-fw"></i>
|
||||
<i class="far fa-dot-circle fa-fw"></i>
|
||||
{% else %}
|
||||
<i class="far fa-circle fa-fw"></i>
|
||||
{% endif %}
|
||||
{{ us.space.name }}</a>
|
||||
{% endfor %}
|
||||
|
||||
<a class="dropdown-item" href="{% url 'view_space_overview' %}"><i class="fas fa-plus fa-fw"></i> {% trans 'Create New' %}</a>
|
||||
{% endif %}
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item" href="{% url 'docs_markdown' %}"><i
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
{% csrf_token %}
|
||||
<div class="alert alert-warning" role="alert">
|
||||
{% blocktrans %}Are you sure you want to delete the {{ title }}: <b>{{ object }}</b> {% endblocktrans %}
|
||||
{% trans 'This cannot be undone!' %}
|
||||
</div>
|
||||
{{ form|crispy }}
|
||||
|
||||
|
||||
@@ -1,70 +0,0 @@
|
||||
{% extends "base.html" %}
|
||||
{% load crispy_forms_filters %}
|
||||
{% load static %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block title %}{% trans "No Space" %}{% endblock %}
|
||||
|
||||
|
||||
{% block content %}
|
||||
|
||||
<div style="text-align: center">
|
||||
|
||||
<h3 class="">{% trans 'No Space' %}</h3>
|
||||
|
||||
<div class="row">
|
||||
<div class="col col-md-12">
|
||||
{% trans 'Recipes, foods, shopping lists and more are organized in spaces of one or more people.' %}
|
||||
{% trans 'You can either be invited into an existing space or create your own one.' %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="row" style="margin-top: 2vh">
|
||||
<div class="col col-md-12">
|
||||
|
||||
<div class="card-group">
|
||||
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
{% trans 'Join Space' %}
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<h5 class="card-title">{% trans 'Join an existing space.' %}</h5>
|
||||
<p class="card-text" style="height: 64px">{% trans 'To join an existing space either enter your invite token or click on the invite link the space owner send you.' %}</p>
|
||||
|
||||
<form method="POST" action="{% url 'view_no_space' %}">
|
||||
{% csrf_token %}
|
||||
{{ join_form | crispy }}
|
||||
<input type="submit" class="btn btn-primary" value="{% trans 'Join Space' %}"/>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
{% trans 'Create Space' %}
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<h5 class="card-title">{% trans 'Create your own recipe space.' %}</h5>
|
||||
<p class="card-text" style="height: 64px">{% trans 'Start your own recipe space and invite other users to it.' %}</p>
|
||||
<form method="POST" action="{% url 'view_no_space' %}">
|
||||
{% csrf_token %}
|
||||
{{ create_form | crispy }}
|
||||
<input type="submit" class="btn btn-primary" value="{% trans 'Create Space' %}"/>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
106
cookbook/templates/space_overview.html
Normal file
106
cookbook/templates/space_overview.html
Normal file
@@ -0,0 +1,106 @@
|
||||
{% extends "base.html" %}
|
||||
{% load crispy_forms_filters %}
|
||||
{% load static %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block title %}{% trans "No Space" %}{% endblock %}
|
||||
|
||||
|
||||
{% block content %}
|
||||
|
||||
<div style="text-align: center">
|
||||
|
||||
<h3 class="">{% trans 'Space' %}</h3>
|
||||
|
||||
<div class="row">
|
||||
<div class="col col-md-12">
|
||||
{% trans 'Recipes, foods, shopping lists and more are organized in spaces of one or more people.' %}
|
||||
{% trans 'You can either be invited into an existing space or create your own one.' %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% if request.user.userspace_set.all|length > 0 %}
|
||||
<div class="row mt-2">
|
||||
<div class="col col-12">
|
||||
<h5>{% trans 'Your Spaces' %}</h5>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mt-2">
|
||||
<div class="col col-12">
|
||||
<div class="card-deck">
|
||||
{% for us in request.user.userspace_set.all %}
|
||||
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h5 class="card-title"><a
|
||||
href="{% url 'view_switch_space' us.space.id %}">{{ us.space.name }}</a>
|
||||
</h5>
|
||||
<p class="card-text"><small
|
||||
class="text-muted">{% trans 'Owner' %}: {{ us.space.created_by }}</small>
|
||||
{% if us.space.created_by != us.user %}
|
||||
<p class="card-text"><small
|
||||
class="text-muted"><a
|
||||
href="{% url 'delete_user_space' us.pk %}">{% trans 'Leave Space' %}</a></small>
|
||||
{% endif %}
|
||||
<!--TODO add direct link to management page -->
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div class="row" style="margin-top: 2vh">
|
||||
<div class="col col-md-12">
|
||||
|
||||
<div class="card-group">
|
||||
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
{% trans 'Join Space' %}
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<h5 class="card-title">{% trans 'Join an existing space.' %}</h5>
|
||||
<p class="card-text"
|
||||
style="height: 64px">{% trans 'To join an existing space either enter your invite token or click on the invite link the space owner send you.' %}</p>
|
||||
|
||||
<form method="POST" action="{% url 'view_space_overview' %}">
|
||||
{% csrf_token %}
|
||||
{{ join_form | crispy }}
|
||||
<input type="submit" class="btn btn-primary" value="{% trans 'Join Space' %}"/>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
{% trans 'Create Space' %}
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<h5 class="card-title">{% trans 'Create your own recipe space.' %}</h5>
|
||||
<p class="card-text"
|
||||
style="height: 64px">{% trans 'Start your own recipe space and invite other users to it.' %}</p>
|
||||
<form method="POST" action="{% url 'view_space_overview' %}">
|
||||
{% csrf_token %}
|
||||
{{ create_form | crispy }}
|
||||
<input type="submit" class="btn btn-primary" value="{% trans 'Create Space' %}"/>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
Reference in New Issue
Block a user