mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-16 17:33:45 +00:00
Show attachments to tags #2828
This commit is contained in:
@@ -242,6 +242,7 @@ class TagController extends Controller
|
|||||||
$start = $start ?? session('start');
|
$start = $start ?? session('start');
|
||||||
$end = $end ?? session('end');
|
$end = $end ?? session('end');
|
||||||
$location = $this->repository->getLocation($tag);
|
$location = $this->repository->getLocation($tag);
|
||||||
|
$attachments = $this->repository->getAttachments($tag);
|
||||||
$subTitle = trans(
|
$subTitle = trans(
|
||||||
'firefly.journals_in_period_for_tag',
|
'firefly.journals_in_period_for_tag',
|
||||||
['tag' => $tag->tag, 'start' => $start->formatLocalized($this->monthAndDayFormat),
|
['tag' => $tag->tag, 'start' => $start->formatLocalized($this->monthAndDayFormat),
|
||||||
@@ -263,7 +264,7 @@ class TagController extends Controller
|
|||||||
$groups->setPath($path);
|
$groups->setPath($path);
|
||||||
$sums = $this->repository->sumsOfTag($tag, $start, $end);
|
$sums = $this->repository->sumsOfTag($tag, $start, $end);
|
||||||
|
|
||||||
return view('tags.show', compact('tag', 'sums', 'periods', 'subTitle', 'subTitleIcon', 'groups', 'start', 'end', 'location'));
|
return view('tags.show', compact('tag', 'attachments', 'sums', 'periods', 'subTitle', 'subTitleIcon', 'groups', 'start', 'end', 'location'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -285,6 +286,7 @@ class TagController extends Controller
|
|||||||
$subTitle = (string) trans('firefly.all_journals_for_tag', ['tag' => $tag->tag]);
|
$subTitle = (string) trans('firefly.all_journals_for_tag', ['tag' => $tag->tag]);
|
||||||
$start = $this->repository->firstUseDate($tag) ?? new Carbon;
|
$start = $this->repository->firstUseDate($tag) ?? new Carbon;
|
||||||
$end = new Carbon;
|
$end = new Carbon;
|
||||||
|
$attachments = $this->repository->getAttachments($tag);
|
||||||
$path = route('tags.show', [$tag->id, 'all']);
|
$path = route('tags.show', [$tag->id, 'all']);
|
||||||
$location = $this->repository->getLocation($tag);
|
$location = $this->repository->getLocation($tag);
|
||||||
/** @var GroupCollectorInterface $collector */
|
/** @var GroupCollectorInterface $collector */
|
||||||
@@ -295,7 +297,7 @@ class TagController extends Controller
|
|||||||
$groups->setPath($path);
|
$groups->setPath($path);
|
||||||
$sums = $this->repository->sumsOfTag($tag, $start, $end);
|
$sums = $this->repository->sumsOfTag($tag, $start, $end);
|
||||||
|
|
||||||
return view('tags.show', compact('tag', 'sums', 'periods', 'subTitle', 'subTitleIcon', 'groups', 'start', 'end', 'location'));
|
return view('tags.show', compact('tag', 'attachments', 'sums', 'periods', 'subTitle', 'subTitleIcon', 'groups', 'start', 'end', 'location'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -185,7 +185,7 @@ class TagRepository implements TagRepositoryInterface
|
|||||||
public function getTagsInYear(?int $year): array
|
public function getTagsInYear(?int $year): array
|
||||||
{
|
{
|
||||||
// get all tags in the year (if present):
|
// get all tags in the year (if present):
|
||||||
$tagQuery = $this->user->tags()->with(['locations'])->orderBy('tags.tag');
|
$tagQuery = $this->user->tags()->with(['locations', 'attachments'])->orderBy('tags.tag');
|
||||||
|
|
||||||
// add date range (or not):
|
// add date range (or not):
|
||||||
if (null === $year) {
|
if (null === $year) {
|
||||||
@@ -203,10 +203,11 @@ class TagRepository implements TagRepositoryInterface
|
|||||||
foreach ($collection as $tag) {
|
foreach ($collection as $tag) {
|
||||||
// return value for tag cloud:
|
// return value for tag cloud:
|
||||||
$return[$tag->id] = [
|
$return[$tag->id] = [
|
||||||
'tag' => $tag->tag,
|
'tag' => $tag->tag,
|
||||||
'id' => $tag->id,
|
'id' => $tag->id,
|
||||||
'created_at' => $tag->created_at,
|
'created_at' => $tag->created_at,
|
||||||
'location' => $tag->locations->first(),
|
'location' => $tag->locations->first(),
|
||||||
|
'attachments' => $tag->attachments,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -37,8 +37,7 @@
|
|||||||
style="font-weight: normal;font-size:0.9em;"
|
style="font-weight: normal;font-size:0.9em;"
|
||||||
|
|
||||||
title="{{ tagInfo.created_at.formatLocalized(monthAndDayFormat) }}"
|
title="{{ tagInfo.created_at.formatLocalized(monthAndDayFormat) }}"
|
||||||
href="{{ route('tags.show',tagInfo.id) }}">{% if tagInfo.location %}<i
|
href="{{ route('tags.show',tagInfo.id) }}">{% if tagInfo.location %}<i class="fa fa-fw fa-map-marker"></i>{% endif %}<i class="fa fa-fw fa-tag"></i>{{ tagInfo.tag }}{% if tagInfo.attachments.count > 0 %}<i class="fa fa-fw fa-paperclip"></i>{% endif %}</a></div>
|
||||||
class="fa fa-fw fa-map-marker"></i>{% endif %}<i class="fa fa-fw fa-tag"></i>{{ tagInfo.tag }}</a></div>
|
|
||||||
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
|
@@ -111,6 +111,23 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
{% if attachments.count > 0 %}
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
|
||||||
|
<div class="box">
|
||||||
|
<div class="box-header with-border">
|
||||||
|
<h3 class="box-title">
|
||||||
|
{{ 'attachments'|_ }}
|
||||||
|
</h3>
|
||||||
|
</div>
|
||||||
|
<div class="box-body table-responsive no-padding">
|
||||||
|
{% include 'list.attachments' %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{% if periods|length > 0 %}
|
{% if periods|length > 0 %}
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-lg-offset-10 col-lg-2 col-md-offset-10 col-md-2 col-sm-12 col-xs-12">
|
<div class="col-lg-offset-10 col-lg-2 col-md-offset-10 col-md-2 col-sm-12 col-xs-12">
|
||||||
|
Reference in New Issue
Block a user