Proyectos de Subversion LeadersLinked - Backend

Rev

Rev 6539 | Rev 6583 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 6539 Rev 6547
Línea 596... Línea 596...
596
        
596
        
597
        $("#industry-box").modal('hide');
597
        $("#industry-box").modal('hide');
598
        return false;
598
        return false;
Línea 599... Línea -...
599
    });
-
 
600
 
-
 
601
    var validatorImage = $('#form-image').validate({
-
 
602
        debug: true,
-
 
603
        onclick: false,
-
 
604
        onkeyup: false,
-
 
605
        onfocusout: false,
-
 
606
        ignore: [],
-
 
607
        rules: {
-
 
608
           'image': {
-
 
609
                required: true,
-
 
610
                extension: 'jpg|jpeg|png',
-
 
611
                accept: 'image/jpeg,image/png'
-
 
612
            },
-
 
613
        },
-
 
614
 
-
 
615
        submitHandler: function(form)
-
 
616
        {
-
 
617
            var formdata = false;
-
 
618
            if (window.FormData){
-
 
619
                formdata = new FormData(form); //form[0]);
-
 
620
            }
-
 
621
 
-
 
622
            NProgress.start();
-
 
623
            $.ajax({
-
 
624
                'dataType'  : 'json',
-
 
625
                'accept'    : 'application/json',
-
 
626
                'method'    : 'post',
-
 
627
                'url'       :  $('#form-image').attr('action'),
-
 
628
                'data'      : formdata ? formdata : $('#form-image').serialize(),
-
 
629
                'processData': false,
-
 
630
                'contentType': false,
-
 
631
            }).done(function(response) {
-
 
632
                if(response['success']) {
-
 
633
				    $('#company-img').attr('src',response['data']);
-
 
634
                    $("#image-box").modal('hide');
-
 
635
                } else {
-
 
636
                    validatorImage.resetForm();
-
 
637
                    if(jQuery.type(response['data']) == 'string') {
-
 
638
                        $.fn.showError(response['data']);
-
 
639
                    } else  {
-
 
640
                        $.each(response['data'], function( fieldname, errors ) {
-
 
641
                            console.log('#form-image #' + fieldname);
-
 
642
 
-
 
643
                            $.fn.showFormErrorValidator('#form-image #' + fieldname, errors);
-
 
644
                        });
-
 
645
                    }
-
 
646
                }
-
 
647
            }).fail(function( jqXHR, textStatus, errorThrown) {
-
 
648
                $.fn.showError(textStatus);
-
 
649
            }).always(function() {
-
 
650
                NProgress.done();
-
 
651
            });
-
 
652
            return false;
-
 
653
        },
-
 
654
        invalidHandler: function(form, validator) {
-
 
655
        
-
 
656
        }
-
 
657
    });
-
 
658
 
-
 
659
    $('.btn-image-open').on("click", function(e){
-
 
660
        e.preventDefault();
-
 
661
        $('#form-image #image').fileinput('reset');
-
 
662
        $('#form-image #image').val('');
-
 
663
        validatorImage.resetForm();
-
 
664
        $("#image-box").modal('show');
-
 
665
        return false;
-
 
666
    });
-
 
667
 
-
 
668
    $('.btn-image-close').on("click", function(e){
-
 
669
        e.preventDefault();
-
 
670
        
-
 
671
        $("#image-box").modal('hide');
-
 
672
        return false;
-
 
673
    });
-
 
674
 
-
 
675
    $('.btn-image-explorer').on("click", function(e){
-
 
676
        e.preventDefault();
-
 
677
        $('#form-image #image').click();
-
 
678
        return false;
-
 
679
    });
599
    });
680
 
600
 
681
    $("#form-cover #cover").fileinput({
601
    $("#form-cover #cover").fileinput({
682
        theme: 'fas',
602
        theme: 'fas',
683
        language: 'es',
603
        language: 'es',
Línea 687... Línea 607...
687
        allowedFileExtensions: ['jpg', 'jpeg', 'png', 'gif'],
607
        allowedFileExtensions: ['jpg', 'jpeg', 'png', 'gif'],
688
        mainClass: "input-group",
608
        mainClass: "input-group",
689
        msgPlaceholder: 'LABEL_RECOMMENDED_SIZE $image_size_cover',
609
        msgPlaceholder: 'LABEL_RECOMMENDED_SIZE $image_size_cover',
690
    });
610
    });
Línea 691... Línea -...
691
 
-
 
692
    $("#form-image #image").fileinput({
-
 
693
        theme: 'fas',
-
 
694
        language: 'es',
-
 
695
        showUpload: false,
-
 
696
        dropZoneEnabled: false,
-
 
697
        maxFileCount: 1,
-
 
698
        allowedFileExtensions: ['jpg', 'jpeg', 'png', 'gif'],
-
 
699
        mainClass: "input-group",
-
 
700
        msgPlaceholder: 'LABEL_RECOMMENDED_SIZE $image_size_profile',
-
 
701
    });
-
 
702
 
611
 
Línea 703... Línea 612...
703
    CKEDITOR.replace('description');
612
    CKEDITOR.replace('description');
Línea 704... Línea 613...
704
 
613
 
Línea 936... Línea 845...
936
                <button type="button" class="btn btn-default btn-location-close">LABEL_CANCEL</button>
845
                <button type="button" class="btn btn-default btn-location-close">LABEL_CANCEL</button>
937
            </div>
846
            </div>
938
            <?php echo $this->form()->closeTag($form); ?>
847
            <?php echo $this->form()->closeTag($form); ?>
939
        </div>
848
        </div>
940
    </div>
849
    </div>
941
</div>
-
 
942
<div class="modal" tabindex="-1" role="dialog" id="image-box">
-
 
943
    <div class="modal-dialog" role="document">
-
 
944
        <?php
-
 
945
        $form = $this->formImage;
-
 
946
        $form->setAttributes([
-
 
947
            'method' => 'post',
-
 
948
            'action' => $routeImageUpload,
-
 
949
            'name' => 'form-image',
-
 
950
            'id' => 'form-image',
-
 
951
            'enctype' => 'multipart/form-data'
-
 
952
        ]);
-
 
953
        $form->prepare();
-
 
954
        echo $this->form()->openTag($form);
-
 
955
        ?>
-
 
956
        <div class="modal-content">
-
 
957
            <div class="modal-header">
-
 
958
                <h3 class="modal-title">LABEL_CHANGE</h3>
-
 
959
            </div>
-
 
960
            <div class="modal-body">
-
 
961
                <div class="form-group">
-
 
962
                    <div class="file-loading">
-
 
963
                        <?php
-
 
964
                        $element = $form->get('image');
-
 
965
                        $element->setAttributes(['class' => 'form-control', 'accept' => 'image/jpeg,image/png']);
-
 
966
                        $element->setOptions(['label' => 'LABEL_IMAGE']);
-
 
967
                        echo $this->formLabel($element);
-
 
968
                        echo $this->formFile($element);
-
 
969
                        ?>
-
 
970
                    </div>
-
 
971
                </div>
-
 
972
            </div>
-
 
973
            <div class="modal-footer">
-
 
974
                <button type="submit" class="btn btn-primary">LABEL_UPLOAD</button>
-
 
975
                <button type="button" class="btn btn-default btn-image-close">LABEL_CANCEL</button>
-
 
976
            </div>
-
 
977
            <?php echo $this->form()->closeTag($form); ?>
-
 
978
        </div>
-
 
979
    </div>
-
 
980
</div>
850
</div>
981
851