From 83af063c88d1fe614d58960f0a522e990de56ef0 Mon Sep 17 00:00:00 2001 From: iriska-gri <79623434+iriska-gri@users.noreply.github.com> Date: Tue, 28 Nov 2023 12:29:48 +0300 Subject: [PATCH 01/32] =?UTF-8?q?=D0=A1=D0=BE=D1=85=D1=80=D0=B0=D0=BD?= =?UTF-8?q?=D1=8F=D0=BB=D0=BA=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/front/src/components/news-list-news.vue | 337 +++++++++++++++++++- src/front/src/views/NewsPage.vue | 2 +- 2 files changed, 336 insertions(+), 3 deletions(-) diff --git a/src/front/src/components/news-list-news.vue b/src/front/src/components/news-list-news.vue index 59903c081..1a6003727 100644 --- a/src/front/src/components/news-list-news.vue +++ b/src/front/src/components/news-list-news.vue @@ -1,6 +1,335 @@ @@ -369,4 +698,8 @@ export default { } */ + .heigCard { + height: 47vh; + } + \ No newline at end of file diff --git a/src/front/src/views/NewsPage.vue b/src/front/src/views/NewsPage.vue index 21141533d..e511e7542 100644 --- a/src/front/src/views/NewsPage.vue +++ b/src/front/src/views/NewsPage.vue @@ -2,7 +2,7 @@ From 0b89f9684a8d6844edcbaae0f740234b6be20286 Mon Sep 17 00:00:00 2001 From: iriska-gri <79623434+iriska-gri@users.noreply.github.com> Date: Tue, 28 Nov 2023 15:59:51 +0300 Subject: [PATCH 02/32] =?UTF-8?q?=D0=A1=D0=BA=D1=80=D0=BE=D0=BB=D0=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/front/src/components/news-list-news.vue | 463 +++++++++++--------- 1 file changed, 264 insertions(+), 199 deletions(-) diff --git a/src/front/src/components/news-list-news.vue b/src/front/src/components/news-list-news.vue index 1a6003727..dbb68f9d0 100644 --- a/src/front/src/components/news-list-news.vue +++ b/src/front/src/components/news-list-news.vue @@ -1,5 +1,255 @@ @@ -699,7 +760,11 @@ export default { } */ .heigCard { - height: 47vh; + height: 46vh; + } + + .commentHeight { + height: 91.5vh; } \ No newline at end of file From 5650a913b8f1d03ef6a4c05f5963dd9b3bfc232f Mon Sep 17 00:00:00 2001 From: iriska-gri <79623434+iriska-gri@users.noreply.github.com> Date: Tue, 28 Nov 2023 16:03:33 +0300 Subject: [PATCH 03/32] =?UTF-8?q?=D0=A1=D0=BA=D1=80=D0=BE=D0=BB=D0=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/front/src/components/news-list-news.vue | 83 +++++++++++++++++++-- 1 file changed, 76 insertions(+), 7 deletions(-) diff --git a/src/front/src/components/news-list-news.vue b/src/front/src/components/news-list-news.vue index dbb68f9d0..643d10790 100644 --- a/src/front/src/components/news-list-news.vue +++ b/src/front/src/components/news-list-news.vue @@ -225,8 +225,8 @@ - - + + + + - 1 + From f3b196319a17aa9c6aca1bcf391ac281b6c057b0 Mon Sep 17 00:00:00 2001 From: iriska-gri <79623434+iriska-gri@users.noreply.github.com> Date: Wed, 29 Nov 2023 10:23:45 +0300 Subject: [PATCH 04/32] =?UTF-8?q?=D0=9D=D0=BE=D0=B2=D0=BE=D1=81=D1=82?= =?UTF-8?q?=D0=B8=20=D1=81=20=D0=BA=D0=B0=D1=80=D1=82=D0=B8=D0=BD=D0=BA?= =?UTF-8?q?=D0=B0=D0=BC=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/front/src/components/news-list-news.vue | 21 ++++++++++++++++----- src/navigation/models.py | 5 ++++- src/navigation/urls.py | 1 + 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/src/front/src/components/news-list-news.vue b/src/front/src/components/news-list-news.vue index 643d10790..80467e543 100644 --- a/src/front/src/components/news-list-news.vue +++ b/src/front/src/components/news-list-news.vue @@ -217,7 +217,12 @@ @@ -226,8 +231,8 @@ - + { + return text.replaceAll('src="/media/uploads', `src="${baseURL}media/uploads`) + + } + const limitText=(text)=> { @@ -791,7 +801,8 @@ export default { selecnews, checkremote, route, - spravURL + spravURL, + formatText diff --git a/src/navigation/models.py b/src/navigation/models.py index 6c7e7f57e..20a136a14 100644 --- a/src/navigation/models.py +++ b/src/navigation/models.py @@ -2,6 +2,8 @@ from django.db import models from accounts.models import * # Create your models here. from django.conf import settings +from ckeditor.fields import RichTextField +from ckeditor_uploader.fields import RichTextUploadingField class BaseSender(models.Model): name = models.CharField(verbose_name='Название', max_length=150, blank=True, db_index=True) @@ -34,7 +36,8 @@ class Links(models.Model): class News(models.Model): title=models.CharField(max_length=255, verbose_name='Заголовок') - text= models.TextField(null=True, verbose_name='Сообщение') + text= RichTextUploadingField(null=True, blank= True, verbose_name='Текст новости') + cdate =models.DateTimeField(auto_now_add=True, verbose_name='Дата создания') author = models.ForeignKey(settings.AUTH_USER_MODEL, editable=False, on_delete=models.PROTECT, verbose_name='Автор') link = models.ImageField(upload_to='newsimage/%Y/%m/%d', null=True, default="newsimage/default.jpg", verbose_name='Изображение') diff --git a/src/navigation/urls.py b/src/navigation/urls.py index 1bab690d6..00654d3f8 100644 --- a/src/navigation/urls.py +++ b/src/navigation/urls.py @@ -8,6 +8,7 @@ urlpatterns = [ path('links/', LinkAPIView.as_view(), name='LinkAPIView'), path('news/', NewsAPIView.as_view(), name='NewsAPIView'), path('carousels/', CarouselsAPIView.as_view(), name='CarouselsAPIView'), + path('ckeditor/', include('ckeditor_uploader.urls')) From 8517f4838b028705b6b75e0bdb586c28f113372f Mon Sep 17 00:00:00 2001 From: iriska-gri <79623434+iriska-gri@users.noreply.github.com> Date: Wed, 29 Nov 2023 11:25:43 +0300 Subject: [PATCH 05/32] =?UTF-8?q?=D0=9D=D0=BE=D0=B2=D0=BE=D1=81=D1=82?= =?UTF-8?q?=D0=BD=D0=BE=D0=B9=20=D0=BA=D0=BE=D0=BD=D1=82=D0=B5=D0=BD=D1=82?= =?UTF-8?q?=20=D1=81=20=D0=BA=D0=B0=D1=80=D1=82=D0=B8=D0=BD=D0=BA=D0=B0?= =?UTF-8?q?=D0=BC=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/front/src/components/news-list-home.vue | 15 ++++++++++++--- src/front/src/components/news-list-news.vue | 7 ++++--- src/front/src/utils/universal_functions.js | 4 ++++ 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/src/front/src/components/news-list-home.vue b/src/front/src/components/news-list-home.vue index 0ea513dea..767d892b9 100644 --- a/src/front/src/components/news-list-home.vue +++ b/src/front/src/components/news-list-home.vue @@ -41,7 +41,9 @@ - {{limitText(x.text)}} +
+
+
@@ -69,7 +71,7 @@ import myHelper from './UI/my-helper.vue' import { axiosApiInstance } from '@/utils/axios-api' import { format } from 'date-fns' import { useRoute } from 'vue-router' - +import {formatText} from '@/utils/universal_functions' const accountStore = useAccountStore() export default { @@ -148,7 +150,13 @@ export default { const limitText=(text)=> { + + text = text.replaceAll('src="/media/uploads', `src="${baseURL}media/uploads`) const t = text.split(' ').slice(0, 25) + console.log(t, 'ttttttttttttttttttttttttttt'); + // return t + // const t = text.split(' ').slice(0, 25) + return `${text.split(' ').slice(0, 25).join(' ')} ${t.length<25?'':'...'}` } @@ -178,7 +186,8 @@ export default { divs, page, selecnews, - route + route, + formatText diff --git a/src/front/src/components/news-list-news.vue b/src/front/src/components/news-list-news.vue index 80467e543..77e90ecf9 100644 --- a/src/front/src/components/news-list-news.vue +++ b/src/front/src/components/news-list-news.vue @@ -231,8 +231,8 @@ - - + { + return text.replaceAll('src="/media/uploads', `src="${baseURL}media/uploads`) } diff --git a/src/front/src/utils/universal_functions.js b/src/front/src/utils/universal_functions.js index 37e72e828..1ae80bf81 100644 --- a/src/front/src/utils/universal_functions.js +++ b/src/front/src/utils/universal_functions.js @@ -81,3 +81,7 @@ export function pagecounter(){ + export function formatText(text) { + return text.replaceAll('src="/media/uploads', `src="${baseURL}media/uploads`) + + } \ No newline at end of file From 012119ee43f155057b9a1ea0f63890648cd2913b Mon Sep 17 00:00:00 2001 From: iriska-gri <79623434+iriska-gri@users.noreply.github.com> Date: Wed, 29 Nov 2023 11:34:57 +0300 Subject: [PATCH 06/32] =?UTF-8?q?=D0=9D=D0=BE=D0=B2=D0=BE=D1=81=D1=82?= =?UTF-8?q?=D0=B8=20=D0=BD=D0=B0=20=D0=B3=D0=BB=D0=B0=D0=B2=D0=BD=D0=BE?= =?UTF-8?q?=D0=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/front/src/components/news-list-home.vue | 9 +++------ src/front/src/utils/universal_functions.js | 4 ---- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/src/front/src/components/news-list-home.vue b/src/front/src/components/news-list-home.vue index 767d892b9..ad065e243 100644 --- a/src/front/src/components/news-list-home.vue +++ b/src/front/src/components/news-list-home.vue @@ -43,7 +43,6 @@
-
@@ -71,7 +70,7 @@ import myHelper from './UI/my-helper.vue' import { axiosApiInstance } from '@/utils/axios-api' import { format } from 'date-fns' import { useRoute } from 'vue-router' -import {formatText} from '@/utils/universal_functions' + const accountStore = useAccountStore() export default { @@ -153,9 +152,7 @@ export default { text = text.replaceAll('src="/media/uploads', `src="${baseURL}media/uploads`) const t = text.split(' ').slice(0, 25) - console.log(t, 'ttttttttttttttttttttttttttt'); - // return t - // const t = text.split(' ').slice(0, 25) + return `${text.split(' ').slice(0, 25).join(' ')} ${t.length<25?'':'...'}` } @@ -187,7 +184,7 @@ export default { page, selecnews, route, - formatText + diff --git a/src/front/src/utils/universal_functions.js b/src/front/src/utils/universal_functions.js index 1ae80bf81..37e72e828 100644 --- a/src/front/src/utils/universal_functions.js +++ b/src/front/src/utils/universal_functions.js @@ -81,7 +81,3 @@ export function pagecounter(){ - export function formatText(text) { - return text.replaceAll('src="/media/uploads', `src="${baseURL}media/uploads`) - - } \ No newline at end of file From 1c8238d2962794f6d1c7f077c5b785bedd71bf36 Mon Sep 17 00:00:00 2001 From: iriska-gri <79623434+iriska-gri@users.noreply.github.com> Date: Wed, 29 Nov 2023 12:50:36 +0300 Subject: [PATCH 07/32] =?UTF-8?q?=D0=9D=D0=BE=D0=B2=D0=BE=D1=81=D1=82?= =?UTF-8?q?=D0=B8=20=D0=B4=D0=BB=D1=8F=20=D0=B3=D0=BB=D0=B0=D0=B2=D0=BD?= =?UTF-8?q?=D0=BE=D0=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/front/src/components/news-list-home.vue | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/front/src/components/news-list-home.vue b/src/front/src/components/news-list-home.vue index ad065e243..0681b43bd 100644 --- a/src/front/src/components/news-list-home.vue +++ b/src/front/src/components/news-list-home.vue @@ -149,12 +149,11 @@ export default { const limitText=(text)=> { - - text = text.replaceAll('src="/media/uploads', `src="${baseURL}media/uploads`) - const t = text.split(' ').slice(0, 25) - - - return `${text.split(' ').slice(0, 25).join(' ')} ${t.length<25?'':'...'}` + let parser = new DOMParser().parseFromString(text, "text/html"); + let doc = parser.body.textContent || "" + doc = doc.replaceAll('src="/media/uploads', `src="${baseURL}media/uploads`) + const t = doc.split(' ').slice(0, 25) + return `${doc.split(' ').slice(0, 25).join(' ')} ${t.length<25?'':'...'}` } const splitname = (name) => { From 39ad9615ea47efc66d45c7946c6200df9989af2b Mon Sep 17 00:00:00 2001 From: iriska-gri <79623434+iriska-gri@users.noreply.github.com> Date: Wed, 29 Nov 2023 17:03:59 +0300 Subject: [PATCH 08/32] =?UTF-8?q?=D0=93=D0=B0=D0=BB=D0=B5=D1=80=D0=B5?= =?UTF-8?q?=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/front/src/components/news-list-home.vue | 1 + src/front/src/components/news-list-news.vue | 445 +++++--------------- src/navigation/admin.py | 16 + src/navigation/models.py | 15 +- src/navigation/serializers.py | 13 +- 5 files changed, 142 insertions(+), 348 deletions(-) diff --git a/src/front/src/components/news-list-home.vue b/src/front/src/components/news-list-home.vue index 0681b43bd..48b91aa7e 100644 --- a/src/front/src/components/news-list-home.vue +++ b/src/front/src/components/news-list-home.vue @@ -1,6 +1,7 @@