Proyectos de Subversion LeadersLinked - Backend

Rev

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

Rev 344 Rev 345
Línea 144... Línea 144...
144
                    }
144
                    }
145
                }
145
                }
146
            }
146
            }
147
            $('[data-toggle="tooltip"]').tooltip();
147
            $('[data-toggle="tooltip"]').tooltip();
148
        };
148
        };
-
 
149
         /**
-
 
150
         * Add element to question array
-
 
151
         */
-
 
152
        this.editQuestion = function(slug_section, slug_question, status) {
-
 
153
            var renderTable = false;
-
 
154
            for (i = 0; i < this.sections.length; i++) {
-
 
155
                if (slug_section == this.sections[i].slug_section) {
-
 
156
                    for (j = 0; j < this.sections[i].questions.length; j++) {
-
 
157
                        if (slug_question == this.sections[i].questions[j].slug_question) {
-
 
158
                            
-
 
159
                            this.sections[i].questions[j].status = status;
-
 
160
 
-
 
161
 
-
 
162
                            renderTable = true;
-
 
163
                            break;
-
 
164
                        }
-
 
165
                    }
-
 
166
                }
-
 
167
                if (renderTable) {
-
 
168
                    break;
-
 
169
                }
-
 
170
            }
-
 
171
            if (renderTable) {
-
 
172
                this.renderSection(slug_section);
-
 
173
            }
-
 
174
        };
149
}
175
}
150
jQuery(document).ready(function($) {
176
jQuery(document).ready(function($) {
151
    var objFormGenerator = new classFormGenerator();
177
    var objFormGenerator = new classFormGenerator();
152
    objFormGenerator.render();
178
    objFormGenerator.render();
153
    var allowEdit = $allowEdit;
179
    var allowEdit = $allowEdit;
Línea 535... Línea 561...
535
            opt.correct == 1) ? 'LABEL_CORRECT' : 'LABEL_FAIL'
561
            opt.correct == 1) ? 'LABEL_CORRECT' : 'LABEL_FAIL'
536
    /**
562
    /**
537
     * Remove Html Tags
563
     * Remove Html Tags
538
     */
564
     */
539
    const removeTags = (str) => str.toString().replace(/(<([^>]+)>)/ig, '')
565
    const removeTags = (str) => str.toString().replace(/(<([^>]+)>)/ig, '')
-
 
566
    
540
    /**
567
    /**
541
     * Render Sections data
568
     * Render Sections data
542
     */
569
     */
543
    const renderSectionData = (data) => $("#rows").html($("#sectionTemplate").render(data, {
570
    const renderSectionData = (data) => $("#rows").html($("#sectionTemplate").render(data, {
544
        removeTags: removeTags,
571
        removeTags: removeTags,
545
        getAnswer: getAnswer,
572
        getAnswer: getAnswer,
546
        getStatus: getStatus
573
        getStatus: getStatus,
-
 
574
        editQuestion: objFormGenerator.editQuestion
547
    }));
575
    }));
548
    /**
576
    /**
549
     * Clear Div Section data 
577
     * Clear Div Section data 
550
     */
578
     */
551
    const clearSectionData = () => $("#rows").html('');
579
    const clearSectionData = () => $("#rows").html('');
Línea 677... Línea 705...
677
                                {{:~getStatus( options,answer)}}
705
                                {{:~getStatus( options,answer)}}
Línea 678... Línea 706...
678
 
706
 
Línea 679... Línea 707...
679
                                {{/if}}
707
                                {{/if}}
680
 
708
 
681
                                {{if type == 'open' || type == 'rating-open' || type=='rating-range' }}
709
                                {{if type == 'open' || type == 'rating-open' || type=='rating-range' }}
682
<select class="form-control" onchange="myFunction()">
710
<select class="form-control" onchange="editQuestion()">
683
    <option value="true">LABEL_CORRECT </option>
711
    <option value="true">LABEL_CORRECT </option>
684
    <option value="false">LABEL_FAIL</option>
712
    <option value="false">LABEL_FAIL</option>