Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Less decimals for bbox info on project view page #4032

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 0 additions & 14 deletions assets/src/legacy/view.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,3 @@
var addDescriptionSlider = function(){
$('.liz-project-img').parent().mouseenter(function(){
var self = $(this);
self.find('.liz-project-desc').slideDown();
}).mouseleave(function(){
var self = $(this);
self.find('.liz-project-desc').hide();
}).click(function(){
var self = $(this);
window.location = self.parent().find('a.liz-project-view').attr('href');
return false;
});
}

var searchProjects = function(){
// Hide search if there are no projects
Expand Down Expand Up @@ -287,6 +274,5 @@ var searchProjects = function(){
}

window.addEventListener('load', function () {
addDescriptionSlider();
searchProjects();
});
2 changes: 1 addition & 1 deletion lizmap/modules/view/classes/lizmapMainViewItem.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function __construct($id, $title, $abstract = '', $keywordList = '', $pro
$this->abstract = $abstract;
$this->keywordList = $keywordList;
$this->proj = $proj;
$this->bbox = $bbox;
$this->bbox = preg_replace('/([0-9]+\.[0-9]{2})[0-9]+/', '$1', $bbox);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
$this->bbox = preg_replace('/([0-9]+\.[0-9]{2})[0-9]+/', '$1', $bbox);
$this->bbox = preg_replace('/([0-9]+\.[0-9]{6})[0-9]+/', '$1', $bbox);

Can you provide 6 decimals ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if I get the code at all... From a UX it would be nice to show 2 decimal places (rounded) for projected CRS, 6 I guess would be ok for geographical ones (degrees). Six decimals for CRSs in meters or feet do not give a good UX.

$this->url = $url;
$this->img = $img;
$this->order = $order;
Expand Down
6 changes: 4 additions & 2 deletions lizmap/modules/view/templates/view.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@
<a name="link-projet-{$idm}"></a>
<div class="thumbnail">
<div class="liz-project">
<img width="250" height="250" loading="lazy" src="{$p->img}" alt="project image" class="liz-project-img">
<p class="liz-project-desc" style="display:none;">
<a href="{$p->url}{if $hide_header}&h=0{/if}">
<img width="250" height="250" loading="lazy" src="{$p->img}" alt="project image" class="_liz-project-img">
<p class="liz-project-desc" >
<b class="title">{$p->title}</b>
<br/>
<br/><b>{@default.project.abstract.label@}</b>&nbsp;: <span class="abstract">{$p->abstract|strip_tags|truncate:100}</span>
Expand All @@ -25,6 +26,7 @@
<br/><b>{@default.project.projection.label@}</b>&nbsp;: <span class="proj">{$p->proj}</span>
<br/><b>{@default.project.bbox.label@}</b>&nbsp;: <span class="bbox">{$p->bbox}</span>
</p>
</a>
</div>
<h5 class="liz-project-title">{$p->title}</h5>
<p>
Expand Down
10 changes: 8 additions & 2 deletions lizmap/www/assets/css/view.css
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,24 @@
.liz-project-desc {
color: white;
font-size: 0.8em;
line-height: 0.8em;
line-height: 0em;
position: absolute;
bottom:-1px;
right:0px;
left:0px;
text-align: left;
text-transform: none;
background-color: rgba(0, 0, 0, 0.5);
padding:5px;
padding:0px;
margin:0px;
overflow-wrap: break-word;
}
.liz-project:hover .liz-project-desc {
line-height: 0.8em;
transition: line-height 300ms ease-in;
padding:5px;
}


.liz-project-title{
overflow-wrap: anywhere;
Expand Down
Loading