forked from projects/thebadspace
Updated search and listing links, added new icons
Search methodolgy has been tweaked and the correspending result links have been updated, as well as links in the Listing page to display both silence and suspend counts and the overall heat rating. Also plugged in new silence and suspend icons provideb by https://rage.love/@puf. Big thanks for that, man.
This commit is contained in:
parent
0a64de2378
commit
175ea25d7b
7 changed files with 92 additions and 42 deletions
|
@ -11,24 +11,24 @@ class FrontIndexController extends Controller
|
|||
{
|
||||
private $limit = 15;
|
||||
|
||||
public function start()
|
||||
private function getRecent()
|
||||
{
|
||||
$sources = Source::where("active", true)->get();
|
||||
$locations = Location::where("active", true)->orderByDesc('updated_at')->get();
|
||||
$list = [];
|
||||
foreach ($locations as $location) {
|
||||
if (($location->block_count + $location->silence_count) > 2) {
|
||||
if (($location->block_count + $location->silence_count) >= 2) {
|
||||
array_push($list, $location);
|
||||
}
|
||||
}
|
||||
return $list;
|
||||
}
|
||||
|
||||
$recentList = Location::where("active", true)
|
||||
->where('block_count', '>', 2)
|
||||
->limit(10)->orderByDesc('updated_at')->get();
|
||||
|
||||
public function start()
|
||||
{
|
||||
$list = $this->getRecent();
|
||||
return view('front.index', [
|
||||
'count' => count($list),
|
||||
'sources' => count($sources),
|
||||
'sources' => count(Source::where("active", true)->get()),
|
||||
'recent' => $list,
|
||||
'title' => "The Bad Space"
|
||||
]);
|
||||
|
@ -36,6 +36,7 @@ class FrontIndexController extends Controller
|
|||
|
||||
public function indexSearch(Request $request)
|
||||
{
|
||||
// this grabs the search results from the db
|
||||
$terms = $request->index_search;
|
||||
$rawSearch = $terms;
|
||||
$terms = str_replace(",", "", $terms);
|
||||
|
@ -48,18 +49,17 @@ class FrontIndexController extends Controller
|
|||
}
|
||||
}
|
||||
|
||||
$locations = Location::where("active", true)->get();
|
||||
$count = count($locations);
|
||||
$recent = Location::where("active", true)
|
||||
->where('block_count', '>', 2)
|
||||
->where('silence_count', '>', 2)
|
||||
->limit(10)->orderByDesc('updated_at')->get();
|
||||
//this gets recent updates to display under search results
|
||||
$list = $this->getRecent();
|
||||
|
||||
return view('front.index', [
|
||||
'count' => $count,
|
||||
'recent' => $recent,
|
||||
'title' => "The Bad Space",
|
||||
'results' => $results
|
||||
'count' => count($list),
|
||||
'sources' => count(Source::where("active", true)->get()),
|
||||
'recent' => $list,
|
||||
'results' => $results,
|
||||
'recent' => $list,
|
||||
'terms' => $terms,
|
||||
'title' => "Search Results",
|
||||
]);
|
||||
}
|
||||
|
||||
|
@ -92,12 +92,40 @@ class FrontIndexController extends Controller
|
|||
|
||||
public function listings(int $pageNum = 1)
|
||||
{
|
||||
$range = $pageNum * $this->limit - $this->limit;
|
||||
$active = Location::where("active", true)->where('block_count', '>', 2)->get();
|
||||
$locations = Location::where("active", true)->where('block_count', '>', 2)
|
||||
->limit($this->limit)->offset($range)->orderByDesc('id')->get();
|
||||
$locations = Location::where("active", true)->get();
|
||||
$active = [];
|
||||
foreach ($locations as $location) {
|
||||
if (($location->block_count + $location->silence_count) >= 2) {
|
||||
array_push($active, $location);
|
||||
}
|
||||
}
|
||||
|
||||
$pages = [];
|
||||
|
||||
if (count($active) != 0) {
|
||||
if (count($active) < $this->limit) {
|
||||
$this->limit = count($active) - 1;
|
||||
}
|
||||
$range = $pageNum * $this->limit - $this->limit;
|
||||
|
||||
if ($range != 0) {
|
||||
$range = $range + 1;
|
||||
}
|
||||
for ($i = 0; $i <= $this->limit; ++$i) {
|
||||
if (isset($active[$i + $range])) {
|
||||
array_push($pages, $active[$i + $range]);
|
||||
} else {
|
||||
// chill out
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$pageCount = ceil(count($active) / $this->limit);
|
||||
|
||||
if ($range != 0) {
|
||||
$range = $range + 1;
|
||||
}
|
||||
|
||||
$next = $pageNum + 1;
|
||||
if ($next > $pageCount) {
|
||||
$next = 1;
|
||||
|
@ -111,11 +139,12 @@ class FrontIndexController extends Controller
|
|||
|
||||
return view('front.listing', [
|
||||
'title' => "Listings",
|
||||
'sources' => count(Source::where("active", true)->get()),
|
||||
"totalPages" => $pageCount,
|
||||
"prev" => $prev,
|
||||
"next" => $next,
|
||||
'pageNum' => $pageNum,
|
||||
'locations' => $locations
|
||||
'locations' => $pages
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,6 +42,7 @@ a.list-link {
|
|||
width: 80%;
|
||||
height: 45px;
|
||||
padding-bottom: 20px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
a.list-link > .item-rating {
|
||||
|
@ -58,6 +59,7 @@ a.list-link > .item-name {
|
|||
color: var(--black);
|
||||
font-weight: 400;
|
||||
padding: 9px 5px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
a.list-link > .item-silence {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Generated by Pixelmator Pro 3.4.3 -->
|
||||
<svg width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
|
||||
<path id="Path" fill="none" stroke="none" d="M 0 0 L 24 0 L 24 24 L 0 24 Z"/>
|
||||
<path id="path1" fill="#efebe3" stroke="none" d="M 17 3.34 C 21.1674 5.746208 23.030024 10.779379 21.433001 15.318825 C 19.835976 19.858273 15.232252 22.616514 10.476249 21.883377 C 5.720245 21.15024 2.160861 17.133654 2.005 12.324 L 2 12 L 2.005 11.676 C 2.118919 8.162982 4.068822 4.967705 7.140892 3.259882 C 10.212963 1.552061 13.95609 1.582479 17 3.34 Z M 15 14 L 9 14 L 8.883 14.007 C 8.37995 14.066836 8.001114 14.493402 8.001114 15 C 8.001114 15.506598 8.37995 15.933164 8.883 15.993 L 9 16 L 15 16 L 15.117 15.993 C 15.62005 15.933164 15.998886 15.506598 15.998886 15 C 15.998886 14.493402 15.62005 14.066836 15.117 14.007 L 15 14 Z M 9.01 9 L 8.883 9.007 C 8.37995 9.066836 8.001114 9.493402 8.001114 10 C 8.001114 10.506598 8.37995 10.933164 8.883 10.993 L 9 11 L 9.127 10.993 C 9.630051 10.933164 10.008885 10.506598 10.008885 10 C 10.008885 9.493402 9.630051 9.066836 9.127 9.007 L 9.01 9 Z M 15.01 9 L 14.883 9.007 C 14.37995 9.066836 14.001114 9.493402 14.001114 10 C 14.001114 10.506598 14.37995 10.933164 14.883 10.993 L 15 11 L 15.127 10.993 C 15.630051 10.933164 16.008886 10.506598 16.008886 10 C 16.008886 9.493402 15.630051 9.066836 15.127 9.007 L 15.01 9 Z"/>
|
||||
<path id="path2292" fill="#efebe3" stroke="none" d="M 11.931641 1.986328 C 6.851659 2.0299 2.1895 6.012724 2.005859 11.675781 L 2 12 L 2.00586 12.324219 C 2.161932 17.140404 5.551549 20.72867 9.675782 21.730469 C 9.588913 21.443272 9.558197 21.13777 9.597657 20.835938 C 9.47312 18.918024 9.545824 16.97234 10.00586 15.101562 C 8.788254 14.549991 8.926215 13.552958 10.486329 13.134766 C 10.688758 12.435676 11.011918 11.808259 11.775392 11.5625 C 12.475244 11.321042 13.30658 11.50242 13.822267 12.039062 C 14.182369 12.380361 14.347692 12.851138 14.367189 13.318359 C 15.557706 13.858945 15.447286 14.835346 13.984376 15.267578 C 13.876838 15.708144 13.794972 16.040434 13.751954 16.230469 C 14.035457 16.215448 14.343313 16.25919 14.525392 16.310549 C 15.273297 15.605935 16.559305 15.683684 17.234377 16.451174 C 18.030642 17.245865 17.777361 18.485273 17.160156 19.302736 C 16.834358 19.841322 16.59597 20.440948 16.324219 21.01758 C 16.59798 20.884926 16.870295 20.73892 17.138672 20.578127 C 23.68045 16.658728 23.604391 7.153141 17 3.339844 C 15.364385 2.395456 13.624967 1.971804 11.931641 1.986328 Z M 7.978516 7.474609 C 8.504453 7.484797 9.026345 7.633665 9.589844 7.914063 C 9.807306 8.022272 9.962496 8.065799 10.025391 8.089844 C 10.30621 8.197204 10.600216 8.074305 10.783203 8.117188 C 11.423864 8.267323 11.413255 9.201465 10.703123 9.310547 C 10.368721 9.361912 9.987375 9.327701 9.675781 9.240234 C 10.263738 9.753045 10.07576 10.87933 9.126953 10.992188 L 9 11 L 8.882813 10.992188 C 7.706968 10.852325 7.706968 9.147676 8.882813 9.007813 L 9.060547 9 C 8.389929 8.673583 7.954104 8.424998 6.910156 8.925781 C 6.097967 9.296431 5.682192 8.17984 6.337891 7.869141 C 6.921612 7.592548 7.452579 7.464422 7.978516 7.474609 Z M 16.025391 7.476559 C 16.551327 7.466373 17.082294 7.596451 17.666016 7.873043 C 18.321714 8.183743 17.905939 9.298381 17.09375 8.927732 C 16.049803 8.426949 15.612026 8.677486 14.941406 9.003903 L 15.119141 9.009764 C 16.294985 9.149627 16.294985 10.856229 15.119141 10.996092 L 15.003906 11.003892 L 14.876953 10.996092 C 13.928146 10.883233 13.738215 9.756949 14.326172 9.244139 C 14.014578 9.331604 13.635186 9.365818 13.300781 9.31445 C 12.590652 9.205368 12.578091 8.269274 13.218751 8.119138 C 13.401738 8.076256 13.697696 8.199155 13.978517 8.091794 C 14.041407 8.067749 14.196601 8.024221 14.414063 7.916012 C 14.977562 7.635616 15.499455 7.486746 16.025393 7.476559 Z"/>
|
||||
<path id="path1819" fill="#efebe3" stroke="none" d="M 11.711456 13.193301 L 10.960155 16.263454 L 10.723999 18.598185 L 10.817269 21.317106 C 10.888359 21.702995 11.090498 21.968763 11.535805 22.011623 C 12.458734 22.051924 13.518139 21.943733 14.323691 21.738602 C 14.589794 21.658991 14.723038 21.499723 14.821309 21.311239 L 16.050283 18.831099 L 16.454288 18.104069 C 16.90646 17.320887 15.688282 16.454172 15.087541 17.494686 L 14.908501 17.80386 C 13.974688 16.986099 12.358489 17.746168 12.358489 17.746168 L 12.426389 16.614141 L 13.161877 13.597538 C 13.372696 12.60058 11.976026 12.279035 11.711465 13.193299 Z"/>
|
||||
</svg>
|
||||
|
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 3.2 KiB |
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Generated by Pixelmator Pro 3.4.3 -->
|
||||
<svg width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
|
||||
<path id="Path" fill="none" stroke="none" d="M 0 0 L 24 0 L 24 24 L 0 24 Z"/>
|
||||
<path id="path1" fill="#efebe3" stroke="none" d="M 17 3.34 C 21.1674 5.746208 23.030024 10.779379 21.433001 15.318825 C 19.835976 19.858273 15.232252 22.616514 10.476249 21.883377 C 5.720245 21.15024 2.160861 17.133654 2.005 12.324 L 2 12 L 2.005 11.676 C 2.118919 8.162982 4.068822 4.967705 7.140892 3.259882 C 10.212963 1.552061 13.95609 1.582479 17 3.34 Z M 15.57 13.502 C 13.250918 13.340779 10.940379 13.918414 8.97 15.152 C 8.501662 15.444711 8.359289 16.061663 8.652 16.530001 C 8.944711 16.998337 9.561663 17.140711 10.03 16.848 C 11.642129 15.838702 13.53257 15.366092 15.43 15.498 C 15.98118 15.53666 16.459339 15.121181 16.497999 14.57 C 16.536659 14.01882 16.12118 13.54066 15.57 13.502 Z M 9.01 9 L 8.883 9.007 C 8.37995 9.066836 8.001114 9.493402 8.001114 10 C 8.001114 10.506598 8.37995 10.933164 8.883 10.993 L 9 11 L 9.127 10.993 C 9.630051 10.933164 10.008885 10.506598 10.008885 10 C 10.008885 9.493402 9.630051 9.066836 9.127 9.007 L 9.01 9 Z M 15.01 9 L 14.883 9.007 C 14.37995 9.066836 14.001114 9.493402 14.001114 10 C 14.001114 10.506598 14.37995 10.933164 14.883 10.993 L 15 11 L 15.127 10.993 C 15.630051 10.933164 16.008886 10.506598 16.008886 10 C 16.008886 9.493402 15.630051 9.066836 15.127 9.007 L 15.01 9 Z"/>
|
||||
<path id="path1" fill="#efebe3" stroke="none" d="M 14.865711 21.562855 C 13.484051 21.973886 11.977767 22.11401 10.475826 21.882484 C 5.720059 21.149376 2.160853 17.13295 2.005 12.323484 L 2 11.999497 L 2.005 11.67551 C 2.118913 8.162631 4.068719 4.96748 7.140635 3.259726 C 10.212553 1.551971 13.955494 1.582388 16.999252 3.33984 C 20.471048 5.344435 22.335369 9.211392 21.941496 13.063743 C 21.638853 12.282332 20.494862 12.311415 20.494862 12.311415 C 20.33622 10.935238 17.531656 10.99734 17.395786 12.263875 C 17.394386 12.277055 17.356598 12.320015 17.356598 12.320015 C 16.094175 12.350565 15.655445 13.278266 15.569292 13.501472 L 15.569296 13.50147 C 13.25033 13.340255 10.939906 13.917868 8.969625 15.151405 C 8.50131 15.444105 8.358945 16.061031 8.651641 16.529352 C 8.944338 16.997669 9.561259 17.140038 10.029573 16.847338 C 11.734911 15.86276 13.531968 15.365489 15.429303 15.497391 C 15.421703 15.655235 15.402763 15.934267 15.402763 15.934267 C 13.722934 15.730796 12.71482 17.372704 13.250748 18.700893 Z M 10.408088 8.316023 L 7.034182 7.900524 C 6.303076 7.827415 6.131269 8.98021 6.91 9.092553 C 7.125181 9.123596 8.310906 9.275673 8.310906 9.275673 C 8.11896 9.458725 8.000814 9.716671 8.000814 9.999577 C 8.000814 10.506154 8.379631 10.932703 8.882656 10.992537 L 8.99965 10.999537 L 9.126644 10.992537 C 9.62967 10.932697 10.008486 10.506154 10.008486 9.999577 C 10.008486 9.805412 9.997353 9.657336 9.855869 9.468498 C 9.855869 9.468498 9.999368 9.481016 10.294614 9.510522 C 10.994176 9.502202 11.148743 8.475587 10.408088 8.316023 Z M 13.556226 8.327742 C 12.888803 8.452742 12.975172 9.494161 13.694857 9.506617 C 13.804587 9.508516 14.176233 9.453409 14.176233 9.453409 C 14.079473 9.607802 14.000515 9.805637 14.000515 9.999578 C 14.000515 10.506154 14.379333 10.932703 14.882357 10.992537 L 14.999352 10.999537 L 15.126345 10.992537 C 15.629371 10.932697 16.008186 10.506154 16.008186 9.999578 C 16.008186 9.720305 15.873525 9.445825 15.685923 9.263232 C 15.685923 9.263232 16.734871 9.135027 17.114626 9.084742 C 17.836151 8.928703 17.728067 7.867409 16.94478 7.904829 Z"/>
|
||||
<path id="path1034" fill="#efebe3" stroke="none" d="M 21.293535 15.272347 C 21.293535 14.230235 22.856705 14.230235 22.856705 15.272347 L 22.856705 19.701324 C 22.856705 21.427954 21.456995 22.827662 19.730368 22.827662 L 18.688253 22.827662 L 18.796635 22.827662 C 17.7449 22.827839 16.763556 22.299183 16.185101 21.420811 C 16.150921 21.36879 16.11688 21.316687 16.082973 21.264494 C 15.920404 21.014908 15.349847 20.02021 14.370783 18.279884 C 14.163248 17.911001 14.287053 17.443947 14.650069 17.226309 C 15.03267 16.99674 15.522393 17.056881 15.838077 17.372204 L 16.616611 18.138157 L 16.604033 14.230235 C 16.597332 13.188145 18.1672 13.188123 18.1672 14.230235 L 18.1672 15.923668 L 18.1672 13.188123 C 18.1672 12.146011 19.73037 12.146011 19.73037 13.188123 L 19.73037 14.222953 C 19.73037 13.188123 21.293537 13.188123 21.293537 14.230253 L 21.293537 15.27504"/>
|
||||
</svg>
|
||||
|
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 3.1 KiB |
|
@ -20,6 +20,7 @@
|
|||
Technical support provided by
|
||||
<a href="https://roiskinda.cool/profile.html">Ro</a>. The repo can be found <a href="https://koodu.h-i.works/projects/thebadspace">here</a>.
|
||||
</p>
|
||||
<p>Custom silence and suspend icons graciously provided by <a href="https://rage.love/@puf">puf</a>.</p>
|
||||
<h2 id="how">How does it work?</h2>
|
||||
<p>The Bad Space is a collaboration of instances committed to actively moderating against racism, sexism, heterosexism, transphobia, ableism, casteism, or religion.</p>
|
||||
|
||||
|
|
|
@ -14,12 +14,25 @@
|
|||
@isset($results)
|
||||
<section>
|
||||
<article>
|
||||
<strong>
|
||||
Found {{count($results)}} results:
|
||||
</strong><br>
|
||||
@for($i = 0; $i < 10; $i++)
|
||||
<a role="listitem" href="/location/{{$recent[$i]->uuid}}">{{$recent[$i]->name}}</a></a><br />
|
||||
@endfor
|
||||
<h2>Found {{count($results)}} results for {{$terms}}</h2>
|
||||
@foreach($results as $item)
|
||||
@php
|
||||
$action = $item->block_count + $item->silence_count;
|
||||
$rating = ($action / $sources)*100;
|
||||
@endphp
|
||||
<a class="list-link" role="listitem" href="/location/{{$item->uuid}}">
|
||||
<span class="item-rating">{{$rating}}%</span>
|
||||
<label class="item-name">{{$item->name}}</label>
|
||||
<div class="item-silence">
|
||||
<img class="item-icon" src="/assets/images/global/status-silence.svg" title="silenced" />
|
||||
{{$item->silence_count}}
|
||||
</div>
|
||||
<div class="item-block">
|
||||
<img class="item-icon" src="/assets/images/global/status-suspend.svg" title="suspended" />
|
||||
{{$item->block_count}}
|
||||
</div>
|
||||
</a>
|
||||
@endforeach
|
||||
</article>
|
||||
</section>
|
||||
@endisset
|
||||
|
@ -27,7 +40,6 @@
|
|||
<article>
|
||||
<h2>Recent Updates</h2>
|
||||
@for($i = 0; $i < 10; $i++)
|
||||
|
||||
@php
|
||||
$action = $recent[$i]->block_count + $recent[$i]->silence_count;
|
||||
$rating = ($action / $sources)*100;
|
||||
|
|
|
@ -9,15 +9,21 @@
|
|||
{{$pageNum}} of {{$totalPages}}
|
||||
<a href="/listings/{{$next}}">NEXT</a><br /><br />
|
||||
@foreach($locations as $location)
|
||||
@php
|
||||
$action = $location->block_count + $location->silence_count;
|
||||
$rating = ($action / $sources)*100;
|
||||
@endphp
|
||||
<a class="list-link" role="listitem" href="/location/{{$location->uuid}}">
|
||||
@if($location->rating == 'silence')
|
||||
<span>{{$location->block_count}}</span>
|
||||
<img class="menu-icon" src="/assets/images/global/status-silence.svg" title="silenced" />
|
||||
@else
|
||||
<span>{{$location->block_count}}</span>
|
||||
<img class="menu-icon" src="/assets/images/global/status-suspend.svg" title="suspended" />
|
||||
@endif
|
||||
<label>{{$location->name}}</label>
|
||||
<span class="item-rating">{{$rating}}%</span>
|
||||
<label class="item-name">{{$location->name}}</label>
|
||||
<div class="item-silence">
|
||||
<img class="item-icon" src="/assets/images/global/status-silence.svg" title="silenced" />
|
||||
{{$location->silence_count}}
|
||||
</div>
|
||||
<div class="item-block">
|
||||
<img class="item-icon" src="/assets/images/global/status-suspend.svg" title="suspended" />
|
||||
{{$location->block_count}}
|
||||
</div>
|
||||
</a>
|
||||
@endforeach
|
||||
<br />
|
||||
|
|
Loading…
Reference in a new issue