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
c54e37c2
Commit
c54e37c2
authored
Feb 14, 2019
by
Florian Pagnoux
Browse files
Add links towards CSV files
parent
3866e779
Changes
3
Hide whitespace changes
Inline
Side-by-side
.env-prod.wp
View file @
c54e37c2
PRODUCTION=true
BASENAME=/outils/baremes-ipp
CSV_PATH=/wp-content/themes/ipp/baremes
config.js
View file @
c54e37c2
module
.
exports
=
{
basename
:
process
.
env
.
BASENAME
||
''
,
isProd
:
process
.
env
.
PRODUCTION
isProd
:
process
.
env
.
PRODUCTION
,
csvPath
:
process
.
env
.
CSV_PATH
||
''
,
}
pages/table.js
View file @
c54e37c2
import
{
withRouter
}
from
'
next/router
'
import
last
from
'
lodash.last
'
import
ParameterTable
from
"
../components/ParameterTable
"
import
Layout
from
'
../components/Layout
'
import
{
basename
}
from
'
../config
'
import
{
basename
,
csvPath
}
from
'
../config
'
function
getLinkToCsv
(
parameter
,
path
)
{
return
`
${
csvPath
||
basename
}${
path
}
/
${
last
(
parameter
.
id
.
split
(
'
.
'
))}
.csv`
}
const
BreadCrum
=
({
links
})
=>
(
<
p
><
a
href
=
{
basename
+
'
/
'
}
>
Barèmes
IPP
<
/a>{links.map
((
{path, title}, index
)
=>
{
...
...
@@ -18,9 +23,11 @@ const BreadCrum = ({links}) => (
const
TablePage
=
(
props
)
=>
{
const
{
parameter
,
parents
}
=
props
.
router
.
query
const
path
=
props
.
router
.
asPath
return
<
Layout
fullWidth
=
{
true
}
>
<
BreadCrum
links
=
{
parents
}
/
>
<
h1
className
=
"
box
"
><
span
>
{
parameter
.
description
}
<
/span></
h1
>
<
a
href
=
{
getLinkToCsv
(
parameter
,
path
)}
>
Download
CSV
<
/a
>
<
ParameterTable
parameter
=
{
parameter
}
/
>
<
/Layout
>
}
...
...
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