1
0
mirror of https://github.com/freescout-helpdesk/freescout.git synced 2024-11-24 19:33:07 +01:00

Show customer social profiles

This commit is contained in:
FreeScout 2020-11-19 03:13:17 -08:00
parent 4f8063214f
commit bd1278aab4
2 changed files with 13 additions and 6 deletions

View File

@ -1148,7 +1148,7 @@ class Customer extends Model
{
if (!empty($this->photo_url) || !$default_if_empty) {
if (!empty($this->photo_url)) {
return Storage::url(self::PHOTO_DIRECTORY.DIRECTORY_SEPARATOR.$this->photo_url);
return self::getPhotoUrlByFileName($this->photo_url);
} else {
return '';
}
@ -1157,6 +1157,11 @@ class Customer extends Model
}
}
public static function getPhotoUrlByFileName($file_name)
{
return Storage::url(self::PHOTO_DIRECTORY.DIRECTORY_SEPARATOR.$file_name);
}
/**
* Resize and save photo.
*/
@ -1234,11 +1239,13 @@ class Customer extends Model
$sp['type_name'] = self::$social_type_names[$sp['type']];
if (!preg_match("/^https?:\/\//i", $sp['value'])) {
$sp['value'] = 'http://'.$sp['value'];
$sp['value_url'] = $sp['value'];
if (!preg_match("/^https?:\/\//i", $sp['value_url'])) {
$sp['value_url'] = 'http://'.$sp['value_url'];
}
if (empty($sp['value'])) {
$sp['value'] = '';
if (empty($sp['value_url'])) {
$sp['value_url'] = '';
}
return $sp;

View File

@ -31,7 +31,7 @@
<a href="{{ $website }}" target="_blank" title="{{ parse_url($website, PHP_URL_HOST) }}" data-toggle="tooltip" class="glyphicon glyphicon-globe"></a>
@endforeach
@foreach ($customer->getSocialProfiles() as $sp)
<a href="{{ App\Customer::formatSocialProfile($sp)['value'] }}" target="_blank" data-toggle="tooltip" title="{{ App\Customer::formatSocialProfile($sp)['type_name'] }}" class="glyphicon glyphicon-user"></a>
<a href="{{ App\Customer::formatSocialProfile($sp)['value_url'] }}" target="_blank" data-toggle="tooltip" title="{{ App\Customer::formatSocialProfile($sp)['type_name'] }}" class="glyphicon glyphicon-user"></a>
@endforeach
</div>
@endif