1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 13:12:50 +01:00

Inline downloads for file resources

This commit is contained in:
David Bomba 2021-09-27 08:03:11 +10:00
parent ee947ad6c6
commit f35ad6a5a3
3 changed files with 10 additions and 16 deletions

View File

@ -20,10 +20,10 @@ use Illuminate\Database\Eloquent\Builder;
class DocumentFilters extends QueryFilters class DocumentFilters extends QueryFilters
{ {
public function client_id(int $client_id) :Builder // public function client_id(int $client_id) :Builder
{ // {
return $this->builder->where('client_id', $client_id); // return $this->builder->where('client_id', $client_id);
} // }
/** /**
* Filter based on search text. * Filter based on search text.

View File

@ -57,7 +57,12 @@ class DocumentController extends Controller
{ {
$document = Document::where('hash', $document_hash)->firstOrFail(); $document = Document::where('hash', $document_hash)->firstOrFail();
return Storage::disk($document->disk)->download($document->url, $document->name); $headers = [];
if(request()->input('inline') == 'true')
$headers = array_merge($headers, ['Content-Disposition' => 'inline']);
return Storage::disk($document->disk)->download($document->url, $document->name, $headers);
} }
public function downloadMultiple(DownloadMultipleDocumentsRequest $request) public function downloadMultiple(DownloadMultipleDocumentsRequest $request)

View File

@ -43,37 +43,26 @@ class GatewayType extends StaticModel
switch ($type) { switch ($type) {
case self::CREDIT_CARD: case self::CREDIT_CARD:
return ctrans('texts.credit_card'); return ctrans('texts.credit_card');
break;
case self::BANK_TRANSFER: case self::BANK_TRANSFER:
return ctrans('texts.bank_transfer'); return ctrans('texts.bank_transfer');
break;
case self::PAYPAL: case self::PAYPAL:
return ctrans('texts.paypal'); return ctrans('texts.paypal');
break;
case self::CRYPTO: case self::CRYPTO:
return ctrans('texts.crypto'); return ctrans('texts.crypto');
break;
case self::CUSTOM: case self::CUSTOM:
return ctrans('texts.custom'); return ctrans('texts.custom');
break;
case self::ALIPAY: case self::ALIPAY:
return ctrans('texts.alipay'); return ctrans('texts.alipay');
break;
case self::SOFORT: case self::SOFORT:
return ctrans('texts.sofort'); return ctrans('texts.sofort');
break;
case self::APPLE_PAY: case self::APPLE_PAY:
return ctrans('texts.apple_pay'); return ctrans('texts.apple_pay');
break;
case self::SEPA: case self::SEPA:
return ctrans('texts.sepa'); return ctrans('texts.sepa');
break;
case self::KBC: case self::KBC:
return ctrans('texts.kbc_cbc'); return ctrans('texts.kbc_cbc');
break;
case self::BANCONTACT: case self::BANCONTACT:
return ctrans('texts.bancontact'); return ctrans('texts.bancontact');
break;
default: default:
return 'Undefined.'; return 'Undefined.';