mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Icons for attachments.
This commit is contained in:
parent
be030f15c4
commit
f12dfc8a14
@ -36,7 +36,8 @@ class General extends Twig_Extension
|
|||||||
$this->formatJournal(),
|
$this->formatJournal(),
|
||||||
$this->balance(),
|
$this->balance(),
|
||||||
$this->getAccountRole(),
|
$this->getAccountRole(),
|
||||||
$this->formatFilesize()
|
$this->formatFilesize(),
|
||||||
|
$this->mimeIcon(),
|
||||||
];
|
];
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -88,6 +89,26 @@ class General extends Twig_Extension
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Twig_SimpleFilter
|
||||||
|
*/
|
||||||
|
protected function mimeIcon()
|
||||||
|
{
|
||||||
|
return new Twig_SimpleFilter(
|
||||||
|
'mimeIcon', function ($string) {
|
||||||
|
switch ($string) {
|
||||||
|
default:
|
||||||
|
return 'fa-file-o';
|
||||||
|
case 'application/pdf':
|
||||||
|
return 'fa-file-pdf-o';
|
||||||
|
case 'image/png':
|
||||||
|
case 'image/jpeg':
|
||||||
|
return 'fa-file-image-o';
|
||||||
|
}
|
||||||
|
}, ['is_safe' => ['html']]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Twig_SimpleFilter
|
* @return Twig_SimpleFilter
|
||||||
*/
|
*/
|
||||||
|
@ -92,7 +92,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<i class="fa fa-file-pdf-o"></i>
|
<i class="fa {{ att.mime|mimeIcon }}"></i>
|
||||||
<a href="{{ route('attachment.download', att.id) }}" title="{{ att.filename }}">
|
<a href="{{ route('attachment.download', att.id) }}" title="{{ att.filename }}">
|
||||||
{% if att.title %}
|
{% if att.title %}
|
||||||
{{ att.title }}
|
{{ att.title }}
|
||||||
|
Loading…
Reference in New Issue
Block a user