Browse Source

Rename variables for clarity.

pull/21/head
Ned Zimmerman 7 years ago
parent
commit
a969791fae
No known key found for this signature in database
GPG Key ID: FF56334A013120CA
  1. 2
      app/controllers/App.php
  2. 4
      app/controllers/FrontPage.php
  3. 4
      app/controllers/PageCatalog.php
  4. 8
      resources/views/page-catalog.blade.php
  5. 6
      resources/views/partials/front-page-catalog.blade.php

2
app/controllers/App.php

@ -122,7 +122,7 @@ class App extends Controller
return $page + 1;
}
public static function books($page = 1, $per_page = 10, $orderby = 'title', $license = '', $subject = '')
public static function catalogData($page = 1, $per_page = 10, $orderby = 'title', $license = '', $subject = '')
{
$request = new \WP_REST_Request('GET', '/pressbooks/v2/books');
$request->set_query_params([

4
app/controllers/FrontPage.php

@ -29,9 +29,9 @@ class FrontPage extends Controller
return __('Our Latest Titles', 'aldine');
}
public function books()
public function catalogData()
{
$page = (get_query_var('page')) ? get_query_var('page') : 1;
return App::books($page, 3);
return App::catalogData($page, 3);
}
}

4
app/controllers/PageCatalog.php

@ -100,12 +100,12 @@ class PageCatalog extends Controller
];
}
public function books()
public function catalogData()
{
$page = (get_query_var('paged')) ? get_query_var('paged') : 1;
$orderby = (get_query_var('orderby')) ? get_query_var('orderby') : 'title';
$subject = (get_query_var('subject')) ? get_query_var('subject') : '';
$license = (get_query_var('license')) ? get_query_var('license') : '';
return App::books($page, 9, $orderby, $license, $subject);
return App::catalogData($page, 9, $orderby, $license, $subject);
}
}

8
resources/views/page-catalog.blade.php

@ -40,15 +40,15 @@
</div>
</div>
<div class="books">
@foreach($books['books'] as $book)
@foreach($catalog_data['books'] as $book)
@include('partials.book', ['book' => $book])
@endforeach
</div>
@if($books['pages'] > 1)
@if($catalog_data['pages'] > 1)
<nav class="catalog-navigation">
@if($previous_page)<a class="previous" data-page="{{ $previous_page }}" href="{{ network_home_url("/catalog/page/$previous_page/") }}">@php(include get_theme_file_path() . '/dist/' . Aldine\svg_path('images/left-arrow.svg')) {{ __('Previous', 'aldine') }}</a>@endif
<div class="pages">
@for($i = 1; $i <= $books['pages']; $i++)
@for($i = 1; $i <= $catalog_data['pages']; $i++)
@if($i === $current_page)
<span class="current">{{ $i }}</span>
@else
@ -56,7 +56,7 @@
@endif
@endfor
</div>
@if($next_page <= $books['pages'])<a class="next" data-page="{{ $next_page }}" href="{{ network_home_url("/catalog/page/$next_page/") }}">{{ __('Next', 'aldine') }} @php(include get_theme_file_path() . '/dist/' . Aldine\svg_path('images/right-arrow.svg'))</a>@endif
@if($next_page <= $catalog_data['pages'])<a class="next" data-page="{{ $next_page }}" href="{{ network_home_url("/catalog/page/$next_page/") }}">{{ __('Next', 'aldine') }} @php(include get_theme_file_path() . '/dist/' . Aldine\svg_path('images/right-arrow.svg'))</a>@endif
</nav>
@endif
</section>

6
resources/views/partials/front-page-catalog.blade.php

@ -1,8 +1,8 @@
<div id="latest-titles" class="latest-books w-100">
<h3 class="tc ttu">{{ $latest_books_title }}</h3>
<div class="track flex flex-row flex-wrap justify-center items-center">
<div class="books flex flex-column justify-center items-center order-0 order-1-l flex-row-l justify-between-l" data-total-pages="{{ $books['pages'] }}" data-next-page="2">
@foreach($books['books'] as $book)
<div class="books flex flex-column justify-center items-center order-0 order-1-l flex-row-l justify-between-l" data-total-pages="{{ $catalog_data['pages'] }}" @if($next_page <= $catalog_data['pages'])data-next-page="{{ $next_page }}"@endif>
@foreach($catalog_data['books'] as $book)
<div class="book flex flex-column justify-end w-100">
@if(isset($book['metadata']['keywords']))
<p class="subject tc ma0">
@ -19,7 +19,7 @@
@endforeach
</div>
@if($previous_page)<a class="previous db mr-auto f1 order-1 order-0-l" data-page="{{ $previous_page }}" href="{{ network_home_url("/page/$previous_page/#latest-titles") }}">@php(include get_theme_file_path() . '/dist/' . Aldine\svg_path('images/left-arrow.svg'))</a>@endif
@if($next_page <= $books['pages'])<a class="next ml-auto order-2 db f1" data-page="{{ $next_page }}" href="{{ network_home_url("/page/$next_page/#latest-titles") }}">@php(include get_theme_file_path() . '/dist/' . Aldine\svg_path('images/right-arrow.svg'))</a>@endif
@if($next_page <= $catalog_data['pages'])<a class="next ml-auto order-2 db f1" data-page="{{ $next_page }}" href="{{ network_home_url("/page/$next_page/#latest-titles") }}">@php(include get_theme_file_path() . '/dist/' . Aldine\svg_path('images/right-arrow.svg'))</a>@endif
</div>
<div class="catalog-link tc">
<a class="button button-inverse button-wide" href="{{ network_home_url('/catalog/') }}">{{ __('View Complete Catalog', 'aldine') }}</a>

Loading…
Cancel
Save