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
Luc Didry
kresus
Commits
305e614e
Commit
305e614e
authored
Mar 28, 2019
by
Benjamin Bouvier
Browse files
[client] Rejigger URLs so all the settings subsections have a uniform URL and a title;
parent
e83bbe4c
Changes
6
Hide whitespace changes
Inline
Side-by-side
client/components/menu/params.js
View file @
305e614e
...
...
@@ -26,7 +26,8 @@ class ParamMenu extends React.Component {
<
div
className
=
"
settings-dropdown-menu
"
>
<
ul
>
<
li
>
<
NavLink
to
=
{
URL
.
categories
.
url
(
this
.
props
.
currentAccountId
)}
>
<
NavLink
to
=
{
URL
.
settings
.
url
(
'
categories
'
,
this
.
props
.
currentAccountId
)}
>
<
span
className
=
"
fa fa-list-ul
"
/>
{
$t
(
'
client.menu.categories
'
)}
<
/NavLink
>
...
...
client/components/settings/index.js
View file @
305e614e
...
...
@@ -5,6 +5,7 @@ import URL from '../../urls';
import
BackupParameters
from
'
./backup
'
;
import
BankAccountsList
from
'
./bank-accesses
'
;
import
CategoryList
from
'
../categories
'
;
import
CustomizationParameters
from
'
./customization
'
;
import
EmailsParameters
from
'
./emails
'
;
import
LogsSection
from
'
./logs
'
;
...
...
@@ -12,30 +13,34 @@ import WeboobParameters from './weboob';
const
SettingsComponents
=
props
=>
{
let
currentAccountId
=
URL
.
settings
.
accountId
(
props
.
match
);
return
(
<
Switch
>
<
Route
path
=
{
URL
.
settings
.
url
(
'
accounts
'
,
currentAccountId
)}
component
=
{
BankAccountsList
}
/
>
<
Route
path
=
{
URL
.
settings
.
url
(
'
emails
'
,
currentAccountId
)}
component
=
{
EmailsParameters
}
/
>
<
Route
path
=
{
URL
.
settings
.
url
(
'
backup
'
,
currentAccountId
)}
component
=
{
BackupParameters
}
/
>
<
Route
path
=
{
URL
.
settings
.
url
(
'
weboob
'
,
currentAccountId
)}
component
=
{
WeboobParameters
}
path
=
{
URL
.
settings
.
url
(
'
categories
'
,
currentAccountId
)}
component
=
{
CategoryList
}
/
>
<
Route
path
=
{
URL
.
settings
.
url
(
'
customization
'
,
currentAccountId
)}
component
=
{
CustomizationParameters
}
/
>
<
Route
path
=
{
URL
.
settings
.
url
(
'
emails
'
,
currentAccountId
)}
component
=
{
EmailsParameters
}
/
>
<
Route
path
=
{
URL
.
settings
.
url
(
'
logs
'
,
currentAccountId
)}
component
=
{
LogsSection
}
/
>
<
Route
path
=
{
URL
.
settings
.
url
(
'
weboob
'
,
currentAccountId
)}
component
=
{
WeboobParameters
}
/
>
<
Redirect
to
=
{
URL
.
settings
.
url
(
'
accounts
'
,
currentAccountId
)}
push
=
{
false
}
/
>
<
/Switch
>
);
...
...
client/main.js
View file @
305e614e
...
...
@@ -16,7 +16,6 @@ import LazyLoader from './components/lazyLoader';
// Components
import
About
from
'
./components/about
'
;
import
CategoryList
from
'
./components/categories
'
;
import
loadCharts
from
'
bundle-loader?lazy!./components/charts
'
;
import
OperationList
from
'
./components/operations
'
;
import
Budget
from
'
./components/budget
'
;
...
...
@@ -180,7 +179,6 @@ class BaseApp extends React.Component {
<
Route
path
=
{
URL
.
reports
.
pattern
}
component
=
{
OperationList
}
/
>
<
Route
path
=
{
URL
.
budgets
.
pattern
}
component
=
{
Budget
}
/
>
<
Route
path
=
{
URL
.
charts
.
pattern
}
component
=
{
Charts
}
/
>
<
Route
path
=
{
URL
.
categories
.
pattern
}
component
=
{
CategoryList
}
/
>
<
Route
path
=
{
URL
.
duplicates
.
pattern
}
component
=
{
DuplicatesList
}
/
>
<
Route
path
=
{
URL
.
settings
.
pattern
}
component
=
{
Settings
}
/
>
<
Route
path
=
{
URL
.
about
.
pattern
}
component
=
{
About
}
/
>
...
...
client/urls.js
View file @
305e614e
// The list of the available sections.
const
SECTIONS
=
[
'
about
'
,
'
budget
'
,
'
categories
'
,
'
charts
'
,
'
duplicates
'
,
'
reports
'
,
'
settings
'
];
const
SETTINGS_SUBSECTIONS
=
[
'
accounts
'
,
'
backup
'
,
'
categories
'
,
'
customization
'
,
'
emails
'
,
'
logs
'
,
'
weboob
'
];
function
getCurrentAccountId
(
match
)
{
return
match
.
params
.
currentAccountId
;
...
...
@@ -38,13 +47,6 @@ const URLs = {
accountId
:
getCurrentAccountId
},
categories
:
{
pattern
:
'
/categories/:currentAccountId
'
,
url
(
accountId
)
{
return
`/categories/
${
accountId
}
`
;
}
},
settings
:
{
pattern
:
'
/settings/:subsection/:currentAccountId
'
,
url
(
subsection
,
accountId
)
{
...
...
@@ -78,7 +80,7 @@ const URLs = {
},
sections
:
{
pattern
:
'
/:section
'
,
pattern
:
'
/:section
/:subsection?
'
,
genericPattern
:
'
/:section/:subsection?/:currentAccountId
'
,
sub
(
match
,
section
,
defaultValue
)
{
let
{
section
:
matchSection
,
subsection
:
matchSubsection
}
=
match
.
params
;
...
...
@@ -87,7 +89,16 @@ const URLs = {
:
defaultValue
;
},
title
(
match
)
{
return
match
&&
SECTIONS
.
includes
(
match
.
params
.
section
)
?
match
.
params
.
section
:
null
;
if
(
!
match
||
!
match
.
params
)
{
return
null
;
}
if
(
SETTINGS_SUBSECTIONS
.
includes
(
match
.
params
.
subsection
))
{
return
match
.
params
.
subsection
;
}
if
(
SECTIONS
.
includes
(
match
.
params
.
section
))
{
return
match
.
params
.
section
;
}
return
null
;
},
accountId
:
getCurrentAccountId
}
...
...
shared/locales/en.json
View file @
305e614e
...
...
@@ -155,18 +155,22 @@
"add_custom_label"
:
"Add a custom label"
},
"menu"
:
{
"about"
:
"About"
,
"accounts"
:
"Bank accounts"
,
"backup"
:
"Backups"
,
"banks"
:
"Banks"
,
"budget"
:
"Budget"
,
"categories"
:
"Categories"
,
"charts"
:
"Charts"
,
"settings"
:
"Settings"
,
"customization"
:
"Customization"
,
"different_currencies"
:
"Different currencies"
,
"duplicates"
:
"Duplicates"
,
"sublists"
:
"Accounts"
,
"emails"
:
"Alerts"
,
"logs"
:
"Logs"
,
"outstanding_balance"
:
"Ongoing: "
,
"reports"
:
"Reports"
,
"budget"
:
"Budget"
,
"about"
:
"About"
,
"different_currencies"
:
"Different currencies"
,
"total"
:
"Total"
,
"
outstanding_balance"
:
"Ongoing:
"
"
weboob"
:
"Weboob
"
},
"operations"
:
{
"amount"
:
"Amount"
,
...
...
shared/locales/fr.json
View file @
305e614e
...
...
@@ -155,18 +155,22 @@
"add_custom_label"
:
"Ajouter un libellé personnalisé"
},
"menu"
:
{
"about"
:
"À propos"
,
"accounts"
:
"Comptes bancaires"
,
"backup"
:
"Sauvegardes"
,
"banks"
:
"Banques"
,
"budget"
:
"Budget"
,
"categories"
:
"Catégories"
,
"charts"
:
"Graphiques"
,
"settings"
:
"Préférences"
,
"customization"
:
"Personnalisation"
,
"different_currencies"
:
"Devises différentes"
,
"duplicates"
:
"Doublons"
,
"sublists"
:
"Comptes"
,
"emails"
:
"Alertes"
,
"logs"
:
"Journaux"
,
"outstanding_balance"
:
"Encours : "
,
"reports"
:
"Relevé"
,
"budget"
:
"Budget"
,
"about"
:
"À propos"
,
"different_currencies"
:
"Devises différentes"
,
"total"
:
"Total"
,
"
outstanding_balance"
:
"Encours :
"
"
weboob"
:
"Weboob
"
},
"operations"
:
{
"amount"
:
"Montant"
,
...
...
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