Skip to content

Commit 8e5998e

Browse files
committed
Better search version filtering
1 parent 9d1eb4d commit 8e5998e

3 files changed

Lines changed: 26 additions & 8 deletions

File tree

src/templates/forms/misc/search_input.txp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
<txp:variable name="compatibility" value='<txp:page_url type="compatibility" />' />
21
<div class="wrapper-inner zebra">
32
<div class="container" itemscope itemtype="https://schema.org/WebSite">
43
<meta itemprop="url" content="<txp:site_url />">
@@ -7,7 +6,7 @@
76
<input id="q" name="q" type="search" size="28" placeholder="Search plugins…" itemprop="query-input"<txp:if_search> value="<txp:search_term />"</txp:if_search>>
87
<input class="button-primary" type="submit" value="Search">
98
<br>
10-
<label for="textpattern-target">Textpattern version compatibility</label>
9+
<label for="textpattern-target">Textpattern version compatibility verified</label>
1110
<select id="textpattern-target" name="compatibility">
1211
<txp:category_list type="file" parent="txp-version" exclude="txp-version" sort="name desc" break="">
1312
<option<txp:if_variable name="compatibility" value='<txp:category title />'> selected</txp:if_variable>><txp:category title /></option>

src/templates/pages/default.txp

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@
4444
<txp:variable name="homepage" value="1" />
4545
</txp:if_category>
4646
</txp:if_search>
47-
<txp:variable name="min-txp-version-unverified" value='<txp:category_list type="file" parent="txp-version" exclude="txp-version" limit="1"><txp:category title /></txp:category_list>' />
48-
<txp:variable name="max-txp-version-unverified" value='<txp:category_list type="file" parent="txp-version" exclude="txp-version" limit="1" sort="name desc"><txp:category title /></txp:category_list>' />
47+
<txp:variable name="min-txp-version-unverified" value='<txp:category_list type="file" parent="txp-version" exclude="txp-version,any" limit="1"><txp:category title /></txp:category_list>' />
48+
<txp:variable name="max-txp-version-unverified" value='<txp:category_list type="file" parent="txp-version" exclude="txp-version,any" limit="1" sort="name desc"><txp:category title /></txp:category_list>' />
4949
</head>
5050
<txp:if_variable name="homepage">
5151
<body itemscope itemtype="https://schema.org/WebPage">
@@ -104,7 +104,16 @@
104104
</main>
105105
<txp:else />
106106
<txp:if_search>
107-
<txp:article min-txp-version-verified='%%<txp:page_url type="compatibility" />' max-txp-version-verified='<txp:page_url type="compatibility" />%%' pgonly limit="12" />
107+
<txp:variable name="compatibility" value='<txp:page_url type="compatibility" />' />
108+
<txp:if_variable name="compatibility">
109+
<txp:if_variable name="compatibility" value="Any">
110+
<txp:article pgonly limit="12" />
111+
<txp:else />
112+
<txp:article min-txp-version-verified='%%<txp:page_url type="compatibility" />' max-txp-version-verified='<txp:page_url type="compatibility" />%%' pgonly limit="12" />
113+
</txp:if_variable>
114+
<txp:else />
115+
<txp:article pgonly limit="12" />
116+
</txp:if_variable>
108117
<body itemscope itemtype="https://schema.org/SearchResultsPage">
109118
<txp:output_form form="body_header" />
110119
<main aria-label="Main content">
@@ -116,7 +125,15 @@
116125
<div class="article-description" itemprop="description">
117126
<p><txp:search_result_count text="article(s) found" /> matching your search request <q><txp:search_term /></q>.</p>
118127
</div>
119-
<txp:article min-txp-version-verified='%%<txp:page_url type="compatibility" />' max-txp-version-verified='<txp:page_url type="compatibility" />%%' searchform="article_listing" limit="12" wraptag="div" class="layout-container" />
128+
<txp:if_variable name="compatibility">
129+
<txp:if_variable name="compatibility" value="Any">
130+
<txp:article searchform="article_listing" limit="12" wraptag="div" class="layout-container" />
131+
<txp:else />
132+
<txp:article min-txp-version-verified='%%<txp:page_url type="compatibility" />' max-txp-version-verified='<txp:page_url type="compatibility" />%%' searchform="article_listing" limit="12" wraptag="div" class="layout-container" />
133+
</txp:if_variable>
134+
<txp:else />
135+
<txp:article searchform="article_listing" limit="12" wraptag="div" class="layout-container" />
136+
</txp:if_variable>
120137
<txp:output_form form="pagination" />
121138
<txp:else />
122139
<div class="article-description" itemprop="description">

src/templates/pages/plugins.txp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,15 @@ if (!empty($json->legacy)) {
5555
"stable": {
5656
"version": "<txp:variable name="json-stable-version" escape="json" />",
5757
<txp:if_custom_field name="max-txp-version-verified">"verifiedMaxTxpCompatibility": "<txp:custom_field name="max-txp-version-verified" escape="json" />",</txp:if_custom_field>
58+
<txp:if_custom_field name="min-txp-version-verified">"verifiedMinTxpCompatibility": "<txp:custom_field name="min-txp-version-verified" escape="json" />",</txp:if_custom_field>
5859
<txp:if_variable name="json-stable-date">"datePublished": "<txp:variable name="json-stable-date" escape="json" />",</txp:if_variable>
5960
<txp:if_variable name="json-stable-php">"endpointUrl": "<txp:variable name="json-stable-php" escape="json" />"<txp:else />"endpointUrl": "<txp:variable name="json-stable-txt" escape="json" />"</txp:if_variable>
6061
}
6162
<txp:else />
6263
"beta": {
6364
"version": "<txp:variable name="json-beta-version" escape="json" />",
6465
<txp:if_custom_field name="max-txp-version-verified-beta">"verifiedMaxTxpCompatibility": "<txp:custom_field name="max-txp-version-verified-beta" escape="json" />",</txp:if_custom_field>
66+
<txp:if_custom_field name="min-txp-version-verified">"verifiedMinTxpCompatibility": "<txp:custom_field name="min-txp-version-verified" escape="json" />",</txp:if_custom_field>
6567
<txp:if_variable name="json-beta-date">"datePublished": "<txp:variable name="json-beta-date" escape="json" />",</txp:if_variable>
6668
<txp:if_variable name="json-beta-php">"endpointUrl": "<txp:variable name="json-beta-php" escape="json" />"<txp:else />"endpointUrl": "<txp:variable name="json-beta-txt" escape="json" />"</txp:if_variable>
6769
}
@@ -198,8 +200,8 @@ if (!empty($json->legacy)) {
198200
}
199201
</script>
200202
</txp:if_article_list>
201-
<txp:variable name="min-txp-version-unverified" value='<txp:category_list type="file" parent="txp-version" exclude="txp-version" limit="1"><txp:category title /></txp:category_list>' />
202-
<txp:variable name="max-txp-version-unverified" value='<txp:category_list type="file" parent="txp-version" exclude="txp-version" limit="1" sort="name desc"><txp:category title /></txp:category_list>' />
203+
<txp:variable name="min-txp-version-unverified" value='<txp:category_list type="file" parent="txp-version" exclude="txp-version,any" limit="1"><txp:category title /></txp:category_list>' />
204+
<txp:variable name="max-txp-version-unverified" value='<txp:category_list type="file" parent="txp-version" exclude="txp-version,any" limit="1" sort="name desc"><txp:category title /></txp:category_list>' />
203205
</head>
204206
<txp:if_article_list>
205207
<body itemscope itemtype="https://schema.org/CollectionPage">

0 commit comments

Comments
 (0)