mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-01 22:02:11 +03:00
4fa13bfa9f
no issue - added `{{humanize-setting-key}}` helper that uses the base `humanize` output but then forces capitalization for known acronyms - updated `<CustomThemeSettings::Select>` to use the new helper
17 lines
465 B
JavaScript
17 lines
465 B
JavaScript
import {helper} from '@ember/component/helper';
|
|
import {humanize} from 'ember-cli-string-helpers/helpers/humanize';
|
|
|
|
export function humanizeSettingKey([key]) {
|
|
let humanized = humanize([key]);
|
|
|
|
const allCaps = ['API', 'CTA'];
|
|
allCaps.forEach((str) => {
|
|
const regex = new RegExp(`(^| )(${str})( |$)`, 'gi');
|
|
humanized = humanized.replace(regex, `$1${str}$3`);
|
|
});
|
|
|
|
return humanized;
|
|
}
|
|
|
|
export default helper(humanizeSettingKey);
|