Compose window for dms

This commit is contained in:
Mouse Reeve 2021-01-29 11:14:18 -08:00
parent bae54b6847
commit 779a5e0cbf
5 changed files with 31 additions and 12 deletions

View file

@ -92,6 +92,12 @@ class ReplyForm(CustomForm):
'user', 'content', 'content_warning', 'sensitive',
'reply_parent', 'privacy']
class StatusForm(CustomForm):
class Meta:
model = models.Status
fields = [
'user', 'content', 'content_warning', 'sensitive', 'privacy']
class EditUserForm(CustomForm):
class Meta:

View file

@ -4,6 +4,11 @@
<div class="block">
<h1 class="title">Direct Messages</h1>
<div class="box">
{% include 'snippets/create_status_form.html' with type="direct" uuid=1 %}
</div>
<section class="block">
{% if not activities %}
<p>You have no messages right now.</p>
{% endif %}
@ -14,6 +19,7 @@
{% endfor %}
{% include 'snippets/pagination.html' with page=activities path="direct-messages" %}
</section>
</div>
{% endblock %}

View file

@ -76,7 +76,7 @@
{% block panel %}{% endblock %}
{% if activities %}
{% include 'snippets/pagination.html' with page=activities path='/'|add:tab anchor="#feed" %}
{% include 'snippets/pagination.html' with page=activities path=path anchor="#feed" %}
{% endif %}
</div>
</div>

View file

@ -1,5 +1,5 @@
{% load bookwyrm_tags %}
<form class="is-flex-grow-1" name="{{ type }}" action="/post/{{ type }}" method="post" id="tab-{{ type }}-{{ book.id }}{{ reply_parent.id }}">
<form class="is-flex-grow-1" name="{{ type }}" action="/post/{% if type == 'direct' %}status{% else %}{{ type }}{% endif %}" method="post" id="tab-{{ type }}-{{ book.id }}{{ reply_parent.id }}">
{% csrf_token %}
<input type="hidden" name="book" value="{{ book.id }}">
<input type="hidden" name="user" value="{{ request.user.id }}">
@ -11,7 +11,7 @@
</div>
{% endif %}
<div class="control">
{% if not type == 'reply' %}
{% if type != 'reply' and type != 'direct' %}
<label class="label" for="id_{% if type == 'quotation' %}quote{% else %}content{% endif %}_{{ book.id }}_{{ type }}">{{ type|title }}:</label>
{% endif %}
@ -53,7 +53,12 @@
{% include 'snippets/toggle/toggle_button.html' with text="Include spoiler alert" icon="warning is-size-4" controls_text="spoilers" controls_uid=uuid focus="id_content_warning" checkbox="id_show_spoilers" class="toggle-button" pressed=status.content_warning %}
</div>
<div class="control">
{% include 'snippets/privacy_select.html' with current=reply_parent.privacy%}
{% if type == 'direct' %}
<input type="hidden" name="privacy" value="direct">
<button type="button" class="button" aria-label="Privacy" disabled>Private</button>
{% else %}
{% include 'snippets/privacy_select.html' with current=reply_parent.privacy %}
{% endif %}
</div>
</div>
<div class="column is-narrow">

View file

@ -44,6 +44,7 @@ class Feed(View):
'activities': paginated.page(page),
'tab': tab,
'goal_form': forms.GoalForm(),
'path': '/%s' % tab,
}}
return TemplateResponse(request, 'feed/feed.html', data)
@ -65,6 +66,7 @@ class DirectMessage(View):
'title': 'Direct Messages',
'user': request.user,
'activities': activity_page,
'path': '/direct-messages',
}}
return TemplateResponse(request, 'feed/direct_messages.html', data)