diff --git a/.gitignore b/.gitignore index f240ab3..9b9245f 100644 --- a/.gitignore +++ b/.gitignore @@ -4,5 +4,8 @@ .project /.idea +# Ignore .bak files +js/widget-settings.min.js.bak + # Ignore system files .DS_Store diff --git a/admin.php b/admin.php index dafcba7..e27d4a9 100755 --- a/admin.php +++ b/admin.php @@ -56,9 +56,9 @@ function emfluence_emailer_admin_enqueue_scripts($hook) { ); wp_enqueue_script( - 'emfluence-emailer-widget' - ,plugins_url( '/js/widget-settings.min.js', __FILE__ ) - ,array('jquery', 'jquery-ui-accordion', 'jquery-ui-datepicker') + 'emfluence-emailer-widget' + ,plugins_url( '/js/widget-settings.min.js', __FILE__ ) + ,array('jquery', 'jquery-ui-accordion', 'jquery-ui-datepicker') ); // in JavaScript, object properties are accessed as ajax_object.ajax_url, ajax_object.we_value diff --git a/css/widget-frontend.css b/css/widget-frontend.css old mode 100644 new mode 100755 index 9f3fc78..ca8c699 --- a/css/widget-frontend.css +++ b/css/widget-frontend.css @@ -1,2 +1,3 @@ -.emfluence_email_signup .message.error{color:red}.emfluence_email_signup .field.row,.emfluence_email_signup .actions.row{padding:0.5em 0} +/*.emfluence_email_signup .message.error{color:red}.emfluence_email_signup .field.row,.emfluence_email_signup .actions.row{padding:0.5em 0}*/ +.emfluence_email_signup {.message.error {color: red;}.field.row, .actions.row {padding: 0.5em 0;}.field.row label {display: block;}} /*# sourceMappingURL=widget-frontend.css.map */ diff --git a/css/widget-frontend.css.map b/css/widget-frontend.css.map old mode 100644 new mode 100755 diff --git a/css/widget-frontend.scss b/css/widget-frontend.scss old mode 100644 new mode 100755 index 59dfe17..6d92229 --- a/css/widget-frontend.scss +++ b/css/widget-frontend.scss @@ -6,4 +6,8 @@ .actions.row { padding: 0.5em 0; } + + .field.row label { + display: block; + } } \ No newline at end of file diff --git a/css/widget-settings.css b/css/widget-settings.css old mode 100644 new mode 100755 index 8f358f9..33b45b6 --- a/css/widget-settings.css +++ b/css/widget-settings.css @@ -485,8 +485,24 @@ .wp-emfluence { padding: 10px 0; } .wp-emfluence .contact-field { border-top: solid 1px #aaa; padding: 5px 0 10px; } .wp-emfluence p.heading label { padding-right: 10px; display: inline-block; } +.wp-emfluence p.heading label:first-of-type { font-weight: bold !important; } +.wp-emfluence p.heading label input.order { display: inline !important; width: 40px !important; } .wp-emfluence label.heading { font-weight: 600; font-size: 1rem; } .wp-emfluence input.hidden-value { display: none; vertical-align: middle; } .wp-emfluence .validation-error { color: red; display: block; } +.widget-content p, .widget-content .wp-emfluence p { font-size: 12px; } +.widget-content .wp-emfluence div.filter { display: block; width: 100%; } +.widget-content .wp-emfluence div.selected { display: block; width: 100%; padding: 0 10px; } +.widget-content .wp-emfluence div.selected div { display: block; } + +.wp-emfluence .basic-fields-adder p select { display: inline-block !important; width: 60% !important; } +.wp-emfluence .basic-fields-adder p button { display: inline-block !important; margin-left: 6px; } + +.wp-emfluence .custom-variable-adder p input { width: 60% !important; display: inline-block !important; } +.wp-emfluence .custom-variable-adder p button { display: inline-block !important; margin-left: 5px; } + +/* .wp-emfluence .contact-field label { display: inline !important; } +.wp-emfluence .contact-field label input.order { width: 20px; } */ + /*# sourceMappingURL=widget-settings.css.map */ diff --git a/css/widget-settings.css.map b/css/widget-settings.css.map old mode 100644 new mode 100755 diff --git a/css/widget-settings.scss b/css/widget-settings.scss old mode 100644 new mode 100755 index 78709e8..d16e3a4 --- a/css/widget-settings.scss +++ b/css/widget-settings.scss @@ -10,6 +10,13 @@ padding-right: 10px; display: inline-block; } + p.heading label:first-of-type { + font-weight: bold !important; + } + p.heading label input.order { + display: inline !important; + width: 40px !important; + } label.heading { font-weight: 600; font-size: 1rem; @@ -22,4 +29,49 @@ color: red; display: block; } + + p { + font-size: 12px; + } + + div.filter { + display: block; width: 100%; + } + + div.selected { + display: block; + width: 100%; + padding: 0 10px; + + div { + display: block; + } + } + + .basic-fields-adder { + p { + select { + display: inline-block !important; width: 60% !important; + } + + button { + display: inline-block !important; margin-left: 6px; + } + } + } + + .custom-variable-adder p input { + width: 60% !important; + display: inline-block !important; + } + .custom-variable-adder p button { + display: inline-block !important; + margin-left: 5px; + } +} + +.widget-content { + p { + font-size: 12px; + } } diff --git a/emfluence.php b/emfluence.php index 8f4c5f7..adbe717 100755 --- a/emfluence.php +++ b/emfluence.php @@ -4,7 +4,7 @@ Plugin URI: https://github.com/emfluencekc/wp-emfluence Description: Easily add forms to your website for contacts to add or update their details in your emfluence Marketing Platform account. Author: emfluence Digital Marketing -Version: 2.13 +Version: 2.14 Author URI: https://www.emfluence.com Text Domain: emfl_form */ diff --git a/js/widget-settings.js b/js/widget-settings.js index 19d25c6..98cd250 100755 --- a/js/widget-settings.js +++ b/js/widget-settings.js @@ -1,5 +1,6 @@ // Multiple instances of the widget may exist on the widget settings page. // This is completely functional programming. + emfluenceEmailerWidget = { init: function() { @@ -9,6 +10,7 @@ emfluenceEmailerWidget = { collapsible: true, active: false }); + jQuery('.wp-emfluence .type-selector').each(function(index, el) { emfluenceEmailerWidget.fields.typeSelected(jQuery(el).parents('.type-section')); }); @@ -55,9 +57,12 @@ emfluenceEmailerWidget = { add: function(element){ $widget = jQuery(element).parents('.widget'); $input = this.getInput($widget); + + $groupIdsContainer = this.getGroupIdsContainer($widget); // Validate the value var values = this.processValue($input.val()); + if( !values ){ return; } @@ -71,14 +76,45 @@ emfluenceEmailerWidget = { } $checkboxesContainer.append( this.createCheckbox($widget, values) ); + + if($groupIdsContainer.val().length === 0) { + $groupIdsContainer.val( values.id ); + } else { + $groupIdsContainer.val( $groupIdsContainer.val() + ',' + values.id ); + } + $input.val(null); } + + ,removeGroup: function(element) { + $widget = jQuery(element).parents('.widget'); + $groupIdsContainer = this.getGroupIdsContainer($widget); + $currentGroupId = jQuery(element).attr("value"); + $groupIdsArray = $groupIdsContainer.val().split(','); + + if(jQuery(element).is(":checked")) { + $groupIdsArray.push($currentGroupId); + } else { + $groupIdsArray = jQuery.grep( $groupIdsArray, function(value) { + return value != $currentGroupId; + }); + } + + $commaString = $groupIdsArray.join(","); + $groupIdsContainer.val($commaString); + } + ,getInput: function($widget){ return $widget.find('.groups input[list]'); } ,getCheckboxesContainer: function($widget){ return $widget.find('.groups .selected'); } + + ,getGroupIdsContainer: function($widget) { + return $widget.find('.begroups'); + } + ,processValue: function(value){ // Seperate the name and id // It should be in the format of name [##] @@ -92,8 +128,20 @@ emfluenceEmailerWidget = { } } ,createCheckbox: function($widget, values){ - var widgetId = $widget.attr('id').slice(-1); - var id = 'groups-' + widgetId + '-' + values.id; + + var widgetId = ''; + var id = ''; + + try{ + widgetId = $widget.attr('id').slice(-1); + id = 'groups-' + widgetId + '-' + values.id; + } + catch { + instance_number = jQuery("#emfluence_email_signup_instance").val(); + widgetId = 'widget-7_emfluence_email_signup-' + instance_number.slice(-1); + id = 'groups-' + instance_number + '-' + values.id; + } + var html = '