Proyectos de Subversion LeadersLinked - Backend

Rev

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

Rev 202 Rev 203
Línea 1071... Línea 1071...
1071
        e.preventDefault();
1071
        e.preventDefault();
1072
        validatorFormQuestion.resetForm();
1072
        validatorFormQuestion.resetForm();
1073
        var slug = $(this).data('section');
1073
        var slug = $(this).data('section');
1074
        $('#form-question #question-section').val(slug);
1074
        $('#form-question #question-section').val(slug);
1075
        $('#form-question #question-slug').val('');
1075
        $('#form-question #question-slug').val('');
1076
        CKEDITOR.instances['question-text'].setData('', function() {
1076
        CKEDITOR.instances['question-text'].setData('');
1077
            editor.focus();
-
 
1078
        });
-
 
1079
        $('#form-question #question-value').val('0');
1077
        $('#form-question #question-value').val('0');
1080
        $('#form-question #question-type').val($('#form-question #question-type option:first').val());
1078
        $('#form-question #question-type').val($('#form-question #question-type option:first').val());
1081
        $('#form-question #question-max-length').val('0');
1079
        $('#form-question #question-max-length').val('0');
1082
        $('#form-question #question-max-length').parent().show();
1080
        $('#form-question #question-max-length').parent().show();
1083
        $('#form-question #question-multiline').val('0');
1081
        $('#form-question #question-multiline').val('0');
Línea 1097... Línea 1095...
1097
                for (j = 0; j < objFormGenerator.sections[i].questions.length; j++) {
1095
                for (j = 0; j < objFormGenerator.sections[i].questions.length; j++) {
1098
                    if (slug == objFormGenerator.sections[i].questions[j].slug_question) {
1096
                    if (slug == objFormGenerator.sections[i].questions[j].slug_question) {
1099
                        validatorFormQuestion.resetForm();
1097
                        validatorFormQuestion.resetForm();
1100
                        $('#form-question #question-section').val(objFormGenerator.sections[i].slug_section);
1098
                        $('#form-question #question-section').val(objFormGenerator.sections[i].slug_section);
1101
                        $('#form-question #question-slug').val(objFormGenerator.sections[i].questions[j].slug_question);
1099
                        $('#form-question #question-slug').val(objFormGenerator.sections[i].questions[j].slug_question);
1102
                        CKEDITOR.instances['question-text'].setData(objFormGenerator.sections[i].questions[j].text, function() {
1100
                        CKEDITOR.instances['question-text'].setData(objFormGenerator.sections[i].questions[j].text);
1103
                            editor.focus();
-
 
1104
                        });
-
 
1105
                        $('#form-question #question-value').val(objFormGenerator.sections[i].questions[j].value);
1101
                        $('#form-question #question-value').val(objFormGenerator.sections[i].questions[j].value);
1106
                        $('#form-question #question-type').val(objFormGenerator.sections[i].questions[j].type);
1102
                        $('#form-question #question-type').val(objFormGenerator.sections[i].questions[j].type);
1107
                        if (objFormGenerator.sections[i].questions[j].type == 'open') {
1103
                        if (objFormGenerator.sections[i].questions[j].type == 'open') {
1108
                            $('#form-question #question-max-length').val(objFormGenerator.sections[i].questions[j].maxlength);
1104
                            $('#form-question #question-max-length').val(objFormGenerator.sections[i].questions[j].maxlength);
1109
                            $('#form-question #question-max-length').parent().show();
1105
                            $('#form-question #question-max-length').parent().show();
Línea 1155... Línea 1151...
1155
                    renderSectionData(objFormGenerator.sections);
1151
                    renderSectionData(objFormGenerator.sections);
1156
                }
1152
                }
1157
            }
1153
            }
1158
        });
1154
        });
1159
    });
1155
    });
1160
 
-
 
1161
     /**
-
 
1162
      * Get Question type
-
 
1163
      */
-
 
1164
     const getQuestionTypeBySlug = (slug_section, slug_question) => {
-
 
1165
         for (i = 0; i < objFormGenerator.sections.length; i++) {
-
 
1166
             if (slug_section == objFormGenerator.sections[i].slug_section) {
-
 
1167
                 for (j = 0; j < objFormGenerator.sections[i].questions.length; j++) {
-
 
1168
                     if (slug_question == objFormGenerator.sections[i].questions[j].slug_question) {
-
 
1169
                         return objFormGenerator.sections[i].questions[j].type;
-
 
1170
                     }
-
 
1171
                 }
-
 
1172
             }
-
 
1173
         }
-
 
1174
     }
-
 
1175
        
-
 
1176
     /**
-
 
1177
      * Render Sections data
-
 
1178
      */
-
 
1179
     const renderSectionData = (data) => $("#rows").html($("#sectionTemplate").render(data, {
-
 
1180
         getType: getQuestionTypeBySlug
-
 
1181
     }));
-
 
Línea 1182... Línea -...
1182
     
-
 
1183
     /**
-
 
1184
      * Clear Div Section data 
-
 
1185
      */
-
 
1186
     const clearSectionData = () => $("#rows").html(''); 
-
 
1187
     
-
 
1188
    
-
 
1189
        
1156
     
1190
    $('body').on('click', 'button.btn-add-option', function(e) {
1157
    $('body').on('click', 'button.btn-add-option', function(e) {
1191
        e.preventDefault();
1158
        e.preventDefault();
1192
        var slug_section = $(this).data('section');
1159
        var slug_section = $(this).data('section');
1193
        var slug_question = $(this).data('question');
1160
        var slug_question = $(this).data('question');
Línea 1356... Línea 1323...
1356
        $('#row-forms').hide();
1323
        $('#row-forms').hide();
1357
        $('#row-edit').show();
1324
        $('#row-edit').show();
1358
        $('#form-main #form-name').focus();
1325
        $('#form-main #form-name').focus();
Línea 1359... Línea 1326...
1359
 
1326
 
1360
    });
-
 
1361
 
-
 
1362
    $('button.btn-refresh').click(function(e) {
-
 
1363
        tableForm.fnDraw(); 
-
 
1364
    });
1327
    });
1365
    $('button.btn-edit-cancel').click(function(e) {
1328
    $('button.btn-edit-cancel').click(function(e) {
1366
        e.preventDefault();
1329
        e.preventDefault();
1367
        $('#row-edit').hide();
1330
        $('#row-edit').hide();
1368
        $('#row-forms').show();
1331
        $('#row-forms').show();
Línea 1380... Línea 1343...
1380
    $('#modal-section, #modal-question, #modal-option').modal({
1343
    $('#modal-section, #modal-question, #modal-option').modal({
1381
        backdrop: 'static',
1344
        backdrop: 'static',
1382
        keyboard: false,
1345
        keyboard: false,
1383
        show: false
1346
        show: false
1384
    });
1347
    });
-
 
1348
 
-
 
1349
    /**
-
 
1350
    * Get Question type
-
 
1351
    */
-
 
1352
    const getQuestionTypeBySlug = (slug_section, slug_question) => {
-
 
1353
         for (i = 0; i < objFormGenerator.sections.length; i++) {
-
 
1354
             if (slug_section == objFormGenerator.sections[i].slug_section) {
-
 
1355
                 for (j = 0; j < objFormGenerator.sections[i].questions.length; j++) {
-
 
1356
                     if (slug_question == objFormGenerator.sections[i].questions[j].slug_question) {
-
 
1357
                         return objFormGenerator.sections[i].questions[j].type;
-
 
1358
                     }
-
 
1359
                 }
-
 
1360
             }
-
 
1361
         }
-
 
1362
    }
-
 
1363
        
-
 
1364
    /**
-
 
1365
    * Render Sections data
-
 
1366
    */
-
 
1367
    const renderSectionData = (data) => $("#rows").html($("#sectionTemplate").render(data, {
-
 
1368
         getType: getQuestionTypeBySlug
-
 
1369
    }));
-
 
1370
     
-
 
1371
    /**
-
 
1372
    * Clear Div Section data 
-
 
1373
    */
-
 
1374
    const clearSectionData = () => $("#rows").html(''); 
-
 
1375
 
-
 
1376
    /**
-
 
1377
    * Click on refresh button
-
 
1378
    */
-
 
1379
    $('button.btn-refresh').click(function(e) {
-
 
1380
        tableForm.fnDraw(); 
-
 
1381
    });
1385
});
1382
});
1386
JS;
1383
JS;
1387
$this->inlineScript()->captureEnd();
1384
$this->inlineScript()->captureEnd();
1388
?>
1385
?>