Changeset 1417875
- Timestamp:
- 05/16/2016 12:52:51 PM (10 years ago)
- Location:
- webcourier-email-marketing/trunk
- Files:
-
- 1 deleted
- 3 edited
-
js/template_code.js (deleted)
-
js/template_upload.js (modified) (2 diffs)
-
views/templates_code.php (modified) (4 diffs)
-
views/templates_upload.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
webcourier-email-marketing/trunk/js/template_upload.js
r1416591 r1417875 31 31 $.ajax({ 32 32 type: 'POST', 33 url: 'https://app.webcourier.com.br/api/mailmarketing/' + (id != "0" ? 'updatetemplate' : 'createtemplate'), 33 34 data: { 34 35 "AplTemplate[nome]" : jQuery('#template-nome').val(), 35 36 "AplTemplate[file]": template_file.file, 36 "AplTemplate[ filename]" : template_file.name,37 "AplTemplate[arquivo]" : template_file.name, 37 38 "tipo": 1, 38 39 "api": api … … 41 42 if(response.status == "Sucesso"){ 42 43 window.location.href = url; 44 } else { 45 for (var erro in response.erro) { 46 jQuery('#resposta-erro ul').append("<li style='color:red'>" + response.erro[erro] + "</li>"); 47 } 48 jQuery('#resposta-erro').show(); 43 49 } 44 50 }); -
webcourier-email-marketing/trunk/views/templates_code.php
r1416591 r1417875 7 7 var api = '<?= $api ?>'; 8 8 var id = '<?= $id ? $id : '0'; ?>'; 9 var url = '<?= $url ? $url : '' ?>';9 var url = '<?= $url ? $url : '' ?>'; 10 10 </script> 11 11 <h1 class="webcourier-email-marketing-page-title">Templates</h1> 12 12 13 13 <div class="panel panel-default"> 14 <div class="panel-heading" style="font-size:17px"><?= $id ? "Editar Template" : "Adicionar Template" ?></div>14 <div class="panel-heading" style="font-size:17px"><?= $id ? "Editar Template" : "Adicionar Template" ?></div> 15 15 <div class="panel-body"> 16 <div class="row" id="resposta-erro" style="display:none"> 17 <div class="col-md-12 info-msg-template-upload"> 18 <ul style="color:red"><b>Favor corrija os seguintes erros : </b></ul> 19 </div> 20 </div> 16 21 <div class="row"> 17 22 <div class="col-md-6 form-group"> 18 23 <label class="control-label" required>Nome</label> 19 <input class="form-control" type="text" value="<?= $id ? $template->template->nome : '' ?>">24 <input id="template-nome" class="form-control" type="text" value="<?= $id ? $template->template->nome : '' ?>"> 20 25 </div> 21 26 </div> … … 29 34 <div class="col-md-12 form-group"> 30 35 <label class="control-label" required>Conteúdo Texto</label> 31 <input type="text" class="form-control" value="<?= $id ? $template->template->conteudotxt : '' ?>">36 <input type="text" class="form-control" value="<?= $id ? $template->template->conteudotxt : '' ?>"> 32 37 </div> 33 38 </div> … … 64 69 <div class="col-md-12"> 65 70 <button id="back" class="btn btn-warning pull-left" style="margin: 0 0 10px 0; width: 7%">Voltar</button> 66 <button id="submit-btn-code" class="btn btn-primary pull-right" style="margin: 0 0 10px 0; width: 7%"><?= $id ? "Editar" : "Criar" ?></button>71 <button id="submit-btn-code" class="btn btn-primary pull-right" style="margin: 0 0 10px 0; width: 7%"><?= $id ? "Editar" : "Criar" ?></button> 67 72 </div> 68 73 </div> … … 70 75 </div> 71 76 <script> 72 var flag = true; 73 jQuery(document).ready(function ($) { 74 $('#summernote-editor').summernote({ 75 height: 300, 76 lang: 'pt-BR' 77 }); 78 $('.btn-sm[data-original-title="Imagem"]').unbind('click'); 79 $('.btn-sm[data-original-title="Imagem"]').on('click', function(e){ 80 var imagem = wp.media({ 81 title: 'Upload Imagem', 82 // mutiple: true if you want to upload multiple files at once 83 multiple: false 84 }).open() 85 .on('select', function (e) { 86 // This will return the selected image from the Media Uploader, the result is an object 87 var uploaded_imagem = imagem.state().get('selection').first(); 88 // We convert uploaded_image to a JSON object to make accessing it easier 89 // Output to the console uploaded_image 90 var imagem_filename = uploaded_imagem.toJSON().filename; 91 var imagem_url = uploaded_imagem.toJSON().url; 92 console.log(imagem_url); 93 // Let's assign the url value to the input field 94 $('#summernote-editor').summernote('insertImage', imagem_url, imagem_filename); 95 // Create the var to send to webcourier 96 }); 97 }); 98 $('.btn-fullscreen').attr('data-original-title', "Expandir"); 99 $('.btn-fullscreen').unbind('click'); 100 $('.btn-fullscreen').on('click', function () { 101 var height = $('.note-editable').height(); 102 flag ? $('.note-editable').height(height + 400) : $('.note-editable').height(height - 400); 103 flag = !flag; 104 }); 105 $('#submit-btn-template').on('click', function (e) { 106 e.preventDefault(); 107 $.ajax({ 108 type: 'POST', 109 url: 'https://app.webcourier.com.br/api/mailmarketing/createtemplate', 110 data: { 111 "AplTemplate[nome]": $('#template-nome').val(), 112 "AplTemplate[filename]": template_file.name, 113 "tipo": 0, 114 "api": api 115 } 116 }).done(function (response) { 117 console.log(response); 77 var flag = true; 78 jQuery(document).ready(function ($) { 79 $('#summernote-editor').summernote({ 80 height: 300, 81 lang: 'pt-BR' 82 }); 83 $('.btn-sm[data-original-title="Imagem"]').unbind('click'); 84 $('.btn-sm[data-original-title="Imagem"]').on('click', function (e) { 85 var imagem = wp.media({ 86 title: 'Upload Imagem', 87 // mutiple: true if you want to upload multiple files at once 88 multiple: false 89 }).open() 90 .on('select', function (e) { 91 // This will return the selected image from the Media Uploader, the result is an object 92 var uploaded_imagem = imagem.state().get('selection').first(); 93 // We convert uploaded_image to a JSON object to make accessing it easier 94 // Output to the console uploaded_image 95 var imagem_filename = uploaded_imagem.toJSON().filename; 96 var imagem_url = uploaded_imagem.toJSON().url; 97 // Let's assign the url value to the input field 98 $('#summernote-editor').summernote('insertImage', imagem_url, imagem_filename); 99 // Create the var to send to webcourier 100 }); 101 }); 102 $('.btn-fullscreen').attr('data-original-title', "Expandir"); 103 $('.btn-fullscreen').unbind('click'); 104 $('.btn-fullscreen').on('click', function () { 105 var height = $('.note-editable').height(); 106 flag ? $('.note-editable').height(height + 400) : $('.note-editable').height(height - 400); 107 flag = !flag; 108 }); 109 $('#submit-btn-code').on('click', function (e) { 110 e.preventDefault(); 111 $.ajax({ 112 type: 'POST', 113 url: 'https://app.webcourier.com.br/api/mailmarketing/' + (id != "0" ? 'updatetemplate' : 'createtemplate'), 114 data: { 115 "AplTemplate[nome]": $('#template-nome').val(), 116 "AplTemplate[conteudo]": $('#summernote-editor').summernote('code'), 117 "tipo": 0, 118 "api": api, 119 "id" : id != "0" ? id : undefined 120 } 121 }).done(function (response) { 122 if (response.status == "Sucesso") { 123 window.location.href = url; 124 } else { 125 for (var erro in response.erro) { 126 jQuery('#resposta-erro ul').append("<li style='color:red'>" + response.erro[erro] + "</li>"); 127 } 128 jQuery('#resposta-erro').show(); 129 } 130 }); 131 }); 132 $('#back').on('click', function (e) { 133 e.preventDefault(); 134 window.location.href = url; 118 135 }); 119 136 }); 120 $('#back').on('click', function (e) {121 e.preventDefault();122 window.location.href = url;123 });124 });125 137 126 138 </script> -
webcourier-email-marketing/trunk/views/templates_upload.php
r1416591 r1417875 7 7 var api = '<?= $api ?>'; 8 8 var id = '<?= $id ? $id : '0'; ?>'; 9 var url = '<?= $url ? $url : '' ?>';9 var url = '<?= $url ? $url : '' ?>'; 10 10 </script> 11 11 <h1 class="webcourier-email-marketing-page-title">Templates</h1> 12 12 13 13 <div class="panel panel-default"> 14 <div class="panel-heading" style="font-size:17px"><?= $id ? "Editar Template" : "Adicionar Template" ?></div>14 <div class="panel-heading" style="font-size:17px"><?= $id ? "Editar Template" : "Adicionar Template" ?></div> 15 15 <div class="panel-body"> 16 <div class="row"> 17 <div class="col-md-3 form-group" style="margin: 0 auto; float:none"> 18 <label class="control-label" required>Nome</label> 19 <input id="template-nome" class="form-control" type="text" value="<?= $id ? $template->template->nome : ''?>"> 16 <div class="row" id="resposta-erro" style="display:none"> 17 <div class="col-md-12 info-msg-template-upload"> 18 <ul style="color:red"><b>Favor corrija os seguintes erros : </b></ul> 19 </div> 20 </div> 21 <div class="row"> 22 <div class="col-md-3 form-group" style="margin: 0 auto; float:none"> 23 <label class="control-label" required>Nome</label> 24 <input id="template-nome" class="form-control" type="text" value="<?= $id ? $template->template->nome : '' ?>"> 25 </div> 26 </div> 27 <div class="row"> 28 <div class="col-md-3 form-group" style="margin: 20px auto 0 auto; float:none;"> 29 <label class="control-label" style="width: 100%" required>Escolha o arquivo</label> 30 <div style="width: 25%; float:left"> 31 <button id="upload-btn" class="btn btn-primary form-control"><strong>Upload</strong></button> 20 32 </div> 33 <div id="template-uploaded-div" class="template-upload"></div> 21 34 </div> 22 <div class="row"> 23 <div class="col-md-3 form-group" style="margin: 20px auto 0 auto; float:none;"> 24 <label class="control-label" style="width: 100%" required>Escolha o arquivo</label> 25 <div style="width: 25%; float:left"> 26 <button id="upload-btn" class="btn btn-primary form-control"><strong>Upload</strong></button> 27 </div> 28 <div id="template-uploaded-div" class="template-upload"></div> 29 </div> 30 </div> 35 </div> 31 36 </div> 32 37 <hr>
Note: See TracChangeset
for help on using the changeset viewer.