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 */
@media screen and (max-width: 880px){
body{
overflow-x:hidden;
}
.mobile{
display:inherit !important;
}
#top-bar .header{
overflow:hidden;
width:0px;
@ -283,14 +283,14 @@ nav#links a,
height:28px;
background-size:28px;
}
#top-bar .search-form{
display:block;
width:100%;
padding:0 35px;
margin:0;
}
.homepage-wrapper,
.search-wrapper{
width:95%;
@ -299,17 +299,17 @@ nav#links a,
.homepage-wrapper .search-wrapper{
width:100%;
}
.homepage-wrapper{
margin:90px auto;
}
.search-results,
.sub-menu-outer .sub-menu-inner{
width:95%;
max-width:500px;
}
.hamburger{
position:absolute;
top:0px;
@ -319,7 +319,7 @@ nav#links a,
line-height:22px;
cursor:pointer;
}
nav#links{
position:absolute;
width:100%;
@ -355,14 +355,14 @@ nav#links a,
line-height:2.5em;
margin:4px 0;
}
.profile,
.profile .profile-info{
overflow-wrap:break-word;
word-wrap:break-word;
overflow:hidden;
}
}
/* The moment the header starts getting squashed */
@ -381,7 +381,7 @@ nav#links a,
/* close to mobile in portrait */
@media screen and (max-width: 400px){
.profile .profile-photo{
width:60px;
border-radius:11.25px;
@ -390,5 +390,5 @@ nav#links a,
.profile .profile-info .url{
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` )
AGAINST ('$search' IN BOOLEAN MODE) " : "");
AGAINST ('$search' IN BOOLEAN MODE) " : '');
if (!is_null($community)) {
$sql_extra .= " and comm=" . intval($community) . " ";
$sql_extra .= ' AND `comm` = ' . intval($community) . ' ';
}
$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 ");
if (count($r)) {
$total = $r[0]['total'];
$a->set_pager_total($r[0]['total']);
$a->set_pager_total($total);
}
if ($alpha) {
$order = " order by name asc ";
$order = ' ORDER BY `name` ASC ';
} 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 ",

View File

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

View File

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