From bb0dfd7d6a056df843628fcc7c8b41ed64124711 Mon Sep 17 00:00:00 2001 From: Tomas 'Jethro' Pokorny Date: Wed, 21 Oct 2020 08:36:02 +0200 Subject: [PATCH] =?UTF-8?q?TreeNode=20editor=20|=20upload=20obr=C3=A1zk?= =?UTF-8?q?=C5=AF=20z=20CKEditoru.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- flat.json | 4 +- seminar/forms.py | 5 +++ seminar/urls.py | 1 + seminar/views/views_all.py | 24 +++++++++++ vue_frontend/package.json | 3 +- vue_frontend/src/components/TextNode.vue | 38 +++++++++++++++- vue_frontend/yarn.lock | 55 ++++++++++++++++++++++-- 7 files changed, 122 insertions(+), 8 deletions(-) diff --git a/flat.json b/flat.json index 61a7a2db..7c201dcf 100644 --- a/flat.json +++ b/flat.json @@ -140,7 +140,7 @@ "fields": { "url": "/soustredeni/pripravujeme/", "title": "P\u0159ipravujeme", - "content": "

Pozdimn\u00ed soust\u0159ed\u011bn\u00ed

\r\n\r\n

se bude konat v term\u00ednu od 12. do 20. \u0159\u00edjna 2019.

", + "content": "

Jarn\u00ed soust\u0159ed\u011bn\u00ed

\r\n\r\n

se z d\u016fvodu koronavirov\u00e9 pandemie nekon\u00e1.

\r\n\r\n

Podzimn\u00ed soust\u0159ed\u011bn\u00ed

\r\n\r\n

se uskute\u010dn\u00ed 17. - 25. \u0159\u00edjna 2020.

", "enable_comments": false, "template_name": "", "registration_required": false, @@ -320,7 +320,7 @@ "fields": { "url": "/co-je-MaM/mam-moc-casu/", "title": "M\u00e1m moc \u010dasu!", - "content": "

Z\u00e1\u017eitkov\u00e9 akce

\r\n\r\n

Letn\u00ed a Zimn\u00ed \u0160kola Matematiky a Fyziky (L\u0160MF, Z\u0160MF) - \u0160MFko je v zim\u011b t\u00fddenn\u00ed, v l\u00e9t\u011b dvout\u00fddenn\u00ed, z\u00e1\u017eitkov\u00e1 akce ur\u010den\u00e1 st\u0159edo\u0161kol\u00e1k\u016fm se z\u00e1jmem o dal\u0161\u00ed sebevzd\u011bl\u00e1n\u00ed. Krom popul\u00e1rn\u011b nau\u010dn\u00fdch p\u0159edn\u00e1\u0161ek se na \u0161mfku prob\u011bhne\u0161 venku, vy\u0159\u00e1d\u00ed\u0161 se ve sn\u011bhu, u\u017eije\u0161 si vesel\u00fd vnit\u0159n\u00ed program a taky se pobav\u00ed\u0161 b\u011bhem spole\u010dn\u00e9ho \u0161ar\u00e1d\u011bn\u00ed, leno\u0161en\u00ed nebo hran\u00ed na kytaru.

\r\n\r\n

InterSoB - InterSoB je z\u00e1bavn\u00e1 a pou\u010dn\u00e1 jednodenn\u00ed sout\u011b\u017e st\u0159edo\u0161kolsk\u00fdch student\u016f, p\u0159i kter\u00e9 m\u00e1te mo\u017enost pod\u00edvat se netradi\u010dn\u00edm zp\u016fsobem do z\u00e1kulis\u00ed Masarykovy univerzity, vyzkou\u0161et si sv\u00e9 schopnosti v mnoha r\u016fzn\u00fdch oblastech, ud\u011blat si s kamar\u00e1dy zaj\u00edmav\u00fd v\u00fdlet po Brn\u011b a v neposledn\u00ed \u0159ad\u011b tak\u00e9 pom\u011b\u0159it svoje s\u00edly s dal\u0161\u00edmi t\u00fdmy.

\r\n\r\n

Dal\u0161\u00ed semin\u00e1\u0159e

\r\n\r\n

Koresponden\u010dn\u00ed Semin\u00e1\u0159 z Programov\u00e1n\u00ed (KSP) - KSP je semin\u00e1\u0159 ur\u010den\u00fd pro studenty st\u0159edn\u00edch a z\u00e1kladn\u00edch \u0161kol, kte\u0159\u00ed maj\u00ed z\u00e1jem nau\u010dit se n\u011bco z oblasti algoritm\u016f, logick\u00fdch \u00faloh, programov\u00e1n\u00ed a informatiky v\u016fbec. Na sv\u00e9 si v\u0161ak p\u0159ijdou i p\u0159\u00edznivci matematiky (a vlastn\u011b libovoln\u00e9ho p\u0159em\u00fd\u0161len\u00ed), je\u017eto oba obory maj\u00ed mnoho spole\u010dn\u00e9ho.

\r\n\r\n

FYzik\u00e1ln\u00ed KOresponden\u010dn\u00ed Semin\u00e1\u0159 (FYKOS) - FYKOS pro v\u00e1s p\u0159edstavuje mo\u017enost si zaj\u00edmav\u00fdm zp\u016fsobem roz\u0161\u00ed\u0159it ch\u00e1p\u00e1n\u00ed fyziky a proniknout do dal\u0161\u00edch, dosud nepoznan\u00fdch, oblast\u00ed t\u00e9to v\u011bdy. C\u00edlem FYKOSu je rozv\u00edjet fyzik\u00e1ln\u00ed my\u0161len\u00ed, proto\u017ee \u010dlov\u011bk, kter\u00fd se um\u00ed nad (nejen fyzik\u00e1ln\u00edmi) probl\u00e9my zamyslet a c\u00edt\u00ed touhu dobrat se k n\u011bjak\u00e9mu \u0159e\u0161en\u00ed, se uplatn\u00ed v\u0161ude, kde si schopnost\u00ed lidsk\u00e9ho mozku cen\u00ed.

\r\n\r\n

Matematick\u00fd koresponden\u010dn\u00ed semin\u00e1\u0159 PraSe (PRA\u017esk\u00fd SEmin\u00e1\u0159) - \u0158e\u0161en\u00edm \u00faloh tohoto semin\u00e1\u0159e z\u00edsk\u00e1\u0161 mnoho matematick\u00fdch znalost\u00ed a nau\u010d\u00ed\u0161 p\u0159esn\u011bji a srozumiteln\u011bji formulovat sv\u00e9 my\u0161lenky a z\u00e1v\u011bry. Semin\u00e1\u0159 je dobrou p\u0159\u00edpravou pro \u00fa\u010dast v nejr\u016fzn\u011bj\u0161\u00edch matematick\u00fdch sout\u011b\u017e\u00edch i pro dal\u0161\u00ed studium matematiky, ale schopnost logick\u00e9ho my\u0161len\u00ed, kterou si m\u016f\u017ee\u0161 procvi\u010dit, se ti v \u017eivot\u011b bude hodit, i kdy\u017e se v n\u011bm t\u0159eba pr\u00e1v\u011b matematice v\u011bnovat nehodl\u00e1\u0161.

\r\n\r\n

Pro mlad\u0161\u00ed sourozence

\r\n\r\n

Pikomat - Pikomat je matematick\u00fd semin\u00e1\u0159 ur\u010den\u00fd \u017e\u00e1k\u016fm \u0161est\u00fdch a\u017e dev\u00e1t\u00fdch t\u0159\u00edd z\u00e1kladn\u00edch \u0161kol a student\u016fm odpov\u00eddaj\u00edc\u00edch ro\u010dn\u00edk\u016f v\u00edcelet\u00fdch gymn\u00e1zi\u00ed. Spo\u010d\u00edv\u00e1 v \u0159e\u0161en\u00ed n\u011bkolika \u00faloh propojen\u00fdch p\u0159\u00edb\u011bhem. Sout\u011b\u017e\u00edc\u00ed ode\u0161le v dan\u00fdch term\u00ednech jednotliv\u00e9 p\u0159\u00edklady dan\u00e9 s\u00e9rie na adresu Pikomatu nebo je odevzd\u00e1 elektronicky. Organiz\u00e1to\u0159i oprav\u00ed do\u0161l\u00e9 \u00falohy, vypracuj\u00ed jejich vzorov\u00e1 \u0159e\u0161en\u00ed a sestav\u00ed v\u00fdsledkovou listinu. Na ja\u0159e se kon\u00e1 soust\u0159ed\u011bn\u00ed pro nejlep\u0161\u00ed \u0159e\u0161itele, v l\u00e9t\u011b pak t\u00e1bor pro v\u0161echny z\u00e1jemce.

\r\n\r\n

V\u00fdfuk (V\u00ddpo\u010dty Fyzik\u00e1ln\u00edch UKol\u016f) - V\u00fdfuk je samostatn\u00fd koresponden\u010dn\u00ed semin\u00e1\u0159 Matfyzu, kter\u00fd spad\u00e1 pod Katedru didaktiky fyziky. B\u011bhem \u0161koln\u00edho roku krom\u011b \u0161esti s\u00e9ri\u00ed semin\u00e1\u0159e organiz\u00e1to\u0159i p\u0159ipravuj\u00ed i podzimn\u00ed a jarn\u00ed setk\u00e1n\u00ed, letn\u00ed t\u00e1bor a N\u00e1boj junior.

\r\n\r\n

 

", + "content": "

Z\u00e1\u017eitkov\u00e9 akce

\r\n\r\n

Letn\u00ed a Zimn\u00ed \u0160kola Matematiky a Fyziky (L\u0160MF, Z\u0160MF) - \u0160MFko je v zim\u011b t\u00fddenn\u00ed, v l\u00e9t\u011b dvout\u00fddenn\u00ed, z\u00e1\u017eitkov\u00e1 akce ur\u010den\u00e1 st\u0159edo\u0161kol\u00e1k\u016fm se z\u00e1jmem o dal\u0161\u00ed sebevzd\u011bl\u00e1n\u00ed. Krom popul\u00e1rn\u011b nau\u010dn\u00fdch p\u0159edn\u00e1\u0161ek se na \u0161mfku prob\u011bhne\u0161 venku, vy\u0159\u00e1d\u00ed\u0161 se ve sn\u011bhu, u\u017eije\u0161 si vesel\u00fd vnit\u0159n\u00ed program a taky se pobav\u00ed\u0161 b\u011bhem spole\u010dn\u00e9ho \u0161ar\u00e1d\u011bn\u00ed, leno\u0161en\u00ed nebo hran\u00ed na kytaru.

\r\n\r\n

InterSoB - InterSoB je z\u00e1bavn\u00e1 a pou\u010dn\u00e1 jednodenn\u00ed sout\u011b\u017e st\u0159edo\u0161kolsk\u00fdch student\u016f, p\u0159i kter\u00e9 m\u00e1te mo\u017enost pod\u00edvat se netradi\u010dn\u00edm zp\u016fsobem do z\u00e1kulis\u00ed Masarykovy univerzity, vyzkou\u0161et si sv\u00e9 schopnosti v mnoha r\u016fzn\u00fdch oblastech, ud\u011blat si s kamar\u00e1dy zaj\u00edmav\u00fd v\u00fdlet po Brn\u011b a v neposledn\u00ed \u0159ad\u011b tak\u00e9 pom\u011b\u0159it svoje s\u00edly s dal\u0161\u00edmi t\u00fdmy.

\r\n\r\n

Dal\u0161\u00ed semin\u00e1\u0159e

\r\n\r\n

Koresponden\u010dn\u00ed Semin\u00e1\u0159 z Programov\u00e1n\u00ed (KSP) - KSP je semin\u00e1\u0159 ur\u010den\u00fd pro studenty st\u0159edn\u00edch a z\u00e1kladn\u00edch \u0161kol, kte\u0159\u00ed maj\u00ed z\u00e1jem nau\u010dit se n\u011bco z oblasti algoritm\u016f, logick\u00fdch \u00faloh, programov\u00e1n\u00ed a informatiky v\u016fbec. Na sv\u00e9 si v\u0161ak p\u0159ijdou i p\u0159\u00edznivci matematiky (a vlastn\u011b libovoln\u00e9ho p\u0159em\u00fd\u0161len\u00ed), je\u017eto oba obory maj\u00ed mnoho spole\u010dn\u00e9ho.

\r\n\r\n

FYzik\u00e1ln\u00ed KOresponden\u010dn\u00ed Semin\u00e1\u0159 (FYKOS) - FYKOS pro v\u00e1s p\u0159edstavuje mo\u017enost si zaj\u00edmav\u00fdm zp\u016fsobem roz\u0161\u00ed\u0159it ch\u00e1p\u00e1n\u00ed fyziky a proniknout do dal\u0161\u00edch, dosud nepoznan\u00fdch, oblast\u00ed t\u00e9to v\u011bdy. C\u00edlem FYKOSu je rozv\u00edjet fyzik\u00e1ln\u00ed my\u0161len\u00ed, proto\u017ee \u010dlov\u011bk, kter\u00fd se um\u00ed nad (nejen fyzik\u00e1ln\u00edmi) probl\u00e9my zamyslet a c\u00edt\u00ed touhu dobrat se k n\u011bjak\u00e9mu \u0159e\u0161en\u00ed, se uplatn\u00ed v\u0161ude, kde si schopnost\u00ed lidsk\u00e9ho mozku cen\u00ed.

\r\n\r\n

Matematick\u00fd koresponden\u010dn\u00ed semin\u00e1\u0159 PraSe (PRA\u017esk\u00fd SEmin\u00e1\u0159) - \u0158e\u0161en\u00edm \u00faloh tohoto semin\u00e1\u0159e z\u00edsk\u00e1\u0161 mnoho matematick\u00fdch znalost\u00ed a nau\u010d\u00ed\u0161 p\u0159esn\u011bji a srozumiteln\u011bji formulovat sv\u00e9 my\u0161lenky a z\u00e1v\u011bry. Semin\u00e1\u0159 je dobrou p\u0159\u00edpravou pro \u00fa\u010dast v nejr\u016fzn\u011bj\u0161\u00edch matematick\u00fdch sout\u011b\u017e\u00edch i pro dal\u0161\u00ed studium matematiky, ale schopnost logick\u00e9ho my\u0161len\u00ed, kterou si m\u016f\u017ee\u0161 procvi\u010dit, se ti v \u017eivot\u011b bude hodit, i kdy\u017e se v n\u011bm t\u0159eba pr\u00e1v\u011b matematice v\u011bnovat nehodl\u00e1\u0161.

\r\n\r\n

Pro mlad\u0161\u00ed sourozence

\r\n\r\n

Pikomat - Pikomat je matematick\u00fd semin\u00e1\u0159 ur\u010den\u00fd \u017e\u00e1k\u016fm \u0161est\u00fdch a\u017e dev\u00e1t\u00fdch t\u0159\u00edd z\u00e1kladn\u00edch \u0161kol a student\u016fm odpov\u00eddaj\u00edc\u00edch ro\u010dn\u00edk\u016f v\u00edcelet\u00fdch gymn\u00e1zi\u00ed. Spo\u010d\u00edv\u00e1 v \u0159e\u0161en\u00ed n\u011bkolika \u00faloh propojen\u00fdch p\u0159\u00edb\u011bhem. Sout\u011b\u017e\u00edc\u00ed ode\u0161le v dan\u00fdch term\u00ednech jednotliv\u00e9 p\u0159\u00edklady dan\u00e9 s\u00e9rie na adresu Pikomatu nebo je odevzd\u00e1 elektronicky. Organiz\u00e1to\u0159i oprav\u00ed do\u0161l\u00e9 \u00falohy, vypracuj\u00ed jejich vzorov\u00e1 \u0159e\u0161en\u00ed a sestav\u00ed v\u00fdsledkovou listinu. Na ja\u0159e se kon\u00e1 soust\u0159ed\u011bn\u00ed pro nejlep\u0161\u00ed \u0159e\u0161itele, v l\u00e9t\u011b pak t\u00e1bor pro v\u0161echny z\u00e1jemce.

\r\n\r\n

V\u00fdfuk (V\u00ddpo\u010dty Fyzik\u00e1ln\u00edch UKol\u016f) - V\u00fdfuk je samostatn\u00fd koresponden\u010dn\u00ed semin\u00e1\u0159 Matfyzu, kter\u00fd spad\u00e1 pod Katedru didaktiky fyziky. B\u011bhem \u0161koln\u00edho roku krom\u011b \u0161esti s\u00e9ri\u00ed semin\u00e1\u0159e organiz\u00e1to\u0159i p\u0159ipravuj\u00ed i podzimn\u00ed a jarn\u00ed setk\u00e1n\u00ed, letn\u00ed t\u00e1bor a N\u00e1boj junior.

\r\n\r\n

Datab\u00e1ze mimo\u0161koln\u00edch aktivit

\r\n\r\n

Je-li Ti v\u00fd\u010det aktivit v\u00fd\u0161e m\u00e1lo nebo T\u011b \u017e\u00e1dn\u00e1 z nich nezaujala, doporu\u010dujeme nav\u0161t\u00edvit web organizace ProSt\u0159edo\u0161kol\u00e1ky, je\u017e zde p\u0159ipravila rozs\u00e1hlou datab\u00e1zi mimo\u0161koln\u00edch aktivit a akc\u00ed. Krom toho organizace po\u0159\u00e1d\u00e1 sout\u011b\u017e St\u0159edo\u0161kol\u00e1k roku, ve kter\u00e9 ka\u017ed\u00fd rok oce\u0148uje nejaktivn\u011bj\u0161\u00ed st\u0159edo\u0161kol\u00e1ky. V\u011bnuje\u0161-li se tedy mimo\u0161koln\u011b n\u011b\u010demu ve v\u011bt\u0161\u00edm m\u011b\u0159\u00edtku, nev\u00e1hej se do sout\u011b\u017ee p\u0159ihl\u00e1sit.

", "enable_comments": false, "template_name": "", "registration_required": false, diff --git a/seminar/forms.py b/seminar/forms.py index 24a2109c..be722e16 100644 --- a/seminar/forms.py +++ b/seminar/forms.py @@ -277,3 +277,8 @@ ReseniSPrilohamiFormSet = inlineformset_factory(m.Reseni,m.PrilohaReseni, ) +class NahrajObrazekKTreeNoduForm(forms.ModelForm): + class Meta: + model = m.Obrazek + fields = ('na_web',) + diff --git a/seminar/urls.py b/seminar/urls.py index f62ca8c4..00225f45 100644 --- a/seminar/urls.py +++ b/seminar/urls.py @@ -121,6 +121,7 @@ urlpatterns = [ path('temp/nahraj_reseni', views.NahrajReseniView.as_view(),name='seminar_nahraj_reseni'), re_path(r'^temp/vue/.*$',views.VueTestView.as_view(),name='vue_test_view'), + path('temp/image_upload/', views.NahrajObrazekKTreeNoduView.as_view()), path('', views.TitulniStranaView.as_view(), name='titulni_strana'), diff --git a/seminar/views/views_all.py b/seminar/views/views_all.py index f769155f..04296d8a 100644 --- a/seminar/views/views_all.py +++ b/seminar/views/views_all.py @@ -1492,3 +1492,27 @@ class PasswordChangeView(auth_views.PasswordChangeView): class VueTestView(generic.TemplateView): template_name = 'seminar/vuetest.html' + +class NahrajObrazekKTreeNoduView(LoginRequiredMixin, CreateView): + model = s.Obrazek + form_class = f.NahrajObrazekKTreeNoduForm + + def get_initial(self): + initial = super().get_initial() + initial['na_web'] = self.request.FILES['upload'] + return initial + + + def form_valid(self,form): + print(self.request.headers) + print(self.request.headers['Textid']) + print(form.instance) + print(form) + self.object = form.save(commit=False) + print(self.object.na_web) + self.object.text = m.Text.objects.get(pk=int(self.request.headers['Textid'])) + self.object.save() + + return JsonResponse({"url":self.object.na_web.url}) + + diff --git a/vue_frontend/package.json b/vue_frontend/package.json index d019190c..ffb20ef1 100644 --- a/vue_frontend/package.json +++ b/vue_frontend/package.json @@ -8,9 +8,10 @@ "lint": "vue-cli-service lint" }, "dependencies": { - "@ckeditor/ckeditor5-build-classic": "^22.0.0", + "@ckeditor/ckeditor5-upload": "^23.0.0", "@ckeditor/ckeditor5-vue": "^1.0.1", "axios": "^0.19.2", + "ckeditor5-build-classic-simple-upload-adapter-image-resize": "^1.0.4", "core-js": "^3.6.5", "vue": "^2.6.11", "vue-router": "^3.4.3" diff --git a/vue_frontend/src/components/TextNode.vue b/vue_frontend/src/components/TextNode.vue index b52b50d7..c5142c66 100644 --- a/vue_frontend/src/components/TextNode.vue +++ b/vue_frontend/src/components/TextNode.vue @@ -19,7 +19,8 @@