Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
French Tax and Benefit Tables
baremes-ipp-views
Commits
9a97ac39
Commit
9a97ac39
authored
Oct 25, 2018
by
Florian Pagnoux
Browse files
Use new order metadata to sort nodes
parent
4e31cfbf
Changes
3
Hide whitespace changes
Inline
Side-by-side
components/ParameterTable.js
View file @
9a97ac39
...
...
@@ -2,6 +2,8 @@ import map from 'lodash.map'
import
range
from
'
lodash.range
'
import
size
from
'
lodash.size
'
import
isString
from
'
lodash.isstring
'
import
sortBy
from
'
lodash.sortby
'
import
flow
from
'
lodash.flow
'
import
{
FormattedDate
,
IntlProvider
,
addLocaleData
,
FormattedNumber
}
from
'
react-intl
'
import
fr
from
'
react-intl/locale-data/fr
'
...
...
@@ -64,7 +66,11 @@ function buildColumn(parameter) {
if
(
parameter
.
subparams
)
{
return
{
Header
:
parameter
.
description
||
parameter
.
id
,
columns
:
map
(
parameter
.
subparams
,
buildColumn
)
columns
:
flow
([
x
=>
map
(
x
,
(
subParam
,
name
)
=>
Object
.
assign
({},
subParam
,
{
name
})),
x
=>
sortBy
(
x
,
subParam
=>
parameter
?.
metadata
?.
order
.
indexOf
(
subParam
.
name
)),
x
=>
map
(
x
,
buildColumn
)
])(
parameter
.
subparams
)
}
}
}
...
...
pages/section.js
View file @
9a97ac39
...
...
@@ -9,7 +9,7 @@ import sortBy from 'lodash.sortby';
function
renderSubParams
(
item
,
key
,
path
)
{
const
subParams
=
isArray
(
item
.
subparams
)
?
item
.
subparams
:
flow
([
x
=>
map
(
x
,
(
subParam
,
name
)
=>
Object
.
assign
({},
subParam
,
{
name
})),
x
=>
sortBy
(
x
,
subParam
=>
subPara
m
?.
metadata
?.
rank
||
subParam
?.
table
?.
metadata
.
rank
)
x
=>
sortBy
(
x
,
subParam
=>
ite
m
?.
metadata
?.
order
.
indexOf
(
subParam
.
name
)
)
])(
item
.
subparams
)
return
map
(
subParams
,
subParam
=>
{
...
...
@@ -39,7 +39,7 @@ const Section = (props) => {
const
path
=
props
.
router
.
asPath
.
endsWith
(
'
/
'
)
?
props
.
router
.
asPath
:
props
.
router
.
asPath
+
'
/
'
const
subParams
=
flow
([
x
=>
map
(
x
,
(
subParam
,
name
)
=>
Object
.
assign
({},
subParam
,
{
name
})),
x
=>
sortBy
(
x
,
subParam
=>
s
ubParam
.
metadata
&&
subParam
.
metadata
.
rank
)
x
=>
sortBy
(
x
,
subParam
=>
s
ection
?
.
metadata
?.
order
.
indexOf
(
subParam
.
name
)
)
])(
section
.
subparams
)
return
<
Layout
>
...
...
tables/retraite.yaml
View file @
9a97ac39
title
:
Retraite
subsection
:
retraites
depth
:
1
subparams
:
-
subsection
:
retraites.secteur_prive
depth
:
1
-
subsection
:
retraites.secteur_public
-
subsection
:
retraites.independants
Write
Preview
Supports
Markdown
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