Proyectos de Subversion LeadersLinked - Backend

Rev

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

Rev 201 Rev 202
Línea 773... Línea 773...
773
                                $('#form-main #form-continue').val(0);
773
                                $('#form-main #form-continue').val(0);
774
                            } else {
774
                            } else {
775
                                $('#row-edit').hide();
775
                                $('#row-edit').hide();
776
                                $('#row-forms').show();
776
                                $('#row-forms').show();
777
                            }
777
                            }
778
                            tableForm.fnDraw();
-
 
Línea 779... Línea 778...
779
 
778
 
780
                            /*---------- Reset Form -------- */
779
                            /*---------- Reset Form -------- */
Línea 781... Línea 780...
781
                            $('#form-main')[0].reset();
780
                            $('#form-main')[0].reset();
Línea 785... Línea 784...
785
                            CKEDITOR.instances['form-description'].setData('');
784
                            CKEDITOR.instances['form-description'].setData('');
Línea 786... Línea 785...
786
 
785
 
787
                            /*--------Reset Sections ----------*/
786
                            /*--------Reset Sections ----------*/
Línea -... Línea 787...
-
 
787
                            clearSectionData();
-
 
788
 
-
 
789
                            /* ------- Refresh Table -----------*/
788
                            clearSectionData();
790
                            tableForm.fnDraw();
789
 
791
 
790
                        } else {
792
                        } else {
791
                            $.fn.showError(response['message'] || 'ERROR_UNKNOWN');
793
                            $.fn.showError(response['message'] || 'ERROR_UNKNOWN');
792
                        }
794
                        }
Línea 1014... Línea 1016...
1014
    $('body').on('click', 'button[id="btn-add-section"]', function(e) {
1016
    $('body').on('click', 'button[id="btn-add-section"]', function(e) {
1015
        e.preventDefault();
1017
        e.preventDefault();
1016
        validatorFormSection.resetForm();
1018
        validatorFormSection.resetForm();
1017
        $('#form-section #section-slug').val('');
1019
        $('#form-section #section-slug').val('');
1018
        $('#form-section #section-name').val('');
1020
        $('#form-section #section-name').val('');
1019
        instanceName = 'section-text';
1021
        CKEDITOR.instances['section-text'].setData('');
1020
        let editor = CKEDITOR.instances[instanceName];
-
 
1021
        editor.setData('', function() {
-
 
1022
            editor.focus();
-
 
1023
        });
-
 
1024
        $('#form-section #section-value').val('0');
1022
        $('#form-section #section-value').val('0');
1025
        $('#modal-section h4[class="modal-title"]').html('LABEL_ADD LABEL_SECTION');
1023
        $('#modal-section h4[class="modal-title"]').html('LABEL_ADD LABEL_SECTION');
1026
        $('#modal-section').modal('show');
1024
        $('#modal-section').modal('show');
1027
    });
1025
    });
1028
    $('body').on('click', 'button.btn-edit-section', function(e) {
1026
    $('body').on('click', 'button.btn-edit-section', function(e) {
Línea 1034... Línea 1032...
1034
            section = objFormGenerator.sections[i];
1032
            section = objFormGenerator.sections[i];
1035
            if (slug == section.slug_section) {
1033
            if (slug == section.slug_section) {
1036
                validatorFormSection.resetForm();
1034
                validatorFormSection.resetForm();
1037
                $('#form-section #section-slug').val(section.slug_section);
1035
                $('#form-section #section-slug').val(section.slug_section);
1038
                $('#form-section #section-name').val(section.name);
1036
                $('#form-section #section-name').val(section.name);
1039
                instanceName = 'section-text';
1037
                CKEDITOR.instances['section-text'].setData(section.text);
1040
                let editor = CKEDITOR.instances[instanceName];
-
 
1041
                editor.setData(section.text, function() {
-
 
1042
                    editor.focus();
-
 
1043
                });
-
 
1044
                $('#form-section #section-value').val(section.value);
1038
                $('#form-section #section-value').val(section.value);
1045
                showForm = true;
1039
                showForm = true;
1046
                break;
1040
                break;
1047
            }
1041
            }
1048
        }
1042
        }
Línea 1077... Línea 1071...
1077
        e.preventDefault();
1071
        e.preventDefault();
1078
        validatorFormQuestion.resetForm();
1072
        validatorFormQuestion.resetForm();
1079
        var slug = $(this).data('section');
1073
        var slug = $(this).data('section');
1080
        $('#form-question #question-section').val(slug);
1074
        $('#form-question #question-section').val(slug);
1081
        $('#form-question #question-slug').val('');
1075
        $('#form-question #question-slug').val('');
1082
        instanceName = 'question-text';
-
 
1083
        let editor = CKEDITOR.instances[instanceName];
-
 
1084
        editor.setData('', function() {
1076
        CKEDITOR.instances['question-text'].setData('', function() {
1085
            editor.focus();
1077
            editor.focus();
1086
        });
1078
        });
1087
        $('#form-question #question-value').val('0');
1079
        $('#form-question #question-value').val('0');
1088
        $('#form-question #question-type').val($('#form-question #question-type option:first').val());
1080
        $('#form-question #question-type').val($('#form-question #question-type option:first').val());
1089
        $('#form-question #question-max-length').val('0');
1081
        $('#form-question #question-max-length').val('0');
Línea 1105... Línea 1097...
1105
                for (j = 0; j < objFormGenerator.sections[i].questions.length; j++) {
1097
                for (j = 0; j < objFormGenerator.sections[i].questions.length; j++) {
1106
                    if (slug == objFormGenerator.sections[i].questions[j].slug_question) {
1098
                    if (slug == objFormGenerator.sections[i].questions[j].slug_question) {
1107
                        validatorFormQuestion.resetForm();
1099
                        validatorFormQuestion.resetForm();
1108
                        $('#form-question #question-section').val(objFormGenerator.sections[i].slug_section);
1100
                        $('#form-question #question-section').val(objFormGenerator.sections[i].slug_section);
1109
                        $('#form-question #question-slug').val(objFormGenerator.sections[i].questions[j].slug_question);
1101
                        $('#form-question #question-slug').val(objFormGenerator.sections[i].questions[j].slug_question);
1110
                        instanceName = 'question-text';
-
 
1111
                        let editor = CKEDITOR.instances[instanceName];
-
 
1112
                        editor.setData(objFormGenerator.sections[i].questions[j].text, function() {
1102
                        CKEDITOR.instances['question-text'].setData(objFormGenerator.sections[i].questions[j].text, function() {
1113
                            editor.focus();
1103
                            editor.focus();
1114
                        });
1104
                        });
1115
                        $('#form-question #question-value').val(objFormGenerator.sections[i].questions[j].value);
1105
                        $('#form-question #question-value').val(objFormGenerator.sections[i].questions[j].value);
1116
                        $('#form-question #question-type').val(objFormGenerator.sections[i].questions[j].type);
1106
                        $('#form-question #question-type').val(objFormGenerator.sections[i].questions[j].type);
1117
                        if (objFormGenerator.sections[i].questions[j].type == 'open') {
1107
                        if (objFormGenerator.sections[i].questions[j].type == 'open') {
Línea 1192... Línea 1182...
1192
     
1182
     
1193
     /**
1183
     /**
1194
      * Clear Div Section data 
1184
      * Clear Div Section data 
1195
      */
1185
      */
-
 
1186
     const clearSectionData = () => $("#rows").html(''); 
-
 
1187
     
Línea 1196... Línea 1188...
1196
     const clearSectionData = () => $("#rows").html(''); 
1188
    
1197
        
1189
        
1198
    $('body').on('click', 'button.btn-add-option', function(e) {
1190
    $('body').on('click', 'button.btn-add-option', function(e) {
1199
        e.preventDefault();
1191
        e.preventDefault();
Línea 1206... Línea 1198...
1206
                    if (slug_question == objFormGenerator.sections[i].questions[j].slug_question) {
1198
                    if (slug_question == objFormGenerator.sections[i].questions[j].slug_question) {
1207
                        validatorFormOption.resetForm();
1199
                        validatorFormOption.resetForm();
1208
                        $('#form-option #option-section').val(slug_section);
1200
                        $('#form-option #option-section').val(slug_section);
1209
                        $('#form-option #option-question').val(slug_question);
1201
                        $('#form-option #option-question').val(slug_question);
1210
                        $('#form-option #option-slug').val('');
1202
                        $('#form-option #option-slug').val('');
1211
                        instanceName = 'option-text';
-
 
1212
                        let editor = CKEDITOR.instances[instanceName];
-
 
-
 
1203
 
1213
                        editor.setData('', function() {
1204
                        CKEDITOR.instances['option-text'].setData('', function() {
1214
                            editor.focus();
1205
                            editor.focus();
1215
                        });
1206
                        });
-
 
1207
 
1216
                        $('#form-option #option-correct').val('0');
1208
                        $('#form-option #option-correct').val('0');
1217
                        if (objFormGenerator.sections[i].questions[j].type == 'rating-open') {
1209
                        if (objFormGenerator.sections[i].questions[j].type == 'rating-open') {
1218
                            $('#form-option #option-correct').parent().hide();
1210
                            $('#form-option #option-correct').parent().hide();
1219
                        } else {
1211
                        } else {
1220
                            $('#form-option #option-correct').parent().show();
1212
                            $('#form-option #option-correct').parent().show();
Línea 1252... Línea 1244...
1252
                            if (slug == objFormGenerator.sections[i].questions[j].options[k].slug_option) {
1244
                            if (slug == objFormGenerator.sections[i].questions[j].options[k].slug_option) {
1253
                                validatorFormOption.resetForm();
1245
                                validatorFormOption.resetForm();
1254
                                $('#form-option #option-section').val(objFormGenerator.sections[i].slug_section);
1246
                                $('#form-option #option-section').val(objFormGenerator.sections[i].slug_section);
1255
                                $('#form-option #option-question').val(objFormGenerator.sections[i].questions[j].slug_question);
1247
                                $('#form-option #option-question').val(objFormGenerator.sections[i].questions[j].slug_question);
1256
                                $('#form-option #option-slug').val(objFormGenerator.sections[i].questions[j].options[k].slug_option);
1248
                                $('#form-option #option-slug').val(objFormGenerator.sections[i].questions[j].options[k].slug_option);
1257
                                instanceName = 'option-text';
1249
                                CKEDITOR.instances['option-text'].setData(objFormGenerator.sections[i].questions[j].options[k].text, 
1258
                                let editor = CKEDITOR.instances[instanceName];
1250
                                function() {
1259
                                editor.setData(objFormGenerator.sections[i].questions[j].options[k].text, function() {
-
 
1260
                                    editor.focus();
1251
                                    editor.focus();
1261
                                });
1252
                                });
1262
                                $('#form-option #option-correct').val(objFormGenerator.sections[i].questions[j].options[k].correct);
1253
                                $('#form-option #option-correct').val(objFormGenerator.sections[i].questions[j].options[k].correct);
1263
                                if (objFormGenerator.sections[i].questions[j].type == 'multiple' || objFormGenerator.sections[i].questions[j].type == 'simple') {
1254
                                if (objFormGenerator.sections[i].questions[j].type == 'multiple' || objFormGenerator.sections[i].questions[j].type == 'simple') {
1264
                                    $('#form-option #option-correct').parent().show();
1255
                                    $('#form-option #option-correct').parent().show();
Línea 1357... Línea 1348...
1357
 
1348
 
1358
        $('#form-main #form-id').val('0');
1349
        $('#form-main #form-id').val('0');
1359
        $('#form-main #form-continue').val('0');
1350
        $('#form-main #form-continue').val('0');
Línea 1360... Línea -...
1360
        $('#form-main #form-name').val('');
-
 
1361
 
-
 
1362
        CKEDITOR.instances['form-text'].setData('')
1351
        $('#form-main #form-name').val('');
1363
        CKEDITOR.instances['form-description'].setData('');
1352
 
Línea 1364... Línea 1353...
1364
        $('#form-main #form-language').val('$lang_es'),
1353
        $('#form-main #form-language').val('$lang_es'),
1365
        $('#form-main #form-status').val('$status_inactive');
1354
        $('#form-main #form-status').val('$status_inactive');
1366
 
1355
 
Línea 1367... Línea 1356...
1367
        $('#row-forms').hide();
1356
        $('#row-forms').hide();
-
 
1357
        $('#row-edit').show();
-
 
1358
        $('#form-main #form-name').focus();
-
 
1359
 
-
 
1360
    });
1368
        $('#row-edit').show();
1361
 
1369
        $('#form-main #form-name').focus();
1362
    $('button.btn-refresh').click(function(e) {
1370
 
1363
        tableForm.fnDraw(); 
1371
    });
1364
    });
1372
    $('button.btn-edit-cancel').click(function(e) {
1365
    $('button.btn-edit-cancel').click(function(e) {