Skip to content

Commit

Permalink
Merge pull request #12 from AdTechMedia/dev
Browse files Browse the repository at this point in the history
Fix issues reported wp.org
  • Loading branch information
AlexanderC authored Dec 1, 2016
2 parents aa96425 + ae3b5ac commit 8b45b6b
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 66 deletions.
36 changes: 21 additions & 15 deletions src/adtechmedia-plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -263,38 +263,44 @@ public function ajax_save_template() {
]
);
} else if ( isset( $_POST['contentConfig'] ) ) {
$content_config = json_decode( stripslashes( $_POST['contentConfig'] ), true );
$content_config = json_decode( wp_unslash( $_POST['contentConfig'] ), true );
foreach ( $content_config as $a_option_key => $a_option_meta ) {
if ( ! empty( $content_config[ $a_option_key ] ) ) {
$this->update_plugin_option( $a_option_key, $content_config[ $a_option_key ] );
}
}
$this->update_prop();
} else {
$inputs = $_POST['inputs'];
$style_inputs = $_POST['styleInputs'];
$component = $_POST['component'];
$options = [
'template_inputs' => 'inputs',
'template_style_inputs' => 'styleInputs',
'template_position' => 'position',
'template_overall_styles' => 'overallStyles',
'template_overall_styles_inputs' => 'overallStylesInputs',
];
$data = [];
foreach ( $options as $db_key => $post_key ) {
$value = '';
if ( isset ( $_POST[ $post_key ] ) ) {
$value = sanitize_text_field( wp_unslash( $_POST[ $post_key ] ) );
}
$data[ $db_key ] = $value;
$this->add_plugin_option( $db_key, $value );
}
$component = sanitize_text_field( wp_unslash( $_POST['component'] ) );
$template = $_POST['template'];
$position = $_POST['position'];
$overall_styles = $_POST['overallStyles'];
$overall_styles_inputs = $_POST['overallStylesInputs'];
$this->add_plugin_option( 'template_inputs', $inputs );
$this->add_plugin_option( 'template_style_inputs', $style_inputs );
$this->add_plugin_option( 'template_' . $component, $template );
$this->add_plugin_option( 'template_position', $position );
$this->add_plugin_option( 'template_overall_styles', $overall_styles );
$this->add_plugin_option( 'template_overall_styles_inputs', $overall_styles_inputs );
Adtechmedia_Request::property_update_config_by_array(
$this->get_plugin_option( 'id' ),
$this->get_plugin_option( 'key' ),
[
'templates' => [ $component => base64_encode( stripslashes( $template ) ), ],
'targetModal' => [
'targetCb' => $this->get_target_cb_js( json_decode( stripslashes( $position ), true ) ),
'toggleCb' => $this->get_toggle_cb_js( json_decode( stripslashes( $position ), true ) ),
'targetCb' => $this->get_target_cb_js( json_decode( stripslashes( $data[ 'template_position' ] ), true ) ),
'toggleCb' => $this->get_toggle_cb_js( json_decode( stripslashes( $data[ 'template_position' ] ), true ) ),
],
'styles' => [
'main' => base64_encode( $overall_styles ),
'main' => base64_encode( $data[ 'template_overall_styles' ] ),
],
]
);
Expand Down
3 changes: 3 additions & 0 deletions src/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -2039,4 +2039,7 @@ input:disabled::-moz-placeholder { /* Mozilla Firefox 19+ */
}
input:disabled:-ms-input-placeholder { /* Internet Explorer 10+ */
color: #e1e1e1;
}
.template-name[data-view-text="collapsed"]{
padding-top: 16px;
}
7 changes: 5 additions & 2 deletions src/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ function fillPositionFields() {
}
}
});
if (!jQuery(this).prop('checked')) {
if (!jQuery('#checkbox-sticky').prop('checked')) {
jQuery('.disable-if-sticky input').attr('disabled', 'disabled');
} else {
jQuery('.disable-if-sticky input').removeAttr('disabled');
Expand Down Expand Up @@ -188,7 +188,7 @@ jQuery(document).ready(function () {
inputName : 'message-expanded',
type : 'expanded'
}, {
name : 'heading-headline',
name : 'heading-headline-setup',
inputName : 'message-collapsed',
type : 'collapsed'
}]
Expand Down Expand Up @@ -363,12 +363,15 @@ jQuery(document).ready(function () {

var $form = $('section.views-tabs');
var $inputs = $form.find('input');
var $colorInputs = $form.find('input[type="color"]');
$inputs.bind('keyup', throttledSync);
$colorInputs.bind('change', throttledSync);

var overallSync = jQuery.throttle(200, function () {
applayOverallStyling(getOverallStyling());
});
jQuery('[data-template="overall-styling"] input').bind('keyup', overallSync);
jQuery('[data-template="overall-styling"] input[type="color"]').bind('change', overallSync);

function addLoader(btn){
var icon = btn.find('i');
Expand Down
Loading

0 comments on commit 8b45b6b

Please sign in to comment.