Proyectos de Subversion LeadersLinked - Backend

Rev

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

Rev 179 Rev 180
Línea 1246... Línea 1246...
1246
                }
1246
                }
1247
            }
1247
            }
1248
        });
1248
        });
1249
    });
1249
    });
Línea 1250... Línea 1250...
1250
 
1250
 
1251
    /**
1251
     /**
1252
     * Render Sections data
1252
      * Get Question type
-
 
1253
      */
-
 
1254
     const getQuestionTypeBySlug = (slug_section: string, slug_question: string) => {
-
 
1255
         for (i = 0; i < objFormGenerator.sections.length; i++) {
-
 
1256
             if (slug_section == objFormGenerator.sections[i].slug_section) {
-
 
1257
                 for (j = 0; j < objFormGenerator.sections[i].questions.length; j++) {
1253
    */
1258
                     if (slug_question == objFormGenerator.sections[i].questions[j].slug_question) {
-
 
1259
                         return objFormGenerator.sections[i].questions[j].type;
-
 
1260
                     }
-
 
1261
                 }
-
 
1262
             }
-
 
1263
         }
1254
    const renderData = (data) => $("#rows").html($("#sectionTemplate").render(data));
1264
     }
-
 
1265
        
-
 
1266
     /**
-
 
1267
      * Render Sections data
-
 
1268
      */
-
 
1269
     const renderData = (data) => $("#rows").html($("#sectionTemplate").render(data, {
-
 
1270
         getType: getQuestionTypeBySlug
1255
    
1271
     }));
1256
 
1272
        
1257
    $('body').on('click', 'button.btn-add-option', function(e) {
1273
    $('body').on('click', 'button.btn-add-option', function(e) {
1258
        e.preventDefault();
1274
        e.preventDefault();
1259
        var slug_section = $(this).data('section');
1275
        var slug_section = $(this).data('section');
1260
        var slug_question = $(this).data('question');
1276
        var slug_question = $(this).data('question');
Línea 1512... Línea 1528...
1512
        </div>
1528
        </div>
1513
    </div>
1529
    </div>
Línea 1514... Línea 1530...
1514
 
1530
 
Línea 1515... Línea -...
1515
    <!-- Create/Edit Form -->
-
 
1516
 
-
 
1517
<!---Template Sections --->
-
 
1518
    <script id="sectionTemplate" type="text/x-jsrender">
-
 
1519
    <div class="panel panel-default" id="panel-{{:slug_section}}">
-
 
1520
   <div class="panel-heading">
-
 
1521
      <h4 class="panel-title">
-
 
1522
         <a class="accordion-toggle" data-toggle="collapse" aria-expanded="true" data-parent="#panel-{{:slug_section}}" href="#collapse-{{:slug_section}}">
-
 
1523
         <span class="section-name{{:slug_section}}">
-
 
1524
         {{:name}}
-
 
1525
         </span>
-
 
1526
         </a>
-
 
1527
      </h4>
-
 
1528
   </div>
-
 
1529
   <div id="collapse-{{:slug_section}}" class="panel-collapse in collapse show">
-
 
1530
      <div class="panel-body">
-
 
1531
         <div class="table-responsive">
-
 
1532
            <table class="table table-bordered">
-
 
1533
               <thead>
-
 
1534
                  <tr>
-
 
1535
                     <th>LABEL_ELEMENT</th>
-
 
1536
                     <th>LABEL_TEXT</th>
-
 
1537
                     <th>LABEL_VALUE</th>
-
 
1538
                     <th>LABEL_TYPE</th>
-
 
1539
                     <th>LABEL_ACTIONS</th>
-
 
1540
                  </tr>
-
 
1541
               </thead>
-
 
1542
               <tbody>
-
 
1543
                  <tr class="tr-section">
-
 
1544
                     <td class="text-left">LABEL_SECTION</td>
-
 
1545
                     <td class="text-left">{{:name}}</td>
-
 
1546
                     <td>{{:value}}</td>
-
 
1547
                     <td></td>
-
 
1548
                     <td>
-
 
1549
                        <button class="btn btn-default btn-edit-section" data-section="{{:slug_section}}" data-toggle="tooltip"  data-original-title="LABEL_EDIT LABEL_SECTION"><i class="fa fa-edit" aria-hidden="true"></i> LABEL_EDIT LABEL_SECTION </button>
-
 
1550
                        <button class="btn btn-default btn-delete-section" data-section="{{:slug_section}}" data-toggle="tooltip"  data-original-title="LABEL_DELETE LABEL_SECTION"><i class="fa fa-ban" aria-hidden="true"></i> LABEL_DELETE LABEL_SECTION </button> 
-
 
1551
                        <button class="btn btn-default btn-add-question" data-section="{{:slug_section}}" data-toggle="tooltip"  data-original-title="LABEL_ADD  LABEL_QUESTION"><i class="fa fa-plus" aria-hidden="true"></i> LABEL_ADD  LABEL_QUESTION </button> 
-
 
1552
                     </td>
-
 
1553
                  </tr>
-
 
1554
                  {{for questions}}
-
 
1555
                  <tr class="tr-question">
-
 
1556
                     <td class="text-left">--LABEL_QUESTION</td>
-
 
1557
                     <td class="text-left">
-
 
1558
                        {{:text}}
-
 
1559
                     </td>
-
 
1560
                     <td><font color="red">{{:value}}</font></td>
-
 
1561
                     <td class="text-capitalize">
-
 
1562
                        {{if type == 'open'}} LABEL_OPEN {{/if}}
-
 
1563
                        {{if type == 'simple'}} Simple {{/if}}
-
 
1564
                        {{if type == 'multiple'}} Multiple {{/if}}
-
 
1565
                        {{if type == 'rating-open'}} LABEL_RATING_OPEN {{/if}}
-
 
1566
                        {{if type == 'rating-range'}} LABEL_RATING_RANGE {{/if}}
-
 
1567
                     </td>
-
 
1568
                     <td>
-
 
1569
                        <button class="btn btn-default btn-edit-question" data-section="{{:slug_section}}" data-question="{{:slug_question}}" data-toggle="tooltip"  data-original-title="LABEL_EDIT LABEL_QUESTION"><i class="fa fa-edit" aria-hidden="true"></i> LABEL_EDIT LABEL_QUESTION</button> 
-
 
1570
                        <button class="btn btn-default btn-delete-question" data-section="{{:slug_section}}" data-question="{{:slug_question}}" data-toggle="tooltip"  data-original-title="LABEL_DELETE LABEL_QUESTION"><i class="fa fa-ban" aria-hidden="true"></i> LABEL_DELETE LABEL_QUESTION</button> 
-
 
1571
                        <button class="btn btn-default btn-add-option" data-section="{{:slug_section}}" data-question="{{:slug_question}}" data-toggle="tooltip"  data-original-title="LABEL_ADD  LABEL_OPTION"><i class="fa fa-plus" aria-hidden="true"></i> LABEL_ADD  LABEL_OPTION</button> 
-
 
1572
                     </td>
-
 
1573
                  </tr>
-
 
1574
                  {{for options}}
-
 
1575
                  <tr class="tr-option">
-
 
1576
                     <td class="text-left">---LABEL_OPTION</td>
-
 
1577
                     <td class="text-left">
-
 
1578
                        {{:text}}
-
 
1579
                     </td>
-
 
1580
                     <td>
-
 
1581
                        {{if question_type == 'multiple' || question_type == 'rating-open'  }}
-
 
1582
                        {{:value}}
-
 
1583
                        {{/if}}
-
 
1584
                     </td>
-
 
1585
                     <td class="text-left">
-
 
1586
                        {{if question_type != rating-open'}}
-
 
1587
                        {{if correct == 1}}
-
 
1588
                        <font color="green">LABEL_CORRECT</font>
-
 
1589
                        {{/if}}
-
 
1590
                        {{if correct == 0}}
-
 
1591
                        <font color="red">LABEL_FAIL</font>
-
 
1592
                        {{/if}}
-
 
1593
                        {{/if}}
-
 
1594
                     </td>
-
 
1595
                     <td>
-
 
1596
                        <button class="btn btn-default btn-edit-option" data-section="{{:slug_section}}" data-question="{{:slug_question}}" data-slug="{{:slug_option}}" data-toggle="tooltip"  data-original-title="LABEL_EDIT LABEL_OPTION"><i class="fa fa-edit" aria-hidden="true"></i> LABEL_EDIT LABEL_OPTION</button> 
-
 
1597
                        <button class="btn btn-default btn-delete-option" data-section="{{:slug_section}}" data-question="{{:slug_question}}" data-slug="{{:slug_option}}" data-toggle="tooltip"  data-original-title="LABEL_DELETE LABEL_OPTION"><i class="fa fa-ban" aria-hidden="true"></i> LABEL_DELETE LABEL_OPTION</button> 
-
 
1598
                     </td>
-
 
1599
                  </tr>
-
 
1600
                  {{/for}}
-
 
1601
                  {{/for}}
-
 
1602
               </tbody>
-
 
1603
            </table>
-
 
1604
         </div>
-
 
1605
      </div>
-
 
1606
   </div>
-
 
1607
</div>
-
 
1608
    </script>
-
 
1609
    
-
 
1610
    <!-- End Template Sections-->
1531
    <!-- Create/Edit Form -->
1611
 
1532
 
1612
    <div class="row" id="row-edit" style="display: none">
1533
    <div class="row" id="row-edit" style="display: none">
1613
        <div class="col-xs-12 col-md-12">
1534
        <div class="col-xs-12 col-md-12">
1614
            <form action="#" name="form-main" id="form-main">
1535
            <form action="#" name="form-main" id="form-main">
Línea 1663... Línea 1584...
1663
        </div>
1584
        </div>
1664
    </div>
1585
    </div>
Línea 1665... Línea 1586...
1665
 
1586
 
Línea 1666... Línea -...
1666
    <!-- Create/Edit Form-->
-
 
1667
 
-
 
1668
    <!-- Modals -->
1587
    <!-- Create/Edit Form-->
1669
 
1588
 
1670
    <!-- Section Modal -->
1589
    <!-- Section Modal -->
1671
    <div  id="modal-section" class="modal" tabindex="-1" role="dialog">
1590
    <div  id="modal-section" class="modal" tabindex="-1" role="dialog">
1672
        <div class="modal-dialog modal-lg" role="document">
1591
        <div class="modal-dialog modal-lg" role="document">
Línea 1812... Línea 1731...
1812
        </div>
1731
        </div>
1813
    </div>
1732
    </div>
Línea 1814... Línea 1733...
1814
 
1733
 
Línea -... Línea 1734...
-
 
1734
    <!-- End Modal Options -->
-
 
1735
 
-
 
1736
    <!---Template Sections --->
-
 
1737
    <script id="sectionTemplate" type="text/x-jsrender">
-
 
1738
    <div class="panel panel-default" id="panel-{{:slug_section}}">
-
 
1739
        <div class="panel-heading">
-
 
1740
            <h4 class="panel-title">
-
 
1741
                <a class="accordion-toggle" data-toggle="collapse" aria-expanded="true" data-parent="#panel-{{:slug_section}}" href="#collapse-{{:slug_section}}">
-
 
1742
                    <span class="section-name{{:slug_section}}">
-
 
1743
                        {{:name}}
-
 
1744
                    </span>
-
 
1745
                </a>
-
 
1746
            </h4>
-
 
1747
        </div>
-
 
1748
        <div id="collapse-{{:slug_section}}" class="panel-collapse in collapse show">
-
 
1749
            <div class="panel-body">
-
 
1750
                <div class="table-responsive">
-
 
1751
                    <table class="table table-bordered">
-
 
1752
                        <thead>
-
 
1753
                            <tr>
-
 
1754
                                <th>LABEL_ELEMENT</th>
-
 
1755
                                <th>LABEL_TEXT</th>
-
 
1756
                                <th>LABEL_VALUE</th>
-
 
1757
                                <th>LABEL_TYPE</th>
-
 
1758
                                <th>LABEL_ACTIONS</th>
-
 
1759
                            </tr>
-
 
1760
                        </thead>
-
 
1761
                        <tbody>
-
 
1762
                            <tr class="tr-section">
-
 
1763
                                <td class="text-left">LABEL_SECTION</td>
-
 
1764
                                <td class="text-left">{{:name}}</td>
-
 
1765
                                <td>{{:value}}</td>
-
 
1766
                                <td></td>
-
 
1767
                                <td>
-
 
1768
                                    <button class="btn btn-default btn-edit-section" data-section="{{:slug_section}}" data-toggle="tooltip"  data-original-title="LABEL_EDIT LABEL_SECTION"><i class="fa fa-edit" aria-hidden="true"></i> LABEL_EDIT LABEL_SECTION </button>
-
 
1769
                                    <button class="btn btn-default btn-delete-section" data-section="{{:slug_section}}" data-toggle="tooltip"  data-original-title="LABEL_DELETE LABEL_SECTION"><i class="fa fa-ban" aria-hidden="true"></i> LABEL_DELETE LABEL_SECTION </button> 
-
 
1770
                                    <button class="btn btn-default btn-add-question" data-section="{{:slug_section}}" data-toggle="tooltip"  data-original-title="LABEL_ADD  LABEL_QUESTION"><i class="fa fa-plus" aria-hidden="true"></i> LABEL_ADD  LABEL_QUESTION </button> 
-
 
1771
                                </td>
-
 
1772
                            </tr>
-
 
1773
                            {{for questions}}
-
 
1774
                            <tr class="tr-question">
-
 
1775
                                <td class="text-left">--LABEL_QUESTION</td>
-
 
1776
                                <td class="text-left">
-
 
1777
                                    {{:text}}
-
 
1778
                                </td>
-
 
1779
                                <td><font color="red">{{:value}}</font></td>
-
 
1780
                                <td class="text-capitalize">
-
 
1781
                                    {{if type == 'open'}} LABEL_OPEN {{/if}}
-
 
1782
                                    {{if type == 'simple'}} Simple {{/if}}
-
 
1783
                                    {{if type == 'multiple'}} Multiple {{/if}}
-
 
1784
                                    {{if type == 'rating-open'}} LABEL_RATING_OPEN {{/if}}
-
 
1785
                                    {{if type == 'rating-range'}} LABEL_RATING_RANGE {{/if}}
-
 
1786
                                </td>
-
 
1787
                                <td>
-
 
1788
                                    <button class="btn btn-default btn-edit-question" data-section="{{:slug_section}}" data-question="{{:slug_question}}" data-toggle="tooltip"  data-original-title="LABEL_EDIT LABEL_QUESTION"><i class="fa fa-edit" aria-hidden="true"></i> LABEL_EDIT LABEL_QUESTION</button> 
-
 
1789
                                    <button class="btn btn-default btn-delete-question" data-section="{{:slug_section}}" data-question="{{:slug_question}}" data-toggle="tooltip"  data-original-title="LABEL_DELETE LABEL_QUESTION"><i class="fa fa-ban" aria-hidden="true"></i> LABEL_DELETE LABEL_QUESTION</button> 
-
 
1790
                                    <button class="btn btn-default btn-add-option" data-section="{{:slug_section}}" data-question="{{:slug_question}}" data-toggle="tooltip"  data-original-title="LABEL_ADD  LABEL_OPTION"><i class="fa fa-plus" aria-hidden="true"></i> LABEL_ADD  LABEL_OPTION</button> 
-
 
1791
                                </td>
-
 
1792
                            </tr>
-
 
1793
                            {{for options}}
-
 
1794
                            <tr class="tr-option">
-
 
1795
                                <td class="text-left">---LABEL_OPTION</td>
-
 
1796
                                <td class="text-left">
-
 
1797
                                    {{:text}}
-
 
1798
                                </td>
-
 
1799
                                <td>
-
 
1800
 
-
 
1801
                                    {{:~getType( slug_section, slug_question)}}
-
 
1802
 
-
 
1803
                                    {{if question_type == 'multiple' || question_type == 'rating-open'  }}
-
 
1804
                                    {{:value}}
-
 
1805
                                    {{/if}}
-
 
1806
                                </td>
-
 
1807
                                <td class="text-left">
-
 
1808
                                    {{if question_type != rating-open'}}
-
 
1809
                                    {{if correct == 1}}
-
 
1810
                                    <font color="green">LABEL_CORRECT</font>
-
 
1811
                                    {{/if}}
-
 
1812
                                    {{if correct == 0}}
-
 
1813
                                    <font color="red">LABEL_FAIL</font>
-
 
1814
                                    {{/if}}
-
 
1815
                                    {{/if}}
-
 
1816
                                </td>
1815
    <!-- End Modal Options -->
1817
                                <td>
-
 
1818
                                    <button class="btn btn-default btn-edit-option" data-section="{{:slug_section}}" data-question="{{:slug_question}}" data-slug="{{:slug_option}}" data-toggle="tooltip"  data-original-title="LABEL_EDIT LABEL_OPTION"><i class="fa fa-edit" aria-hidden="true"></i> LABEL_EDIT LABEL_OPTION</button> 
-
 
1819
                                    <button class="btn btn-default btn-delete-option" data-section="{{:slug_section}}" data-question="{{:slug_question}}" data-slug="{{:slug_option}}" data-toggle="tooltip"  data-original-title="LABEL_DELETE LABEL_OPTION"><i class="fa fa-ban" aria-hidden="true"></i> LABEL_DELETE LABEL_OPTION</button> 
-
 
1820
                                </td>
-
 
1821
                            </tr>
-
 
1822
                            {{/for}}
-
 
1823
                            {{/for}}
-
 
1824
                        </tbody>
-
 
1825
                    </table>
-
 
1826
                </div>
-
 
1827
            </div>
-
 
1828
        </div>
-
 
1829
    </div>
-
 
1830
    </script>
Línea 1816... Línea 1831...
1816
 
1831
 
1817
    <!-- End Modals -->
1832
    <!-- End Template Sections-->