Skip to content
This repository has been archived by the owner on Sep 13, 2024. It is now read-only.

Commit

Permalink
Improved copying values from the phone and email fields.
Browse files Browse the repository at this point in the history
  • Loading branch information
areksolek committed Sep 12, 2023
1 parent 3e21356 commit 712f855
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 6 deletions.
2 changes: 1 addition & 1 deletion layouts/basic/modules/Vtiger/RelatedListContents.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@
{/if}
{assign var=COUNT value=$COUNT+1}
{assign var=RELATED_HEADERNAME value=$HEADER_FIELD->getFieldName()}
<td class="{$WIDTHTYPE}" data-field-type="{$HEADER_FIELD->getFieldDataType()}" nowrap
<td class="listViewEntryValue {$WIDTHTYPE}" data-field-type="{$HEADER_FIELD->getFieldDataType()}" nowrap
{if $smarty.foreach.listHeaderForeach.iteration eq $RELATED_HEADER_COUNT} colspan="2" {/if}>
{if empty($HEADER_FIELD->get('source_field_name')) && ($HEADER_FIELD->isNameField() eq true or $HEADER_FIELD->getUIType() eq '4') && $RELATED_MODULE->isListViewNameFieldNavigationEnabled() && $RELATED_RECORD->isViewable()}
<a class="modCT_{$RELATED_MODULE_NAME} js-list__field js-popover-tooltip--record" data-js="width" title="" href="{$RELATED_RECORD->getDetailViewUrl()}">
Expand Down
2 changes: 1 addition & 1 deletion layouts/basic/modules/Vtiger/SummaryWidgetsContent.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
{foreach item=HEADER_FIELD from=$RELATED_HEADERS}
{$COUNT = $COUNT+1}
{assign var=RELATED_HEADERNAME value=$HEADER_FIELD->getFieldName()}
<td class="text-left {$WIDTHTYPE}
<td class="listViewEntryValue text-left {$WIDTHTYPE}
{if $RELATED_HEADERNAME && $HEADER_FIELD->getFieldDataType() eq 'documentsFileUpload' && $HEADER_FIELD->isEditable() && $RELATED_RECORD->isEditable() && 'I' === $RELATED_RECORD->getValueByField('filelocationtype') } js-drop-container{/if}"
data-id="{$RELATED_RECORD->getId()}"
data-module="{$RELATED_MODULE->getName()}"
Expand Down
2 changes: 1 addition & 1 deletion modules/Vtiger/uitypes/Email.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public function getDisplayValue($value, $record = false, $recordModel = false, $
$icon = $button = '';
if ('Base' !== \App\Mail::getMailComposer()) {
$icon = '<span class="fa-solid fa-envelope" aria-hidden="true"></span> ';
$button = "<button type=\"button\" class=\"btn btn-primary btn-xs ml-1 clipboard\" data-copy-attribute=\"clipboard-text\" data-clipboard-text=\"{$value}\" title=\"" . \App\Language::translate('BTN_COPY_TO_CLIPBOARD', $recordModel->getModuleName()) . '"><span class="fa-regular fa-copy"></span></button>';
$button = "<button type=\"button\" class=\"btn btn-primary btn-xs float-right clipboard\" data-copy-attribute=\"clipboard-text\" data-clipboard-text=\"{$value}\" title=\"" . \App\Language::translate('BTN_COPY_TO_CLIPBOARD', $recordModel->getModuleName()) . '"><span class="fa-regular fa-copy"></span></button>';
}
return "<a class=\"u-cursor-pointer js-email-compose \" {$data} data-js=\"click|container\">{$icon}{$value}</a>$button";
}
Expand Down
4 changes: 2 additions & 2 deletions modules/Vtiger/uitypes/Phone.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public function getDisplayValue($value, $record = false, $recordModel = false, $
if (!\App\Integrations\Pbx::isActive()) {
return '<a href="' . $href . '" class="js-popover-tooltip" title="' . $label . ' ' . trim($title) . '">' . $international . '</a>' . $extra;
}
$button = "<button type=\"button\" class=\"btn btn-primary btn-xs ml-1 clipboard\" data-copy-attribute=\"clipboard-text\" data-clipboard-text=\"{$international}\" title=\"" . \App\Language::translate('BTN_COPY_TO_CLIPBOARD', $recordModel->getModuleName()) . '"><span class="fa-regular fa-copy"></span></button>';
$button = "<button type=\"button\" class=\"btn btn-primary btn-xs float-right clipboard\" data-copy-attribute=\"clipboard-text\" data-clipboard-text=\"{$international}\" title=\"" . \App\Language::translate('BTN_COPY_TO_CLIPBOARD', $recordModel->getModuleName()) . '"><span class="fa-regular fa-copy"></span></button>';
$data = 'data-phone="' . preg_replace('/(?<!^)\+|[^\d+]+/', '', $international) . '"';
if ($record) {
$data .= ' data-record="' . $record . '"';
Expand All @@ -109,7 +109,7 @@ public function getTextParserDisplayValue($value, Vtiger_Record_Model $recordMod
$international = $phoneUtil->format($swissNumberProto, \libphonenumber\PhoneNumberFormat::INTERNATIONAL);
$href = $phoneUtil->format($swissNumberProto, $format);
} catch (\libphonenumber\NumberParseException $e) {
\App\Log::info($e->__toString(), __CLASS__);
\App\Log::info($e->__toString(), __CLASS__);
}
if (\libphonenumber\PhoneNumberFormat::RFC3966 !== $format) {
$href = 'tel:' . $href;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2836,7 +2836,7 @@ jQuery.Class(
// Not detail view page
return;
}
App.Fields.Text.registerCopyClipboard(detailViewContainer);
App.Fields.Text.registerCopyClipboard(detailViewContainer.find('.detailViewTable:not(.js-widget-general-info)'));
this.registerWidgetProductAndServices();
this.registerSetReadRecord(detailViewContainer);
this.getForm().validationEngine(app.validationEngineOptionsForRecord);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -990,6 +990,12 @@ jQuery.Class(
},
registerListEvents: function () {
let thisInstance = this;
let listRow = this.content.find('.listViewEntries.js-list__row');
if (listRow.length > 0) {
listRow.find('.clipboard').on('click', function (e) {
App.Fields.Text.registerCopyClipboard($(e.currentTarget));
});
}
this.content.find('a.favorites').on('click', function () {
let progressInstance = jQuery.progressIndicator({
position: 'html',
Expand Down
10 changes: 10 additions & 0 deletions public_html/layouts/basic/styles/_Style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -1578,6 +1578,16 @@ td.listViewEntryValue .row input {
.detailViewTable .fieldValue:hover .clipboard {
display: inline-block;
}
.c-detail-widget .fieldValue:hover .clipboard,
.listViewEntries .listViewEntryValue:hover .clipboard {
position: absolute;
}
.listViewEntries .listViewEntryValue:hover .clipboard {
right: 0;
}
.c-detail-widget .fieldValue:hover .clipboard {
right: 36px;
}
}
.listViewContentDiv {
position: relative;
Expand Down

0 comments on commit 712f855

Please sign in to comment.