Update search page display

This commit is contained in:
Hypolite Petovan 2017-05-04 21:33:44 -04:00
parent a35dab70b8
commit 9af47634e3
4 changed files with 35 additions and 40 deletions

View file

@ -267,15 +267,15 @@ nav#links a,
/* smaller than tablet in portrait */ /* smaller than tablet in portrait */
@media screen and (max-width: 880px){ @media screen and (max-width: 880px){
body{ body{
overflow-x:hidden; overflow-x:hidden;
} }
.mobile{ .mobile{
display:inherit !important; display:inherit !important;
} }
#top-bar .header{ #top-bar .header{
overflow:hidden; overflow:hidden;
width:0px; width:0px;
@ -283,14 +283,14 @@ nav#links a,
height:28px; height:28px;
background-size:28px; background-size:28px;
} }
#top-bar .search-form{ #top-bar .search-form{
display:block; display:block;
width:100%; width:100%;
padding:0 35px; padding:0 35px;
margin:0; margin:0;
} }
.homepage-wrapper, .homepage-wrapper,
.search-wrapper{ .search-wrapper{
width:95%; width:95%;
@ -299,17 +299,17 @@ nav#links a,
.homepage-wrapper .search-wrapper{ .homepage-wrapper .search-wrapper{
width:100%; width:100%;
} }
.homepage-wrapper{ .homepage-wrapper{
margin:90px auto; margin:90px auto;
} }
.search-results, .search-results,
.sub-menu-outer .sub-menu-inner{ .sub-menu-outer .sub-menu-inner{
width:95%; width:95%;
max-width:500px; max-width:500px;
} }
.hamburger{ .hamburger{
position:absolute; position:absolute;
top:0px; top:0px;
@ -319,7 +319,7 @@ nav#links a,
line-height:22px; line-height:22px;
cursor:pointer; cursor:pointer;
} }
nav#links{ nav#links{
position:absolute; position:absolute;
width:100%; width:100%;
@ -355,14 +355,14 @@ nav#links a,
line-height:2.5em; line-height:2.5em;
margin:4px 0; margin:4px 0;
} }
.profile, .profile,
.profile .profile-info{ .profile .profile-info{
overflow-wrap:break-word; overflow-wrap:break-word;
word-wrap:break-word; word-wrap:break-word;
overflow:hidden; overflow:hidden;
} }
} }
/* The moment the header starts getting squashed */ /* The moment the header starts getting squashed */
@ -381,7 +381,7 @@ nav#links a,
/* close to mobile in portrait */ /* close to mobile in portrait */
@media screen and (max-width: 400px){ @media screen and (max-width: 400px){
.profile .profile-photo{ .profile .profile-photo{
width:60px; width:60px;
border-radius:11.25px; border-radius:11.25px;
@ -390,5 +390,5 @@ nav#links a,
.profile .profile-info .url{ .profile .profile-info .url{
display:none; display:none;
} }
} }

View file

@ -51,10 +51,10 @@ function search_content(App $a)
} }
$sql_extra = ((strlen($search)) ? " AND MATCH (`name`, `pdesc`, `homepage`, `locality`, `region`, `country-name`, `tags` ) $sql_extra = ((strlen($search)) ? " AND MATCH (`name`, `pdesc`, `homepage`, `locality`, `region`, `country-name`, `tags` )
AGAINST ('$search' IN BOOLEAN MODE) " : ""); AGAINST ('$search' IN BOOLEAN MODE) " : '');
if (!is_null($community)) { if (!is_null($community)) {
$sql_extra .= " and comm=" . intval($community) . " "; $sql_extra .= ' AND `comm` = ' . intval($community) . ' ';
} }
$sql_extra = str_replace('%', '%%', $sql_extra); $sql_extra = str_replace('%', '%%', $sql_extra);
@ -63,13 +63,13 @@ function search_content(App $a)
$r = q("SELECT COUNT(*) AS `total` FROM `profile` WHERE `censored` = 0 $sql_extra "); $r = q("SELECT COUNT(*) AS `total` FROM `profile` WHERE `censored` = 0 $sql_extra ");
if (count($r)) { if (count($r)) {
$total = $r[0]['total']; $total = $r[0]['total'];
$a->set_pager_total($r[0]['total']); $a->set_pager_total($total);
} }
if ($alpha) { if ($alpha) {
$order = " order by name asc "; $order = ' ORDER BY `name` ASC ';
} else { } else {
$order = " order by updated desc, id desc "; $order = ' ORDER BY `updated` DESC, `id` DESC ';
} }
$r = q("SELECT * FROM `profile` WHERE `censored` = 0 $sql_extra $order LIMIT %d , %d ", $r = q("SELECT * FROM `profile` WHERE `censored` = 0 $sql_extra $order LIMIT %d , %d ",

View file

@ -7,26 +7,23 @@
</div> </div>
<div class="search-results"> <div class="search-results">
<h3>Results for "<?php echo $query; ?>" (<?php echo $total; ?>)</h3>
<div class="profiles"> <div class="profiles">
<?php if (count($results)): ?> <?php if (count($results)): ?>
<h3>Results for "<?php echo $query; ?>" (<?php echo $total; ?>)</h3>
<?php <?php
foreach ($results as $profile) foreach ($results as $profile) {
echo $this->view('_profile', array('profile'=>$profile)); echo $this->view('_profile', array('profile' => $profile));
}
echo $this->paginate();
?> ?>
<?php else: ?> <?php else: ?>
<h3>There were no results</h3> <h3>There were no results</h3>
<?php endif ?> <?php endif ?>
</div> </div>
<?php echo $this->paginate();?>
</div> </div>

View file

@ -5,13 +5,11 @@ $finding
<div id="forum-link"><a href="$forum">$toggle</a></div> <div id="forum-link"><a href="$forum">$toggle</a></div>
<div id="alpha-link"><a href="$alink">$alpha</a></div> <div id="alpha-link"><a href="$alink">$alpha</a></div>
<div id="directory-search-wrapper"> <div id="directory-search-wrapper">
<form id="directory-search-form" action="directory$args" method="get" > <form id="directory-search-form" action="search$args" method="get" >
<input type="text" name="search" id="directory-search" class="search-input" onfocus="this.select();" value="$search" /> <input type="text" name="query" id="directory-search" class="search-input" onfocus="this.select();" value="$search" />
<input type="submit" name="submit" id="directory-search-submit" value="$submit" /> <button type="submit" name="submit" id="directory-search-submit" value="submit" >$submit</button>
<input type="submit" name="submit" id="directory-search-clear" value="$clear" /> lear">$clear</button>
</form> </form>
</div> </div>
<div id="directory-search-end"></div> <div id="directory-search-end"></div>