Commit 3d07f4f48cb4fd5a6807ae7e1cc4cfc475cd5eed
1 parent
0b32801c
Exists in
master
and in
3 other branches
modified form and added pdf rendering in html
Showing
2 changed files
with
33 additions
and
29 deletions
Show diff stats
pdf_file/templates/pdf_file/_form.html
| ... | ... | @@ -87,28 +87,7 @@ |
| 87 | 87 | {% endif %} |
| 88 | 88 | </div> |
| 89 | 89 | |
| 90 | - <div class="form-group{% if form.has_error %} has-error {% endif %}"> | |
| 91 | - <div class=" checkbox"> | |
| 92 | - <label for="{{ form.show_window.auto_id }}"> | |
| 93 | - {% render_field form.show_window %} {{ form.show_window.label }} | |
| 94 | - </label> | |
| 95 | - </div> | |
| 96 | - | |
| 97 | - <span id="helpBlock" class="help-block">{{ form.show_window.help_text }}</span> | |
| 98 | - | |
| 99 | - {% if form.show_window.errors %} | |
| 100 | - <div class="alert alert-danger alert-dismissible" role="alert"> | |
| 101 | - <button type="button" class="close" data-dismiss="alert" aria-label="Close"> | |
| 102 | - <span aria-hidden="true">×</span> | |
| 103 | - </button> | |
| 104 | - <ul> | |
| 105 | - {% for error in form.show_window.errors %} | |
| 106 | - <li>{{ error }}</li> | |
| 107 | - {% endfor %} | |
| 108 | - </ul> | |
| 109 | - </div> | |
| 110 | - {% endif %} | |
| 111 | - </div> | |
| 90 | + | |
| 112 | 91 | |
| 113 | 92 | <div class="form-group{% if form.has_error %} has-error {% endif %} is-fileinput"> |
| 114 | 93 | <label for="{{ form.tags.auto_id }}">{{ form.tags.label }}</label> |
| ... | ... | @@ -318,6 +297,29 @@ |
| 318 | 297 | |
| 319 | 298 | <div class="form-group{% if form.has_error %} has-error {% endif %}"> |
| 320 | 299 | <div class=" checkbox"> |
| 300 | + <label for="{{ form.show_window.auto_id }}"> | |
| 301 | + {% render_field form.show_window %} {{ form.show_window.label }} | |
| 302 | + </label> | |
| 303 | + </div> | |
| 304 | + | |
| 305 | + <span id="helpBlock" class="help-block">{{ form.show_window.help_text }}</span> | |
| 306 | + | |
| 307 | + {% if form.show_window.errors %} | |
| 308 | + <div class="alert alert-danger alert-dismissible" role="alert"> | |
| 309 | + <button type="button" class="close" data-dismiss="alert" aria-label="Close"> | |
| 310 | + <span aria-hidden="true">×</span> | |
| 311 | + </button> | |
| 312 | + <ul> | |
| 313 | + {% for error in form.show_window.errors %} | |
| 314 | + <li>{{ error }}</li> | |
| 315 | + {% endfor %} | |
| 316 | + </ul> | |
| 317 | + </div> | |
| 318 | + {% endif %} | |
| 319 | + </div> | |
| 320 | + | |
| 321 | + <div class="form-group{% if form.has_error %} has-error {% endif %}"> | |
| 322 | + <div class=" checkbox"> | |
| 321 | 323 | <label for="{{ form.visible.auto_id }}"> |
| 322 | 324 | {% render_field form.visible %} {{ form.visible.label }} |
| 323 | 325 | </label> | ... | ... |
pdf_file/templates/pdf_file/view.html
| ... | ... | @@ -13,20 +13,22 @@ |
| 13 | 13 | {% endblock %} |
| 14 | 14 | |
| 15 | 15 | {% block breadcrumbs %} |
| 16 | - {{ block.super }} | |
| 17 | - | |
| 18 | - {% breadcrumb topic 'subjects:topic_view' topic.subject.slug topic.slug %} | |
| 19 | - | |
| 16 | + {% clear_breadcrumbs %} | |
| 17 | + {% breadcrumb 'Home' 'subjects:home' %} | |
| 18 | + {% breadcrumb pdf_file.topic.subject.category 'subjects:cat_view' pdf_file.topic.subject.category.slug %} | |
| 19 | + {% breadcrumb pdf_file.topic.subject 'subjects:view' pdf_file.topic.subject.slug %} | |
| 20 | + {% breadcrumb pdf_file.topic 'subjects:topic_view' pdf_file.topic.subject.slug pdf_file.topic.slug %} | |
| 21 | + {% breadcrumb pdf_file 'pdf_file:view' pdf_file.slug %} | |
| 20 | 22 | |
| 21 | 23 | {% endblock %} |
| 22 | 24 | |
| 23 | 25 | |
| 24 | 26 | {% block content %} |
| 25 | 27 | |
| 26 | -<object width="100%" height="100%" type="application/pdf" data="{{pdf_file.file.path}}" id="pdf_content"> | |
| 27 | - <p>Insert your error message here, if the PDF cannot be displayed.</p> | |
| 28 | +<object width="100%" height="800px" type="application/pdf" data="{{pdf_file.file.url}}" id="pdf_content"> | |
| 29 | + <p>{% trans "PDF could not be displayed" %}</p> | |
| 28 | 30 | </object> |
| 29 | 31 | |
| 30 | - <embed src="{{pdf_file.file.path}}" width="100%" height="100%"> | |
| 32 | + | |
| 31 | 33 | |
| 32 | 34 | {% endblock content %} |
| 33 | 35 | \ No newline at end of file | ... | ... |