Browse Source

Fix lint errors.

pull/124/head
Ned Zimmerman 8 years ago
parent
commit
6b8008909d
No known key found for this signature in database
GPG Key ID: FF56334A013120CA
  1. 61
      assets/scripts/catalog-admin.js
  2. 29
      assets/scripts/page-section.js

61
assets/scripts/catalog-admin.js

@ -2,12 +2,18 @@
( function ( $ ) { ( function ( $ ) {
$( document ).ready( function () { $( document ).ready( function () {
$( '.wrap' ).on( 'click', '.notice-dismiss', function () { $( '.wrap' ).on( 'click', '.notice-dismiss', function () {
$( this ).parent( '#message' ).fadeOut( 500, function () { $( this )
.parent( '#message' )
.fadeOut( 500, function () {
$( this ).remove(); $( this ).remove();
} ); } );
} ); } );
$( 'input.in-catalog' ).on( 'change', function () { $( 'input.in-catalog' ).on( 'change', function () {
let book_id = $( this ).parent( 'td' ).siblings( 'th' ).children( 'input' ).val(); let book_id = $( this )
.parent( 'td' )
.siblings( 'th' )
.children( 'input' )
.val();
let in_catalog = $( this ).prop( 'checked' ); let in_catalog = $( this ).prop( 'checked' );
$.ajax( { $.ajax( {
url: ajaxurl, url: ajaxurl,
@ -18,24 +24,63 @@
in_catalog: in_catalog, in_catalog: in_catalog,
_ajax_nonce: PB_Aldine_Admin.aldineAdminNonce, _ajax_nonce: PB_Aldine_Admin.aldineAdminNonce,
}, },
success: function (){ success: function () {
if ( $( '#message' ).length < 1 ) { 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 ); $( '<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 { } else {
$( '#message' ).fadeOut( 500, function () { $( '#message' ).fadeOut( 500, function () {
$( this ).remove(); $( 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 ); $( '<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 ) { error: function ( jqXHR, textStatus, errorThrown ) {
if ( $( '#message' ).length < 1 ) { 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 ); $( '<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 { } else {
$( '#message' ).fadeOut( 500, function () { $( '#message' ).fadeOut( 500, function () {
$( this ).remove(); $( 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 ); $( '<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 );
} ); } );
} }
}, },

29
assets/scripts/page-section.js

@ -19,16 +19,30 @@
name: 'variant', name: 'variant',
label: 'Variant', label: 'Variant',
values: [ values: [
{ text: aldine.page_section.standard, value: '' }, {
{ text: aldine.page_section.accent, value: 'accent' }, text: aldine.page_section.standard, value: '',
{ text: aldine.page_section.bordered, value: 'bordered' }, },
{ text: aldine.page_section.borderless, value: 'borderless' }, {
text: aldine.page_section.accent, value: 'accent',
},
{
text: aldine.page_section.bordered, value: 'bordered',
},
{
text: aldine.page_section.borderless, value: 'borderless',
},
], ],
value: '', // Sets the default value: '', // Sets the default
}, },
], ],
onsubmit: function ( e ) { onsubmit: function ( e ) {
editor.insertContent( '[aldine_page_section title="' + e.data.title + '" variant="' + e.data.variant + '"]<p>Insert your page section content here.</p>[/aldine_page_section]' ); editor.insertContent(
'[aldine_page_section title="' +
e.data.title +
'" variant="' +
e.data.variant +
'"]<p>Insert your page section content here.</p>[/aldine_page_section]'
);
}, },
} ); } );
}, },
@ -38,5 +52,8 @@
return null; return null;
}, },
} ); } );
tinymce.PluginManager.add( 'aldine_page_section', tinymce.plugins.aldine_page_section ); tinymce.PluginManager.add(
'aldine_page_section',
tinymce.plugins.aldine_page_section
);
} )(); } )();

Loading…
Cancel
Save