Skip to content

Commit 50ead13

Browse files
committed
Improved the Tag list component
1 parent 8a7c6bc commit 50ead13

File tree

4 files changed

+20
-19
lines changed

4 files changed

+20
-19
lines changed

components/Tags.php

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ public function defineProperties()
3232
'showExternalParam' => false
3333
],
3434
'tagPage' => [
35-
'title' => 'indikator.news::lang.settings.tag_page_title',
36-
'description' => 'indikator.news::lang.settings.tag_page_description',
35+
'title' => 'indikator.news::lang.settings.tags_page_title',
36+
'description' => 'indikator.news::lang.settings.tags_page_description',
3737
'type' => 'dropdown',
3838
'default' => ''
3939
]
@@ -51,11 +51,14 @@ public function onRun()
5151
$news = Posts::where('status', 1)->where('published_at', '<=', date('Y-m-d H:i:00'))->get()->all();
5252

5353
foreach ($news as $post) {
54-
foreach ($post['tags'] as $tag) {
55-
if (! in_array($tag, $tags)) {
56-
$tags[] = $tag;
57-
}
58-
}
54+
if ($post['tags'] !== null) {
55+
$post['tags'] = explode(',', $post['tags']);
56+
foreach ($post['tags'] as $tag) {
57+
if (! in_array($tag, $tags)) {
58+
$tags[] = $tag;
59+
}
60+
}
61+
}
5962
}
6063

6164
usort($tags, function($item1, $item2) {

components/tags/default.htm

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
{% set tags = __SELF__.tags %}
2-
31
{% for tag in tags %}
42
{% if loop.first %}
5-
<ul>
3+
<ul class="tags">
64
{% endif %}
7-
<li><a href="/{{ tagPage }}/{{ tag }}">{{ tag }}</a></li>
5+
<li><a href="{{ tagPage }}/{{ tag }}">{{ tag }}</a></li>
86
{% if loop.last %}
97
</ul>
108
{% endif %}

lang/en/lang.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -247,10 +247,10 @@
247247
'category_filter_description' => 'Enter a category slug or URL parameter to filter the posts by. Leave empty to show all posts.',
248248
'nested_category_posts_title' => 'Nested Posts',
249249
'nested_category_posts_description' => 'Display posts which are in a nested category.',
250-
'tag_slug_title' => 'Tag slug',
251-
'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.',
252-
'tag_page_title' => 'Tag page',
253-
'tag_page_description' => 'Name of the tag page file for the tag links. This property is used by the default component partial.',
250+
'tags_slug_title' => 'Tag slug',
251+
'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.',
252+
'tags_page_title' => 'Tag page',
253+
'tags_page_description' => 'Name of the tag page file for the tag links. This property is used by the default component partial.',
254254
'links' => 'Links'
255255
],
256256
'sorting' => [

lang/hu/lang.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -245,10 +245,10 @@
245245
'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.',
246246
'nested_category_posts_title' => 'Alkategória',
247247
'nested_category_posts_description' => 'Alkategóriához tartozó bejegyzések megjelenítése.',
248-
'tag_slug_title' => 'Címke webcím',
249-
'tag_slug_description' => '',
250-
'tag_page_title' => 'Címke aloldal',
251-
'tag_page_description' => 'Adja meg a címke fájl nevét. Ennek alapján lesznek generálva a címke linkek webcíme.',
248+
'tags_slug_title' => 'Címke webcím',
249+
'tags_slug_description' => '',
250+
'tags_page_title' => 'Címke aloldal',
251+
'tags_page_description' => 'Adja meg a címke fájl nevét. Ennek alapján lesznek generálva a címke linkek webcíme.',
252252
'links' => 'Linkek'
253253
],
254254
'sorting' => [

0 commit comments

Comments
 (0)