Skip to content

Commit

Permalink
Improved the Tag list component
Browse files Browse the repository at this point in the history
  • Loading branch information
gergo85 committed Jul 14, 2022
1 parent 8a7c6bc commit 50ead13
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 19 deletions.
17 changes: 10 additions & 7 deletions components/Tags.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ public function defineProperties()
'showExternalParam' => false
],
'tagPage' => [
'title' => 'indikator.news::lang.settings.tag_page_title',
'description' => 'indikator.news::lang.settings.tag_page_description',
'title' => 'indikator.news::lang.settings.tags_page_title',
'description' => 'indikator.news::lang.settings.tags_page_description',
'type' => 'dropdown',
'default' => ''
]
Expand All @@ -51,11 +51,14 @@ public function onRun()
$news = Posts::where('status', 1)->where('published_at', '<=', date('Y-m-d H:i:00'))->get()->all();

foreach ($news as $post) {
foreach ($post['tags'] as $tag) {
if (! in_array($tag, $tags)) {
$tags[] = $tag;
}
}
if ($post['tags'] !== null) {
$post['tags'] = explode(',', $post['tags']);
foreach ($post['tags'] as $tag) {
if (! in_array($tag, $tags)) {
$tags[] = $tag;
}
}
}
}

usort($tags, function($item1, $item2) {
Expand Down
6 changes: 2 additions & 4 deletions components/tags/default.htm
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
{% set tags = __SELF__.tags %}

{% for tag in tags %}
{% if loop.first %}
<ul>
<ul class="tags">
{% endif %}
<li><a href="/{{ tagPage }}/{{ tag }}">{{ tag }}</a></li>
<li><a href="{{ tagPage }}/{{ tag }}">{{ tag }}</a></li>
{% if loop.last %}
</ul>
{% endif %}
Expand Down
8 changes: 4 additions & 4 deletions lang/en/lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -247,10 +247,10 @@
'category_filter_description' => 'Enter a category slug or URL parameter to filter the posts by. Leave empty to show all posts.',
'nested_category_posts_title' => 'Nested Posts',
'nested_category_posts_description' => 'Display posts which are in a nested category.',
'tag_slug_title' => 'Tag slug',
'tag_slug_description' => 'Look up the tag using the supplied slug value. This property is used by the default component partial for marking the currently active tag.',
'tag_page_title' => 'Tag page',
'tag_page_description' => 'Name of the tag page file for the tag links. This property is used by the default component partial.',
'tags_slug_title' => 'Tag slug',
'tags_slug_description' => 'Look up the tag using the supplied slug value. This property is used by the default component partial for marking the currently active tag.',
'tags_page_title' => 'Tag page',
'tags_page_description' => 'Name of the tag page file for the tag links. This property is used by the default component partial.',
'links' => 'Links'
],
'sorting' => [
Expand Down
8 changes: 4 additions & 4 deletions lang/hu/lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -245,10 +245,10 @@
'category_filter_description' => 'Adja meg a kategória webcímét, ami alapján szűrve lesznek a bejegyzések. Üresen hagyva minden bejegyzés meg fog jelenni.',
'nested_category_posts_title' => 'Alkategória',
'nested_category_posts_description' => 'Alkategóriához tartozó bejegyzések megjelenítése.',
'tag_slug_title' => 'Címke webcím',
'tag_slug_description' => '',
'tag_page_title' => 'Címke aloldal',
'tag_page_description' => 'Adja meg a címke fájl nevét. Ennek alapján lesznek generálva a címke linkek webcíme.',
'tags_slug_title' => 'Címke webcím',
'tags_slug_description' => '',
'tags_page_title' => 'Címke aloldal',
'tags_page_description' => 'Adja meg a címke fájl nevét. Ennek alapján lesznek generálva a címke linkek webcíme.',
'links' => 'Linkek'
],
'sorting' => [
Expand Down

0 comments on commit 50ead13

Please sign in to comment.