Skip to content

Commit

Permalink
Merge branch 'release/2.15.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
Misplon committed Nov 27, 2021
2 parents 189450e + 1abb1bc commit cbf0b89
Show file tree
Hide file tree
Showing 7 changed files with 206 additions and 23 deletions.
18 changes: 18 additions & 0 deletions css/admin.less
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,15 @@
opacity: 0.9;
}

&.so-hidden-row {
opacity: 0.7;

&:focus,
&:hover {
opacity: 1;
}
}

.so-cells {
.clearfix();
margin: 0 -5px;
Expand Down Expand Up @@ -619,6 +628,15 @@
color: #eee;
}
}

&.so-hidden-widget {
opacity: 0.7;

&:focus,
&:hover {
opacity: 1;
}
}
}

.so-widget-sortable-highlight{
Expand Down
102 changes: 88 additions & 14 deletions inc/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -1351,30 +1351,104 @@ public function get_layout_directories(){
}

/**
* Display links for various SiteOrigin addons
* Display links for various SiteOrigin Premium Addons.
*/
public static function display_footer_premium_link(){
public static function display_footer_premium_link() {
$links = array(
array(
'text' => __('Get a lightbox addon for SiteOrigin widgets', 'siteorigin-panels'),
'url' => SiteOrigin_Panels::premium_url('plugin/lightbox')
'text' => __( 'Get the row, cell, and widget %link%.', 'siteorigin-panels' ),
'url' => SiteOrigin_Panels::premium_url( 'plugin/animations' ),
'anchor' => __( 'Animations Addon', 'siteorigin-panels' ),
),
array(
'text' => __('Get the row, cell and widget animations addon', 'siteorigin-panels'),
'url' => SiteOrigin_Panels::premium_url('plugin/lightbox')
'text' => __( 'Get the %link%. Build custom post types with reusable Page Builder layouts.', 'siteorigin-panels' ),
'url' => SiteOrigin_Panels::premium_url( 'plugin/cpt-builder' ),
'anchor' => __( 'CPT Builder Addon', 'siteorigin-panels' ),
),
array(
'text' => __('Get premium email support for SiteOrigin Page Builder', 'siteorigin-panels'),
'url' => SiteOrigin_Panels::premium_url()
'text' => __( 'Get the %link%. Add beautiful and customizable text overlays with animations to your images.', 'siteorigin-panels' ),
'url' => SiteOrigin_Panels::premium_url( 'plugin/image-overlay' ),
'anchor' => __( 'Image Overlay Addon', 'siteorigin-panels' ),
),
array(
'text' => __( 'Get a %link% for the SiteOrigin Image, Masonry, and Slider Widgets.', 'siteorigin-panels' ),
'url' => SiteOrigin_Panels::premium_url( 'plugin/lightbox' ),
'anchor' => __( 'Lightbox Addon', 'siteorigin-panels' ),
),
array(
'text' => __( 'Link an entire Page Builder row, cell, or widget with the %link%.', 'siteorigin-panels' ),
'url' => SiteOrigin_Panels::premium_url( 'plugin/link-overlay' ),
'anchor' => __( 'Link Overlay Addon', 'siteorigin-panels' ),
),
array(
'text' => __( 'Get the %link%. Create a widget once, use it everywhere. Update it and the changes reflect in all instances of the widget.', 'siteorigin-panels' ),
'url' => SiteOrigin_Panels::premium_url( 'plugin/mirror-widgets' ),
'anchor' => __( 'Mirror Widgets Addon', 'siteorigin-panels' ),
),
array(
'text' => __( 'Upload multiple image frames at once to Widgets Bundle Slider and Image Grid type widgets with %link%.', 'siteorigin-panels' ),
'url' => SiteOrigin_Panels::premium_url( 'plugin/multiple-media' ),
'anchor' => __( 'SiteOrigin Premium', 'siteorigin-panels' ),
),
array(
'text' => __( 'Add parallax background images to your slider type widgets with %link%.', 'siteorigin-panels' ),
'url' => SiteOrigin_Panels::premium_url( 'plugin/parallax-sliders' ),
'anchor' => __( 'SiteOrigin Premium', 'siteorigin-panels' ),
),
array(
'text' => __( 'Hide rows and widgets based for logged-in or logged-out users with the %link%.', 'siteorigin-panels' ),
'url' => SiteOrigin_Panels::premium_url( 'plugin/toggle-visibility' ),
'anchor' => __( 'Toggle Visibility Addon', 'siteorigin-panels' ),
),
array(
'text' => __( 'Show or hide rows and widgets between a selected date range with the %link%.', 'siteorigin-panels' ),
'url' => SiteOrigin_Panels::premium_url( 'plugin/toggle-visibility' ),
'anchor' => __( 'Toggle Visibility Addon', 'siteorigin-panels' ),
),
array(
'text' => __( 'Hide rows and widgets on specific devices with the %link%.', 'siteorigin-panels' ),
'url' => SiteOrigin_Panels::premium_url( 'plugin/toggle-visibility' ),
'anchor' => __( 'Toggle Visibility Addon', 'siteorigin-panels' ),
),
array(
'text' => __( 'Get a %link% with SiteOrigin Premium.', 'siteorigin-panels' ),
'url' => SiteOrigin_Panels::premium_url( 'plugin/tooltip' ),
'anchor' => __( 'Tooltip Addon', 'siteorigin-panels' ),
),
array(
'text' => __( 'Use Google Fonts in SiteOrigin Widgets with the %link%.', 'siteorigin-panels' ),
'url' => SiteOrigin_Panels::premium_url( 'plugin/web-font-selector' ),
'anchor' => __( 'Webfont Selector Addon', 'siteorigin-panels' ),
),
array(
'text' => __( 'Get fast email support for Page Builder with %link%.', 'siteorigin-panels' ),
'url' => SiteOrigin_Panels::premium_url(),
'anchor' => __( 'SiteOrigin Preimum', 'siteorigin-panels' ),
),
);
$link = $links[array_rand($links)];
if ( class_exists( 'woocommerce' ) ) {
$links[] = array(
'text' => __( 'Get the %link%. Create custom templates for the Product, Archives, Shop, Cart, and Checkout pages.', 'siteorigin-panels' ),
'url' => SiteOrigin_Panels::premium_url( 'plugin/woocommerce-templates' ),
'anchor' => __( 'WooCommerce Templates Addon', 'siteorigin-panels' ),
);
}
$link = $links[ array_rand( $links ) ];

?>
<a href="<?php echo esc_url( $link['url'] ) ?>" target="_blank" rel='noopener noreferrer'>
<?php echo esc_html( $link['text'] ) ?>.
</a>
<?php
// If this link has an anchor, it has a custom link location.
if ( isset( $link['anchor'] ) ) {
echo str_replace(
'%link%',
'<a href="' . esc_url( $link['url'] ) .'" target="_blank" rel="noopener noreferrer">' . esc_html( $link['anchor'] ) . '</a>',
esc_html( $link['text'] )
);
} else {
?>
<a href="<?php echo esc_url( $link['url'] ) ?>" target="_blank" rel='noopener noreferrer'>
<?php echo esc_html( $link['text'] ) ?>.
</a>
<?php
}
}

public function admin_notices() {
Expand Down
40 changes: 35 additions & 5 deletions js/siteorigin-panels/dialog/row.js
Original file line number Diff line number Diff line change
Expand Up @@ -703,29 +703,59 @@ module.exports = panels.view.dialog.extend({
// Update the row styles if they've loaded
if (!_.isUndefined(this.styles) && this.styles.stylesLoaded) {
// This is an edit dialog, so there are styles
var style = {};
var newStyles = {};
try {
style = this.getFormValues('.so-sidebar .so-visual-styles.so-row-styles').style;
newStyles = this.getFormValues( '.so-sidebar .so-visual-styles.so-row-styles' ).style;
}
catch (err) {
console.log('Error retrieving row styles - ' + err.message);
}

this.model.set('style', style);
// Have there been any Style changes?
if ( JSON.stringify( this.model.attributes.style ) !== JSON.stringify( newStyles ) ) {
this.model.set( 'style', newStyles );
this.model.trigger( 'change:styles' );
this.model.trigger( 'change:styles-row' );
}
}


if ( this.styles.stylesLoaded ) {
// If the styles view has loaded.
var newStyles = {};
try {
newStyles = this.getFormValues( '.so-sidebar .so-visual-styles' ).style;
}
catch ( e ) {
}

// Have there been any Style changes?
if ( JSON.stringify( this.model.attributes.style ) !== JSON.stringify( newStyles ) ) {
this.model.set( 'style', newStyles );
this.model.trigger( 'change:styles' );
this.model.trigger( 'change:styles-row' );
}
}


// Update the cell styles if any are showing.
if (!_.isUndefined(this.cellStyles) && this.cellStyles.stylesLoaded) {

var style = {};
var newStyles = {};
try {
style = this.getFormValues('.so-sidebar .so-visual-styles.so-cell-styles').style;
newStyles = this.getFormValues( '.so-sidebar .so-visual-styles.so-cell-styles' ).style;
}
catch (err) {
console.log('Error retrieving cell styles - ' + err.message);
}

this.cellStyles.model.set('style', style);
// Has there been any Style changes?
if ( JSON.stringify( this.model.attributes.style ) !== JSON.stringify( newStyles ) ) {
this.model.set( 'style', newStyles );
this.model.trigger( 'change:styles' );
this.model.trigger( 'change:styles-cell' );
}
}

if (args.refresh) {
Expand Down
11 changes: 8 additions & 3 deletions js/siteorigin-panels/dialog/widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -263,13 +263,18 @@ module.exports = panels.view.dialog.extend( {

if ( this.styles.stylesLoaded ) {
// If the styles view has loaded
var style = {};
var newStyles = {};
try {
style = this.getFormValues( '.so-sidebar .so-visual-styles' ).style;
newStyles = this.getFormValues( '.so-sidebar .so-visual-styles' ).style;
}
catch ( e ) {
}
this.model.set( 'style', style );

// Have there been any Style changes?
if ( JSON.stringify( this.model.attributes.style ) !== JSON.stringify( newStyles ) ) {
this.model.set( 'style', newStyles );
this.model.trigger( 'change:styles' );
}
}

this.savingWidget = false;
Expand Down
26 changes: 26 additions & 0 deletions js/siteorigin-panels/view/row.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ module.exports = Backbone.View.extend( {
}, this );

this.listenTo( this.model, 'change:label', this.onLabelChange );
this.listenTo( this.model, 'change:styles-row ', this.toggleVisibilityFade );
},

/**
Expand Down Expand Up @@ -88,6 +89,8 @@ module.exports = Backbone.View.extend( {
this.$('.so-row-toolbar' ).remove();
}

this.toggleVisibilityFade();

// Resize the rows when ever the widget sortable moves
this.listenTo( this.builder, 'widget_sortable_move', this.resizeRow );
this.listenTo( this.builder, 'builder_resize', this.resizeRow );
Expand All @@ -97,6 +100,29 @@ module.exports = Backbone.View.extend( {
return this;
},

checkIfStyleExists: function( styles, setting ) {
return typeof styles[ setting ] !== 'undefined' && styles[ setting ] == 'on';
},

/**
* Toggle Visibility: Check if row is hidden and apply fade as needed.
*/
toggleVisibilityFade: function() {
var currentRowStyle = this.model.attributes.style;
if (
this.checkIfStyleExists( currentRowStyle, 'disable_row' ) ||
this.checkIfStyleExists( currentRowStyle, 'disable_desktop' ) ||
this.checkIfStyleExists( currentRowStyle, 'disable_tablet' ) ||
this.checkIfStyleExists( currentRowStyle, 'disable_mobile' ) ||
this.checkIfStyleExists( currentRowStyle, 'disable_logged_in' ) ||
this.checkIfStyleExists( currentRowStyle, 'disable_logged_out' )
) {
this.$el.addClass( 'so-hidden-row' );
} else {
this.$el.removeClass( 'so-hidden-row' );
}
},

/**
* Give a visual indication of the creation of this row
*/
Expand Down
28 changes: 27 additions & 1 deletion js/siteorigin-panels/view/widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ module.exports = Backbone.View.extend( {
initialize: function () {
this.listenTo(this.model, 'destroy', this.onModelDestroy);
this.listenTo(this.model, 'change:values', this.onModelChange);
this.listenTo( this.model, 'change:styles ', this.toggleVisibilityFade );
this.listenTo(this.model, 'change:label', this.onLabelChange);
},

Expand Down Expand Up @@ -80,12 +81,37 @@ module.exports = Backbone.View.extend( {
dialog.setupDialog();
}

this.toggleVisibilityFade();

// Add the global builder listeners
this.listenTo(this.cell.row.builder, 'after_user_adds_widget', this.afterUserAddsWidgetHandler);
this.listenTo( this.cell.row.builder, 'after_user_adds_widget', this.afterUserAddsWidgetHandler );

return this;
},

checkIfStyleExists: function( styles, setting ) {
return typeof styles[ setting ] !== 'undefined' && styles[ setting ] == 'on';
},

/**
* Toggle Visibility: Check if row is hidden and apply fade as needed.
*/
toggleVisibilityFade: function() {
var currentRowStyle = this.model.attributes.style;
if (
this.checkIfStyleExists( currentRowStyle, 'disable_widget' ) ||
this.checkIfStyleExists( currentRowStyle, 'disable_desktop' ) ||
this.checkIfStyleExists( currentRowStyle, 'disable_tablet' ) ||
this.checkIfStyleExists( currentRowStyle, 'disable_mobile' ) ||
this.checkIfStyleExists( currentRowStyle, 'disable_logged_in' ) ||
this.checkIfStyleExists( currentRowStyle, 'disable_logged_out' )
) {
this.$el.addClass( 'so-hidden-widget' );
} else {
this.$el.removeClass( 'so-hidden-widget' );
}
},

/**
* Display an animation that implies creation using a visual animation
*/
Expand Down
4 changes: 4 additions & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,10 @@ SiteOrigin Premium includes access to our professional email support service, pe

== Changelog ==

= 2.15.1 - 27 November 2021 =
* Updated Page Builder `Pro Tips`.
* SiteOrigin Premium: Added row and widget fade styling when hidden by the Toggle Visibility Addon.

= 2.15.0 - 22 October 2021 =
* Added a "Mobile Margin" setting to `Widget Styles > Mobile Layout`.
* Ensured the Widget Title is used as the widget description if present.
Expand Down

0 comments on commit cbf0b89

Please sign in to comment.