-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1109 from publishpress/develop
Develop
- Loading branch information
Showing
23 changed files
with
2,710 additions
and
2,348 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/** | ||
* Generate option title suggestions | ||
* | ||
* @since 3.1.1 | ||
* @param options Available options as objects with slug and title. e.g. [{slug: 'subscriber', title: 'Subscriber'}, {slug: 'new_customer', title: 'New Customer'}] | ||
* | ||
* @return {array} Option slugs. e.g. ['subscriber','new_customer'] | ||
*/ | ||
export const getOptionSuggestions = function( options ) { | ||
return options.map( ( item ) => item.title ); | ||
} | ||
|
||
/** | ||
* Match option slugs with its option titles | ||
* to display as field value (but NOT saved!). | ||
* | ||
* @since 3.1.1 | ||
* @param slugs Option slugs. e.g. ['subscriber','new_customer'] | ||
* @param options Available options as objects with slug and title. e.g. [{slug: 'subscriber', title: 'Subscriber'}, {slug: 'new_customer', title: 'New Customer'}] | ||
* | ||
* @return {array} Option titles. e.g. ['Subscriber','New Customer'] | ||
*/ | ||
export const getOptionTitles = function( slugs, options ) { | ||
let field_value = []; | ||
|
||
if ( options !== null ) { | ||
field_value = slugs.map( ( option_slug ) => { | ||
let find_option = options.find( ( item ) => { | ||
return item.slug === option_slug; | ||
} ); | ||
if ( find_option === undefined || ! find_option ) { | ||
return option_slug; // It should return false but creates empty selections | ||
} | ||
return find_option.title; | ||
} ); | ||
} | ||
|
||
return field_value; | ||
} | ||
|
||
/** | ||
* Match option titles with its slugs, and save slugs | ||
* | ||
* @since 3.1.1 | ||
* @param slugs Option slugs. e.g. ['subscriber','new_customer'] | ||
* @param options Available options as objects with slug and title. e.g. [{slug: 'subscriber', title: 'Subscriber'}, {slug: 'new_customer', title: 'New Customer'}] | ||
* | ||
* @return {array} Option slugs. e.g. ['subscriber','new_customer'] | ||
*/ | ||
export const getOptionSlugs = function( slugs, options ) { | ||
let slugs_array = []; | ||
|
||
slugs.map( | ||
( option_title ) => { | ||
const matching_slug = options.find( ( item ) => { | ||
return item.title === option_title; | ||
} ); | ||
if ( matching_slug !== undefined ) { | ||
slugs_array.push( matching_slug.slug ); | ||
} | ||
} | ||
) | ||
|
||
return slugs_array; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
jQuery(document).ready(function ( $ ) { | ||
$('.advgb-image-block:not(.advgb-lightbox)').find('.advgb-image-overlay').each( function() { | ||
if( $(this).attr('href') === undefined ) { | ||
return; | ||
} | ||
var url = $(this).attr('href'); | ||
var target = $(this).attr('target'); | ||
if( url.length && target.length ) { | ||
$(this).siblings().addClass('advgb-image-text--linkable').on( 'click', function() { | ||
window.open(url, target); | ||
}); | ||
} | ||
}); | ||
}); |
Oops, something went wrong.