use semantic.card for document { title, overview, metadata }
This commit is contained in:
parent
448d058fa7
commit
aa7e400b6f
|
@ -18,6 +18,7 @@
|
||||||
<link rel="stylesheet" type="text/css" href="{% static 'semantic/components/segment.css' %}">
|
<link rel="stylesheet" type="text/css" href="{% static 'semantic/components/segment.css' %}">
|
||||||
<link rel="stylesheet" type="text/css" href="{% static 'semantic/components/dropdown.css' %}">
|
<link rel="stylesheet" type="text/css" href="{% static 'semantic/components/dropdown.css' %}">
|
||||||
<link rel="stylesheet" type="text/css" href="{% static 'semantic/components/icon.css' %}">
|
<link rel="stylesheet" type="text/css" href="{% static 'semantic/components/icon.css' %}">
|
||||||
|
<link rel="stylesheet" type="text/css" href="{% static 'semantic/components/card.css' %}">
|
||||||
<link rel="stylesheet" type="text/css" href="{% static 'semantic/components/progress.css' %}">
|
<link rel="stylesheet" type="text/css" href="{% static 'semantic/components/progress.css' %}">
|
||||||
|
|
||||||
{% block stylesheet %}{% endblock %}
|
{% block stylesheet %}{% endblock %}
|
||||||
|
@ -50,13 +51,16 @@
|
||||||
<a class="item" href="/docs">Documents</a>
|
<a class="item" href="/docs">Documents</a>
|
||||||
<a class="item" href="/docs">Tâches</a>
|
<a class="item" href="/docs">Tâches</a>
|
||||||
{% block "navigation" %} {% endblock %}
|
{% block "navigation" %} {% endblock %}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="ui main text container">
|
<div class="ui two column stackable grid">
|
||||||
<h1 class="ui header">{% block "title" %}{% endblock %}</h1>
|
<div class="three wide column">
|
||||||
{% block "content" %}{% endblock %}
|
{% block "content_navigation" %}{% endblock %}
|
||||||
|
</div>
|
||||||
|
<div class="ten wide colum">
|
||||||
|
{% block "content" %}{% endblock %}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -9,13 +9,29 @@
|
||||||
</ul>
|
</ul>
|
||||||
{% endblock "navigation" %}
|
{% endblock "navigation" %}
|
||||||
|
|
||||||
{% block "content" %}
|
{% block "title" %}
|
||||||
|
{{ document.title }}
|
||||||
|
{% endblock "title" %}
|
||||||
|
|
||||||
<h2>{{ document.title }}</h2>
|
{% block "content_navigation" %}
|
||||||
<p>Document Type: {{ document.type }} - Created at {{ document.created_at }}</p>
|
<div class="segment">
|
||||||
<p>Overview: {{ document.overview }}</p>
|
<div class="ui card">
|
||||||
|
<div class="content">
|
||||||
|
<a class="header">{{ document.title }}</a>
|
||||||
|
|
||||||
{% if document.last_published_version %}
|
<div class="meta">
|
||||||
|
<span class="date">{{ document.created_at }}</span>
|
||||||
|
</div>
|
||||||
|
<div class="description">
|
||||||
|
{{ document.overview }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="extra content">
|
||||||
|
Type : {{ document.type }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{% if document.last_published_version %}
|
||||||
<h3>Last published version: {{ document.last_published_version }}</h3>
|
<h3>Last published version: {{ document.last_published_version }}</h3>
|
||||||
<ul>
|
<ul>
|
||||||
<li>Authors: {% for author in document.last_published_version.authors.all %}{{ author }}{% endfor %}</li>
|
<li>Authors: {% for author in document.last_published_version.authors.all %}{{ author }}{% endfor %}</li>
|
||||||
|
@ -53,8 +69,16 @@
|
||||||
<h4>Rédaction</h4>
|
<h4>Rédaction</h4>
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="{% url 'document_sections' document.pk %}">Rédaction inline</a></li>
|
<li><a href="{% url 'document_sections' document.pk %}">Rédaction inline</a></li>
|
||||||
<li><a href="#">Visualiser le document (HTML)</a></li>
|
|
||||||
<li><a href="#">Convertir en PDF et créer une nouvelle version</a></li>
|
<li><a href="#">Convertir en PDF et créer une nouvelle version</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
{% endblock "content" %}
|
</div>
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block "content" %}
|
||||||
|
<div class="segment">
|
||||||
|
{% for section in document.sections.all %}
|
||||||
|
<h1>{{ section }}</h1>
|
||||||
|
{{ section.get_message_as_markdown | safe }}
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
{% endblock "content" %}
|
|
@ -1,17 +1,21 @@
|
||||||
from django.db import models
|
from django.db import models
|
||||||
|
|
||||||
from markdown import Markdown
|
from django.utils.html import mark_safe
|
||||||
|
from markdown import Markdown, markdown
|
||||||
import pdfkit
|
import pdfkit
|
||||||
|
|
||||||
from dms.models import Document
|
from dms.models import Document
|
||||||
|
|
||||||
|
|
||||||
class Section(models.Model):
|
class Section(models.Model):
|
||||||
document = models.ForeignKey(Document)
|
document = models.ForeignKey(Document, related_name='sections')
|
||||||
order = models.IntegerField()
|
order = models.IntegerField()
|
||||||
title = models.CharField(max_length=255)
|
title = models.CharField(max_length=255)
|
||||||
content = models.TextField()
|
content = models.TextField()
|
||||||
|
|
||||||
|
def get_message_as_markdown(self):
|
||||||
|
return mark_safe(markdown(self.content, safe_mode='escape'))
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
unique_together = ('document', 'order')
|
unique_together = ('document', 'order')
|
||||||
ordering = ('document', 'order')
|
ordering = ('document', 'order')
|
||||||
|
|
Loading…
Reference in New Issue