diff --git a/api/v1/views.py b/api/v1/views.py
index 1ad1a679..96a0255a 100644
--- a/api/v1/views.py
+++ b/api/v1/views.py
@@ -454,6 +454,7 @@ class ObjectCommentsViewSet(ExtendedModelViewSet):
queryset = Comment.objects.all()
serializer_class = CommentCreateSerializer
permission_classes = (IsAuthorObjectOrAdmin,)
+ ordering_fields = ('update_at', )
def get_queryset(self):
queryset = self.queryset
@@ -470,7 +471,7 @@ class ObjectCommentsViewSet(ExtendedModelViewSet):
queryset = queryset.filter(deactivated_at__isnull=True)
elif is_deactivated == '2':
queryset = queryset.filter(deactivated_at__isnull=False)
- return queryset.order_by('update_at')
+ return queryset
def get_serializer_class(self):
if self.request.method == 'POST':
diff --git a/apps/course/templates/course/lesson.html b/apps/course/templates/course/lesson.html
index 8e30ea5a..d36219f7 100644
--- a/apps/course/templates/course/lesson.html
+++ b/apps/course/templates/course/lesson.html
@@ -118,13 +118,7 @@
diff --git a/apps/school/templates/school/livelesson_detail.html b/apps/school/templates/school/livelesson_detail.html
index fc483b02..96db3a06 100644
--- a/apps/school/templates/school/livelesson_detail.html
+++ b/apps/school/templates/school/livelesson_detail.html
@@ -21,7 +21,8 @@
mozallowfullscreen allowfullscreen>
Если видео не загрузилось, - уменьшите качество видео или обновите страницу
-
+
+
{% else %}
{% if livelesson.cover %}
diff --git a/web/src/components/Comment.vue b/web/src/components/Comment.vue
index 279992f9..376d1788 100644
--- a/web/src/components/Comment.vue
+++ b/web/src/components/Comment.vue
@@ -9,7 +9,7 @@
-
![]()
+
@@ -24,13 +24,13 @@
-
@@ -48,11 +48,6 @@
export default {
name: 'comment',
props: ['controller', 'comment',],
- data() {
- return {
- store: window.VUE_STORE,
- }
- },
computed: {
isHeart(){
return this.comment.content === '❤';
diff --git a/web/src/components/CommentForm.vue b/web/src/components/CommentForm.vue
index c6eae9f6..d83c8dd1 100644
--- a/web/src/components/CommentForm.vue
+++ b/web/src/components/CommentForm.vue
@@ -1,7 +1,7 @@
-
+
@@ -25,7 +25,6 @@
replyTo: null,
nodes: [],
controller: this,
- store: window.VUE_STORE,
flatComments: {},
}
},
@@ -44,9 +43,9 @@
this.loading = true;
let request = api.addObjComment(this.objId, this.objType, {
content: content,
- author: this.store.user.id,
+ author: this.$root.store.user.id,
parent: this.replyTo && this.replyTo.id,
- }, this.store.accessToken);
+ });
request.then((response) => {
vm.loading = false;
vm.onAdd(response.data);
@@ -63,7 +62,7 @@
}
let vm = this;
this.loading = true;
- let request = api.removeObjComment(comment.id, this.store.accessToken);
+ let request = api.removeObjComment(comment.id);
request.then((response) => {
vm.loading = false;
vm.onRemove(comment);
@@ -73,11 +72,12 @@
if(this.flatComments[comment.id]){
return;
}
+ const method = this.isChat ? 'push' : 'unshift';
if(comment.parent){
- this.flatComments[comment.parent].children.unshift(comment);
+ this.flatComments[comment.parent].children[method](comment);
}
else{
- this.nodes.unshift(comment);
+ this.nodes[method](comment);
}
this.flatComments[comment.id] = comment;
},
@@ -114,7 +114,7 @@
mounted() {
let vm = this;
this.loading = true;
- let request = api.getObjComments(this.objId, this.objType, this.store.accessToken);
+ let request = api.getObjComments(this.objId, this.objType, this.isChat ? 'update_at' : '-update_at');
request
.then((response) => {
vm.loading = false;
diff --git a/web/src/js/modules/api.js b/web/src/js/modules/api.js
index ee0f6337..9d7704b3 100644
--- a/web/src/js/modules/api.js
+++ b/web/src/js/modules/api.js
@@ -510,31 +510,32 @@ export const api = {
}
});
},
- getObjComments: (objId, objType, accessToken) => {
+ getObjComments: (objId, objType, ordering) => {
return api.get('/api/v1/obj-comments/', {
params: {
obj_id: objId,
obj_type: objType,
+ ordering: ordering || '',
},
headers: {
- 'Authorization': `Token ${accessToken}`,
+ 'Authorization': `Token ${window.LIL_STORE.accessToken}`,
}
});
},
- addObjComment: (objId, objType, commentJson, accessToken) => {
+ addObjComment: (objId, objType, commentJson) => {
let data = commentJson;
data.obj_id = objId;
data.obj_type = objType;
return api.post('/api/v1/obj-comments/', data, {
headers: {
- 'Authorization': `Token ${accessToken}`,
+ 'Authorization': `Token ${window.LIL_STORE.accessToken}`,
}
});
},
- removeObjComment: (commentId, accessToken) => {
+ removeObjComment: (commentId) => {
return api.delete(`/api/v1/obj-comments/${commentId}/`, {
headers: {
- 'Authorization': `Token ${accessToken}`,
+ 'Authorization': `Token ${window.LIL_STORE.accessToken}`,
}
});
}
diff --git a/web/src/sass/_common.sass b/web/src/sass/_common.sass
index c1e958b1..862e31b1 100755
--- a/web/src/sass/_common.sass
+++ b/web/src/sass/_common.sass
@@ -2819,10 +2819,12 @@ a.grey-link
&__item
&:not(:last-child)
margin-bottom: 25px
+ +m
+ padding: 10px 0
&_reply
padding-left: 80px
+m
- padding: 0
+ padding: 10px 0
&__reply-info
display: none
margin-bottom: 10px
@@ -2863,6 +2865,8 @@ a.grey-link
&__btn
margin: 0 15px;
border-radius: 20px
+ +m
+ margin-left: 0
&__details
margin-bottom: 5px
&__head,
@@ -2881,6 +2885,7 @@ a.grey-link
&__author
margin-right: 15px
&__date
+ font-size: 10px
display: inline-block
&__foot
height: 20px
@@ -2891,36 +2896,51 @@ a.grey-link
fill: #d40700
width: 28px
height: 28px
+ &__send-icon
+ fill: $gray
+ width: 20px
+ height: 20px
&--heart
&__content
- font-size: 24px;
- color: #d40700;
-
+ font-size: 24px;
+ color: #d40700;
&--chat &__items
- background: white;
- border: 1px solid #ccc;
- padding: 10px;
- border-radius: 5px;
- max-height: 400px;
- overflow: auto;
+ background: white;
+ border: 1px solid #ccc;
+ padding: 10px;
+ border-radius: 5px;
+ max-height: 400px;
+ overflow: auto;
+ +m
+ max-height: inherit
+ &--chat &__item, &--chat &__item_reply
+ +m
+ padding: 0
&--chat &__ava
- height: 40px
- margin-right: 10px
- flex: 0 0 40px
+ height: 40px
+ margin-right: 10px
+ flex: 0 0 40px
+ +m
+ display: none
&--chat &__content
- margin-bottom: 10px
+ margin-bottom: 10px
&--chat &__wrap
- display: flex
- flex: 0 0 calc(100% - 60px);
+ display: flex
+ flex: 0 0 calc(100% - 60px);
+ +m
+ flex: 1
&--chat &__field
- margin-bottom: 0;
- flex: 0 0 calc(100% - 160px);
+ margin-bottom: 0;
+ flex: 0 0 calc(100% - 160px);
+ +m
+ flex: 1
&--chat &__btn
- font-weight: 600;
- text-shadow: 1px 1px #fff;
+ font-weight: 600;
+ text-shadow: 1px 1px #fff;
+ +m
+ margin: 0 0 0 15px;
&--chat &__form-foot
- display: flex;
-
+ display: flex;
.share
&__title
@@ -3702,6 +3722,11 @@ a.grey-link
+m
display: none
+.mobile-show
+ display: none
+ +m
+ display: block
+
.school
display: flex
position: relative