Best Python code snippet using hypothesis
editemailtemplate.js
Source:editemailtemplate.js
1$(function(){2 /* --- APP VALUES --- */3 var template_id = $('#current_template_id').val();4 var old_content = $('#current_content_value').val();5 var mf_summernote = $('#summernote');6 /* --- AUTHENTICATION --- */7 var csrf_token = $('meta[name=csrf-token]').attr('content');8 /* --- INPUT FIELDS --- */9 var email_subject_input = $('#email_subject_input');10 var emailTitleInput = $('#emailTitleInput');11 var buttonTextInput = $('#buttonTextInput');12 var buttonLink = $('#buttonUrlInput');13 var checkoutUrlSelect = $('#checkout_url_select');14 var button_select = $('#button_select');15 var button_form_div = $('#button_forms_div');16 var color_select = $('#color_select');17 //var theme_color_select = $('#theme_color_select');18 var theme_color = $('#theme_color');19 var mf_email_hyperlink_input = $('#mf_email_hyperlink_input');20 var mf_email_hyperlink_text = $('#mf_email_hyperlink_text');21 /* --- EMAIL PREVIEW FIELDS --- */22 var preview_email_title = $('#printEmailTitle');23 var preview_email_button_text = $('#printButtonText');24 var preview_email_buttons_div = $('#preview_buttons_div');25 var preview_email_header = $('#preview_header');26 /* --- EMAIL GREETING COMPONENTS --- */27 var greet_use_default = $('#mf_greet_default');28 var greet_set_div = $('#mf_greet_div');29 var greet_content = $('#mf_greet_content');30 var greet_cust_name_before = $('#mf_greet_before_cust_name');31 var greet_cust_name_after = $('#mf_greet_after_cust_name');32 var preview_greet_default = $('#mf_preview_def_greet');33 var preview_greet = $('#mf_preview_greet');34 var preview_greet_content = $('#preview_greet_content');35 var preview_greet_cust_before = $('#preview_greet_before');36 var preview_greet_cust_after = $('#preview_greet_after');37 /* --- BUTTONS --- */38 var email_submit = $('#email_list_submit_button');39 var mf_email_hyperlink_submit = $('#mf_email_hyperlink_submit');40 /* --- MODALS --- */41 var email_template_saved_modal = $('#email_template_saved_modal');42 var mf_email_hyperlink_modal = $('#mf_email_hyperlink_modal');43 /* --- CUSTOM SUMMERNOTE BUTTONS --- */44 var hyperlinkButton;45 //Initialize Edit Email Template Page46 init();47 /* --- Functions to live update EmailView --- */48 theme_color.on('change', function() {49 var color = $(this).val();50 preview_email_header.css('background', color);51 preview_email_button_text.css('background', color);52 });53 emailTitleInput.on("keyup", function(){54 preview_email_title.html(emailTitleInput.val());55 });56 buttonTextInput.on("keyup", function(){57 preview_email_button_text.html(buttonTextInput.val());58 });59 button_select.on('change', function(){60 if ($(this).val() === 'true') {61 preview_email_buttons_div.show();62 button_form_div.show();63 } else {64 preview_email_buttons_div.hide();65 button_form_div.hide();66 }67 });68 checkoutUrlSelect.on('change', function(){69 if (this.checked) {70 $(this).val(1);71 $("#buttonUrlInput").prop('disabled', true);72 $('#abandoned_text').show();73 } else {74 $(this).val(0);75 $("#buttonUrlInput").prop('disabled', false);76 $('#abandoned_text').hide();77 }78 });79 email_submit.on("click", function(e){80 e.preventDefault();81 var email_subject = email_subject_input.val();82 var email_title = emailTitleInput.val();83 var email_content = $('#summernote').summernote('code');84 var button_text = buttonTextInput.val();85 var button_url = buttonLink.val();86 var color = theme_color.val();87 var has_button = false;88 if (button_select.val() === "true") {89 has_button = true;90 }91 $.ajax({92 type:'POST',93 url: '/ajax_update_email_template',94 dataType: "json",95 data: {96 id: template_id,97 email_subject: email_subject,98 email_title: email_title,99 email_content: email_content,100 has_button: has_button,101 button_text: button_text,102 button_url: button_url,103 color: color,104 has_checkout: checkoutUrlSelect.val(),105 greet_use_default: greet_use_default.val(),106 greet_content: greet_content.val(),107 greet_before_cust_name: greet_cust_name_before.val(),108 greet_after_cust_name: greet_cust_name_after.val(),109 authenticity_token: csrf_token110 },111 error: function(e) {112 console.log(e);113 },114 success: function(response) {115 console.log(response);116 email_template_saved_modal.modal('toggle');117 }118 });119 });120 greet_content.on('keyup', function() {121 preview_greet_content.html($(this).val());122 });123 greet_use_default.on('change', function() {124 if (this.checked) {125 $(this).val(1);126 greet_set_div.attr('class', 'hidden');127 preview_greet_default.attr('class', '');128 preview_greet.attr('class', 'hidden');129 } else {130 $(this).val(0);131 greet_set_div.attr('class', '');132 preview_greet_default.attr('class', 'hidden');133 preview_greet.attr('class', '');134 }135 });136 greet_use_default.on('change', function() {137 if (this.checked) {138 $(this).val(1);139 greet_set_div.attr('class', 'hidden');140 preview_greet_default.attr('class', '');141 preview_greet.attr('class', 'hidden');142 } else {143 $(this).val(0);144 greet_set_div.attr('class', '');145 preview_greet_default.attr('class', 'hidden');146 preview_greet.attr('class', '');147 }148 });149 greet_cust_name_before.on('change', function() {150 if (this.checked) {151 $(this).val(1);152 greet_cust_name_after.attr('checked', false);153 greet_cust_name_after.val(0);154 preview_greet_cust_after.hide();155 preview_greet_cust_before.show();156 } else {157 $(this).val(0);158 greet_cust_name_after.val(0);159 preview_greet_cust_after.hide();160 preview_greet_cust_before.hide();161 }162 });163 greet_cust_name_after.on('change', function() {164 if (this.checked) {165 $(this).val(1);166 greet_cust_name_before.attr('checked', false);167 greet_cust_name_before.val(0);168 preview_greet_cust_before.hide();169 preview_greet_cust_after.show();170 } else {171 $(this).val(0);172 greet_cust_name_before.val(0);173 preview_greet_cust_after.hide();174 preview_greet_cust_before.hide();175 }176 });177 mf_email_hyperlink_input.on('keyup', function() {178 if ($(this).val() === '' || mf_email_hyperlink_text.val() === '') {179 mf_email_hyperlink_submit.prop('disabled', true);180 } else {181 mf_email_hyperlink_submit.prop('disabled', false);182 }183 });184 mf_email_hyperlink_text.on('keyup', function() {185 if ($(this).val() === '' || mf_email_hyperlink_input.val() === '') {186 mf_email_hyperlink_submit.prop('disabled', true);187 } else {188 mf_email_hyperlink_submit.prop('disabled', false);189 }190 });191 mf_email_hyperlink_submit.on('click', function() {192 if (mf_email_hyperlink_input.val() === '') {193 mf_email_hyperlink_submit.prop('disabled', true);194 return;195 }196 $.ajax({197 type: 'POST',198 url: '/mf_email_template_add_link',199 data: {200 url: mf_email_hyperlink_input.val(),201 template_id: template_id202 },203 error: function(e) {204 console.log(e);205 },206 success: function(response) {207 console.log(response);208 mf_summernote.summernote('createLink', {209 text: mf_email_hyperlink_text.val(),210 url: response.link,211 isNewWindow: true212 });213 mf_email_hyperlink_modal.modal('toggle');214 }215 });216 });217 function init() {218 /* --- INITIAL EDIT EMAIL SETUP --- */219 preview_email_title.html(emailTitleInput.val());220 preview_email_button_text.html(buttonTextInput.val());221 color_select.val($('#current_color_value').val());222 //Set the Value of the Show Button Select from DB223 if ($('#show_button_value').val() === '1') {224 button_select.val('true');225 } else {226 button_select.val('false');227 }228 if (button_select.val() === 'true') {229 preview_email_buttons_div.show();230 button_form_div.show();231 } else {232 preview_email_buttons_div.hide();233 button_form_div.hide();234 }235 if (greet_use_default.val() === '1') {236 greet_use_default.attr('checked', true);237 greet_set_div.attr('class', 'hidden');238 preview_greet_default.attr('class', '');239 preview_greet.attr('class', 'hidden');240 } else {241 greet_use_default.attr('checked', false);242 greet_set_div.attr('class', '');243 preview_greet_default.attr('class', 'hidden');244 preview_greet.attr('class', '');245 }246 if (greet_cust_name_before.val() === '1') {247 greet_cust_name_before.attr('checked', true);248 preview_greet_cust_before.show();249 } else {250 greet_cust_name_before.attr('checked', false);251 preview_greet_cust_before.hide();252 }253 if (greet_cust_name_after.val() === '1') {254 greet_cust_name_after.attr('checked', true);255 preview_greet_cust_after.show();256 } else {257 greet_cust_name_after.attr('checked', false);258 preview_greet_cust_after.hide();259 }260 // set the value of checkout select from db261 if ($('#checkout_url_select').val() === '1') {262 checkoutUrlSelect.attr('checked', true);263 $("#buttonUrlInput").prop('disabled', true);264 $('#abandoned_text').show();265 } else {266 checkoutUrlSelect.attr('checked', false);267 $("#buttonUrlInput").prop('disabled', false);268 $('#abandoned_text').hide();269 }270 // Initialize hyperlinkButton271 hyperlinkButton = function (context) {272 var ui = $.summernote.ui;273 // create button274 var button = ui.button({275 contents: '<i class="fa fa-link"/>',276 tooltip: 'Add Hyperlink',277 click: function () {278 // invoke insertText method with 'hello' on editor module.279 mf_email_hyperlink_modal.modal('toggle');280 mf_email_hyperlink_input.val('');281 mf_email_hyperlink_text.val('');282 mf_email_hyperlink_submit.prop('disabled', true);283 }284 });285 return button.render(); // return button as jquery object286 };287 mf_summernote.summernote({288 height: 350,289 width: $('#email_summernote_cont').width(),290 toolbar: [291 // [groupName, [list of button]]292 ['style', ['bold', 'italic', 'underline', 'clear']],293 ['font', ['strikethrough']],294 ['insert', ['picture', 'link']],295 ['fontsize', ['fontsize']],296 ['color', ['color']],297 ['para', ['ul', 'ol', 'paragraph']],298 ['height', ['height']],299 ['misc', ['fullscreen']]300 ],301 shortcuts: false,302 dialogsInBody: true,303 callbacks: {304 onImageUpload: function (files, editor, welEditable) {305 sendFile(files[0], editor, welEditable);306 }307 },308 buttons: {309 hello: hyperlinkButton310 }311 });312 mf_summernote.summernote('code', old_content);313 $('.left_col').height($('.right_col').height() + 100);314 //Set Color Picker to bootstrap color picker instance315 $('#theme_color_select').colorpicker();316 }317 function sendFile(file, editor, welEditable) {318 data = new FormData();319 data.append("file", file);320 $.ajax({321 data: data,322 type: "POST",323 url: "/upload_image_to_aws",324 cache: false,325 contentType: false,326 processData: false,327 success: function(response) {328 console.log(response);329 mf_summernote.summernote('insertImage', response.url);330 }331 });332 }333 $('.btn-fullscreen').on('click', function(e) {334 e.preventDefault();335 $('.left_col').toggle();336 });...
editemailtemplate-6631bd95627477141fe252c326cd32321982bb48d280797cde261eadd03f5be2.js
Source:editemailtemplate-6631bd95627477141fe252c326cd32321982bb48d280797cde261eadd03f5be2.js
1$(function(){2 /* --- APP VALUES --- */3 var template_id = $('#current_template_id').val();4 var old_content = $('#current_content_value').val();5 var mf_summernote = $('#summernote');6 /* --- AUTHENTICATION --- */7 var csrf_token = $('meta[name=csrf-token]').attr('content');8 /* --- INPUT FIELDS --- */9 var email_subject_input = $('#email_subject_input');10 var emailTitleInput = $('#emailTitleInput');11 var buttonTextInput = $('#buttonTextInput');12 var buttonLink = $('#buttonUrlInput');13 var checkoutUrlSelect = $('#checkout_url_select');14 var button_select = $('#button_select');15 var button_form_div = $('#button_forms_div');16 var color_select = $('#color_select');17 //var theme_color_select = $('#theme_color_select');18 var theme_color = $('#theme_color');19 var mf_email_hyperlink_input = $('#mf_email_hyperlink_input');20 var mf_email_hyperlink_text = $('#mf_email_hyperlink_text');21 /* --- EMAIL PREVIEW FIELDS --- */22 var preview_email_title = $('#printEmailTitle');23 var preview_email_button_text = $('#printButtonText');24 var preview_email_buttons_div = $('#preview_buttons_div');25 var preview_email_header = $('#preview_header');26 /* --- EMAIL GREETING COMPONENTS --- */27 var greet_use_default = $('#mf_greet_default');28 var greet_set_div = $('#mf_greet_div');29 var greet_content = $('#mf_greet_content');30 var greet_cust_name_before = $('#mf_greet_before_cust_name');31 var greet_cust_name_after = $('#mf_greet_after_cust_name');32 var preview_greet_default = $('#mf_preview_def_greet');33 var preview_greet = $('#mf_preview_greet');34 var preview_greet_content = $('#preview_greet_content');35 var preview_greet_cust_before = $('#preview_greet_before');36 var preview_greet_cust_after = $('#preview_greet_after');37 /* --- BUTTONS --- */38 var email_submit = $('#email_list_submit_button');39 var mf_email_hyperlink_submit = $('#mf_email_hyperlink_submit');40 /* --- MODALS --- */41 var email_template_saved_modal = $('#email_template_saved_modal');42 var mf_email_hyperlink_modal = $('#mf_email_hyperlink_modal');43 /* --- CUSTOM SUMMERNOTE BUTTONS --- */44 var hyperlinkButton;45 //Initialize Edit Email Template Page46 init();47 /* --- Functions to live update EmailView --- */48 theme_color.on('change', function() {49 var color = $(this).val();50 preview_email_header.css('background', color);51 preview_email_button_text.css('background', color);52 });53 emailTitleInput.on("keyup", function(){54 preview_email_title.html(emailTitleInput.val());55 });56 buttonTextInput.on("keyup", function(){57 preview_email_button_text.html(buttonTextInput.val());58 });59 button_select.on('change', function(){60 if ($(this).val() === 'true') {61 preview_email_buttons_div.show();62 button_form_div.show();63 } else {64 preview_email_buttons_div.hide();65 button_form_div.hide();66 }67 });68 checkoutUrlSelect.on('change', function(){69 if (this.checked == true) {70 $(this).val(1);71 $("#buttonUrlInput").prop('disabled', true);72 $('#abandoned_text').show();73 } else {74 $(this).val(0);75 $("#buttonUrlInput").prop('disabled', false);76 $('#abandoned_text').hide();77 }78 });79 email_submit.on("click", function(e){80 e.preventDefault();81 var email_subject = email_subject_input.val();82 var email_title = emailTitleInput.val();83 var email_content = $('#summernote').summernote('code');84 var button_text = buttonTextInput.val();85 var button_url = buttonLink.val();86 var color = theme_color.val();87 var has_button = false;88 if (button_select.val() === "true") {89 has_button = true;90 }91 $.ajax({92 type:'POST',93 url: '/ajax_update_email_template',94 dataType: "json",95 data: {96 id: template_id,97 email_subject: email_subject,98 email_title: email_title,99 email_content: email_content,100 has_button: has_button,101 button_text: button_text,102 button_url: button_url,103 color: color,104 has_checkout: checkoutUrlSelect.val(),105 greet_use_default: greet_use_default.val(),106 greet_content: greet_content.val(),107 greet_before_cust_name: greet_cust_name_before.val(),108 greet_after_cust_name: greet_cust_name_after.val(),109 authenticity_token: csrf_token110 },111 error: function(e) {112 console.log(e);113 },114 success: function(response) {115 console.log(response);116 email_template_saved_modal.modal('toggle');117 }118 });119 });120 greet_content.on('keyup', function() {121 preview_greet_content.html($(this).val());122 });123 greet_use_default.on('change', function() {124 if (this.checked) {125 $(this).val(1);126 greet_set_div.attr('class', 'hidden');127 preview_greet_default.attr('class', '');128 preview_greet.attr('class', 'hidden');129 } else {130 $(this).val(0);131 greet_set_div.attr('class', '');132 preview_greet_default.attr('class', 'hidden');133 preview_greet.attr('class', '');134 }135 });136 greet_use_default.on('change', function() {137 if (this.checked) {138 $(this).val(1);139 greet_set_div.attr('class', 'hidden');140 preview_greet_default.attr('class', '');141 preview_greet.attr('class', 'hidden');142 } else {143 $(this).val(0);144 greet_set_div.attr('class', '');145 preview_greet_default.attr('class', 'hidden');146 preview_greet.attr('class', '');147 }148 });149 greet_cust_name_before.on('change', function() {150 if (this.checked) {151 $(this).val(1);152 greet_cust_name_after.attr('checked', false);153 greet_cust_name_after.val(0);154 preview_greet_cust_after.hide();155 preview_greet_cust_before.show();156 } else {157 $(this).val(0);158 greet_cust_name_after.val(0);159 preview_greet_cust_after.hide();160 preview_greet_cust_before.hide();161 }162 });163 greet_cust_name_after.on('change', function() {164 if (this.checked) {165 $(this).val(1);166 greet_cust_name_before.attr('checked', false);167 greet_cust_name_before.val(0);168 preview_greet_cust_before.hide();169 preview_greet_cust_after.show();170 } else {171 $(this).val(0);172 greet_cust_name_before.val(0);173 preview_greet_cust_after.hide();174 preview_greet_cust_before.hide();175 }176 });177 mf_email_hyperlink_input.on('keyup', function() {178 if ($(this).val() === '' || mf_email_hyperlink_text.val() === '') {179 mf_email_hyperlink_submit.prop('disabled', true);180 } else {181 mf_email_hyperlink_submit.prop('disabled', false);182 }183 });184 mf_email_hyperlink_text.on('keyup', function() {185 if ($(this).val() === '' || mf_email_hyperlink_input.val() === '') {186 mf_email_hyperlink_submit.prop('disabled', true);187 } else {188 mf_email_hyperlink_submit.prop('disabled', false);189 }190 });191 mf_email_hyperlink_submit.on('click', function() {192 if (mf_email_hyperlink_input.val() === '') {193 mf_email_hyperlink_submit.prop('disabled', true);194 return;195 }196 $.ajax({197 type: 'POST',198 url: '/mf_email_template_add_link',199 data: {200 url: mf_email_hyperlink_input.val(),201 template_id: template_id202 },203 error: function(e) {204 console.log(e);205 },206 success: function(response) {207 console.log(response);208 mf_summernote.summernote('createLink', {209 text: mf_email_hyperlink_text.val(),210 url: response.link,211 isNewWindow: true212 });213 mf_email_hyperlink_modal.modal('toggle');214 }215 });216 });217 function init() {218 /* --- INITIAL EDIT EMAIL SETUP --- */219 preview_email_title.html(emailTitleInput.val());220 preview_email_button_text.html(buttonTextInput.val());221 color_select.val($('#current_color_value').val());222 //Set the Value of the Show Button Select from DB223 if ($('#show_button_value').val() === '1') {224 button_select.val('true');225 } else {226 button_select.val('false');227 }228 if (button_select.val() === 'true') {229 preview_email_buttons_div.show();230 button_form_div.show();231 } else {232 preview_email_buttons_div.hide();233 button_form_div.hide();234 }235 if (greet_use_default.val() === '1') {236 greet_use_default.attr('checked', true);237 greet_set_div.attr('class', 'hidden');238 preview_greet_default.attr('class', '');239 preview_greet.attr('class', 'hidden');240 } else {241 greet_use_default.attr('checked', false);242 greet_set_div.attr('class', '');243 preview_greet_default.attr('class', 'hidden');244 preview_greet.attr('class', '');245 }246 if (greet_cust_name_before.val() === '1') {247 greet_cust_name_before.attr('checked', true);248 preview_greet_cust_before.show();249 } else {250 greet_cust_name_before.attr('checked', false);251 preview_greet_cust_before.hide();252 }253 if (greet_cust_name_after.val() === '1') {254 greet_cust_name_after.attr('checked', true);255 preview_greet_cust_after.show();256 } else {257 greet_cust_name_after.attr('checked', false);258 preview_greet_cust_after.hide();259 }260 // set the value of checkout select from db261 if ($('#checkout_url_select').val() === '1') {262 checkout_url_select.checked = true;263 $("#buttonUrlInput").prop('disabled', true);264 $('#abandoned_text').show();265 } else {266 checkout_url_select.checked = false;267 $("#buttonUrlInput").prop('disabled', false);268 $('#abandoned_text').hide();269 }270 // Initialize hyperlinkButton271 hyperlinkButton = function (context) {272 var ui = $.summernote.ui;273 // create button274 var button = ui.button({275 contents: '<i class="fa fa-link"/>',276 tooltip: 'Add Hyperlink',277 click: function () {278 // invoke insertText method with 'hello' on editor module.279 mf_email_hyperlink_modal.modal('toggle');280 mf_email_hyperlink_input.val('');281 mf_email_hyperlink_text.val('');282 mf_email_hyperlink_submit.prop('disabled', true);283 }284 });285 return button.render(); // return button as jquery object286 };287 mf_summernote.summernote({288 height: 350,289 width: $('#email_summernote_cont').width(),290 toolbar: [291 // [groupName, [list of button]]292 ['style', ['bold', 'italic', 'underline', 'clear']],293 ['font', ['strikethrough']],294 ['insert', ['picture', 'link']],295 ['fontsize', ['fontsize']],296 ['color', ['color']],297 ['para', ['ul', 'ol', 'paragraph']],298 ['height', ['height']],299 ['misc', ['fullscreen']]300 ],301 shortcuts: false,302 dialogsInBody: true,303 callbacks: {304 onImageUpload: function (files, editor, welEditable) {305 sendFile(files[0], editor, welEditable);306 }307 },308 buttons: {309 hello: hyperlinkButton310 }311 });312 mf_summernote.summernote('code', old_content);313 $('.left_col').height($('.right_col').height() + 100);314 //Set Color Picker to bootstrap color picker instance315 $('#theme_color_select').colorpicker();316 }317 function sendFile(file, editor, welEditable) {318 data = new FormData();319 data.append("file", file);320 $.ajax({321 data: data,322 type: "POST",323 url: "/upload_image_to_aws",324 cache: false,325 contentType: false,326 processData: false,327 success: function(response) {328 console.log(response);329 mf_summernote.summernote('insertImage', response.url);330 }331 });332 }333 $('.btn-fullscreen').on('click', function(e) {334 e.preventDefault();335 $('.left_col').toggle();336 });...
editemailtemplate-cf30136a5ab0724b923ce06b29e510d8c1c1415a04307ebdfe6609102ad53047.js
Source:editemailtemplate-cf30136a5ab0724b923ce06b29e510d8c1c1415a04307ebdfe6609102ad53047.js
1$(function(){2 /* --- APP VALUES --- */3 var template_id = $('#current_template_id').val();4 var old_content = $('#current_content_value').val();5 /* --- AUTHENTICATION --- */6 var csrf_token = $('meta[name=csrf-token]').attr('content');7 /* --- INPUT FIELDS --- */8 var email_subject_input = $('#email_subject_input');9 var emailTitleInput = $('#emailTitleInput');10 var buttonTextInput = $('#buttonTextInput');11 var buttonLink = $('#buttonUrlInput');12 var checkoutUrlSelect = $('#checkout_url_select');13 var button_select = $('#button_select');14 var button_form_div = $('#button_forms_div');15 var color_select = $('#color_select');16 //var theme_color_select = $('#theme_color_select');17 var theme_color = $('#theme_color');18 /* --- EMAIL PREVIEW FIELDS --- */19 var preview_email_title = $('#printEmailTitle');20 var preview_email_button_text = $('#printButtonText');21 var preview_email_buttons_div = $('#preview_buttons_div');22 var preview_email_header = $('#preview_header');23 /* --- EMAIL GREETING COMPONENTS --- */24 var greet_use_default = $('#mf_greet_default');25 var greet_set_div = $('#mf_greet_div');26 var greet_content = $('#mf_greet_content');27 var greet_cust_name_before = $('#mf_greet_before_cust_name');28 var greet_cust_name_after = $('#mf_greet_after_cust_name');29 var preview_greet_default = $('#mf_preview_def_greet');30 var preview_greet = $('#mf_preview_greet');31 var preview_greet_content = $('#preview_greet_content');32 var preview_greet_cust_before = $('#preview_greet_before');33 var preview_greet_cust_after = $('#preview_greet_after');34 /* --- BUTTONS --- */35 var email_submit = $('#email_list_submit_button');36 /* --- MODALS --- */37 var email_template_saved_modal = $('#email_template_saved_modal');38 //Initialize Edit Email Template Page39 init();40 /* --- Functions to live update EmailView --- */41 theme_color.on('change', function() {42 var color = $(this).val();43 preview_email_header.css('background', color);44 preview_email_button_text.css('background', color);45 });46 emailTitleInput.on("keyup", function(){47 preview_email_title.html(emailTitleInput.val());48 });49 buttonTextInput.on("keyup", function(){50 preview_email_button_text.html(buttonTextInput.val());51 });52 button_select.on('change', function(){53 if ($(this).val() === 'true') {54 preview_email_buttons_div.show();55 button_form_div.show();56 } else {57 preview_email_buttons_div.hide();58 button_form_div.hide();59 }60 });61 checkoutUrlSelect.on('change', function(){62 if (this.checked == true) {63 $(this).val(1);64 $("#buttonUrlInput").prop('disabled', true);65 $('#abandoned_text').show();66 } else {67 $(this).val(0);68 $("#buttonUrlInput").prop('disabled', false);69 $('#abandoned_text').hide();70 }71 });72 email_submit.on("click", function(e){73 e.preventDefault();74 var email_subject = email_subject_input.val();75 var email_title = emailTitleInput.val();76 var email_content = $('#summernote').summernote('code');77 var button_text = buttonTextInput.val();78 var button_url = buttonLink.val();79 var color = theme_color.val();80 var has_button = false;81 if (button_select.val() === "true") {82 has_button = true;83 }84 $.ajax({85 type:'POST',86 url: '/ajax_update_email_template',87 dataType: "json",88 data: {89 id: template_id,90 email_subject: email_subject,91 email_title: email_title,92 email_content: email_content,93 has_button: has_button,94 button_text: button_text,95 button_url: button_url,96 color: color,97 has_checkout: checkoutUrlSelect.val(),98 greet_use_default: greet_use_default.val(),99 greet_content: greet_content.val(),100 greet_before_cust_name: greet_cust_name_before.val(),101 greet_after_cust_name: greet_cust_name_after.val(),102 authenticity_token: csrf_token103 },104 error: function(e) {105 console.log(e);106 },107 success: function(response) {108 console.log(response);109 email_template_saved_modal.modal('toggle');110 }111 });112 });113 greet_content.on('keyup', function() {114 preview_greet_content.html($(this).val());115 });116 greet_use_default.on('change', function() {117 if (this.checked) {118 $(this).val(1);119 greet_set_div.attr('class', 'hidden');120 preview_greet_default.attr('class', '');121 preview_greet.attr('class', 'hidden');122 } else {123 $(this).val(0);124 greet_set_div.attr('class', '');125 preview_greet_default.attr('class', 'hidden');126 preview_greet.attr('class', '');127 }128 });129 greet_use_default.on('change', function() {130 if (this.checked) {131 $(this).val(1);132 greet_set_div.attr('class', 'hidden');133 preview_greet_default.attr('class', '');134 preview_greet.attr('class', 'hidden');135 } else {136 $(this).val(0);137 greet_set_div.attr('class', '');138 preview_greet_default.attr('class', 'hidden');139 preview_greet.attr('class', '');140 }141 });142 greet_cust_name_before.on('change', function() {143 if (this.checked) {144 $(this).val(1);145 greet_cust_name_after.attr('checked', false);146 greet_cust_name_after.val(0);147 preview_greet_cust_after.hide();148 preview_greet_cust_before.show();149 } else {150 $(this).val(0);151 greet_cust_name_after.val(0);152 preview_greet_cust_after.hide();153 preview_greet_cust_before.hide();154 }155 });156 greet_cust_name_after.on('change', function() {157 if (this.checked) {158 $(this).val(1);159 greet_cust_name_before.attr('checked', false);160 greet_cust_name_before.val(0);161 preview_greet_cust_before.hide();162 preview_greet_cust_after.show();163 } else {164 $(this).val(0);165 greet_cust_name_before.val(0);166 preview_greet_cust_after.hide();167 preview_greet_cust_before.hide();168 }169 });170 function init() {171 /* --- INITIAL EDIT EMAIL SETUP --- */172 preview_email_title.html(emailTitleInput.val());173 preview_email_button_text.html(buttonTextInput.val());174 color_select.val($('#current_color_value').val());175 //Set the Value of the Show Button Select from DB176 if ($('#show_button_value').val() === '1') {177 button_select.val('true');178 } else {179 button_select.val('false');180 }181 if (button_select.val() === 'true') {182 preview_email_buttons_div.show();183 button_form_div.show();184 } else {185 preview_email_buttons_div.hide();186 button_form_div.hide();187 }188 if (greet_use_default.val() === '1') {189 greet_use_default.attr('checked', true);190 greet_set_div.attr('class', 'hidden');191 preview_greet_default.attr('class', '');192 preview_greet.attr('class', 'hidden');193 } else {194 greet_use_default.attr('checked', false);195 greet_set_div.attr('class', '');196 preview_greet_default.attr('class', 'hidden');197 preview_greet.attr('class', '');198 }199 if (greet_cust_name_before.val() === '1') {200 greet_cust_name_before.attr('checked', true);201 preview_greet_cust_before.show();202 } else {203 greet_cust_name_before.attr('checked', false);204 preview_greet_cust_before.hide();205 }206 if (greet_cust_name_after.val() === '1') {207 greet_cust_name_after.attr('checked', true);208 preview_greet_cust_after.show();209 } else {210 greet_cust_name_after.attr('checked', false);211 preview_greet_cust_after.hide();212 }213 // set the value of checkout select from db214 if ($('#checkout_url_select').val() === '1') {215 checkout_url_select.checked = true;216 $("#buttonUrlInput").prop('disabled', true);217 $('#abandoned_text').show();218 } else {219 checkout_url_select.checked = false;220 $("#buttonUrlInput").prop('disabled', false);221 $('#abandoned_text').hide();222 }223 var summernote = $('#summernote');224 summernote.summernote({225 height: 200,226 toolbar: [227 // [groupName, [list of button]]228 ['style', ['bold', 'italic', 'underline', 'clear']],229 ['font', ['strikethrough', 'superscript', 'subscript']],230 ['fontsize', ['fontsize']],231 ['color', ['color']],232 ['para', ['ul', 'ol', 'paragraph']],233 ['height', ['height']]234 ],235 shortcuts: false,236 dialogsInBody: true237 });238 summernote.summernote('code', old_content);239 $('.left_col').height($('.right_col').height());240 //Set Color Picker to bootstrap color picker instance241 $('#theme_color_select').colorpicker();242 }...
greet_pb2_grpc.py
Source:greet_pb2_grpc.py
1# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!2"""Client and server classes corresponding to protobuf-defined services."""3import grpc4import greet_pb2 as greet__pb25class GreetServiceStub(object):6 """Missing associated documentation comment in .proto file."""7 def __init__(self, channel):8 """Constructor.9 Args:10 channel: A grpc.Channel.11 """12 self.Greet = channel.unary_unary(13 '/greet.GreetService/Greet',14 request_serializer=greet__pb2.GreetRequest.SerializeToString,15 response_deserializer=greet__pb2.GreetResponse.FromString,16 )17 self.GreetWithDeadline = channel.unary_unary(18 '/greet.GreetService/GreetWithDeadline',19 request_serializer=greet__pb2.GreetWithDeadlineRequest.SerializeToString,20 response_deserializer=greet__pb2.GreetWithDeadlineResponse.FromString,21 )22 self.GreetManyTimes = channel.unary_stream(23 '/greet.GreetService/GreetManyTimes',24 request_serializer=greet__pb2.GreetManyTimesRequest.SerializeToString,25 response_deserializer=greet__pb2.GreetManyTimesResponse.FromString,26 )27 self.LongGreet = channel.stream_unary(28 '/greet.GreetService/LongGreet',29 request_serializer=greet__pb2.LongGreetRequest.SerializeToString,30 response_deserializer=greet__pb2.LongGreetResponse.FromString,31 )32 self.GreetEveryone = channel.stream_stream(33 '/greet.GreetService/GreetEveryone',34 request_serializer=greet__pb2.GreetEveryoneRequest.SerializeToString,35 response_deserializer=greet__pb2.GreetEveryoneResponse.FromString,36 )37class GreetServiceServicer(object):38 """Missing associated documentation comment in .proto file."""39 def Greet(self, request, context):40 """Unary41 """42 context.set_code(grpc.StatusCode.UNIMPLEMENTED)43 context.set_details('Method not implemented!')44 raise NotImplementedError('Method not implemented!')45 def GreetWithDeadline(self, request, context):46 """Missing associated documentation comment in .proto file."""47 context.set_code(grpc.StatusCode.UNIMPLEMENTED)48 context.set_details('Method not implemented!')49 raise NotImplementedError('Method not implemented!')50 def GreetManyTimes(self, request, context):51 """Server Streaming52 """53 context.set_code(grpc.StatusCode.UNIMPLEMENTED)54 context.set_details('Method not implemented!')55 raise NotImplementedError('Method not implemented!')56 def LongGreet(self, request_iterator, context):57 """Client Streaming58 """59 context.set_code(grpc.StatusCode.UNIMPLEMENTED)60 context.set_details('Method not implemented!')61 raise NotImplementedError('Method not implemented!')62 def GreetEveryone(self, request_iterator, context):63 """Bidi Streaming64 """65 context.set_code(grpc.StatusCode.UNIMPLEMENTED)66 context.set_details('Method not implemented!')67 raise NotImplementedError('Method not implemented!')68def add_GreetServiceServicer_to_server(servicer, server):69 rpc_method_handlers = {70 'Greet': grpc.unary_unary_rpc_method_handler(71 servicer.Greet,72 request_deserializer=greet__pb2.GreetRequest.FromString,73 response_serializer=greet__pb2.GreetResponse.SerializeToString,74 ),75 'GreetWithDeadline': grpc.unary_unary_rpc_method_handler(76 servicer.GreetWithDeadline,77 request_deserializer=greet__pb2.GreetWithDeadlineRequest.FromString,78 response_serializer=greet__pb2.GreetWithDeadlineResponse.SerializeToString,79 ),80 'GreetManyTimes': grpc.unary_stream_rpc_method_handler(81 servicer.GreetManyTimes,82 request_deserializer=greet__pb2.GreetManyTimesRequest.FromString,83 response_serializer=greet__pb2.GreetManyTimesResponse.SerializeToString,84 ),85 'LongGreet': grpc.stream_unary_rpc_method_handler(86 servicer.LongGreet,87 request_deserializer=greet__pb2.LongGreetRequest.FromString,88 response_serializer=greet__pb2.LongGreetResponse.SerializeToString,89 ),90 'GreetEveryone': grpc.stream_stream_rpc_method_handler(91 servicer.GreetEveryone,92 request_deserializer=greet__pb2.GreetEveryoneRequest.FromString,93 response_serializer=greet__pb2.GreetEveryoneResponse.SerializeToString,94 ),95 }96 generic_handler = grpc.method_handlers_generic_handler(97 'greet.GreetService', rpc_method_handlers)98 server.add_generic_rpc_handlers((generic_handler,))99 # This class is part of an EXPERIMENTAL API.100class GreetService(object):101 """Missing associated documentation comment in .proto file."""102 @staticmethod103 def Greet(request,104 target,105 options=(),106 channel_credentials=None,107 call_credentials=None,108 insecure=False,109 compression=None,110 wait_for_ready=None,111 timeout=None,112 metadata=None):113 return grpc.experimental.unary_unary(request, target, '/greet.GreetService/Greet',114 greet__pb2.GreetRequest.SerializeToString,115 greet__pb2.GreetResponse.FromString,116 options, channel_credentials,117 insecure, call_credentials, compression, wait_for_ready, timeout, metadata)118 @staticmethod119 def GreetWithDeadline(request,120 target,121 options=(),122 channel_credentials=None,123 call_credentials=None,124 insecure=False,125 compression=None,126 wait_for_ready=None,127 timeout=None,128 metadata=None):129 return grpc.experimental.unary_unary(request, target, '/greet.GreetService/GreetWithDeadline',130 greet__pb2.GreetWithDeadlineRequest.SerializeToString,131 greet__pb2.GreetWithDeadlineResponse.FromString,132 options, channel_credentials,133 insecure, call_credentials, compression, wait_for_ready, timeout, metadata)134 @staticmethod135 def GreetManyTimes(request,136 target,137 options=(),138 channel_credentials=None,139 call_credentials=None,140 insecure=False,141 compression=None,142 wait_for_ready=None,143 timeout=None,144 metadata=None):145 return grpc.experimental.unary_stream(request, target, '/greet.GreetService/GreetManyTimes',146 greet__pb2.GreetManyTimesRequest.SerializeToString,147 greet__pb2.GreetManyTimesResponse.FromString,148 options, channel_credentials,149 insecure, call_credentials, compression, wait_for_ready, timeout, metadata)150 @staticmethod151 def LongGreet(request_iterator,152 target,153 options=(),154 channel_credentials=None,155 call_credentials=None,156 insecure=False,157 compression=None,158 wait_for_ready=None,159 timeout=None,160 metadata=None):161 return grpc.experimental.stream_unary(request_iterator, target, '/greet.GreetService/LongGreet',162 greet__pb2.LongGreetRequest.SerializeToString,163 greet__pb2.LongGreetResponse.FromString,164 options, channel_credentials,165 insecure, call_credentials, compression, wait_for_ready, timeout, metadata)166 @staticmethod167 def GreetEveryone(request_iterator,168 target,169 options=(),170 channel_credentials=None,171 call_credentials=None,172 insecure=False,173 compression=None,174 wait_for_ready=None,175 timeout=None,176 metadata=None):177 return grpc.experimental.stream_stream(request_iterator, target, '/greet.GreetService/GreetEveryone',178 greet__pb2.GreetEveryoneRequest.SerializeToString,179 greet__pb2.GreetEveryoneResponse.FromString,180 options, channel_credentials,...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!