Skip to content

Commit

Permalink
Add palceholder for custom field value.
Browse files Browse the repository at this point in the history
  • Loading branch information
Integral committed Apr 30, 2019
1 parent 86318d4 commit 596517e
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/article/manuscript/ManuscriptPackage.js
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,7 @@ export default {
config.addLabel('add-action', 'Add')
config.addLabel('enter-url-placeholder', 'Enter url')
config.addLabel('enter-keyword', 'Enter keyword')
config.addLabel('enter-keywords', 'Click to add keywords')

// Icons
config.addIcon('create-unordered-list', { 'fontawesome': 'fa-list-ul' })
Expand Down
2 changes: 2 additions & 0 deletions src/article/metadata/MetadataPackage.js
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,8 @@ export default {
config.addLabel('empty-figure-metadata', 'No fields specified')
config.addLabel('open-link', 'Open Link')
config.addLabel('enter-keyword', 'Enter keyword')
config.addLabel('enter-keywords', 'Click to add keywords')

// Icons
config.addIcon('input-error', { 'fontawesome': 'fa-exclamation-circle' })
config.addIcon('input-loading', { 'fontawesome': 'fa-spinner fa-spin' })
Expand Down
2 changes: 1 addition & 1 deletion src/article/shared/CustomMetadataFieldComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export default class CustomMetadataFieldComponent extends NodeComponent {
this._renderValue($$, 'name', { placeholder: this.getLabel('enter-custom-field-name') }).addClass('se-field-name'),
$$(KeywordInput, {
model: valuesModel,
placeholder: this.getLabel('enter-keyword'),
placeholder: this.getLabel('enter-keywords'),
overlayId: valuesModel.id
}).addClass('se-field-values')
)
Expand Down
6 changes: 4 additions & 2 deletions src/kit/ui/KeywordInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,13 @@ export default class KeywordInput extends OverlayMixin(Component) {
const values = model.getValue()
const isEmpty = values.length === 0
const isExpanded = this.state.isExpanded
const label = isEmpty ? this.props.placeholder : values.join(', ')

const el = $$('div').addClass('sc-keyword-input')
if (isEmpty) el.addClass('sm-empty')
el.addClass(isExpanded ? 'sm-expanded' : 'sm-collapsed')
el.append(
$$('div').addClass('se-label').text(values.join(', '))
$$('div').addClass('se-label').text(label)
.on('click', this._onClick)
)
if (isExpanded) {
Expand All @@ -38,8 +39,9 @@ export default class KeywordInput extends OverlayMixin(Component) {
}

_renderEditor ($$) {
const { model, placeholder } = this.props
const model = this.props.model
const values = model.getValue()
const placeholder = this.getLabel('enter-keyword')

const Button = this.getComponent('button')
const Input = this.getComponent('input')
Expand Down

0 comments on commit 596517e

Please sign in to comment.