From 11fae08b503ed1c98bf89dc685008ee5f1c8df1a Mon Sep 17 00:00:00 2001 From: NomisCZ Date: Tue, 4 Jun 2019 20:49:16 +0200 Subject: [PATCH] Add custom icon functionality Add database 'icon' column Add admin modal icon field Add icon render to TagHero, tagLabel Change tagIcon helper functionality --- .../tags/js/src/admin/components/EditTagModal.js | 13 ++++++++++++- extensions/tags/js/src/common/helpers/tagIcon.js | 16 ++++++++++++---- .../tags/js/src/common/helpers/tagLabel.js | 5 +++-- extensions/tags/js/src/common/models/Tag.js | 1 + .../tags/js/src/forum/components/TagHero.js | 3 ++- extensions/tags/less/admin/TagsPage.less | 2 +- .../2019_04_21_000000_add_icon_to_tags_table.php | 16 ++++++++++++++++ .../tags/src/Api/Serializer/TagSerializer.php | 1 + extensions/tags/src/Command/CreateTagHandler.php | 1 + extensions/tags/src/Command/EditTagHandler.php | 4 ++++ extensions/tags/src/Tag.php | 3 ++- 11 files changed, 55 insertions(+), 10 deletions(-) create mode 100644 extensions/tags/migrations/2019_04_21_000000_add_icon_to_tags_table.php diff --git a/extensions/tags/js/src/admin/components/EditTagModal.js b/extensions/tags/js/src/admin/components/EditTagModal.js index 830cf9f14..fbb0d0934 100644 --- a/extensions/tags/js/src/admin/components/EditTagModal.js +++ b/extensions/tags/js/src/admin/components/EditTagModal.js @@ -19,6 +19,7 @@ export default class EditTagModal extends Modal { this.slug = m.prop(this.tag.slug() || ''); this.description = m.prop(this.tag.description() || ''); this.color = m.prop(this.tag.color() || ''); + this.icon = m.prop(this.tag.icon() || ''); this.isHidden = m.prop(this.tag.isHidden() || false); } @@ -30,7 +31,8 @@ export default class EditTagModal extends Modal { return this.name() ? tagLabel({ name: this.name, - color: this.color + color: this.color, + icon: this.icon, }) : app.translator.trans('flarum-tags.admin.edit_tag.title'); } @@ -71,6 +73,14 @@ export default class EditTagModal extends Modal { , 20); + items.add('icon',
+ +
+ {app.translator.trans('core.admin.edit_group.icon_text', {a: })} +
+ +
, 10); + items.add('hidden',