Skip to content

Commit 2d35957

Browse files
Use new filtered tags relationships instead of filter method
1 parent c52a2b3 commit 2d35957

File tree

3 files changed

+36
-428
lines changed

3 files changed

+36
-428
lines changed

html-templates/projects/project.tpl

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -144,37 +144,32 @@
144144
{/if}
145145
<hr>
146146
<!-- TAGS BLOCK -->
147-
{if $Project->Tags}
148-
{$Tags = Tag::getTagsWithPrefix($Project->Tags,"tech")}
149-
{if $Tags}
147+
{if $Project->TechTags}
150148
{_ "Tech"}:
151149
<ul>
152-
{foreach item=Tag from=$Tags}
150+
{foreach item=Tag from=$Project->TechTags}
153151
<li>{contextLink $Tag}</li>
154152
{/foreach}
155153
</ul>
156154
{/if}
157155

158-
{$Tags = Tag::getTagsWithPrefix($Project->Tags,"topic")}
159-
{if $Tags}
156+
{if $Project->TopicTags}
160157
{_ "Topics"}:
161158
<ul>
162-
{foreach item=Tag from=$Tags}
159+
{foreach item=Tag from=$Project->TopicTags}
163160
<li>{contextLink $Tag}</li>
164161
{/foreach}
165162
</ul>
166163
{/if}
167164

168-
{$Tags = Tag::getTagsWithPrefix($Project->Tags,"event")}
169-
{if $Tags}
165+
{if $Project->EventTags}
170166
{_ "Events"}:
171167
<ul>
172-
{foreach item=Tag from=$Tags}
168+
{foreach item=Tag from=$Project->EventTags}
173169
<li>{contextLink $Tag}</li>
174170
{/foreach}
175171
</ul>
176172
{/if}
177-
{/if}
178173

179174
<hr>
180175

php-classes/Laddr/Project.php

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,36 @@ class Project extends \VersionedRecord
9696
'linkClass' => \TagItem::class,
9797
'linkLocal' => 'ContextID',
9898
'conditions' => ['Link.ContextClass = "Laddr\\\\Project"']
99+
],
100+
'TopicTags' => [
101+
'type' => 'many-many',
102+
'class' => \Tag::class,
103+
'linkClass' => \TagItem::class,
104+
'linkLocal' => 'ContextID',
105+
'conditions' => [
106+
'Link.ContextClass = "Laddr\\\\Project"',
107+
'Related.Handle LIKE "topic.%"'
108+
]
109+
],
110+
'TechTags' => [
111+
'type' => 'many-many',
112+
'class' => \Tag::class,
113+
'linkClass' => \TagItem::class,
114+
'linkLocal' => 'ContextID',
115+
'conditions' => [
116+
'Link.ContextClass = "Laddr\\\\Project"',
117+
'Related.Handle LIKE "tech.%"'
118+
]
119+
],
120+
'EventTags' => [
121+
'type' => 'many-many',
122+
'class' => \Tag::class,
123+
'linkClass' => \TagItem::class,
124+
'linkLocal' => 'ContextID',
125+
'conditions' => [
126+
'Link.ContextClass = "Laddr\\\\Project"',
127+
'Related.Handle LIKE "event.%"'
128+
]
99129
]
100130
];
101131

0 commit comments

Comments
 (0)