Fakultas Ilmu Komputer UI
Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
PMPL
Class Project
DIGIPUS
Commits
4ccb88e8
Commit
4ccb88e8
authored
Oct 08, 2020
by
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
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
app/templates/app/detail_materi.html
View file @
4ccb88e8
...
...
@@ -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&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
app/tests.py
View file @
4ccb88e8
...
...
@@ -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
):
...
...
app/views.py
View file @
4ccb88e8
...
...
@@ -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
:
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment