-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Nazarii
committed
Dec 17, 2023
1 parent
78d77ff
commit 27aceb8
Showing
19 changed files
with
92 additions
and
157 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,12 @@ | ||
from django.urls import path | ||
from rest_framework.routers import DefaultRouter | ||
|
||
from . import views | ||
from main.views import TemplateAPIView | ||
|
||
app_name = 'blog' | ||
|
||
router = DefaultRouter() | ||
router.register('comment', views.CommentViewSet, basename='comment') | ||
|
||
urlpatterns = [ | ||
path('blog/', TemplateAPIView.as_view(template_name='blog/post_list.html'), name='blog-list'), | ||
path('blog/<str:slug>', TemplateAPIView.as_view(template_name='blog/post_detail.html'), name='blog-detail'), | ||
path('comment/<article_id>/', views.CommentViewSet.as_view({'get': 'list'}), name='article_comments'), | ||
path('posts/new/', views.CreateArticleTemplateView.as_view(), name='new_post'), | ||
] | ||
|
||
urlpatterns += router.urls |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
$(function () { | ||
userList() | ||
}); | ||
|
||
|
||
function userList() { | ||
$.ajax({ | ||
type: 'GET', | ||
url: '/api/v1/user/', | ||
success: userListHandler, | ||
}) | ||
} | ||
|
||
function userListTemplate(user) { | ||
const followButtonText = getButtonText(user.follow) | ||
return ` | ||
<li class="span5 clearfix"> | ||
<div class="thumbnail clearfix"> | ||
<img src="${user.avatar}" alt="Avatar" class="pull-left span2 clearfix avatar img-circle img-thumbnail" width="120px" | ||
style='margin-right:10px'> | ||
<div class="caption" class="pull-left"> | ||
<a href="#" data-id="${user.id}" | ||
class="btn btn-primary icon pull-right followMe">${followButtonText}</a> | ||
<h4> | ||
<a href="/user/${user.id}">${ user.full_name}</a> | ||
</h4> | ||
<small><b>RG: </b>99384877</small> | ||
</div> | ||
</div> | ||
</li> | ||
` | ||
} | ||
|
||
function userListHandler(data) { | ||
const userList = $('#userList'); | ||
const result = data.results.map((user) => userListTemplate(user)).join(''); | ||
userList.empty(); | ||
userList.append(result); | ||
$(".followMe").click(followMe); | ||
} |
Oops, something went wrong.