Commit 4d07f46f4bd414a60e32382670b5ff474e24e7d4
1 parent
e61a4f1d
Exists in
master
and in
1 other branch
- removed templates for success, warning and danger. They are now served from th…
…e single template information. - show-ref option now also shows path and filename.
Showing
7 changed files
with
34 additions
and
59 deletions
Show diff stats
demo/test-tutorial.yaml
serve.py
@@ -184,11 +184,9 @@ class TestHandler(BaseHandler): | @@ -184,11 +184,9 @@ class TestHandler(BaseHandler): | ||
184 | 'textarea': 'question-textarea.html', | 184 | 'textarea': 'question-textarea.html', |
185 | # -- information panels -- | 185 | # -- information panels -- |
186 | 'information': 'question-information.html', | 186 | 'information': 'question-information.html', |
187 | - 'info': 'question-information.html', | ||
188 | - 'warning': 'question-warning.html', | ||
189 | - 'warn': 'question-warning.html', | ||
190 | - 'alert': 'question-alert.html', | ||
191 | - 'success': 'question-success.html', | 187 | + 'success': 'question-information.html', |
188 | + 'warning': 'question-information.html', | ||
189 | + 'alert': 'question-information.html', | ||
192 | } | 190 | } |
193 | 191 | ||
194 | # --- GET | 192 | # --- GET |
@@ -258,12 +256,10 @@ class ReviewHandler(BaseHandler): | @@ -258,12 +256,10 @@ class ReviewHandler(BaseHandler): | ||
258 | 'numeric-interval': 'review-question-text.html', | 256 | 'numeric-interval': 'review-question-text.html', |
259 | 'textarea': 'review-question-text.html', | 257 | 'textarea': 'review-question-text.html', |
260 | # -- information panels -- | 258 | # -- information panels -- |
261 | - 'information': 'question-information.html', | ||
262 | - 'info': 'question-information.html', | ||
263 | - 'warning': 'question-warning.html', | ||
264 | - 'warn': 'question-warning.html', | ||
265 | - 'alert': 'question-alert.html', | ||
266 | - 'success': 'question-success.html', | 259 | + 'information': 'review-question-information.html', |
260 | + 'success': 'review-question-information.html', | ||
261 | + 'warning': 'review-question-information.html', | ||
262 | + 'alert': 'review-question-information.html', | ||
267 | } | 263 | } |
268 | 264 | ||
269 | @tornado.web.authenticated | 265 | @tornado.web.authenticated |
@@ -283,11 +279,10 @@ class ReviewHandler(BaseHandler): | @@ -283,11 +279,10 @@ class ReviewHandler(BaseHandler): | ||
283 | else: | 279 | else: |
284 | with f: | 280 | with f: |
285 | t = json.load(f) | 281 | t = json.load(f) |
286 | - # print(yaml.dump(t, default_flow_style=False)) | ||
287 | - self.render('review.html', t=t, md=md_to_html, templ=self._templates) | 282 | + self.render('review.html', t=t, md=md_to_html, templ=self._templates) |
288 | 283 | ||
289 | 284 | ||
290 | -# ------------------------------------------------------------------------- | 285 | +# --- ADMIN ------------------------------------------------------------------ |
291 | class AdminHandler(BaseHandler): | 286 | class AdminHandler(BaseHandler): |
292 | SUPPORTED_METHODS = ['GET', 'POST'] | 287 | SUPPORTED_METHODS = ['GET', 'POST'] |
293 | 288 |
templates/question-alert.html
templates/question-information.html
1 | {% autoescape %} | 1 | {% autoescape %} |
2 | 2 | ||
3 | +{% if q['type'] == 'information' %} | ||
4 | + <div class="alert alert-info border-info" role="alert"> | ||
5 | +{% elif q['type'] == 'success' %} | ||
6 | + <div class="alert alert-success border-success" role="alert"> | ||
7 | +{% elif q['type'] == 'warning' %} | ||
8 | + <div class="alert alert-warning border-warning" role="alert"> | ||
9 | +{% else %} | ||
10 | + <div class="alert alert-danger border-danger" role="alert"> | ||
11 | +{% end %} | ||
12 | + <h3> | ||
13 | + {{ q['title'] }} | ||
14 | + </h3> | ||
3 | 15 | ||
4 | -<div class="alert alert-info border-info" role="alert"> | ||
5 | - <h3> | ||
6 | - {{ q['title'] }} | ||
7 | - </h3> | 16 | + <div id="text"> |
17 | + {{ md(q['text']) }} | ||
18 | + </div> | ||
8 | 19 | ||
9 | - <div id="text"> | ||
10 | - {{ md(q['text']) }} | ||
11 | - </div> | 20 | + {% if show_ref %} |
21 | + <hr> | ||
22 | + path: <code>{{ q['path'] }}</code><br> | ||
23 | + file: <code>{{ q['filename'] }}</code><br> | ||
24 | + ref: <code>{{ q['ref'] }}</code> | ||
25 | + {% end %} | ||
12 | </div> | 26 | </div> |
13 | \ No newline at end of file | 27 | \ No newline at end of file |
templates/question-success.html
templates/question-warning.html
templates/question.html
@@ -25,7 +25,9 @@ | @@ -25,7 +25,9 @@ | ||
25 | 25 | ||
26 | {% if show_ref %} | 26 | {% if show_ref %} |
27 | <div class="card-footer"> | 27 | <div class="card-footer"> |
28 | - <code>{{ q['ref'] }}</code> | 28 | + path: <code>{{ q['path'] }}</code><br> |
29 | + file: <code>{{ q['filename'] }}</code><br> | ||
30 | + ref: <code>{{ q['ref'] }}</code> | ||
29 | </div> | 31 | </div> |
30 | {% end %} | 32 | {% end %} |
31 | </div> | 33 | </div> |