Fakultas Ilmu Komputer UI

Commit 50b67d1e authored by Ken Reinhart's avatar Ken Reinhart
Browse files

shows related material

parent 50e68c42
......@@ -238,71 +238,55 @@
</div>
<div class="row materi-data mr-4 ml-4 p-3 shadow-sm rounded">
<div class="col col-3 cover">
<div class="cover">
<img src={{materi_data.cover.url}} alt="cover">
</div>
<div class="col col-6 ml-3 book">
<h2>{{materi_data.title}}</h2>
<div class="category-wrapper">
{% for category in materi_data.categories.all %}
<span class="mr-1" >#{{category.name}}</span>
{% endfor %}
</div>
<div class="col-9 book">
<div class="similar-material">
{% for item in materi_list %}
<div class="card book">
<img src={{item.cover.url}} class="card-img-top" alt="cover">
</img>
<img src={{item.cover.url}} class="card-img-top" alt="cover"
style="height:200px; widows: 200px;; overflow: hidden;"></img>
<div class="card-body">
<h5 class="card-title">{{item.title}}</h5>
<p class="card-text">{{item.author}}</p>
<p class="card-text">Diunggah oleh
<a class="card-link" href="{% url 'katalog-per-kontributor' item.uploader.email %}">
{{item.uploader.name}}
</a>
</p>
<a href="{% url 'view-materi' item.id %}" class="btn btn-book">Baca</a>
<a href="{% url 'detail-materi' item.id %}" class="btn btn-book">Detail</a>
</div>
</div>
{% endfor %}
<div class="center">
<div class="pagination">
<span class="step-links">
<span class="current">
Page {{ materi_list.number }} of {{ materi_list.paginator.num_pages }}
</span>
</div>
<div class="info-wrapper">
<div class="info" id="1">
<dl class="col col-4">
<dt class="info-name">Penulis</dt>
</dl>
<dd>
<p class="info-content">{{materi_data.author}}</p>
</dd>
</div>
<div class="info" id="1">
<dl class="col col-4">
<dt class="info-name">Penerbit</dt>
</dl>
<dd>
<p class="info-content">{{materi_data.publisher}}</p>
</dd>
</div>
<div class="info" id="1">
<dl class="col col-4">
<dt class="info-name">Kontributor</dt>
</dl>
<dd>
<a class="info-content"
href="{% url 'katalog-per-kontributor' materi_data.uploader.email %}">{{materi_data.uploader.name}}</a>
</dd>
</div>
<div class="info" id="1">
<dl class="col col-4">
<dt class="info-name">Jumlah Halaman</dt>
</dl>
<dd>
<p class="info-content">{{materi_data.pages}}</p>
</dd>
</div>
<div class="info" id="1">
<dl class="col col-4">
<dt class="info-name">Ukuran File</dt>
</dl>
<dd>
<p class="info-content">{{materi_data.content.size|filesizeformat}}</p>
</dd>
<br>
</br>
{% if materi_list.has_previous %}
<a href="?page=1{{url}}">&laquo; first</a>
<a href="?page={{ materi_list.previous_page_number }}{{url}}">previous</a>
{% endif %}
{% if materi_list.has_next %}
<a href="?page={{ materi_list.next_page_number }}{{url}}">next</a>
<a href="?page={{ materi_list.paginator.num_pages }}{{url}}">last &raquo;</a>
{% endif %}
</span>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row menu-wrapper mr-4 ml-4 p-3">
......
......@@ -143,9 +143,12 @@ class DetailMateri(TemplateView):
context['materi_rating_score'] = materi_rating.score
return context
def get_similar_material(self, request, *args, **kwargs):
def get(self, request, *args, **kwargs):
context = self.get_context_data(**kwargs)
query_set_for_comment = Comment.objects.filter(
materi=context["materi_data"])
context["comment_data"] = query_set_for_comment
context["kategori_list"] = Category.objects.all()
lstMateri = Materi.objects.filter(status="APPROVE").order_by("date_modified")
......@@ -167,11 +170,6 @@ class DetailMateri(TemplateView):
return self.render_to_response(context=context)
def get(self, request, *args, **kwargs):
context = self.get_context_data(**kwargs)
query_set_for_comment = Comment.objects.filter(
materi=context["materi_data"])
context["comment_data"] = query_set_for_comment
return self.render_to_response(context=context)
def get_user_name(self, request):
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment