Proyectos de Subversion LeadersLinked - Backend

Rev

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

Rev 997 Rev 998
Línea 966... Línea 966...
966
    });
966
    });
967
    /**
967
    /**
968
     * Clicked add new section
968
     * Clicked add new section
969
     */
969
     */
970
    $('body').on('click', 'button.btn-add-section', function(e) {
970
    $('body').on('click', 'button.btn-add-section', function(e) {
-
 
971
        validatorFormsection.resetForm();
-
 
972
        $('#form-section #section-id').val('');
-
 
973
        CKEDITOR.instances['section-text'].setData('');
-
 
974
        $('#form-section #section-type').val($('#form-section #section-type option:first').val());
-
 
975
        $('#form-section #section-max-length').val('0');
-
 
976
        $('#form-section #section-max-length').parent().show();
-
 
977
        $('#modal-section h4[class="modal-title"]').html('LABEL_ADD LABEL_SECTION');
971
        $('#modal-section').modal('show');
978
        $('#modal-section').modal('show');
972
    });
979
    });
973
    /**
980
    /**
974
     * Clicked edit section
981
     * Clicked edit section
975
     */
982
     */
Línea 1188... Línea 1195...
1188
     */
1195
     */
1189
    const removeTags = (str) => str.toString().replace( /(<([^>]+)>)/ig, '')
1196
    const removeTags = (str) => str.toString().replace( /(<([^>]+)>)/ig, '')
1190
    /**
1197
    /**
1191
     * Render Sections data
1198
     * Render Sections data
1192
     */
1199
     */
1193
    const renderSectionData = (data) => $("#rows").html($("#sectionTemplate").render(data, {
1200
    const renderSectionData = (data) => $("#rows").html('');
1194
        getType: getsectionTypeBySlug,
-
 
1195
        removeTags: removeTags
-
 
1196
    }));
-
 
Línea 1197... Línea 1201...
1197
 
1201
 
1198
 
1202
 
1199
    /**
1203
    /**
Línea 1370... Línea 1374...
1370
 
1374
 
Línea 1371... Línea 1375...
1371
    <!-- End Modal Options -->
1375
    <!-- End Modal Options -->
1372
 
1376
 
1373
    <!---Template Sections --->
-
 
1374
    <script id="sectionTemplate" type="text/x-jsrender">
-
 
1375
    <div class="panel panel-default" id="panel-{{:slug_section}}">
-
 
1376
        <div class="panel-heading">
-
 
1377
            <h4 class="panel-title">
-
 
1378
                <a class="accordion-toggle" data-toggle="collapse" aria-expanded="true" data-parent="#panel-{{:slug_section}}" href="#collapse-{{:slug_section}}">
-
 
1379
                    <span class="section-name{{:slug_section}}">
-
 
1380
                        {{:name}}
-
 
1381
                    </span>
-
 
1382
                </a>
-
 
1383
            </h4>
-
 
1384
        </div>
-
 
1385
        <div id="collapse-{{:slug_section}}" class="panel-collapse in collapse show">
-
 
1386
            <div class="panel-body">
-
 
1387
                <div class="table-responsive">
-
 
1388
                    <table class="table table-bordered">
-
 
1389
                        <thead>
-
 
1390
                            <tr>
-
 
1391
                                <th style="width: 10%;">LABEL_ELEMENT</th>
-
 
1392
                                <th style="width: 50%;">LABEL_TEXT</th>
-
 
1393
                                <th style="width: 10%;">LABEL_VALUE</th>
-
 
1394
                                <th style="width: 10%;">LABEL_TYPE</th>
-
 
1395
                                <th style="width: 20%;">LABEL_ACTIONS</th>
-
 
1396
                            </tr>
-
 
1397
                        </thead>
-
 
1398
                        <tbody>
-
 
1399
                            <tr class="tr-section">
-
 
1400
                                <td class="text-left">LABEL_SECTION</td>
-
 
1401
                                <td class="text-left">{{:name}}</td>
-
 
1402
                                <td>{{:value}}</td>
-
 
1403
                                <td></td>
-
 
1404
                                <td>
-
 
1405
                                    <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>
-
 
1406
                                    <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> 
-
 
1407
                                    <button class="btn btn-default btn-add-section" data-section="{{:slug_section}}" data-toggle="tooltip"  data-original-title="LABEL_ADD  LABEL_SECTION"><i class="fa fa-plus" aria-hidden="true"></i> LABEL_ADD  LABEL_SECTION </button> 
-
 
1408
                                </td>
-
 
1409
                            </tr>
-
 
1410
                            {{for sections}}
-
 
1411
                            <tr class="tr-section">
-
 
1412
                                <td class="text-left">--LABEL_SECTION</td>
-
 
1413
                                <td class="text-left">
-
 
1414
                                    {{:~removeTags(text)}}
-
 
1415
                                </td>
-
 
1416
                                <td><font color="red">{{:value}}</font></td>
-
 
1417
                                <td class="text-capitalize">
-
 
1418
                                    {{if type == 'open'}} LABEL_OPEN {{/if}}
-
 
1419
                                    {{if type == 'simple'}} Simple {{/if}}
-
 
1420
                                    {{if type == 'multiple'}} Multiple {{/if}}
-
 
1421
                                    {{if type == 'rating-open'}} LABEL_RATING_OPEN {{/if}}
-
 
1422
                                    {{if type == 'rating-range'}} LABEL_RATING_RANGE {{/if}}
-
 
1423
                                </td>
-
 
1424
                                <td>
-
 
1425
                                    <button class="btn btn-default btn-edit-section" data-section="{{:slug_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> 
-
 
1426
                                    <button class="btn btn-default btn-delete-section" data-section="{{:slug_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> 
-
 
1427
                                  
-
 
1428
                                    {{if type == 'simple' || type == 'rating-open' || type=='multiple' }}
-
 
1429
                                    <button class="btn btn-default btn-add-option" data-section="{{:slug_section}}" data-section="{{:slug_section}}" data-toggle="tooltip"  data-original-title="LABEL_ADD  LABEL_OPTION"><i class="fa fa-plus" aria-hidden="true"></i> LABEL_ADD  LABEL_OPTION</button> 
-
 
1430
                                    {{/if}}
-
 
1431
                                
-
 
1432
                                </td>
-
 
1433
                            </tr>
-
 
1434
                            {{for options}}
-
 
1435
                            <tr class="tr-option">
-
 
1436
                                <td class="text-left">---LABEL_OPTION</td>
-
 
1437
                                <td class="text-left">
-
 
1438
                                    {{:~removeTags(text)}}
-
 
1439
                                </td>
1377
    <!---Template Sections --->
1440
                                <td>
-
 
1441
 
-
 
1442
                                    {{if ~getType( slug_section, slug_section) == 'multiple' || ~getType( slug_section, slug_section) == 'rating-open'  }}
-
 
1443
                                    {{:value}}
-
 
1444
                                    {{/if}}
-
 
1445
                                </td>
-
 
1446
                                <td class="text-left">
-
 
1447
                                    {{if ~getType( slug_section, slug_section) != 'rating-open'}}
-
 
1448
                                    {{if correct == 1}}
-
 
1449
                                    <font color="green">LABEL_CORRECT</font>
-
 
1450
                                    {{/if}}
-
 
1451
                                    {{if correct == 0}}
-
 
1452
                                    <font color="red">LABEL_FAIL</font>
-
 
1453
                                    {{/if}}
-
 
1454
                                    {{/if}}
-
 
1455
                                </td>
-
 
1456
                                <td>
-
 
1457
                                    <button class="btn btn-default btn-edit-option" data-section="{{:slug_section}}" data-section="{{:slug_section}}" 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> 
-
 
1458
                                    <button class="btn btn-default btn-delete-option" data-section="{{:slug_section}}" data-section="{{:slug_section}}" 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> 
-
 
1459
                                </td>
-
 
1460
                            </tr>
-
 
1461
                            {{/for}}
-
 
1462
                            {{/for}}
-
 
1463
                        </tbody>
-
 
1464
                    </table>
-
 
1465
                </div>
-
 
1466
            </div>
-
 
1467
        </div>
1378
    <script id="sectionTemplate" type="text/x-jsrender">
Línea 1468... Línea 1379...
1468
    </div>
1379
    
Línea 1469... Línea 1380...
1469
    </script>
1380
    </script>
1470
 
1381