Browse Source

Add query parameters for auto-filling PM content

merge-requests/96/head
Cassidy Dingenskirchen 5 years ago
committed by Deimos
parent
commit
dccf3df4db
  1. 4
      tildes/tildes/templates/new_message.jinja2
  2. 10
      tildes/tildes/views/message.py

4
tildes/tildes/templates/new_message.jinja2

@ -28,10 +28,10 @@
<div class="form-group">
<label class="form-label" for="subject">Subject</label>
<input class="form-input" id="subject" name="subject" type="text" placeholder="Subject" required>
<input class="form-input" id="subject" name="subject" type="text" placeholder="Subject" value="{{ subject }}" required>
</div>
{{ markdown_textarea() }}
{{ markdown_textarea(text=message) }}
<div class="form-buttons">
<button type="submit" class="btn btn-primary">Send message</button>

10
tildes/tildes/views/message.py

@ -3,6 +3,7 @@
"""Views related to sending and viewing messages."""
from marshmallow.fields import String
from pyramid.httpexceptions import HTTPFound
from pyramid.request import Request
from pyramid.view import view_config
@ -17,9 +18,14 @@ from tildes.schemas.message import MessageConversationSchema, MessageReplySchema
@view_config(
route_name="new_message", renderer="new_message.jinja2", permission="message"
)
def get_new_message_form(request: Request) -> dict:
@use_kwargs({"subject": String(missing=""), "message": String(missing="")})
def get_new_message_form(request: Request, subject: str, message: str) -> dict:
"""Form for entering a new private message to send."""
return {"user": request.context}
return {
"user": request.context,
"subject": subject,
"message": message,
}
@view_config(route_name="messages", renderer="messages.jinja2")

Loading…
Cancel
Save