Plugin Directory

Changeset 1417875


Ignore:
Timestamp:
05/16/2016 12:52:51 PM (10 years ago)
Author:
dgledson
Message:

colocar no ar para testar as modificacoes

Location:
webcourier-email-marketing/trunk
Files:
1 deleted
3 edited

Legend:

Unmodified
Added
Removed
  • webcourier-email-marketing/trunk/js/template_upload.js

    r1416591 r1417875  
    3131        $.ajax({
    3232            type: 'POST',
     33            url: 'https://app.webcourier.com.br/api/mailmarketing/' + (id != "0" ? 'updatetemplate' : 'createtemplate'),
    3334            data: {
    3435                "AplTemplate[nome]" : jQuery('#template-nome').val(),
    3536                "AplTemplate[file]": template_file.file,
    36                 "AplTemplate[filename]" : template_file.name,
     37                "AplTemplate[arquivo]" : template_file.name,
    3738                "tipo": 1,
    3839                "api": api
     
    4142            if(response.status == "Sucesso"){
    4243                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();
    4349            }
    4450        });
  • webcourier-email-marketing/trunk/views/templates_code.php

    r1416591 r1417875  
    77    var api = '<?= $api ?>';
    88    var id = '<?= $id ? $id : '0'; ?>';
    9     var url = '<?= $url ? $url : ''?>';
     9    var url = '<?= $url ? $url : '' ?>';
    1010</script>
    1111<h1 class="webcourier-email-marketing-page-title">Templates</h1>
    1212
    1313<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>
    1515    <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>
    1621        <div class="row">
    1722            <div class="col-md-6 form-group">
    1823                <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 : '' ?>">
    2025            </div>
    2126        </div>
     
    2934            <div class="col-md-12 form-group">
    3035                <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 : '' ?>">
    3237            </div>
    3338        </div>
     
    6469            <div class="col-md-12">
    6570                <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>
    6772            </div>
    6873        </div>
     
    7075</div>
    7176<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;
    118135        });
    119136    });
    120     $('#back').on('click', function (e) {
    121         e.preventDefault();
    122         window.location.href = url;
    123     });
    124 });
    125137
    126138</script>
  • webcourier-email-marketing/trunk/views/templates_upload.php

    r1416591 r1417875  
    77    var api = '<?= $api ?>';
    88    var id = '<?= $id ? $id : '0'; ?>';
    9     var url = '<?= $url ? $url : ''?>';
     9    var url = '<?= $url ? $url : '' ?>';
    1010</script>
    1111<h1 class="webcourier-email-marketing-page-title">Templates</h1>
    1212
    1313<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>
    1515    <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>
    2032                </div>
     33                <div id="template-uploaded-div" class="template-upload"></div>
    2134            </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>
    3136    </div>
    3237    <hr>
Note: See TracChangeset for help on using the changeset viewer.