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
9b78184d
Commit
9b78184d
authored
1 year ago
by
Arnaud Levy
Browse files
Options
Downloads
Patches
Plain Diff
climate
parent
617d0fc1
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
+2
-2
2 additions, 2 deletions
app/assets/javascripts/admin/commons/content_editor.js
app/controllers/admin/communication/blocks_controller.rb
+34
-21
34 additions, 21 deletions
app/controllers/admin/communication/blocks_controller.rb
with
36 additions
and
23 deletions
app/assets/javascripts/admin/commons/content_editor.js
+
2
−
2
View file @
9b78184d
...
...
@@ -38,7 +38,7 @@ window.osuny.contentEditor = {
},
// Mode écriture du contenu
sortModeWrite
(
to
)
{
sortModeWrite
:
function
(
to
)
{
'
use strict
'
;
var
ids
=
[],
child
,
...
...
@@ -57,7 +57,7 @@ window.osuny.contentEditor = {
},
// Mode organisation du plan
sortModeOrganize
(
to
)
{
sortModeOrganize
:
function
(
to
)
{
'
use strict
'
;
var
ids
=
[],
child
,
...
...
This diff is collapsed.
Click to expand it.
app/controllers/admin/communication/blocks_controller.rb
+
34
−
21
View file @
9b78184d
...
...
@@ -6,28 +6,15 @@ class Admin::Communication::BlocksController < Admin::Communication::Application
def
reorder
# Cette action est très étrange, elle ne met pas en ordre les blocs seuls.
# En fait, elle met en ordre dans le mode "Ecrire le contenu", à la fois les headings et les blocks.
ids
=
params
[
:ids
]
||
[]
index_block
=
0
index_heading
=
0
heading
=
nil
ids
.
values
.
each
do
|
object
|
id
=
object
[
:id
]
if
object
[
:kind
]
==
'heading'
heading
=
current_university
.
communication_block_headings
.
find
(
id
)
heading
.
update_columns
position:
index_heading
index_block
=
0
index_heading
+=
1
else
@block
=
current_university
.
communication_blocks
.
find
(
id
)
@block
.
update_columns
position:
index_block
,
heading_id:
heading
&
.
id
index_block
+=
1
end
end
if
@block
&&
@block
.
about
&
.
respond_to?
(
:is_direct_object?
)
@block
.
about
.
is_direct_object?
?
@block
.
about
.
sync_with_git
:
@block
.
about
.
touch
# Sync indirect object's direct sources through after_touch
@ids
=
params
[
:ids
]
||
[]
@index_block
=
0
@index_heading
=
0
@heading
=
nil
@ids
.
values
.
each
do
|
object
|
@object
=
object
reorder_object
end
sync_after_reorder
end
def
new
...
...
@@ -79,6 +66,32 @@ class Admin::Communication::BlocksController < Admin::Communication::Application
protected
def
reorder_object
@id
=
@object
[
:id
]
@object
[
:kind
]
==
'heading'
?
reorder_heading
:
reorder_block
end
def
reorder_heading
@heading
=
current_university
.
communication_block_headings
.
find
(
@id
)
@heading
.
update_columns
position:
@index_heading
@index_block
=
0
@index_heading
+=
1
end
def
reorder_block
@block
=
current_university
.
communication_blocks
.
find
(
@id
)
@block
.
update_columns
position:
@index_block
,
heading_id:
@heading
&
.
id
@index_block
+=
1
end
def
sync_after_reorder
return
unless
@block
return
unless
@block
.
about
&
.
respond_to?
(
:is_direct_object?
)
@block
.
about
.
is_direct_object?
?
@block
.
about
.
sync_with_git
:
@block
.
about
.
touch
# Sync indirect object's direct sources through after_touch
end
def
website_id
params
[
:website_id
]
||
@block
.
about
&
.
website
.
id
rescue
...
...
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