Proyectos de Subversion LeadersLinked - Backend

Rev

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

Rev 1008 Rev 1009
Línea 252... Línea 252...
252
    /**
252
    /**
253
     * Clicked add new section
253
     * Clicked add new section
254
     */
254
     */
255
    $('#btn-add-section').click(function(e) {
255
    $('#btn-add-section').click(function(e) {
256
        $('#form-section #section-id').val('');
256
        $('#form-section #section-id').val('');
-
 
257
        $('#form-section #section-name').val('');
-
 
258
        $('#form-section #section-name').val('');
257
        CKEDITOR.instances['text'].setData('');
259
        CKEDITOR.instances['section-text'].setData('');
258
        $('#form-section #type').val($('#form-section #section-type option:first').val());
260
        $('#form-section #section-type').val($('#form-section #section-type option:first').val());
259
        $('#modal-section h4[class="modal-title"]').html('LABEL_ADD LABEL_SECTION');
261
        $('#modal-section h4[class="modal-title"]').html('LABEL_ADD LABEL_SECTION');
260
        $('#modal-section').modal('show');
262
        $('#modal-section').modal('show');
261
    });
263
    });
262
    /**
264
    /**
263
     * Clicked edit section
265
     * Clicked edit section
264
     */
266
     */
265
    $('#btn-edit-section').click(function(e) {
267
    $('#btn-edit-section').click(function(e) {
266
        console.log(0)
268
        console.log(0)
267
        $('#modal-section').modal('show');
269
        $('#modal-section').modal('show');
268
    });
270
    });
-
 
271
 
-
 
272
 
-
 
273
    /**
-
 
274
     * Clicked save section
-
 
275
     */
-
 
276
    $('#btn-save-section').click(function(e) {
-
 
277
        
-
 
278
        if($('#section-name').val()==''){
-
 
279
 
-
 
280
            $.fn.showError('Ingrese un nombre'));
-
 
281
            return;
-
 
282
 
-
 
283
        }else{
-
 
284
            if($('#section-id').val()==""){
-
 
285
                addSection(
-
 
286
                    $('#section-name').val(),
-
 
287
                    $('#section-text').val(),
-
 
288
                    $('#section-type').val(),
-
 
289
                    ) 
-
 
290
            }else{
-
 
291
                editSection(
-
 
292
                    $('#section-id').val(),
-
 
293
                    $('#section-name').val(),
-
 
294
                    $('#section-text').val(),
-
 
295
                    $('#section-type').val()
-
 
296
                ) 
-
 
297
            }
-
 
298
        
-
 
299
        }
-
 
300
    });
-
 
301
 
269
    /**
302
    /**
270
     * Clicked remove section
303
     * Clicked remove section
271
     */
304
     */
272
    $('#btn-delete-section').click(function(e) {
305
    $('#btn-delete-section').click(function(e) {
273
        var id = $(this).data('section');
306
        var id = $(this).data('section');
Línea 347... Línea 380...
347
    const renderData= (data) => $("#rows").html('');
380
    const renderData= (data) => $("#rows").html('');
Línea 348... Línea 381...
348
 
381
 
349
    /**
382
    /**
350
     * Add Section to array
383
     * Add Section to array
351
     */
384
     */
352
    const addSection = (title, type, description, level) => {
385
    const addSection = (title, type, text) => {
353
        sections.push({
386
        sections.push({
354
            'id': new Date().getTime(),
387
            'id': new Date().getTime(),
355
            'title': title,
388
            'title': title,
356
            'type': type,
389
            'type': type,
357
            'description': description,
390
            'text': text,
358
            'options': []
391
            'options': []
359
        });
392
        });
360
        renderData(sections);
393
        renderData(sections);
361
    }
394
    }
362
    /**
395
    /**
363
     * Edit item behavior
396
     * Edit item behavior
364
     */
397
     */
365
    const editSection = (id, description, level) => {
398
    const editSection = (id, title, type, text) => {
366
        sections.map((item) => {
399
        sections.map((item) => {
367
            if (item.id == id) {
400
            if (item.id == id) {
368
                item.description = description;
401
                item.title = title;
-
 
402
                item.type = type;
369
                item.level = level
403
                item.text = text;
370
            }
404
            }
371
        });
405
        });
372
        renderData(sections);
406
        renderData(sections);
373
    }
407
    }
Línea 479... Línea 513...
479
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
513
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
480
                            <span aria-hidden="true">&times;</span>
514
                            <span aria-hidden="true">&times;</span>
481
                        </button>
515
                        </button>
482
                    </div>
516
                    </div>
483
                    <div class="modal-body">
517
                    <div class="modal-body">
-
 
518
                    <div class="form-group">
-
 
519
                            <label for="section-name">LABEL_FIRST_NAME</label>
-
 
520
                            <input type="text" name="section-name" id="section-name" class="form-control" maxlength="50" value="" />
-
 
521
                        </div>
484
                        <div class="form-group">
522
                        <div class="form-group">
485
                            <label for="section-text">LABEL_TEXT</label>
523
                            <label for="section-text">LABEL_TEXT</label>
486
                            <!--  ckeditor -->
524
                            <!--  ckeditor -->
487
                            <textarea  name="text" id="text" rows="5" class="ckeditor form-control"></textarea>
525
                            <textarea  name="section-text" id="section-text" rows="5" class="ckeditor form-control"></textarea>
488
                        </div>
526
                        </div>
489
                        <div class="form-group">
527
                        <div class="form-group">
490
                            <label for="type">LABEL_TYPE</label>
528
                            <label for="section-type">LABEL_TYPE</label>
491
                            <select name="type" id="type" class="form-control">
529
                            <select name="section-type" id="section-type" class="form-control">
492
                                <option value="simple">Simple</option>
530
                                <option value="simple">Simple</option>
493
                                <option value="multiple">Multiple</option>
531
                                <option value="multiple">Multiple</option>
494
                            </select>
532
                            </select>
495
                        </div>
533
                        </div>
496
                    </div>
534
                    </div>