mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-09-08 14:15:35 +08:00
cleanup
This commit is contained in:
parent
e5ebedb428
commit
bdc1051cbb
2 changed files with 12 additions and 19 deletions
|
@ -1,15 +1,15 @@
|
|||
// with this utility function we can write nested locales like an json object
|
||||
export function flattenMessages(nestedMessages, prefix = '') {
|
||||
return Object.keys(nestedMessages).reduce((messages, key) => {
|
||||
let value = nestedMessages[key];
|
||||
let prefixedKey = prefix ? `${prefix}.${key}` : key;
|
||||
export function flattenMessages(nestedMessages, prefix = "") {
|
||||
return Object.keys(nestedMessages).reduce((messages, key) => {
|
||||
let value = nestedMessages[key];
|
||||
let prefixedKey = prefix ? `${prefix}.${key}` : key;
|
||||
|
||||
if (typeof value === 'string') {
|
||||
messages[prefixedKey] = value;
|
||||
} else {
|
||||
Object.assign(messages, flattenMessages(value, prefixedKey));
|
||||
}
|
||||
if (typeof value === "string") {
|
||||
messages[prefixedKey] = value;
|
||||
} else {
|
||||
Object.assign(messages, flattenMessages(value, prefixedKey));
|
||||
}
|
||||
|
||||
return messages;
|
||||
}, {});
|
||||
return messages;
|
||||
}, {});
|
||||
}
|
||||
|
|
|
@ -15,10 +15,7 @@ headless.start
|
|||
|
||||
Capybara::Webkit.configure do |config|
|
||||
# Enable debug mode. Prints a log of everything the driver is doing.
|
||||
config.debug = true
|
||||
|
||||
# By default, requests to outside domains (anything besides localhost) will
|
||||
# result in a warning. Several methods allow you to change this behavior.
|
||||
config.debug = false
|
||||
|
||||
# Silently return an empty 200 response for any requests to unknown URLs.
|
||||
config.block_unknown_urls
|
||||
|
@ -38,10 +35,6 @@ end
|
|||
|
||||
Capybara.javascript_driver = :webkit
|
||||
|
||||
Before do
|
||||
`bundle exec rails webpacker:compile`
|
||||
end
|
||||
|
||||
# Capybara defaults to CSS3 selectors rather than XPath.
|
||||
# If you'd prefer to use XPath, just uncomment this line and adjust any
|
||||
# selectors in your step definitions to use the XPath syntax.
|
||||
|
|
Loading…
Add table
Reference in a new issue