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
cb84eb88
Unverified
Commit
cb84eb88
authored
5 months ago
by
Arnaud Levy
Committed by
GitHub
5 months ago
Browse files
Options
Downloads
Patches
Plain Diff
split (#2381)
parent
73e388d0
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
app/controllers/concerns/admin/reorderable.rb
+7
-4
7 additions, 4 deletions
app/controllers/concerns/admin/reorderable.rb
with
7 additions
and
4 deletions
app/controllers/concerns/admin/reorderable.rb
+
7
−
4
View file @
cb84eb88
...
...
@@ -8,16 +8,19 @@ module Admin::Reorderable
object
=
model
.
find_by
(
id:
id
)
object
.
update_column
(
:position
,
index
+
1
)
unless
object
.
nil?
end
if
first_object
&
.
respond_to?
(
:is_direct_object?
)
first_object
.
is_direct_object?
?
first_object
.
sync_with_git
:
first_object
.
touch
# Sync indirect object's direct sources through after_touch
end
sync_after_reorder
(
first_object
)
# Used to add extra code
yield
first_object
if
block_given?
end
protected
def
sync_after_reorder
(
first_object
)
return
unless
first_object
&
.
respond_to?
(
:is_direct_object?
)
first_object
.
is_direct_object?
?
first_object
.
sync_with_git
:
first_object
.
touch
# Sync indirect object's direct sources through after_touch
end
def
model
self
.
class
.
to_s
.
remove
(
'Admin::'
).
remove
(
'Controller'
).
singularize
.
safe_constantize
end
...
...
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