Tilføj oprettelse af tråde, grupper og opslag
This commit is contained in:
@ -2,16 +2,49 @@
|
||||
{% block content %}
|
||||
<h1>{{ group.name }}</h1>
|
||||
<hr>
|
||||
{% if posts|length == 0 %}
|
||||
<p>Gruppen har ingen opslag endnu</p>
|
||||
{% endif %}
|
||||
{% for post in posts %}
|
||||
<article class="media content-section">
|
||||
<div class="media-body">
|
||||
<div class="article-metadata">
|
||||
<a class="mr-2 author-name" href="#">{{ post.author.first_name }} {{ post.author.last_name }}</a>
|
||||
<small class="text-muted">{{ post.date_posted }}</small>
|
||||
<a class="mr-2 author-name" href="#">{{ post.author.first_name }} {{ post.author.last_name }} </a>
|
||||
<small class="text-muted float-right">{{ post.created_date.strftime('%H:%I %d-%m-%Y')}}</small>
|
||||
</div>
|
||||
<h2><a class="article-title" href="#">{{ post.title }}</a></h2>
|
||||
<p class="article-content">{{ post.content }}</p>
|
||||
</div>
|
||||
</article>
|
||||
{% endfor %}
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<p style="font-weight: bold;">Skriv opslag</p>
|
||||
<form method="POST" action="{{ url_for('Post.create')}}">
|
||||
{{ formpost.group_id(value=group.group_id) }}
|
||||
{{ formpost.author_id(value=current_user.user_id) }}
|
||||
<div class="row">
|
||||
<div class="col-md-4">{{ formpost.title(class="form-control", placeholder="Title") }}</div>
|
||||
<div class="col-md-8">{{ formpost.content(class="form-control", placeholder="Indhold") }}</div>
|
||||
<div class="col-md-12 mt-2">{{ formpost.submit(class="btn btn-primary btn-block btn-sm", value="Opret opslag") }}</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock content %}
|
||||
|
||||
{% block sidebar %}
|
||||
<p style="font-weight: bold;">Gruppe tråde</p>
|
||||
{% if threads|length == 0 %}
|
||||
<p>Gruppen har ingen tråde endnu</p>
|
||||
{% endif %}
|
||||
{% for thread in threads %}
|
||||
<p><a href="{{ url_for('Threads.show', thread_id = thread.thread_id) }}">{{ thread.title }}</a></p>
|
||||
{% endfor %}
|
||||
<hr>
|
||||
<form method="POST" action="{{ url_for('Threads.create')}}">
|
||||
{{ form.group_id(value=group.group_id) }}
|
||||
<p>{{ form.title(class="form-control", placeholder="Trådens title") }}</p>
|
||||
<p>{{ form.submit(class="btn btn-primary btn-block", value="Start tråd") }}</p>
|
||||
</form>
|
||||
{% endblock sidebar %}
|
||||
|
@ -1,5 +1,7 @@
|
||||
{% extends "layout.html" %}
|
||||
{% block content %}
|
||||
<h1>Grupper</h1>
|
||||
<hr>
|
||||
{% if groups|length == 0%}
|
||||
<p>Ikke medlem af nogle grupper</p>
|
||||
{% else %}
|
||||
@ -12,3 +14,13 @@
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% endblock content %}
|
||||
|
||||
{% block sidebar %}
|
||||
<p style="font-weight: bold;">Opret gruppe</p>
|
||||
<form method="POST" action="{{ url_for('Group.create')}}">
|
||||
<p>{{ form.title(class="form-control", placeholder="Gruppens navn") }}</p>
|
||||
|
||||
<p>{{ form.hidden() }} {{ form.hidden.label(class="form-check-label") }}</p>
|
||||
<p>{{ form.submit(class="btn btn-primary btn-block") }}</p>
|
||||
</form>
|
||||
{% endblock sidebar %}
|
||||
|
@ -9,7 +9,7 @@
|
||||
<div class="media-body">
|
||||
<div class="article-metadata">
|
||||
<a class="mr-2 author-name" href="#">{{ post.author.first_name }} {{ post.author.last_name }}</a>
|
||||
<small class="text-muted">{{ post.date_posted }}</small>
|
||||
<small class="text-muted float-right">{{ post.created_date.strftime('%H:%I %d-%m-%Y')}}</small>
|
||||
</div>
|
||||
<h2><a class="article-title" href="#">{{ post.title }}</a></h2>
|
||||
<p class="article-content">{{ post.content }}</p>
|
||||
|
@ -50,10 +50,21 @@
|
||||
<main role="main" class="container">
|
||||
<div class="row">
|
||||
<div class="col-md-8">
|
||||
{% with messages = get_flashed_messages(with_categories=true) %}
|
||||
{% if messages %}
|
||||
{% for category, message in messages %}
|
||||
<div class="alert alert-{{ category }}">
|
||||
{{ message }}
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
|
||||
{% block content %}{% endblock %}
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="content-section">
|
||||
{% block sidebar %}{% endblock %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
Reference in New Issue
Block a user