Fakultas Ilmu Komputer UI

Commit 4ccb88e8 authored by arif teguh wangi's avatar arif teguh wangi
Browse files

Merge branch '1706040012-30' into 'master'

[#30] Citation APA

See merge request !15
parents 4a8b9a90 8ba8e2da
Pipeline #57867 passed with stages
in 21 minutes and 16 seconds
......@@ -185,6 +185,28 @@
<button class="dropdown-item btn-book" onclick="copyToClipboard('#url')">Bagikan Tautan</button>
</div>
</div>
<div class="buttons d-flex flex-row bd-highlight mb-1">
<a href="{% url 'view-materi' materi_data.id %}" class="btn btn-link btn-book shadow-sm p-2 mr-2 bg-white rounded">Baca</a>
<a href="{% url 'download-materi' materi_data.id %}" class="btn btn-link btn-book shadow-sm p-2 mr-2 bg-white rounded">Unduh</a>
<button class="btn btn-link btn-book shadow-sm p-2 mr-2 bg-white rounded" onclick="CitateAPA('{{citationAPA}}')">Citate APA</button>
<div class="dropdown">
<button class="btn dropdown-toggle btn-book shadow-sm p-2 mr-2 bg-white rounded" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Bagikan
</button>
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
<div class="fb-share-button" data-href="{% url 'detail-materi' materi_data.id %}" data-layout="button" data-size="small">
<a target="_blank" href="https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fdigipus-staging-2.herokuapp.com%2Fmateri%2F{{materi_data.id}}%2F&amp;src=sdkpreparse" class="dropdown-item fb-xfbml-parse-ignore">Facebook</a>
</div>
<a class="twitter-share-button dropdown-item"
href="https://twitter.com/intent/tweet?text=Cek%20materi%20ini%20yuk%20https%3A%2F%2Fdigipus-staging-2.herokuapp.com%2Fmateri%2F{{materi_data.id}}%2F"
target="_blank"
data-size="large">
Twitter
</a>
<a class="dropdown-item" href="whatsapp://send?text=Cek materi ini yuk! https://digipus-staging-2.herokuapp.com{{request.path}}" target="_blank">Whatsapp</a>
<a class="dropdown-item" href="https://social-plugins.line.me/lineit/share?url=https%3A%2F%2Fdigipus-staging-2.herokuapp.com%2Fmateri%2F{{materi_data.id}}%2F" target="_blank">Line</a>
<p id="url" style="display: none">https://digipus-staging-2.herokuapp.com{{request.path}}</p>
<button class="dropdown-item btn-book" onclick="copyToClipboard('#url')">Bagikan Tautan</button>
<form action="" method="POST">
<input type="hidden" name="action" value="like">
</form>
......@@ -442,6 +464,10 @@
$('#thumbIcon').removeClass("far fa-thumbs-up").addClass('fas fa-thumbs-up')
document.getElementById("thumb").firstChild.data = " Disukai"
}
}
function CitateAPA(text){
alert('Hasil citasi : '+text);
}
</script>
{% endblock extra_scripts %}
\ No newline at end of file
......@@ -217,6 +217,21 @@ class DetailMateriTest(TestCase):
self.assertEqual(Comment.objects.all().filter(
comment="This is new comment by Anonymous").count(), 0)
def test_tombol_citasiAPA(self):
response = self.client.get(self.url)
self.assertContains(response, 'Citate APA')
def test_hasil_citasi_APA(self):
response = self.client.get(self.url)
publishedDate = ''
if(self.materi1.published_date == None):
publishedDate = 'n.d'
else :
publishedDate = self.materi1.published_date
expected = self.materi1.author+' . (' + publishedDate +') . ' + self.materi1.title +' . '+ self.materi1.publisher
self.assertIn(expected,
response.context["citationAPA"])
class PostsViewTest(TestCase):
......
......@@ -111,6 +111,13 @@ class DetailMateri(TemplateView):
context["report"] = VerificationReport.objects.filter(materi=materi)
context["has_liked"] = Like.objects.filter(
materi=materi, session_id=self.request.session.session_key).exists()
publishedDate = ''
if(materi.published_date == None):
publishedDate = 'n.d'
else :
publishedDate = materi.published_date
citationAPA = materi.author+' . (' + publishedDate +') . ' + materi.title +' . '+materi.publisher
context["citationAPA"] = citationAPA
context['materi_rating_score'] = 0
if self.request.user.is_authenticated:
......
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