Fix styling of custom tags

This commit is contained in:
Ivan Diaz 2019-03-01 01:15:03 -03:00
parent d96e8b44b1
commit 5d3a805285
11 changed files with 69 additions and 43 deletions

View File

@ -137,7 +137,7 @@ class AdminPanelMenu extends React.Component {
level: 2 level: 2
}, },
{ {
name: 'Customtags i18n', name: i18n('CUSTOM_TAGS'),
path: '/admin/panel/tickets/custom-tags', path: '/admin/panel/tickets/custom-tags',
level: 1 level: 1
} }

View File

@ -27,8 +27,8 @@ class AdminPanelCustomTagsModal extends React.Component {
render() { render() {
return ( return (
<div> <div className='admin-panel-custom-tags-modal'>
<Header title={'new tags'} description={i18n('Here you can add a topic that works as a category for articles.')} /> <Header title={i18n('ADD_CUSTOM_TAG')} description={i18n('DESCRIPTION_ADD_CUSTOM_TAG')} />
<Form <Form
values={this.state.form} values={this.state.form}
onChange={this.onFormChange.bind(this)} onChange={this.onFormChange.bind(this)}
@ -38,13 +38,14 @@ class AdminPanelCustomTagsModal extends React.Component {
loading={this.state.loading}> loading={this.state.loading}>
<FormField name="name" label={i18n('NAME')} fieldProps={{size: 'large'}} required /> <FormField name="name" label={i18n('NAME')} fieldProps={{size: 'large'}} required />
<FormField name="color" label={i18n('COLOR')} decorator={ColorSelector} /> <FormField name="color" label={i18n('COLOR')} decorator={ColorSelector} />
<div className='admin-panel-custom-tags-modal__actions'>
<SubmitButton className="topic-edit-modal__save-button" type="secondary" size="small"> <SubmitButton type="secondary" size="small">
{i18n('SAVE')} {i18n('SAVE')}
</SubmitButton> </SubmitButton>
<Button className="topic-edit-modal__discard-button" onClick={this.onDiscardClick.bind(this)} size="small"> <Button onClick={this.onDiscardClick.bind(this)} size="small">
{i18n('CANCEL')} {i18n('CANCEL')}
</Button> </Button>
</div>
</Form> </Form>
</div> </div>
); );

View File

@ -0,0 +1,7 @@
.admin-panel-custom-tags-modal {
&__actions{
display: flex;
justify-content: space-between;
}
}

View File

@ -41,19 +41,27 @@ class AdminPanelCustomTags extends React.Component {
renderContent() { renderContent() {
return ( return (
<div className="row"> <div className="admin-panel-custom-tags__content">
<div className="col-md-3"> <div>
<Button onClick={this.openTagModal.bind(this)} type="secondary" ><Icon name="pencil"/>'NUEVO TAGi18n'</Button> <Button onClick={this.openTagModal.bind(this)} type="secondary">
{i18n('CREATE_CUSTOM_TAG')}<Icon className="admin-panel-custom-tags__add-button-icon" name="plus"/>
</Button>
</div>
<div className="admin-panel-custom-tags__tag-list">
{this.props.tags.map(this.renderTag.bind(this))}
</div> </div>
{this.props.tags.map((tag) => {
return(
<Tag color={tag.color} name={tag.name} onRemoveClick={this.onDeleteClick.bind(this, tag.id)} showDeleteButton />
)
})}
</div> </div>
); );
} }
renderTag(tag, index) {
return(
<div key={index} className="admin-panel-custom-tags__tag-container" >
<Tag color={tag.color} name={tag.name} onRemoveClick={this.onDeleteClick.bind(this, tag.id)} size='large' showDeleteButton />
</div>
)
}
openTagModal() { openTagModal() {
ModalContainer.openModal( ModalContainer.openModal(
<AdminPanelCustomTagsModal onTagCreated={this.retrieveCustomTags.bind(this)}/> <AdminPanelCustomTagsModal onTagCreated={this.retrieveCustomTags.bind(this)}/>

View File

@ -1,31 +1,18 @@
.admin-panel-custom-tags { .admin-panel-custom-tags {
&__loading {
height: 300px;
}
&__item-flag { &__content {
float: right;
}
&__actions {
text-align: left; text-align: left;
} }
&__save-button { &__add-button-icon{
display: inline-block; margin-left: 5px;
margin-right: 30px;
} }
&__optional-buttons { &__tag-list{
display: inline; margin-top: 15px;
} }
&__discard-button { &__tag-container{
display: inline-block; margin-top:5px ;
}
&__delete-button {
display: inline-block;
float: right;
} }
} }

View File

@ -9,7 +9,7 @@ class Tag extends React.Component {
color: React.PropTypes.string, color: React.PropTypes.string,
showDeleteButton: React.PropTypes.bool, showDeleteButton: React.PropTypes.bool,
onRemoveClick: React.PropTypes.func, onRemoveClick: React.PropTypes.func,
size: React.PropTypes.oneOf(['small','medium']) size: React.PropTypes.oneOf(['small','medium','large'])
}; };
render() { render() {
@ -33,7 +33,8 @@ class Tag extends React.Component {
let classes = { let classes = {
'tag': true, 'tag': true,
'tag_small': this.props.size === 'small', 'tag_small': this.props.size === 'small',
'tag_medium': this.props.size === 'medium' 'tag_medium': this.props.size === 'medium',
'tag_large': this.props.size === 'large',
}; };
return classNames(classes); return classNames(classes);

View File

@ -21,4 +21,11 @@
&_small { &_small {
font-size: 11px; font-size: 11px;
} }
}
&_large {
width: 220px;
display: flex;
justify-content: space-between;
padding: 3px 8px;
}
}

View File

@ -30,7 +30,8 @@ module.exports = [
'allowedLanguages': ['en', 'es', 'de', 'fr', 'pt', 'jp', 'ru', 'cn', 'in', 'tr'], 'allowedLanguages': ['en', 'es', 'de', 'fr', 'pt', 'jp', 'ru', 'cn', 'in', 'tr'],
'supportedLanguages': ['en', 'es', 'de'], 'supportedLanguages': ['en', 'es', 'de'],
'registration': true, 'registration': true,
'user-system-enabled': true 'user-system-enabled': true,
'tags': [{id:1,name:'bug', color:'#eb144c'},{id: 2,name:'suggestion',color:'#ff6900'}]
} }
}; };
@ -51,7 +52,8 @@ module.exports = [
'allowedLanguages': ['en', 'es', 'de', 'fr', 'pt', 'jp', 'ru', 'cn', 'in', 'tr'], 'allowedLanguages': ['en', 'es', 'de', 'fr', 'pt', 'jp', 'ru', 'cn', 'in', 'tr'],
'supportedLanguages': ['en', 'es', 'de'], 'supportedLanguages': ['en', 'es', 'de'],
'registration': true, 'registration': true,
'user-system-enabled': true 'user-system-enabled': true,
'tags': [{id:1,name:'bug', color:'#eb144c'},{id: 2,name:'suggestion',color:'#ff6900'}]
} }
}; };
} }

View File

@ -109,6 +109,7 @@ module.exports = [
unreadStaff: true, unreadStaff: true,
closed: false, closed: false,
priority: 'medium', priority: 'medium',
tags: [],
author: { author: {
id: '3', id: '3',
name: 'Haskell Curry', name: 'Haskell Curry',

View File

@ -48,6 +48,7 @@ export default {
'ALL_TICKETS': 'All Tickets', 'ALL_TICKETS': 'All Tickets',
'CUSTOM_RESPONSES': 'Custom Responses', 'CUSTOM_RESPONSES': 'Custom Responses',
'CUSTOM_TAGS': 'Custom Tags', 'CUSTOM_TAGS': 'Custom Tags',
'CREATE_CUSTOM_TAG': 'Create custom tag',
'LIST_USERS': 'List Users', 'LIST_USERS': 'List Users',
'BAN_USERS': 'Ban Users', 'BAN_USERS': 'Ban Users',
'LIST_ARTICLES': 'Article List', 'LIST_ARTICLES': 'Article List',
@ -103,6 +104,7 @@ export default {
'COLOR': 'Color', 'COLOR': 'Color',
'ADD_NEW_ARTICLE': 'Add new article', 'ADD_NEW_ARTICLE': 'Add new article',
'ADD_ARTICLE': 'Add article', 'ADD_ARTICLE': 'Add article',
'ADD_CUSTOM_TAG': 'Add custom tag',
'LAST_EDITED_IN': 'Last edited in {date}', 'LAST_EDITED_IN': 'Last edited in {date}',
'EDIT': 'Edit', 'EDIT': 'Edit',
'NO_RESULTS': 'No results', 'NO_RESULTS': 'No results',
@ -207,6 +209,7 @@ export default {
'OPTION': 'Option {index}', 'OPTION': 'Option {index}',
'OPTIONS': 'Options', 'OPTIONS': 'Options',
'FIELD_DESCRIPTION': 'Field description (Optional)', 'FIELD_DESCRIPTION': 'Field description (Optional)',
'DESCRIPTION_ADD_CUSTOM_TAG': 'here you can add a new custom tag',
'CUSTOM_FIELDS': 'Custom fields', 'CUSTOM_FIELDS': 'Custom fields',
'CHART_CREATE_TICKET': 'Tickets created', 'CHART_CREATE_TICKET': 'Tickets created',

View File

@ -0,0 +1,9 @@
describe 'CustomField' do
request('/user/logout')
Scripts.login($staff[:email], $staff[:password], true)
describe '/system/add-custom field' do
it 'should add custom field with departments' do
end
end
end