mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-28 22:43:30 +03:00
Fixed capitalization of API and CTA in theme setting labels
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
This commit is contained in:
parent
d3539655a0
commit
4fa13bfa9f
@ -1,7 +1,7 @@
|
||||
<div class="gh-stack-item {{if (eq @index 0) "gh-setting-first"}}">
|
||||
<div class="flex-grow-1">
|
||||
<label class="gh-setting-title gh-theme-setting-title" for={{this.selectId}}>
|
||||
{{humanize @setting.key}}
|
||||
{{humanize-setting-key @setting.key}}
|
||||
</label>
|
||||
|
||||
<select class="ember-select" name={{this.selectName}} id={{this.selectId}} {{on "change" this.setSelection}}>
|
||||
|
16
ghost/admin/app/helpers/humanize-setting-key.js
Normal file
16
ghost/admin/app/helpers/humanize-setting-key.js
Normal file
@ -0,0 +1,16 @@
|
||||
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);
|
Loading…
Reference in New Issue
Block a user