Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
A
Admin
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
osuny
Admin
Commits
045a8b4b
Unverified
Commit
045a8b4b
authored
1 year ago
by
Sébastien Gaya
Committed by
GitHub
1 year ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #1099 from noesya/heading-children-dependent
Ajustements headings et blocs
parents
c1a563a0
fedb1feb
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/assets/javascripts/admin/commons/content_editor.js
+3
-2
3 additions, 2 deletions
app/assets/javascripts/admin/commons/content_editor.js
app/models/communication/block/heading.rb
+2
-1
2 additions, 1 deletion
app/models/communication/block/heading.rb
with
5 additions
and
3 deletions
app/assets/javascripts/admin/commons/content_editor.js
+
3
−
2
View file @
045a8b4b
...
...
@@ -68,11 +68,12 @@ window.osuny.contentEditor = {
onSortableMove
:
function
(
event
)
{
'
use strict
'
;
var
draggedKind
=
event
.
dragged
.
dataset
.
kind
,
relatedKind
=
event
.
related
.
dataset
.
kind
;
relatedKind
=
event
.
related
.
dataset
.
kind
,
firstHeading
=
this
.
sortableRootContainer
.
querySelector
(
'
.js-content-editor-element[data-kind="heading"]
'
);
if
(
draggedKind
===
'
block
'
)
{
// Prevent dragging a block after a heading, instead of inside
return
relatedKind
!==
'
heading
'
||
!
event
.
willInsertAfter
;
return
relatedKind
!==
'
heading
'
||
!
event
.
willInsertAfter
&&
event
.
related
===
firstHeading
;
}
return
true
;
},
...
...
This diff is collapsed.
Click to expand it.
app/models/communication/block/heading.rb
+
2
−
1
View file @
045a8b4b
...
...
@@ -39,7 +39,8 @@ class Communication::Block::Heading < ApplicationRecord
optional:
true
has_many
:children
,
class_name:
'Communication::Block::Heading'
,
foreign_key: :parent_id
foreign_key: :parent_id
,
dependent: :nullify
has_many
:blocks
,
dependent: :nullify
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment