Browse Source

Configure for use without Pressbooks. (#26)

pull/27/head
Ned Zimmerman 7 years ago committed by GitHub
parent
commit
c8c18de008
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      app/admin.php
  2. 4
      app/controllers/App.php
  3. 4
      app/controllers/PageCatalog.php
  4. 2
      dist/mix-manifest.json
  5. 2
      dist/styles/main.css
  6. 8
      resources/assets/styles/layouts/_header.scss
  7. 20
      resources/views/partials/header.blade.php

4
app/admin.php

@ -79,6 +79,8 @@ add_action('customize_register', function (\WP_Customize_Manager $wp_customize)
'section' => 'pb_network_social',
'settings' => 'pb_network_twitter',
]);
if (function_exists('pb_meets_minimum_requirements') && pb_meets_minimum_requirements()) {
$wp_customize->add_section('pb_front_page_catalog', [
'title' => __('Front Page Catalog', 'aldine'),
'priority' => 25,
@ -101,6 +103,8 @@ add_action('customize_register', function (\WP_Customize_Manager $wp_customize)
'section' => 'pb_front_page_catalog',
'settings' => 'pb_front_page_catalog_title',
]);
}
$wp_customize->add_section('pb_network_contact_form', [
'title' => __('Contact Form', 'aldine'),
'priority' => 25,

4
app/controllers/App.php

@ -126,6 +126,7 @@ class App extends Controller
public static function catalogData($page = 1, $per_page = 10, $orderby = 'title', $license = '', $subject = '')
{
if (function_exists('pb_meets_minimum_requirements') && pb_meets_minimum_requirements()) {
$request = new \WP_REST_Request('GET', '/pressbooks/v2/books');
$request->set_query_params([
'page' => $page,
@ -149,5 +150,8 @@ class App extends Controller
$books = wp_list_sort($books, $orderby);
}
return ['pages' => $pages, 'books' => $books];
} else {
return ['pages' => 0, 'books' => []];
}
}
}

4
app/controllers/PageCatalog.php

@ -8,11 +8,15 @@ class PageCatalog extends Controller
{
public function licenses()
{
if (function_exists('pb_meets_minimum_requirements') && pb_meets_minimum_requirements()) {
$licenses = (new \Pressbooks\Licensing())->getSupportedTypes();
foreach ($licenses as $key => $value) {
$licenses[$key] = preg_replace("/\([^)]+\)/", '', $value['desc']);
}
return $licenses;
} else {
return [];
}
}
public function subjectGroups()

2
dist/mix-manifest.json vendored

@ -1,5 +1,5 @@
{
"/scripts/main.js": "/scripts/main.js?id=39e1eeb8ed8aa60c4413",
"/styles/main.css": "/styles/main.css?id=c39f8348a65d1cc30ad8",
"/styles/main.css": "/styles/main.css?id=be9f897fa23508d206d7",
"/scripts/customizer.js": "/scripts/customizer.js?id=4237643703cf0c22354e"
}

2
dist/styles/main.css vendored

File diff suppressed because one or more lines are too long

8
resources/assets/styles/layouts/_header.scss

@ -178,17 +178,17 @@
&:focus {
color: var(--primary, $brand-primary);
}
}
&:nth-child(1) {
&--catalog {
margin-right: auto;
}
&:nth-child(2) {
&--contact {
margin: 0 1em 0 auto;
}
}
.sep {
&--sep {
display: inline-block;
margin: 0 0.5em;
}

20
resources/views/partials/header.blade.php

@ -7,16 +7,20 @@
<a class="toggle" href="#navigation">{{ __('Toggle menu', 'aldine') }}<span class="toggle__icon"></span></a>
<a class="banner__brand" href="{{ home_url('/') }}"><span class="clip">{{ get_bloginfo('name', 'display') }}</span>{!! $site_logo !!}</a>
<nav class="banner__navigation" id="navigation">
<a href="{{ home_url('/catalog') }}">Catalog</a>
<a href="#contact">Contact</a>
@if(function_exists('pb_meets_minimum_requirements') && pb_meets_minimum_requirements())
<a class="banner__navigation--catalog" href="{{ home_url('/catalog') }}">Catalog</a>
@endif
@if(get_option('pb_network_contact_form'))
<a class="banner__navigation--contact" href="#contact">Contact</a>
@endif
@if(!is_user_logged_in())
<a href="{{ wp_login_url() }}">{{ __('Sign in', 'aldine') }}</a>
<span class="sep">/</span>
<a href="{{ network_home_url('/wp-signup.php') }}">{{ __('Sign up', 'aldine') }}</a>
<a class="banner__navigation--signin" href="{{ wp_login_url() }}">{{ __('Sign in', 'aldine') }}</a>
<span class="banner__navigation--sep">/</span>
<a class="banner__navigation--signup" href="{{ network_home_url('/wp-signup.php') }}">{{ __('Sign up', 'aldine') }}</a>
@else
<a href="{{ admin_url() }}">{{ __('Admin', 'aldine') }}</a>
<span class="sep">/</span>
<a href="{{ wp_logout_url() }}">{{ __('Sign out', 'aldine') }}</a>
<a class="banner__navigation--admin" href="{{ admin_url() }}">{{ __('Admin', 'aldine') }}</a>
<span class="banner__navigation--sep">/</span>
<a class="banner__navigation--signout" href="{{ wp_logout_url() }}">{{ __('Sign out', 'aldine') }}</a>
@endif
</nav>
<header class="banner__branding">

Loading…
Cancel
Save