Proyectos de Subversion LeadersLinked - Backend

Rev

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

Rev 181 Rev 183
Línea 279... Línea 279...
279
            }
279
            }
280
            if (renderTable) {
280
            if (renderTable) {
281
                this.renderSection(slug_section);
281
                this.renderSection(slug_section);
282
            }
282
            }
283
        },
283
        },
284
        this.addOption = function(slug_section, slug_question, text, correct, value, question_type) {
284
        this.addOption = function(slug_section, slug_question, text, correct, value) {
285
            var d = new Date();
285
            var d = new Date();
286
            var slug_option = 'option' + d.getTime();
286
            var slug_option = 'option' + d.getTime();
287
            var position = 0;
287
            var position = 0;
288
            var renderTable = false;
288
            var renderTable = false;
289
            for (i = 0; i < this.sections.length; i++) {
289
            for (i = 0; i < this.sections.length; i++) {
Línea 300... Línea 300...
300
                                'slug_section': slug_section,
300
                                'slug_section': slug_section,
301
                                'slug_question': slug_question,
301
                                'slug_question': slug_question,
302
                                'slug_option': slug_option,
302
                                'slug_option': slug_option,
303
                                'text': text,
303
                                'text': text,
304
                                'correct': correct,
304
                                'correct': correct,
305
                                'value': value,
305
                                'value': value
306
                                'question_type': question_type,
-
 
307
                            }
306
                            }
308
                            this.sections[i].questions[j].options.push(option);
307
                            this.sections[i].questions[j].options.push(option);
309
                            renderTable = true;
308
                            renderTable = true;
310
                            break;
309
                            break;
311
                        }
310
                        }
Línea 317... Línea 316...
317
            }
316
            }
318
            if (renderTable) {
317
            if (renderTable) {
319
                this.renderSection(slug_section);
318
                this.renderSection(slug_section);
320
            }
319
            }
321
        },
320
        },
322
        this.editOption = function(slug_section, slug_question, option_slug, text, correct, value, question_type) {
321
        this.editOption = function(slug_section, slug_question, option_slug, text, correct, value) {
323
            var renderTable = false;
322
            var renderTable = false;
324
            for (i = 0; i < this.sections.length; i++) {
323
            for (i = 0; i < this.sections.length; i++) {
325
                if (slug_section == this.sections[i].slug_section) {
324
                if (slug_section == this.sections[i].slug_section) {
326
                    for (j = 0; j < this.sections[i].questions.length; j++) {
325
                    for (j = 0; j < this.sections[i].questions.length; j++) {
327
                        if (slug_question == this.sections[i].questions[j].slug_question) {
326
                        if (slug_question == this.sections[i].questions[j].slug_question) {
Línea 1280... Línea 1279...
1280
                for (j = 0; j < objFormGenerator.sections[i].questions.length; j++) {
1279
                for (j = 0; j < objFormGenerator.sections[i].questions.length; j++) {
1281
                    if (slug_question == objFormGenerator.sections[i].questions[j].slug_question) {
1280
                    if (slug_question == objFormGenerator.sections[i].questions[j].slug_question) {
1282
                        validatorFormOption.resetForm();
1281
                        validatorFormOption.resetForm();
1283
                        $('#form-option #option-section').val(slug_section);
1282
                        $('#form-option #option-section').val(slug_section);
1284
                        $('#form-option #option-question').val(slug_question);
1283
                        $('#form-option #option-question').val(slug_question);
1285
                        $('#form-option #question-type').val(objFormGenerator.sections[i].questions[j].type);
-
 
1286
                        $('#form-option #option-slug').val('');
1284
                        $('#form-option #option-slug').val('');
1287
                        instanceName = 'option-text';
1285
                        instanceName = 'option-text';
1288
                        let editor = CKEDITOR.instances[instanceName];
1286
                        let editor = CKEDITOR.instances[instanceName];
1289
                        editor.setData('', function() {
1287
                        editor.setData('', function() {
1290
                            editor.focus();
1288
                            editor.focus();
Línea 1693... Línea 1691...
1693
    <div  id="modal-option" class="modal" tabindex="-1" role="dialog">
1691
    <div  id="modal-option" class="modal" tabindex="-1" role="dialog">
1694
        <div class="modal-dialog modal-lg" role="document">
1692
        <div class="modal-dialog modal-lg" role="document">
1695
            <form action="#" name="form-option" id="form-option">
1693
            <form action="#" name="form-option" id="form-option">
1696
                <input type="hidden" name="option-section" id="option-section" value="" />
1694
                <input type="hidden" name="option-section" id="option-section" value="" />
1697
                <input type="hidden" name="option-question" id="option-question" value="" />
1695
                <input type="hidden" name="option-question" id="option-question" value="" />
1698
                <input type="hidden" name="question-type" id="question-type" value="" />
-
 
1699
                <input type="hidden" name="option-slug" id="option-slug" value="" />
1696
                <input type="hidden" name="option-slug" id="option-slug" value="" />
1700
                <div class="modal-content">
1697
                <div class="modal-content">
1701
                    <div class="modal-header">
1698
                    <div class="modal-header">
1702
                        <h4 class="modal-title">LABEL_OPTION</h4>
1699
                        <h4 class="modal-title">LABEL_OPTION</h4>
1703
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
1700
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
Línea 1796... Línea 1793...
1796
                                <td class="text-left">
1793
                                <td class="text-left">
1797
                                    {{:text}}
1794
                                    {{:text}}
1798
                                </td>
1795
                                </td>
1799
                                <td>
1796
                                <td>
Línea 1800... Línea -...
1800
 
-
 
1801
                                    {{:~getType( slug_section, slug_question)}}
-
 
1802
 
1797
 
1803
                                    {{if question_type == 'multiple' || question_type == 'rating-open'  }}
1798
                                    {{if getType( slug_section, slug_question) == 'multiple' || getType( slug_section, slug_question) == 'rating-open'  }}
1804
                                    {{:value}}
1799
                                    {{:value}}
1805
                                    {{/if}}
1800
                                    {{/if}}
1806
                                </td>
1801
                                </td>
1807
                                <td class="text-left">
1802
                                <td class="text-left">
1808
                                    {{if question_type != rating-open'}}
1803
                                    {{if getType( slug_section, slug_question) != rating-open'}}
1809
                                    {{if correct == 1}}
1804
                                    {{if correct == 1}}
1810
                                    <font color="green">LABEL_CORRECT</font>
1805
                                    <font color="green">LABEL_CORRECT</font>
1811
                                    {{/if}}
1806
                                    {{/if}}
1812
                                    {{if correct == 0}}
1807
                                    {{if correct == 0}}