##// END OF EJS Templates
Version bump
Version bump

File last commit:

r1601:24ed0df7 default
r2019:bae74335 4.8.1 default
Show More
preview.py
35 lines | 827 B | text/x-python | PythonLexer
neko259
Added post preview page
r825 from django.shortcuts import render
from django.template import RequestContext
from django.views.generic import View
neko259
Moved text parser and preparser to a separate module (BB-64)
r1066 from boards.mdx_neboard import Parser
neko259
Added post preview page
r825
FORM_QUERY = 'query'
CONTEXT_RESULT = 'result'
CONTEXT_QUERY = 'query'
__author__ = 'neko259'
TEMPLATE = 'boards/preview.html'
class PostPreviewView(View):
def get(self, request):
neko259
Removed stale TODOs. Fixed image actions not getting links
r1601 return render(request, TEMPLATE)
neko259
Added post preview page
r825
def post(self, request):
neko259
Refactored views
r1090 params = dict()
neko259
Added post preview page
r825
if FORM_QUERY in request.POST:
raw_text = request.POST[FORM_QUERY]
if len(raw_text) >= 0:
neko259
Moved text parser and preparser to a separate module (BB-64)
r1066 parser = Parser()
rendered_text = parser.parse(parser.preparse(raw_text))
neko259
Added post preview page
r825
neko259
Refactored views
r1090 params[CONTEXT_RESULT] = rendered_text
params[CONTEXT_QUERY] = raw_text
neko259
Added post preview page
r825
neko259
Refactored views
r1090 return render(request, TEMPLATE, params)