Skip to content

Commit c4e0cbb

Browse files
authored
Merge pull request #2437 from mysubcult/feat/bbcode-direct-button
Widget theme option: BB code (emoji) button next to settings
2 parents 0b8fb90 + c60a6d2 commit c4e0cbb

4 files changed

Lines changed: 21 additions & 1 deletion

File tree

‎lhc_web/design/defaulttheme/tpl/lhabstract/custom/widget_theme.tpl.php‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -918,6 +918,10 @@
918918
<label><?php echo erLhcoreClassAbstract::renderInput('fa_direct', $fields['fa_direct'], $object)?> <?php echo $fields['fa_direct']['trans'];?></label>
919919
</div>
920920

921+
<div class="form-group">
922+
<label><?php echo erLhcoreClassAbstract::renderInput('bbc_direct', $fields['bbc_direct'], $object)?> <?php echo $fields['bbc_direct']['trans'];?></label>
923+
</div>
924+
921925
<div class="form-group">
922926
<label><?php echo erLhcoreClassAbstract::renderInput('no_voice_messages', $fields['no_voice_messages'], $object)?> <?php echo $fields['no_voice_messages']['trans'];?></label>
923927
</div>

‎lhc_web/design/defaulttheme/widget/react-app/src/components/OnlineChat.js‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1271,7 +1271,7 @@ class OnlineChat extends Component {
12711271
{!this.props.chatwidget.getIn(['chatLiveData','closed']) && this.props.chatwidget.getIn(['chatLiveData','status']) == 1 && this.props.chatwidget.hasIn(['chat_ui','voice']) && this.props.chatwidget.getIn(['chat_ui','voice']) === true && <a tabIndex="0" onClick={this.voiceCall} title={t('button.voice')}><i className="material-icons chat-setting-item text-muted voice-ico">&#xf117;</i></a>}
12721272

12731273

1274-
{!this.props.chatwidget.getIn(['chatLiveData','closed']) && !this.props.chatwidget.hasIn(['chat_ui','bbc_btnh']) && <a tabIndex="0" onKeyPress={(e) => { e.key === "Enter" ? this.toggleModal() : '' }} onClick={this.toggleModal} title={t('button.bb_code')}><i className="material-icons chat-setting-item text-muted bbcode-ico">&#xf104;</i></a>}
1274+
{!this.props.chatwidget.getIn(['chatLiveData','closed']) && !this.props.chatwidget.hasIn(['chat_ui','bbc_btnh']) && !this.props.chatwidget.hasIn(['chat_ui','bbc_direct']) && <a tabIndex="0" onKeyPress={(e) => { e.key === "Enter" ? this.toggleModal() : '' }} onClick={this.toggleModal} title={t('button.bb_code')}><i className="material-icons chat-setting-item text-muted bbcode-ico">&#xf104;</i></a>}
12751275
{this.props.chatwidget.hasIn(['chat_ui','mail']) && <a tabIndex="0" onKeyPress={(e) => { e.key === "Enter" ? this.mailChat() : '' }} onClick={this.mailChat} title={t('button.mail')} ><i className="material-icons chat-setting-item text-muted mail-ico">&#xf11a;</i></a>}
12761276
{this.props.chatwidget.hasIn(['chat_ui','font_size']) && <a tabIndex="0" onKeyPress={(e) => { e.key === "Enter" ? this.changeFont(event) : '' }} onClick={(event) => this.changeFont(event)}><i className="material-icons chat-setting-item text-muted fs-ico">&#xf11d;</i></a>}
12771277
{this.props.chatwidget.hasIn(['chat_ui','close_btn']) && <a tabIndex="0" onKeyPress={(e) => { e.key === "Enter" ? this.props.endChat() : '' }} onClick={this.props.endChat} title={endTitle} ><i className="material-icons chat-setting-item text-muted close-ico">&#xf10a;</i></a>}
@@ -1280,6 +1280,8 @@ class OnlineChat extends Component {
12801280
</div>
12811281
</div>
12821282

1283+
{!this.props.chatwidget.getIn(['chatLiveData','closed']) && this.props.chatwidget.hasIn(['chat_ui','bbc_direct']) && !this.props.chatwidget.hasIn(['chat_ui','bbc_btnh']) && <a tabIndex="0" role="button" className="direct-action-icon bbcode-direct d-flex flex-column justify-content-end align-items-stretch" onKeyPress={(e) => { e.key === "Enter" ? this.toggleModal() : '' }} onClick={this.toggleModal} title={t('button.bb_code')}><i className="material-icons settings text-muted direct-icon bbcode-ico">&#xf104;</i></a>}
1284+
12831285
{!this.props.chatwidget.getIn(['chatLiveData','closed']) && this.props.chatwidget.hasIn(['chat_ui','fa_direct']) && this.props.chatwidget.hasIn(['chat_ui','file']) && <ChatFileUploader iClassName="direct-icon" linkClassName="direct-action-icon d-flex flex-column justify-content-end align-items-stretch" fileOptions={this.props.chatwidget.getIn(['chat_ui','file_options'])} onDrag={this.dragging} dropArea={this.textMessageRef} onCompletion={this.updateMessages} onFilePreview={this.onFilePreview} progress={this.setStatusText} base_url={this.props.chatwidget.get('base_url')} is_bot={this.props.chatwidget.getIn(['chatLiveData','status']) === STATUS_BOT_CHAT} chat_id={this.props.chatwidget.getIn(['chatData','id'])} hash={this.props.chatwidget.getIn(['chatData','hash'])} link={true}/>}
12841286

12851287
</ChatOptions>

‎lhc_web/lib/core/lhabstract/fields/erlhabstractmodelwidgettheme.php‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1824,6 +1824,16 @@
18241824
'validation_definition' => new ezcInputFormDefinitionElement(
18251825
ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw'
18261826
)),
1827+
'bbc_direct' => array(
1828+
'type' => 'checkbox',
1829+
'main_attr' => 'bot_configuration_array',
1830+
'trans' => erTranslationClassLhTranslation::getInstance()->getTranslation('abstract/widgettheme','Show BB code (emoji) button next to settings'),
1831+
'required' => false,
1832+
'hidden' => true,
1833+
'nginit' => true,
1834+
'validation_definition' => new ezcInputFormDefinitionElement(
1835+
ezcInputFormDefinitionElement::OPTIONAL, 'unsafe_raw'
1836+
)),
18271837
'show_operator_profile' => array(
18281838
'type' => 'checkbox',
18291839
'main_attr' => 'bot_configuration_array',

‎lhc_web/modules/lhwidgetrestapi/initchat.php‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,10 @@
226226
$outputResponse['chat_ui']['fa_direct'] = true;
227227
}
228228

229+
if (isset($theme->bot_configuration_array['bbc_direct']) && $theme->bot_configuration_array['bbc_direct'] == true) {
230+
$outputResponse['chat_ui']['bbc_direct'] = true;
231+
}
232+
229233
if (isset($theme->bot_configuration_array['custom_html_header']) && $theme->bot_configuration_array['custom_html_header'] != '') {
230234
$outputResponse['chat_ui']['custom_html_header'] = $theme->bot_configuration_array['custom_html_header'];
231235
}

0 commit comments

Comments
 (0)