Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blocs en offcanvas #2188

Merged
merged 408 commits into from
Oct 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
408 commits
Select commit Hold shift + click to select a range
6e76d60
Merge branch 'i18n_step_2' of github.com:osunyorg/admin into i18n_step_2
arnaudlevy Aug 2, 2024
1b2ab70
fix
arnaudlevy Aug 2, 2024
c4fbeb9
Localisation de l'agenda (#2123)
arnaudlevy Aug 2, 2024
af7000b
block event
SebouChu Aug 2, 2024
f1c893a
Simplification des permalinks (#2135)
arnaudlevy Aug 2, 2024
752d5e5
Merge branch 'main' into i18n_step_2
arnaudlevy Aug 19, 2024
ec4a8cd
I18n portfolio (#2142)
SebouChu Aug 19, 2024
67fce65
fix
arnaudlevy Aug 19, 2024
7258b35
fix video snippet
arnaudlevy Aug 19, 2024
c783045
snippets
arnaudlevy Aug 19, 2024
69edc56
snippet person
arnaudlevy Aug 19, 2024
5b99e24
Update forms.sass
arnaudlevy Aug 20, 2024
a2af4b2
Merge branch 'main' into i18n_step_2
arnaudlevy Aug 21, 2024
e631212
Merge branch 'main' into i18n_step_2
arnaudlevy Aug 22, 2024
c9f0d6c
fix (#2143)
arnaudlevy Aug 22, 2024
3ff4b3b
fix (#2146)
arnaudlevy Aug 22, 2024
7322b91
migrate menu items about (#2137)
SebouChu Aug 22, 2024
71b122b
change data migrations
pabois Aug 26, 2024
593be5d
mel ok
pabois Aug 26, 2024
80e3e08
Merge branch 'main' into i18n_step_2
arnaudlevy Aug 27, 2024
1f510cf
Merge branch 'main' into i18n_step_2
arnaudlevy Aug 28, 2024
bd0990f
nav
arnaudlevy Aug 28, 2024
45294bb
fix
arnaudlevy Aug 29, 2024
c28de76
I18n direct object blocks (#2167)
SebouChu Aug 29, 2024
10a1780
i18n education (#2166)
arnaudlevy Aug 29, 2024
09708bf
researchers and publications
arnaudlevy Aug 30, 2024
1fd9c1c
laboratories
arnaudlevy Aug 30, 2024
e8ab9b3
axis
arnaudlevy Aug 30, 2024
219a06a
thesis
arnaudlevy Aug 30, 2024
200e1a3
journal
arnaudlevy Sep 2, 2024
e5de519
localize experiences
pabois Sep 2, 2024
708b494
volumes
arnaudlevy Sep 2, 2024
bae58a4
home
arnaudlevy Sep 2, 2024
cfc661d
Merge branch 'i18n_step_2' into i18n-research
arnaudlevy Sep 2, 2024
51828fa
papers
arnaudlevy Sep 2, 2024
b8bcd7d
Merge branch 'main' into i18n_step_2
arnaudlevy Sep 2, 2024
03d148b
Merge branch 'i18n_step_2' into i18n-research
arnaudlevy Sep 2, 2024
87cfd57
Merge branch 'main' into i18n_step_2
arnaudlevy Sep 2, 2024
74ab555
Merge branch 'i18n_step_2' into i18n-research
arnaudlevy Sep 2, 2024
0824e5a
Merge branch 'main' into i18n_step_2
arnaudlevy Sep 2, 2024
01e8995
Merge branch 'i18n_step_2' into i18n-research
arnaudlevy Sep 2, 2024
9b04bb5
comment
arnaudlevy Sep 2, 2024
3412b4a
migration fixes
SebouChu Sep 2, 2024
2cbb4f6
Merge branch 'i18n_step_2' of github.com:noesya/osuny into i18n_step_2
SebouChu Sep 2, 2024
acc4638
Paper kind
arnaudlevy Sep 3, 2024
b3bded9
Merge branch 'i18n_step_2' into i18n-research
arnaudlevy Sep 3, 2024
b119e5f
wip
arnaudlevy Sep 3, 2024
5b61bfa
fav
arnaudlevy Sep 3, 2024
391503c
wip
arnaudlevy Sep 3, 2024
525b8e7
wip
arnaudlevy Sep 3, 2024
6259c71
wip
arnaudlevy Sep 3, 2024
2dbdb8a
routes and controllers
arnaudlevy Sep 3, 2024
1be1e91
wip
arnaudlevy Sep 3, 2024
351bdc2
wip
arnaudlevy Sep 3, 2024
72adb66
wip
arnaudlevy Sep 3, 2024
57f297a
wip
arnaudlevy Sep 3, 2024
8c5d60f
routes and controllers
arnaudlevy Sep 3, 2024
1f7caf7
merge
arnaudlevy Sep 4, 2024
94bea24
alumni
arnaudlevy Sep 4, 2024
84faee0
contacts and profile
arnaudlevy Sep 4, 2024
55e5e85
xp
arnaudlevy Sep 4, 2024
93378be
company
arnaudlevy Sep 4, 2024
5ee7494
docs
arnaudlevy Sep 4, 2024
5ec162e
docs
arnaudlevy Sep 4, 2024
1aba9bf
working docs
arnaudlevy Sep 4, 2024
7c722a3
change library to documents
arnaudlevy Sep 4, 2024
1dad499
wip
pabois Sep 5, 2024
71c5bf4
fix
arnaudlevy Sep 5, 2024
113750f
posts
arnaudlevy Sep 5, 2024
a4acc54
exports
arnaudlevy Sep 5, 2024
8bc679c
block program and posts refactor
arnaudlevy Sep 5, 2024
0ecdadc
fix
SebouChu Sep 6, 2024
433e6c9
website::loc: fallback des infos de la loca avec website quand blank
SebouChu Sep 6, 2024
7ef9f5a
fix migration + add constraint
SebouChu Sep 6, 2024
3c13558
restore backlinks
SebouChu Sep 6, 2024
f1182d4
fix category show
SebouChu Sep 6, 2024
7ff257a
fix missing summary in agenda category migration
SebouChu Sep 6, 2024
7bec16d
fix for_website?
SebouChu Sep 6, 2024
fc97e1e
fix backlinks
SebouChu Sep 6, 2024
e54bccf
clean education school localizations
SebouChu Sep 6, 2024
08e8fb2
fix category path in blocks
SebouChu Sep 6, 2024
681d6a9
extract layouts
arnaudlevy Sep 6, 2024
0903043
Merge branch 'i18n_step_2' into i18n-research
arnaudlevy Sep 6, 2024
1b813a8
Merge branch 'i18n-research' into i18n_extranet
arnaudlevy Sep 6, 2024
c167bf6
blocks
arnaudlevy Sep 6, 2024
10a8243
fix
SebouChu Sep 9, 2024
a2369c8
trim, lower and unaccent
SebouChu Sep 9, 2024
c34ab2d
schema :)
SebouChu Sep 9, 2024
8b35d94
fix
SebouChu Sep 9, 2024
588f494
Merge branch 'i18n_step_2' into i18n-research
arnaudlevy Sep 10, 2024
75b2233
Merge branch 'i18n-research' into i18n_extranet
arnaudlevy Sep 10, 2024
c0b94d6
mapping
arnaudlevy Sep 10, 2024
0343742
comment
arnaudlevy Sep 10, 2024
875996f
Update app/views/admin/communication/websites/show.html.erb
arnaudlevy Sep 10, 2024
fba3a4d
fix
arnaudlevy Sep 10, 2024
9258d9b
Merge branch 'i18n-research' of github.com:osunyorg/admin into i18n-r…
arnaudlevy Sep 10, 2024
50aec03
Update app/controllers/admin/research/laboratories_controller.rb
arnaudlevy Sep 10, 2024
de324b5
fix
arnaudlevy Sep 10, 2024
33637c2
Merge branch 'i18n-research' of github.com:osunyorg/admin into i18n-r…
arnaudlevy Sep 10, 2024
c442215
paper authors
arnaudlevy Sep 10, 2024
9cb6b04
Update app/views/admin/research/journals/papers/_form.html.erb
arnaudlevy Sep 10, 2024
5e8b267
Update app/controllers/admin/research/researchers_controller.rb
arnaudlevy Sep 10, 2024
4513426
Update app/controllers/admin/research/researchers_controller.rb
arnaudlevy Sep 10, 2024
f6b6e7a
Update app/views/admin/communication/websites/show.html.erb
arnaudlevy Sep 10, 2024
708a3b9
Update app/views/admin/research/laboratories/show.html.erb
arnaudlevy Sep 10, 2024
ad24443
Update app/views/admin/research/laboratories/static.html.erb
arnaudlevy Sep 10, 2024
16359ef
Update app/views/admin/research/publications/_form.html.erb
arnaudlevy Sep 10, 2024
9a97c31
Update app/services/migrations/l10n/research/laboratory/axis.rb
arnaudlevy Sep 10, 2024
5c92d1d
Update app/services/migrations/l10n/research/laboratory/axis.rb
arnaudlevy Sep 10, 2024
52552d4
Update app/services/migrations/l10n/research/thesis.rb
arnaudlevy Sep 10, 2024
3db725c
fix
arnaudlevy Sep 10, 2024
2aa3902
fix
arnaudlevy Sep 10, 2024
f06c608
fix
arnaudlevy Sep 10, 2024
1983ab3
Update app/views/admin/research/theses/show.html.erb
arnaudlevy Sep 10, 2024
ded85fe
Update app/views/admin/research/theses/show.html.erb
arnaudlevy Sep 10, 2024
74693ca
Update app/views/admin/research/theses/show.html.erb
arnaudlevy Sep 10, 2024
8bbd312
Update app/views/admin/research/theses/_list.html.erb
arnaudlevy Sep 10, 2024
0a18323
Update app/views/admin/research/theses/_list.html.erb
arnaudlevy Sep 10, 2024
93e8b17
fix
arnaudlevy Sep 10, 2024
2426ec9
fix
arnaudlevy Sep 10, 2024
19afeb4
Merge branch 'i18n-research' into i18n_extranet
arnaudlevy Sep 10, 2024
10c14c9
fix
arnaudlevy Sep 10, 2024
49774da
fix order
arnaudlevy Sep 11, 2024
714322c
programs
arnaudlevy Sep 11, 2024
aaf64d3
Merge branch 'i18n-research' into i18n_extranet
arnaudlevy Sep 11, 2024
e83e9fa
Merge branch 'i18n_extranet' into better-programs
arnaudlevy Sep 11, 2024
cd7088b
fix
arnaudlevy Sep 11, 2024
2d7bcff
Merge branch 'i18n-research' into i18n_extranet
arnaudlevy Sep 11, 2024
79f6e71
Merge branch 'i18n_extranet' into better-programs
arnaudlevy Sep 11, 2024
c3119de
wip
arnaudlevy Sep 11, 2024
4167fef
Merge branch 'better-programs' of github.com:osunyorg/admin into bett…
arnaudlevy Sep 11, 2024
8e9c3af
done
arnaudlevy Sep 11, 2024
c0b0bde
fix
arnaudlevy Sep 11, 2024
96dc488
Merge branch 'i18n_extranet' into better-programs
arnaudlevy Sep 11, 2024
605f624
fix
arnaudlevy Sep 11, 2024
b0e91ec
#2131
arnaudlevy Sep 11, 2024
6ebffb7
Localisation de la recherche (#2172)
arnaudlevy Sep 12, 2024
aea9c38
tests
arnaudlevy Sep 13, 2024
8831861
Localisation des extranets (#2175)
arnaudlevy Sep 13, 2024
7cb6c94
Merge branch 'i18n_step_2' into better-programs
arnaudlevy Sep 13, 2024
93bc9d2
Merge branch 'better-programs' into blocks-offcanvas
arnaudlevy Sep 13, 2024
7df9904
fix
arnaudlevy Sep 13, 2024
b982581
Merge branch 'i18n_step_2' into better-programs
arnaudlevy Sep 13, 2024
2af8c88
Merge branch 'better-programs' into blocks-offcanvas
arnaudlevy Sep 13, 2024
28d35c2
fix facets
pabois Sep 13, 2024
efb6d61
wip
arnaudlevy Sep 13, 2024
11c2849
fix
arnaudlevy Sep 13, 2024
3f5629e
fix
arnaudlevy Sep 13, 2024
80ccfa7
Merge branch 'i18n_step_2' into better-programs
arnaudlevy Sep 13, 2024
070b485
Merge branch 'better-programs' into blocks-offcanvas
arnaudlevy Sep 13, 2024
7c9c25a
wip ordered
pabois Sep 13, 2024
bf152b2
Merge branch 'i18n_step_2' of github.com:noesya/osuny into i18n_step_2
pabois Sep 13, 2024
2890d23
harmonisation validates
pabois Sep 13, 2024
56448b9
last validators
pabois Sep 13, 2024
9cac094
fixes
pabois Sep 13, 2024
5289b03
adjust
pabois Sep 13, 2024
a02f404
wip
arnaudlevy Sep 13, 2024
7453721
fix
arnaudlevy Sep 13, 2024
6270de9
cool
arnaudlevy Sep 13, 2024
a6f9fc7
working
arnaudlevy Sep 13, 2024
09eaa58
new
arnaudlevy Sep 13, 2024
34841a6
Merge branch 'i18n_step_2' into better-programs
arnaudlevy Sep 13, 2024
a1a119b
Merge branch 'better-programs' into blocks-offcanvas
arnaudlevy Sep 13, 2024
ca1bfd0
clean
arnaudlevy Sep 13, 2024
9178b67
Merge branch 'blocks-offcanvas' of github.com:osunyorg/admin into blo…
arnaudlevy Sep 13, 2024
8510fe6
cleanup
arnaudlevy Sep 13, 2024
cd5bd9a
simplify
arnaudlevy Sep 14, 2024
daf1a99
Merge branch 'main' into i18n_step_2
arnaudlevy Sep 16, 2024
8d13973
involvement scope
SebouChu Sep 16, 2024
74620a2
server fix
SebouChu Sep 16, 2024
06a9152
Merge branch 'i18n_step_2' of github.com:noesya/osuny into i18n_step_2
SebouChu Sep 16, 2024
2106b6a
fix
SebouChu Sep 16, 2024
5c5e358
server fix
SebouChu Sep 16, 2024
74f3fd3
Documentation de l'API avec Swagger et rswag (#2157)
arnaudlevy Sep 10, 2024
fdec759
Fix margin
arnaudlevy Sep 11, 2024
abdb671
fix
SebouChu Sep 16, 2024
8adab54
Merge branch 'i18n_step_2' of github.com:noesya/osuny into i18n_step_2
pabois Sep 16, 2024
e109bd3
fix server languages
SebouChu Sep 16, 2024
bdc9fae
fix to_s_in in server
SebouChu Sep 16, 2024
f5bc1be
Merge branch 'i18n_step_2' of github.com:osunyorg/admin into i18n_step_2
arnaudlevy Sep 16, 2024
1a7d6a7
fix research migration
SebouChu Sep 16, 2024
3e2b4b2
remove for_language_id
SebouChu Sep 16, 2024
c785c97
Merge branch 'i18n_step_2' of github.com:noesya/osuny into i18n_step_2
SebouChu Sep 16, 2024
11cd7f3
fix
SebouChu Sep 16, 2024
4045469
Fix
arnaudlevy Sep 16, 2024
3a1802a
Merge branch 'i18n_step_2' into better-programs
arnaudlevy Sep 16, 2024
fc2e8e1
Merge branch 'better-programs' into blocks-offcanvas
arnaudlevy Sep 16, 2024
ba6166e
fix language
SebouChu Sep 16, 2024
4ca6a1e
fix exporters
SebouChu Sep 16, 2024
cc2ab42
fix sync
SebouChu Sep 16, 2024
ae85e14
biography text
SebouChu Sep 16, 2024
a8ad7db
bring back post legacy text
SebouChu Sep 16, 2024
d2fb669
localized tree
SebouChu Sep 16, 2024
8d935ca
refactored
arnaudlevy Sep 16, 2024
445308c
Merge branch 'blocks-offcanvas' of github.com:osunyorg/admin into blo…
arnaudlevy Sep 16, 2024
7a1e1bf
lighter
arnaudlevy Sep 16, 2024
e10fef1
fix dependencies in education + statics
SebouChu Sep 16, 2024
7235bde
school static
SebouChu Sep 16, 2024
d4ee771
annotate
SebouChu Sep 16, 2024
5b392ff
Merge branch 'i18n_step_2' of github.com:noesya/osuny into i18n_step_2
SebouChu Sep 16, 2024
3b79c9a
fix
SebouChu Sep 16, 2024
cf50a30
fix
arnaudlevy Sep 17, 2024
a66ac56
fix show
arnaudlevy Sep 17, 2024
f6282a2
Merge branch 'main' into i18n_step_2
arnaudlevy Sep 17, 2024
754bc78
Merge branch 'i18n_step_2' of github.com:noesya/osuny into i18n_step_2
pabois Sep 19, 2024
8ec708b
Merge branch 'main' into i18n_step_2
SebouChu Sep 19, 2024
b94bd7f
Fix #2203
arnaudlevy Sep 19, 2024
38e81c5
bundle
arnaudlevy Sep 21, 2024
aa380fb
Merge branch 'i18n_step_2' into better-programs
SebouChu Sep 23, 2024
0947118
I18n filters (#2206)
pabois Sep 23, 2024
fe30d84
Menu pour chaque formation (#2186)
arnaudlevy Sep 23, 2024
2c1a491
Merge branch 'i18n_step_2' into better-programs
arnaudlevy Sep 23, 2024
435bf11
Merge branch 'main' into i18n_step_2
arnaudlevy Sep 23, 2024
c8dfdfc
Merge branch 'i18n_step_2' into better-programs
arnaudlevy Sep 23, 2024
56e3b0e
i18n: importers (#2207)
SebouChu Sep 23, 2024
68af75a
Merge branch 'better-programs' into blocks-offcanvas
arnaudlevy Sep 23, 2024
f3bde99
Merge branch 'i18n_step_2' of github.com:noesya/osuny into i18n_step_2
pabois Sep 23, 2024
ed463b5
fix
pabois Sep 23, 2024
3ea30ff
clean
SebouChu Sep 23, 2024
87b99a3
adjust extranets
pabois Sep 23, 2024
0a64330
Merge branch 'better-programs' into blocks-offcanvas
arnaudlevy Sep 23, 2024
ca10dc5
Merge branch 'i18n_step_2' into better-programs
arnaudlevy Sep 23, 2024
6f31295
Update app/controllers/admin/education/programs/categories_controller.rb
arnaudlevy Sep 23, 2024
5de9917
Update app/models/communication/website/page/localization.rb
SebouChu Sep 23, 2024
ae97067
Update app/views/admin/education/programs/categories/show.html.erb
arnaudlevy Sep 23, 2024
5e3ae8a
clean
SebouChu Sep 23, 2024
63d202b
Merge branch 'better-programs' into blocks-offcanvas
arnaudlevy Sep 23, 2024
3d4c064
about.about => l10n.about
SebouChu Sep 23, 2024
8d79984
Merge branch 'better-programs' into blocks-offcanvas
arnaudlevy Sep 30, 2024
d68b1ee
Merge branch 'main' into better-programs
arnaudlevy Sep 30, 2024
3ecd104
bundle
arnaudlevy Sep 30, 2024
677619c
Merge branch 'better-programs' into blocks-offcanvas
arnaudlevy Sep 30, 2024
228bbe7
clean
arnaudlevy Sep 30, 2024
6d6b32b
fixes
SebouChu Sep 30, 2024
c43c119
bundle lock
SebouChu Sep 30, 2024
4e5da0e
Merge branch 'main' into better-programs
SebouChu Sep 30, 2024
38962e0
fix
SebouChu Sep 30, 2024
a490fb8
Merge branch 'better-programs' into blocks-offcanvas
arnaudlevy Sep 30, 2024
35ef372
bring back template changes
SebouChu Sep 30, 2024
1e08562
Merge branch 'main' into better-programs
SebouChu Sep 30, 2024
c4a0bac
Merge branch 'better-programs' into blocks-offcanvas
SebouChu Sep 30, 2024
5f33652
remove original_id from program categories
SebouChu Sep 30, 2024
0b237b7
Merge branch 'better-programs' into blocks-offcanvas
arnaudlevy Sep 30, 2024
49bab65
Merge branch 'main' into blocks-offcanvas
SebouChu Sep 30, 2024
008a6d6
Merge branch 'main' into blocks-offcanvas
arnaudlevy Sep 30, 2024
89546ea
Update app/assets/javascripts/admin/commons/content_editor/offcanvas.js
SebouChu Sep 30, 2024
40cf29d
Update app/assets/javascripts/admin/commons/content_editor/offcanvas.js
SebouChu Sep 30, 2024
e100c65
i18n
arnaudlevy Sep 30, 2024
4f57b33
Merge branch 'main' into blocks-offcanvas
arnaudlevy Sep 30, 2024
9b1ed50
Merge branch 'main' into blocks-offcanvas
SebouChu Oct 3, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
102 changes: 4 additions & 98 deletions app/assets/javascripts/admin/commons/content_editor.js
Original file line number Diff line number Diff line change
@@ -1,106 +1,12 @@
/* global $, Sortable */
window.osuny = window.osuny || {};
window.osuny.contentEditor = {

init: function () {
'use strict';
this.container = document.querySelector('.js-content-editor');
if (this.container === null) {
return;
}
this.sortHeadingsUrl = this.container.getAttribute('data-sort-headings-url');
this.sortBlocksUrl = this.container.getAttribute('data-sort-blocks-url');
this.modeWriteContainer = this.container.querySelector('#mode-write-container');
this.modeStructureContainer = this.container.querySelector('#mode-structure-container');
this.addListeners('[data-bs-toggle="tab"]', 'shown.bs.tab', this.tabChanged);
this.initSortable();
},

initSortable: function () {
'use strict';
var sortableContainers = this.container.querySelectorAll('.js-content-editor-sortable-container'),
i;

for (i = 0; i < sortableContainers.length; i += 1) {
new Sortable(sortableContainers[i], {
handle: '.content-editor__elements__handle',
fallbackOnBody: false,
onEnd: this.onSortableEnd.bind(this)
});
}
},

tabChanged: function (event) {
'use strict';
var tab = event.target,
id = tab.getAttribute('data-bs-target'),
div = this.container.querySelector(id),
source = div.dataset.source;
this.target = this.container.querySelector(div.dataset.target);
this.target.innerHTML = '';
this.xhr = new XMLHttpRequest();
this.xhr.open('GET', source, true);
this.xhr.onreadystatechange = this.tabLoaded.bind(this);
this.xhr.send();
},

tabLoaded: function () {
'use strict';
if (this.xhr.readyState === XMLHttpRequest.DONE) {
if (this.xhr.status === 200) {
this.target.innerHTML = this.xhr.responseText;
this.initSortable();
}
}
},

onSortableEnd: function (event) {
'use strict';
if (event.from.classList.contains('content-editor--write')) {
this.sortModeWrite(event.to);
} else if (event.from.classList.contains('content-editor--organize')) {
this.sortModeOrganize(event.to);
}
},

// Mode écriture du contenu
sortModeWrite: function (to) {
'use strict';
var ids = [],
child,
i;
for (i = 0; i < to.children.length; i += 1) {
child = to.children[i];
// Nous utilisons une route déjà existante, dédiée aux blocs,
// pour gérer à la fois des blocs et des headings.
// Ca manque d'élégance.
ids.push({
id: child.dataset.id,
kind: child.dataset.kind
});
}
$.post(this.sortBlocksUrl, { ids: ids });
},

// Mode organisation du plan
sortModeOrganize: function (to) {
'use strict';
var ids = [],
child,
i;
for (i = 0; i < to.children.length; i += 1) {
child = to.children[i];
ids.push(child.dataset.id);
}
$.post(this.sortHeadingsUrl, { ids: ids });
},

addListeners: function (selector, event, action) {
'use strict';
var elements = document.querySelectorAll(selector),
i;
for (i = 0; i < elements.length; i += 1) {
elements[i].addEventListener(event, action.bind(this));
if (this.container !== null) {
window.osuny.contentEditor.offcanvas.init();
window.osuny.contentEditor.tabs.init();
window.osuny.contentEditor.sort.init();
}
},

Expand Down
23 changes: 0 additions & 23 deletions app/assets/javascripts/admin/commons/content_editor/element.js

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
window.osuny.contentEditor.offcanvas = {
init: function () {
'use strict';
this.editor = document.getElementById('offcanvasEditor');
this.editorBootstrap = new bootstrap.Offcanvas(this.editor);
this.iframe = document.getElementById('offcanvasEditorIframe');
this.editButtons = document.querySelectorAll('.js-content-editor__element__edit');
this.addBlockButton = document.querySelector('.js-content-editor__add-block');
this.initButtons();
},

initButtons: function () {
'use strict';
var i,
button;
for (i = 0; i < this.editButtons.length; i += 1) {
button = this.editButtons[i];
button.addEventListener('click', this.onEditButtonClick.bind(this));
}
this.addBlockButton.addEventListener('click', this.onAddBlockButtonClick.bind(this));
},

onEditButtonClick: function (event) {
'use strict';
event.preventDefault();
window.open(event.target.href, 'editor');
this.editorBootstrap.show();
},

onAddBlockButtonClick: function (event) {
'use strict';
event.preventDefault();
window.open(event.target.href, 'editor');
this.editorBootstrap.show();
},

onBlockSave: function (blockIdentifier, blockPath) {
'use strict';
var snippet = document.querySelector('#snippet-' + blockIdentifier);
if (snippet === null) {
this.addNewSnippet();
} else {
this.updateExistingSnippet(snippet, blockPath);
}
},

addNewSnippet: function () {
this.editorBootstrap.hide();
window.osuny.contentEditor.tabs.reload();
},

updateExistingSnippet: function (snippet, blockPath) {
'use strict';
var request = new XMLHttpRequest();
request.onreadystatechange = function() {
if (request.status == 200) {
snippet.innerHTML = request.responseText;
}
};
request.open("GET", blockPath);
request.send();
this.editorBootstrap.hide();
},

invoke: function () {
'use strict';
return {
init: this.init.bind(this),
onBlockSave: this.onBlockSave.bind(this)
};
}
}.invoke();
71 changes: 71 additions & 0 deletions app/assets/javascripts/admin/commons/content_editor/sort.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
/* global Sortable */
window.osuny.contentEditor.sort = {
init: function () {
'use strict';
this.container = document.querySelector('.js-content-editor');
this.sortableContainers = this.container.querySelectorAll('.js-content-editor-sortable-container');
this.sortHeadingsUrl = this.container.getAttribute('data-sort-headings-url');
this.sortBlocksUrl = this.container.getAttribute('data-sort-blocks-url');
this.initSortable();
},

initSortable: function () {
'use strict';
var i;
for (i = 0; i < this.sortableContainers.length; i += 1) {
new Sortable(this.sortableContainers[i], {
handle: '.content-editor__elements__handle',
fallbackOnBody: false,
onEnd: this.onSortableEnd.bind(this)
});
}
},

onSortableEnd: function (event) {
'use strict';
if (event.from.classList.contains('content-editor--write')) {
this.sortModeWrite(event.to);
} else if (event.from.classList.contains('content-editor--organize')) {
this.sortModeOrganize(event.to);
}
},

// Mode écriture du contenu
sortModeWrite: function (to) {
'use strict';
var ids = [],
child,
i;
for (i = 0; i < to.children.length; i += 1) {
child = to.children[i];
// Nous utilisons une route déjà existante, dédiée aux blocs,
// pour gérer à la fois des blocs et des headings.
// Ca manque d'élégance.
ids.push({
id: child.dataset.id,
kind: child.dataset.kind
});
}
$.post(this.sortBlocksUrl, { ids: ids });
},

// Mode organisation du plan
sortModeOrganize: function (to) {
'use strict';
var ids = [],
child,
i;
for (i = 0; i < to.children.length; i += 1) {
child = to.children[i];
ids.push(child.dataset.id);
}
$.post(this.sortHeadingsUrl, { ids: ids });
},

invoke: function () {
'use strict';
return {
init: this.init.bind(this)
};
}
}.invoke();
78 changes: 78 additions & 0 deletions app/assets/javascripts/admin/commons/content_editor/tabs.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
window.osuny.contentEditor.tabs = {
init: function () {
'use strict';
this.container = document.querySelector('.js-content-editor');
this.tabs = document.querySelectorAll('[data-bs-toggle="tab"]');
this.modeWriteContainer = this.container.querySelector('#mode-write-container');
this.modeWritePane = this.container.querySelector('#mode-write');
this.modeWriteSource = this.modeWritePane.getAttribute('data-source');
this.modeStructureContainer = this.container.querySelector('#mode-structure-container');
this.modeStructurePane = this.container.querySelector('#mode-structure');
this.modeStructureSource = this.modeStructurePane.getAttribute('data-source');
this.target = this.modeWriteContainer;
this.source = this.modeWriteSource;
this.initTabsHook();
},

initTabsHook: function () {
'use strict';
var i,
tab;
for (i = 0; i < this.tabs.length; i += 1) {
tab = this.tabs[i];
tab.addEventListener('shown.bs.tab', this.tabChanged.bind(this));
}
},

tabChanged: function (event) {
'use strict';
if (event.target.id == 'mode-write-tab') {
this.loadWrite();
} else {
this.loadStructure();
}
},

loadWrite: function () {
this.target = this.modeWriteContainer;
this.source = this.modeWriteSource;
this.loadCurrentTab();
},

loadStructure: function () {
this.target = this.modeStructureContainer;
this.source = this.modeStructureSource;
this.loadCurrentTab();
},

loadCurrentTab: function () {
this.target.innerHTML = '';
this.xhr = new XMLHttpRequest();
this.xhr.open('GET', this.source, true);
this.xhr.onreadystatechange = this.tabLoaded.bind(this);
this.xhr.send();
},

reload: function () {
this.loadCurrentTab();
},

tabLoaded: function () {
'use strict';
if (this.xhr.readyState === XMLHttpRequest.DONE) {
if (this.xhr.status === 200) {
this.target.innerHTML = this.xhr.responseText;
window.osuny.contentEditor.sort.init();
window.osuny.contentEditor.offcanvas.init();
}
}
},

invoke: function () {
'use strict';
return {
init: this.init.bind(this),
reload: this.reload.bind(this),
};
}
}.invoke();
14 changes: 3 additions & 11 deletions app/assets/stylesheets/admin/components/card.sass
Original file line number Diff line number Diff line change
@@ -1,17 +1,9 @@
.card
box-shadow: 0px 2px 4px 0px rgba(16, 15, 15, 0.05)
height: 100%
margin-bottom: $spacing1
overflow: hidden
transition: box-shadow 0.3s ease-in-out
// In the people and organizations
> .osuny__published
margin-right: 0
position: absolute
right: pxToRem(10)
top: pxToRem(10)
&--false
border: 1px solid $color-border
&--osuny
height: 100%
overflow: hidden
&--horizontal
align-items: center
flex-direction: row
Expand Down
Loading
Loading