Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
third-party
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cooperatic-foodcoops
third-party
Commits
4983a101
Commit
4983a101
authored
Oct 15, 2021
by
François
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Modifications to consider unreliable order of returned JSON objects keys order
parent
6f811203
Pipeline
#1396
failed with stage
in 1 minute 25 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
3 deletions
+8
-3
admin.py
members/admin.py
+1
-0
module_config.js
outils/static/js/module_config.js
+7
-3
No files found.
members/admin.py
View file @
4983a101
...
@@ -76,6 +76,7 @@ def get_settings(request):
...
@@ -76,6 +76,7 @@ def get_settings(request):
msettings
[
k
]
=
v
msettings
[
k
]
=
v
result
[
'settings'
]
=
dict
(
sorted
(
msettings
.
items
(),
key
=
lambda
k_v
:
k_v
[
1
][
'sort_order'
]))
result
[
'settings'
]
=
dict
(
sorted
(
msettings
.
items
(),
key
=
lambda
k_v
:
k_v
[
1
][
'sort_order'
]))
# on preprod server, dict order (through JsonResponse ??) is not respected !!
except
Exception
as
e
:
except
Exception
as
e
:
result
[
'error'
]
=
str
(
e
)
result
[
'error'
]
=
str
(
e
)
else
:
else
:
...
...
outils/static/js/module_config.js
View file @
4983a101
...
@@ -67,6 +67,10 @@ function quillify(params) {
...
@@ -67,6 +67,10 @@ function quillify(params) {
quill
.
root
.
innerHTML
=
params
.
content
;
quill
.
root
.
innerHTML
=
params
.
content
;
}
}
function
get_sorted_keys
(
obj
)
{
var
keys
=
Object
.
keys
(
obj
);
return
keys
.
sort
(
function
(
a
,
b
){
return
obj
[
a
].
sort_order
-
obj
[
b
].
sort_order
});
}
function
get_module_settings
()
{
function
get_module_settings
()
{
$
.
ajax
(
'settings'
)
$
.
ajax
(
'settings'
)
.
done
(
function
(
rData
)
{
.
done
(
function
(
rData
)
{
...
@@ -76,11 +80,11 @@ function get_module_settings() {
...
@@ -76,11 +80,11 @@ function get_module_settings() {
var
added_elts
=
[],
var
added_elts
=
[],
quill_containers
=
[];
quill_containers
=
[];
for
(
let
key
in
msettings
)
{
get_sorted_keys
(
msettings
).
forEach
(
function
(
key
)
{
var
param
=
$
(
param_template
.
clone
().
html
());
var
param
=
$
(
param_template
.
clone
().
html
());
// param html include textarea and input : one of them will be removed
// param html include textarea and input : one of them will be removed
var
input
=
null
;
var
input
=
null
;
let
data
=
rData
.
res
.
settings
[
key
];
let
data
=
m
settings
[
key
];
// Fill the label content
// Fill the label content
param
.
find
(
'label'
).
text
(
data
.
title
)
param
.
find
(
'label'
).
text
(
data
.
title
)
...
@@ -126,7 +130,7 @@ function get_module_settings() {
...
@@ -126,7 +130,7 @@ function get_module_settings() {
added_elts
.
push
(
key
);
added_elts
.
push
(
key
);
}
}
)
if
(
added_elts
.
length
>
0
)
{
if
(
added_elts
.
length
>
0
)
{
submit_btn
.
prependTo
(
main_content
);
submit_btn
.
prependTo
(
main_content
);
submit_btn
.
clone
().
appendTo
(
main_content
);
submit_btn
.
clone
().
appendTo
(
main_content
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment