33 changed files with 4119 additions and 3809 deletions
|
Before Width: | Height: | Size: 176 KiB After Width: | Height: | Size: 240 KiB |
@ -0,0 +1,45 @@
|
||||
/* global ajaxurl, PB_Aldine_Admin */ |
||||
( function ( $ ) { |
||||
$( document ).ready( function () { |
||||
$( '.wrap' ).on( 'click', '.notice-dismiss', function () { |
||||
$( this ).parent( '#message' ).fadeOut( 500, function () { |
||||
$( this ).remove(); |
||||
} ); |
||||
} ); |
||||
$( 'input.in-catalog' ).on( 'change', function () { |
||||
let book_id = $( this ).parent( 'td' ).siblings( 'th' ).children( 'input' ).val(); |
||||
let in_catalog = $( this ).prop( 'checked' ); |
||||
$.ajax( { |
||||
url: ajaxurl, |
||||
type: 'POST', |
||||
data: { |
||||
action: 'pressbooks_aldine_update_catalog', |
||||
book_id: book_id, |
||||
in_catalog: in_catalog, |
||||
_ajax_nonce: PB_Aldine_Admin.aldineAdminNonce, |
||||
}, |
||||
success: function (){ |
||||
if ( $( '#message' ).length < 1 ) { |
||||
$( '<div id="message" class="updated notice is-dismissible">' ).html( '<p><strong>'+PB_Aldine_Admin.catalog_updated+'</strong></p><button type="button" class="notice-dismiss"><span class="screen-reader-text">'+PB_Aldine_Admin.dismiss_notice+'</span></button>' ).hide().insertAfter( '.wrap h1' ).fadeIn( 500 ); |
||||
} else { |
||||
$( '#message' ).fadeOut( 500, function () { |
||||
$( this ).remove(); |
||||
$( '<div id="message" class="updated notice is-dismissible">' ).html( '<p><strong>'+PB_Aldine_Admin.catalog_updated+'</strong></p><button type="button" class="notice-dismiss"><span class="screen-reader-text">'+PB_Aldine_Admin.dismiss_notice+'</span></button>' ).hide().insertAfter( '.wrap h1' ).fadeIn( 500 ); |
||||
} ); |
||||
} |
||||
|
||||
}, |
||||
error: function ( jqXHR, textStatus, errorThrown ) { |
||||
if ( $( '#message' ).length < 1 ) { |
||||
$( '<div id="message" class="error notice is-dismissible">' ).html( '<p><strong>'+PB_Aldine_Admin.catalog_not_updated+'</strong></p><button type="button" class="notice-dismiss"><span class="screen-reader-text">'+PB_Aldine_Admin.dismiss_notice+'</span></button>' ).hide().insertAfter( '.wrap h1' ).fadeIn( 500 ); |
||||
} else { |
||||
$( '#message' ).fadeOut( 500, function () { |
||||
$( this ).remove(); |
||||
$( '<div id="message" class="error notice is-dismissible">' ).html( '<p><strong>'+PB_Aldine_Admin.catalog_not_updated+'</strong></p><button type="button" class="notice-dismiss"><span class="screen-reader-text">'+PB_Aldine_Admin.dismiss_notice+'</span></button>' ).hide().insertAfter( '.wrap h1' ).fadeIn( 500 ); |
||||
} ); |
||||
} |
||||
}, |
||||
} ); |
||||
} ); |
||||
} ); |
||||
} )( jQuery ); |
||||
@ -1,7 +1,8 @@
|
||||
@import '~aetna/assets/styles/common/_variables.scss'; |
||||
@import '~aetna/assets/styles/common/_global.scss'; |
||||
|
||||
#tinymce.wp-editor { |
||||
body#tinymce { |
||||
margin: 12px !important; |
||||
@import '~aetna/assets/styles/components/_buttons.scss'; |
||||
@import '~aetna/assets/styles/layouts/_page-sections.scss'; |
||||
} |
||||
|
||||
@ -1,13 +0,0 @@
|
||||
// .page:not(.home) article { |
||||
// .entry-header h1 { |
||||
// @extend .h2; |
||||
// } |
||||
|
||||
// @extend .page-section; |
||||
// text-align: left; |
||||
// width: 100%; |
||||
// max-width: rem(800); |
||||
// margin-top: calc(-80%); |
||||
// margin-left: auto; |
||||
// margin-right: auto; |
||||
// } |
||||
@ -1,3 +0,0 @@
|
||||
body#tinymce { |
||||
margin: 12px !important; |
||||
} |
||||
|
Before Width: | Height: | Size: 176 KiB After Width: | Height: | Size: 240 KiB |
@ -1,8 +1,9 @@
|
||||
{ |
||||
"/scripts/aldine.js": "/scripts/aldine.js?id=23474d19014434f02b3f", |
||||
"/styles/aldine.css": "/styles/aldine.css?id=00b0c10d93f464c01cc5", |
||||
"/styles/editor.css": "/styles/editor.css?id=10e3f4b144847aa8d75e", |
||||
"/scripts/aldine.js": "/scripts/aldine.js?id=ba190765ddbe404a6d2d", |
||||
"/styles/aldine.css": "/styles/aldine.css?id=fa7bbb302e39b92990db", |
||||
"/styles/editor.css": "/styles/editor.css?id=d96762ab5918cde0c2e1", |
||||
"/styles/blocks/page-section/editor.css": "/styles/blocks/page-section/editor.css?id=d41d8cd98f00b204e980", |
||||
"/scripts/customizer.js": "/scripts/customizer.js?id=decf119933e3b2d4b210", |
||||
"/scripts/blocks/page-section/block.js": "/scripts/blocks/page-section/block.js?id=28da8f65e0922aad6041" |
||||
"/scripts/customizer.js": "/scripts/customizer.js?id=1b0d3cfc1d85f460af53", |
||||
"/scripts/catalog-admin.js": "/scripts/catalog-admin.js?id=d25f1240496bd3607338", |
||||
"/scripts/blocks/page-section/block.js": "/scripts/blocks/page-section/block.js?id=0d61a9b8d8de8775309e" |
||||
} |
||||
File diff suppressed because one or more lines are too long
@ -1 +1 @@
|
||||
!function(e){var t={};function a(o){if(t[o])return t[o].exports;var n=t[o]={i:o,l:!1,exports:{}};return e[o].call(n.exports,n,n.exports,a),n.l=!0,n.exports}a.m=e,a.c=t,a.d=function(e,t,o){a.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:o})},a.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(t,"a",t),t},a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},a.p="",a(a.s=2)}({2:function(e,t,a){e.exports=a("plbo")},plbo:function(e,t){var a,o,n,c,l;a=window.wp.blocks,o=window.wp.i18n,n=window.wp.element,c=window._,l=n.createElement,wp.blocks.registerBlockType("aldine/page-section",{title:o.__("Page Section","pressbooks-aldine"),icon:"flag",category:"layout",attributes:{title:{type:"array",source:"children",selector:"h2"},content:{type:"array",source:"children",selector:"p"}},edit:function(e){var t=e.focus?e.focus.editable||"title":null,n=e.attributes;return l("div",{className:e.className},l(a.Editable,{tagName:"h2",className:"page-section__title",inline:!1,placeholder:o.__("About Pressbooks","pressbooks-aldine"),value:n.title,onChange:function(t){e.setAttributes({title:t})},focus:"title"===t?focus:null,onFocus:function(t){e.setFocus(c.extend({},t,{editable:"title"}))}}),l(a.Editable,{tagName:"p",className:"page-section__content",inline:!1,placeholder:o.__("Kogi ennui ugh plaid, hella neutra kitsch cloud bread next level twee taiyaki. Live-edge paleo fixie whatever farm-to-table snackwave, meditation fam man braid next level viral. Four loko waistcoat mustache cloud bread activated charcoal food truck pabst roof party ugh kitsch raw denim edison bulb man braid 8-bit try-hard. Activated charcoal put a bird on it tilde meggings farm-to-table coloring book. Before they sold out four dollar toast stumptown actually.","pressbooks-gutenberg"),value:n.content,onChange:function(t){e.setAttributes({content:t})},focus:"content"===t?focus:null,onFocus:function(t){e.setFocus(c.extend({},t,{editable:"content"}))}}),l("p",{classname:"page-section__cta"},l(a.Editable,{tagName:"a",className:"call-to-action",inline:!1,placeholder:o.__("Learn More","pressbooks-aldine"),value:n.cta,onChange:function(t){e.setAttributes({cta:t})},focus:"cta"===t?focus:null,onFocus:function(t){e.setFocus(c.extend({},t,{editable:"cta"}))}})))},save:function(e){var t=e.attributes;return l("div",{className:e.className},l("h2",{className:"page-section__title"},t.title),l("p",{className:"page-section__content"},t.content),l("p",{classname:"page-section__cta"},l("a",{classname:"call-to-action"},t.cta)))}})}}); |
||||
!function(e){var t={};function a(o){if(t[o])return t[o].exports;var n=t[o]={i:o,l:!1,exports:{}};return e[o].call(n.exports,n,n.exports,a),n.l=!0,n.exports}a.m=e,a.c=t,a.d=function(e,t,o){a.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:o})},a.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(t,"a",t),t},a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},a.p="",a(a.s=3)}({3:function(e,t,a){e.exports=a("plbo")},plbo:function(e,t){var a,o,n,c,l;a=window.wp.blocks,o=window.wp.i18n,n=window.wp.element,c=window._,l=n.createElement,wp.blocks.registerBlockType("aldine/page-section",{title:o.__("Page Section","pressbooks-aldine"),icon:"flag",category:"layout",attributes:{title:{type:"array",source:"children",selector:"h2"},content:{type:"array",source:"children",selector:"p"}},edit:function(e){var t=e.focus?e.focus.editable||"title":null,n=e.attributes;return l("div",{className:e.className},l(a.Editable,{tagName:"h2",className:"page-section__title",inline:!1,placeholder:o.__("About Pressbooks","pressbooks-aldine"),value:n.title,onChange:function(t){e.setAttributes({title:t})},focus:"title"===t?focus:null,onFocus:function(t){e.setFocus(c.extend({},t,{editable:"title"}))}}),l(a.Editable,{tagName:"p",className:"page-section__content",inline:!1,placeholder:o.__("Kogi ennui ugh plaid, hella neutra kitsch cloud bread next level twee taiyaki. Live-edge paleo fixie whatever farm-to-table snackwave, meditation fam man braid next level viral. Four loko waistcoat mustache cloud bread activated charcoal food truck pabst roof party ugh kitsch raw denim edison bulb man braid 8-bit try-hard. Activated charcoal put a bird on it tilde meggings farm-to-table coloring book. Before they sold out four dollar toast stumptown actually.","pressbooks-gutenberg"),value:n.content,onChange:function(t){e.setAttributes({content:t})},focus:"content"===t?focus:null,onFocus:function(t){e.setFocus(c.extend({},t,{editable:"content"}))}}),l("p",{classname:"page-section__cta"},l(a.Editable,{tagName:"a",className:"call-to-action",inline:!1,placeholder:o.__("Learn More","pressbooks-aldine"),value:n.cta,onChange:function(t){e.setAttributes({cta:t})},focus:"cta"===t?focus:null,onFocus:function(t){e.setFocus(c.extend({},t,{editable:"cta"}))}})))},save:function(e){var t=e.attributes;return l("div",{className:e.className},l("h2",{className:"page-section__title"},t.title),l("p",{className:"page-section__content"},t.content),l("p",{classname:"page-section__cta"},l("a",{classname:"call-to-action"},t.cta)))}})}}); |
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -0,0 +1,76 @@
|
||||
<?php |
||||
/** |
||||
* @package Aldine |
||||
*/ |
||||
|
||||
namespace Aldine\Admin; |
||||
|
||||
use PressbooksMix\Assets; |
||||
|
||||
/** |
||||
* Uses old option to provide a simpler upgrade path from pressbooks-publisher theme |
||||
*/ |
||||
const BLOG_OPTION = 'pressbooks_publisher_in_catalog'; |
||||
|
||||
/** |
||||
* @param string $hook |
||||
*/ |
||||
function admin_scripts( $hook ) { |
||||
if ( 'sites.php' !== $hook ) { |
||||
return; |
||||
} |
||||
|
||||
$assets = new Assets( 'pressbooks-aldine', 'theme' ); |
||||
$assets->setSrcDirectory( 'assets' )->setDistDirectory( 'dist' ); |
||||
wp_enqueue_script( 'pressbooks-aldine-admin', $assets->getPath( 'scripts/catalog-admin.js' ), [ 'jquery' ] ); |
||||
|
||||
wp_localize_script( |
||||
'pressbooks-aldine-admin', 'PB_Aldine_Admin', [ |
||||
'aldineAdminNonce' => wp_create_nonce( 'pressbooks-aldine-admin' ), |
||||
'catalog_updated' => __( 'Catalog updated.', 'pressbooks-aldine' ), |
||||
'catalog_not_updated' => __( 'Sorry, but your catalog was not updated. Please try again.', 'pressbooks-aldine' ), |
||||
'dismiss_notice' => __( 'Dismiss this notice.', 'pressbooks-aldine' ), |
||||
] |
||||
); |
||||
} |
||||
|
||||
/** |
||||
* |
||||
*/ |
||||
function update_catalog() { |
||||
if ( ! current_user_can( 'manage_network' ) || ! check_ajax_referer( 'pressbooks-aldine-admin' ) ) { |
||||
return; |
||||
} |
||||
|
||||
$blog_id = absint( $_POST['book_id'] ); |
||||
$in_catalog = $_POST['in_catalog']; |
||||
|
||||
if ( $in_catalog === 'true' ) { |
||||
update_blog_option( $blog_id, \Aldine\Admin\BLOG_OPTION, 1 ); |
||||
} else { |
||||
delete_blog_option( $blog_id, \Aldine\Admin\BLOG_OPTION ); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* @param array $columns |
||||
* |
||||
* @return array |
||||
*/ |
||||
function catalog_columns( $columns ) { |
||||
$columns['in_catalog'] = __( 'In Catalog', 'pressbooks-aldine' ); |
||||
return $columns; |
||||
} |
||||
|
||||
/** |
||||
* @param string $column |
||||
* @param int $blog_id |
||||
*/ |
||||
function catalog_column( $column, $blog_id ) { |
||||
|
||||
if ( 'in_catalog' === $column && ! is_main_site( $blog_id ) ) { ?> |
||||
<input class="in-catalog" type="checkbox" name="in_catalog" value="1" aria-label="<?php echo esc_attr_x( 'Show in Catalog', 'pressbooks-aldine' ); ?>" <?php checked( get_blog_option( $blog_id, \Aldine\Admin\BLOG_OPTION ), 1 ); ?> <?php |
||||
if ( ! get_blog_option( $blog_id, 'blog_public' ) ) { ?>disabled="disabled" title="<?php echo esc_attr_x( 'This book is private, so you can’t display it in your catalog.', 'pressbooks-aldine' ); ?>"<?php } ?> />
|
||||
<?php } |
||||
|
||||
} |
||||
Loading…
Reference in new issue