Proyectos de Subversion LeadersLinked - Backend

Rev

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

Rev 318 Rev 319
Línea 147... Línea 147...
147
            $('[data-toggle="tooltip"]').tooltip();
147
            $('[data-toggle="tooltip"]').tooltip();
148
        };
148
        };
149
    }
149
    }
Línea 150... Línea -...
150
        
-
 
151
        
-
 
152
 
-
 
153
function htmlEntities(str) {
-
 
154
    return String(str).replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;');
150
        
155
}
151
        
156
jQuery(document).ready(function($) {
152
jQuery(document).ready(function($) {
157
    var objFormGenerator = new classFormGenerator();
153
    var objFormGenerator = new classFormGenerator();
158
    objFormGenerator.render();
154
    objFormGenerator.render();
Línea 528... Línea 524...
528
    $('button.btn-form-save-close').click(function(e) {
524
    $('button.btn-form-save-close').click(function(e) {
529
        e.preventDefault();
525
        e.preventDefault();
530
        $('#form-main #form-continue').val('0')
526
        $('#form-main #form-continue').val('0')
531
        $('#form-main').submit();
527
        $('#form-main').submit();
532
    });
528
    });
533
    /**
529
 
534
     * Modal Settings
530
    const getAnswerOfQuestion = (question) =>{
535
     */
531
 
536
    $('#modal-section, #modal-question, #modal-option').modal({
532
        if(question.type =='open' || question.type == "rating-open" ){
537
        backdrop: 'static',
-
 
538
        keyboard: false,
-
 
539
        show: false
-
 
540
    });
-
 
541
    /**
533
 
542
     * Get Question type
534
            return question.aswer;
543
     */
-
 
544
    const getQuestionTypeBySlug = (slug_section, slug_question) => {
-
 
545
        for (i = 0; i < objFormGenerator.sections.length; i++) {
-
 
546
            if (slug_section == objFormGenerator.sections[i].slug_section) {
-
 
547
                for (j = 0; j < objFormGenerator.sections[i].questions.length; j++) {
-
 
548
                    if (slug_question == objFormGenerator.sections[i].questions[j].slug_question) {
-
 
549
                        return objFormGenerator.sections[i].questions[j].type;
-
 
550
                    }
-
 
551
                }
-
 
552
            }
-
 
553
        }
535
        }
-
 
536
        
-
 
537
        return question.options.filter((opt) => opt.slug_option == question.aswer)[0];
-
 
538
        
-
 
539
 
554
    }
540
    }
-
 
541
   
555
    /**
542
    /**
556
     * Remove Html Tags
543
     * Remove Html Tags
557
     */
544
     */
558
    const removeTags = (str) => str.toString().replace( /(<([^>]+)>)/ig, '')
545
    const removeTags = (str) => str.toString().replace( /(<([^>]+)>)/ig, '')
559
    /**
546
    /**
560
     * Render Sections data
547
     * Render Sections data
561
     */
548
     */
562
    const renderSectionData = (data) => $("#rows").html($("#sectionTemplate").render(data, {
549
    const renderSectionData = (data) => $("#rows").html($("#sectionTemplate").render(data, {
563
        getType: getQuestionTypeBySlug,
-
 
564
        removeTags: removeTags
550
        removeTags: removeTags
-
 
551
        getAnswer: getAnswerOfQuestion
565
    }));
552
    }));
Línea 566... Línea 553...
566
 
553
 
567
 
554
 
Línea 651... Línea 638...
651
                    <div class="col-xs-12 col-md-12">
638
                    <div class="col-xs-12 col-md-12">
652
                        <div class="panel-group" id="rows"></div>
639
                        <div class="panel-group" id="rows"></div>
653
                    </div>
640
                    </div>
654
                </div>
641
                </div>
655
                <div class="form-group">
642
                <div class="form-group">
656
                    <button type="submit" form="form-main" class="btn btn-info btn-form-save-continue">LABEL_SAVE & LABEL_CONTINUE</button>
-
 
657
                    <button type="button" class="btn btn-primary btn-form-save-close">LABEL_SAVE & LABEL_CLOSE</button>
643
                    <button type="button" class="btn btn-primary btn-form-save-close">LABEL_SAVE</button>
658
                    <button type="button" class="btn btn-secondary btn-edit-cancel">LABEL_CANCEL</button>
644
                    <button type="button" class="btn btn-secondary btn-edit-cancel">LABEL_CANCEL</button>
659
                </div>
645
                </div>
660
            </form>
646
            </form>
661
        </div>
647
        </div>
662
    </div>
648
    </div>
Línea 702... Línea 688...
702
                                <th colspan="3">LABEL_ANSWER</th>
688
                                <th colspan="3">LABEL_ANSWER</th>
703
                            </tr>
689
                            </tr>
704
                        </thead>
690
                        </thead>
705
                        <tbody>
691
                        <tbody>
706
                            <tr class="tr-question">
692
                            <tr class="tr-question">
707
                                <td colspan="3" class="text-left">{{:answer}} </td>
693
                                <td colspan="3" class="text-left">{{:getAnswer(questions)}} </td>
708
                            </tr>
694
                            </tr>
709
                        </tbody>
695
                        </tbody>
710
                    </table>
696
                    </table>
Línea 711... Línea 697...
711
                                                
697