Skip to content

Commit a5458d1

Browse files
committed
UX - Remove keywords from the gray box on the landing page
1 parent a84e3c3 commit a5458d1

File tree

3 files changed

+19
-56
lines changed

3 files changed

+19
-56
lines changed

assets/src/legacy/view.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@ var searchProjects = function(){
4444
// Get unique keywords for visible projects
4545
var getVisibleProjectsKeywords = function() {
4646
var keywordList = [];
47-
var selector = '.liz-repository-project-item :visible .keywordList';
47+
var selector = '.liz-repository-project-item :visible .liz-project';
4848

4949
$(selector).each(function () {
50-
if ($(this).text() !== '') {
50+
if ($(this).attr('data-lizmap-keywords') !== '') {
5151
var keywordsSplitByComma = $(this).text().toUpperCase().split(', ');
5252
if (isGraph) {
5353
for (var index = 0; index < keywordsSplitByComma.length; index++) {
@@ -66,8 +66,8 @@ var searchProjects = function(){
6666
var getEdges = function () {
6767
var edgeList = [];
6868

69-
$('.liz-repository-project-item :visible .keywordList').each(function () {
70-
if ($(this).text() !== '') {
69+
$('.liz-repository-project-item :visible .liz-project').each(function () {
70+
if ($(this).attr('data-lizmap-keywords') !== '') {
7171
var keywordsSplitByComma = $(this).text().toUpperCase().split(', ');
7272
for (var index = 0; index < keywordsSplitByComma.length; index++) {
7373
var keywordsInGraph = keywordsSplitByComma[index].split('/');
@@ -95,9 +95,9 @@ var searchProjects = function(){
9595
$("#content.container .liz-repository-title").hide();
9696

9797
// Show project when its keywords match all keywords in selectedKeywords
98-
$('.keywordList').each(function () {
98+
$('.liz-project').each(function () {
9999
var showProject = false;
100-
var keywordListSplitByComma = $(this).text().toUpperCase().split(', ');
100+
var keywordListSplitByComma = $(this).attr('data-lizmap-keywords').toUpperCase().split(', ');
101101

102102
// Graph
103103
if (isGraph) {

lizmap/modules/view/templates/view.tpl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
data-lizmap-repository="{$mi->id}"
1818
data-lizmap-project="{$p->id}"
1919
data-lizmap-keywords="{$p->keywordList}"
20+
data-lizmap-title="{$p->title}"
21+
data-lizmap-abstract="{$p->abstract}"
2022
data-lizmap-bbox="{$p->bbox}"
2123
data-lizmap-proj="{$p->proj}">
2224
<a class="liz-project-view" href="{$p->url}{if $hide_header}&h=0{/if}">
@@ -25,8 +27,6 @@
2527
<b class="title">{$p->title}</b>
2628
<br/>
2729
<br/><b>{@default.project.abstract.label@}</b>&nbsp;: <span class="abstract">{$p->abstract|strip_tags|truncate:100}</span>
28-
<br/>
29-
<br/><b>{@default.project.keywordList.label@}</b>&nbsp;: <span class="keywordList">{$p->keywordList}</span>
3030
</p>
3131
</a>
3232
</div>

tests/end2end/playwright/project-homepage.spec.js

Lines changed: 11 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -8,68 +8,31 @@ test.describe('Projects homepage @readonly', function () {
88
await page.goto(url, { waitUntil: 'networkidle' });
99
});
1010

11-
test('should display project metadata (cold cache)', async function ({ page }) {
11+
test('should have project metadata', async function ({ page }) {
1212

1313
let project = page.locator('.liz-project').filter({ hasText: 'Test tags: nature, flower' });
1414
await expect(project).toHaveAttribute(
1515
"data-lizmap-proj",'EPSG:4326');
1616
await expect(project).toHaveAttribute(
1717
"data-lizmap-bbox", '-1.2459627329192546, -1.0, 1.2459627329192546, 1.0');
18-
19-
const allMetadata = await project.locator('.liz-project-desc');
20-
await expect(allMetadata).not.toBeVisible();
21-
22-
await project.hover();
23-
await expect(allMetadata).toBeVisible();
24-
await expect(allMetadata.locator('.title')).toContainText('Test tags: nature, flower');
25-
await expect(allMetadata.locator('.abstract')).toContainText('This is an abstract');
26-
await expect(allMetadata.locator('.keywordList')).toContainText('nature, flower');
27-
28-
// hover on header
29-
await page.locator('#headermenu').hover();
30-
await expect(allMetadata).not.toBeVisible();
18+
await expect(project).toHaveAttribute(
19+
"data-lizmap-title", 'Test tags: nature, flower');
20+
await expect(project).toHaveAttribute(
21+
"data-lizmap-abstract", 'This is an abstract');
22+
await expect(project).toHaveAttribute(
23+
"data-lizmap-keywords", 'nature, flower');
3124

3225
// another project
3326
project = page.locator('.liz-project').filter({ hasText: 'Tests tags: nature, tree' });
3427
await expect(project).toHaveAttribute(
3528
"data-lizmap-proj",'EPSG:4326');
3629
await expect(project).toHaveAttribute(
3730
"data-lizmap-bbox", '-1.2459627329192546, -1.0, 1.2459627329192546, 1.0');
38-
39-
const allMetadataTree = project.locator('.liz-project-desc');
40-
await expect(allMetadataTree).not.toBeVisible();
41-
42-
await project.hover();
43-
await expect(allMetadataTree).toBeVisible();
44-
await expect(allMetadataTree.locator('.title')).toContainText('Tests tags: nature, tree');
45-
await expect(allMetadataTree.locator('.abstract')).toContainText('Tags: nature, tree');
46-
await expect(allMetadataTree.locator('.keywordList')).toContainText('nature, tree');
47-
48-
// hover on header
49-
await page.locator('#headermenu').hover();
50-
await expect(allMetadataTree).not.toBeVisible();
51-
52-
});
53-
54-
test('should display project metadata (hot cache)', async function ({ page }) {
55-
56-
const project = page.locator('.liz-project').filter({ hasText: 'Test tags: nature, flower' });
5731
await expect(project).toHaveAttribute(
58-
"data-lizmap-proj",'EPSG:4326');
32+
"data-lizmap-title", 'Tests tags: nature, tree');
5933
await expect(project).toHaveAttribute(
60-
"data-lizmap-bbox", '-1.2459627329192546, -1.0, 1.2459627329192546, 1.0');
61-
const allMetadata = project.locator('.liz-project-desc');
62-
await expect(allMetadata).not.toBeVisible();
63-
64-
await project.hover();
65-
await expect(allMetadata).toBeVisible();
66-
await expect(allMetadata.locator('.title')).toContainText('Test tags: nature, flower');
67-
await expect(allMetadata.locator('.abstract')).toContainText('This is an abstract');
68-
await expect(allMetadata.locator('.keywordList')).toContainText('nature, flower');
69-
70-
// hover on header
71-
await page.locator('#headermenu').hover();
72-
await expect(allMetadata).not.toBeVisible();
73-
34+
"data-lizmap-abstract", 'Tags: nature, tree');
35+
await expect(project).toHaveAttribute(
36+
"data-lizmap-keywords", 'nature, tree');
7437
});
7538
});

0 commit comments

Comments
 (0)