Proyectos de Subversion LeadersLinked - Backend

Rev

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

Rev 386 Rev 387
Línea 154... Línea 154...
154
        for (i = 0; i < this.sections.length; i++) {
154
        for (i = 0; i < this.sections.length; i++) {
155
            if (slug_section == this.sections[i].slug_section) {
155
            if (slug_section == this.sections[i].slug_section) {
156
                for (j = 0; j < this.sections[i].questions.length; j++) {
156
                for (j = 0; j < this.sections[i].questions.length; j++) {
157
                    if (slug_question == this.sections[i].questions[j].slug_question) {
157
                    if (slug_question == this.sections[i].questions[j].slug_question) {
158
                        this.sections[i].questions[j].status = status;
158
                        this.sections[i].questions[j].status = status;
159
                        renderTable = true;
159
                        this.renderSection(slug_section);
160
                        break;
160
                        break;
161
                    }
161
                    }
162
                }
162
                }
163
            }
163
            }
164
 
-
 
165
        }
-
 
166
        if (renderTable) {
-
 
167
            this.renderSection(slug_section);
-
 
168
        }
164
        }
169
    };
165
    };
170
}
166
}
171
jQuery(document).ready(function($) {
167
jQuery(document).ready(function($) {
172
    var objFormGenerator = new classFormGenerator();
168
    var objFormGenerator = new classFormGenerator();
Línea 324... Línea 320...
324
            'url': action,
320
            'url': action,
325
        }).done(function(response) {
321
        }).done(function(response) {
326
            if (response['success']) {
322
            if (response['success']) {
327
                $('#form-main').attr('action', action);
323
                $('#form-main').attr('action', action);
328
                $('#form-main #form-id').val(response['data']['id']),
324
                $('#form-main #form-id').val(response['data']['id']),
329
                $('#name').html(response['data']['name']);
325
                    $('#name').html(response['data']['name']);
330
                $('#form-status').val(response['data']['status']);
326
                $('#form-status').val(response['data']['status']);
331
                $('#text').html(response['data']['text']);
327
                $('#text').html(response['data']['text']);
332
                $('#user').html(response['data']['user']);
328
                $('#user').html(response['data']['user']);
333
                /*-------------Render Sections -------*/
329
                /*-------------Render Sections -------*/
334
                objFormGenerator.clear();
330
                objFormGenerator.clear();
Línea 406... Línea 402...
406
     */
402
     */
407
    const removeTags = (str) => str.toString().replace(/(<([^>]+)>)/ig, '')
403
    const removeTags = (str) => str.toString().replace(/(<([^>]+)>)/ig, '')
408
    /**
404
    /**
409
     * Render Sections data
405
     * Render Sections data
410
     */
406
     */
-
 
407
    const renderSectionData = (data) => {
-
 
408
        console.log(data);
411
    const renderSectionData = (data) => $("#rows").html($("#sectionTemplate").render(data, {
409
        return $("#rows").html($("#sectionTemplate").render(data, {
412
        removeTags: removeTags,
410
        removeTags: removeTags,
413
        getAnswer: getAnswer,
411
        getAnswer: getAnswer,
414
        getStatus: getStatus
412
        getStatus: getStatus
415
    }));
413
    }))};
416
    /**
414
    /**
417
     * Clear Div Section data 
415
     * Clear Div Section data 
418
     */
416
     */
419
    const clearSectionData = () => $("#rows").html('');
417
    const clearSectionData = () => $("#rows").html('');
420
    /**
418
    /**
421
     * Clicked refresh button
419
     * Clicked refresh button
422
     */
420
     */
423
    $('button.btn-refresh').click(function(e) {
421
    $('button.btn-refresh').click(function(e) {
424
        tableForm.fnDraw();
422
        tableForm.fnDraw();
425
    });
423
    });
426
    
-
 
427
    /**
424
    /**
428
     * Clicked edit question
425
     * Clicked edit question
429
     */
426
     */
430
    $('body').on('click', 'button.btn-add-status', function(e) {
427
    $('body').on('click', 'button.btn-add-status', function(e) {
431
        e.preventDefault();
-
 
432
        var slug_section = $(this).data('section');
-
 
433
 
-
 
434
        objFormGenerator.editQuestion(
428
        objFormGenerator.editQuestion(
435
            $(this).data('section'),
429
            $(this).data('section'),
436
            $(this).data('question'),
430
            $(this).data('question'),
437
                    true
431
            true
438
                );
432
        );
439
    });
433
    });
440
 
-
 
441
    /**
434
    /**
442
     * Clicked edit question
435
     * Clicked edit question
443
     */
436
     */
444
    $('body').on('click', 'button.btn-remove-status', function(e) {
437
    $('body').on('click', 'button.btn-remove-status', function(e) {
445
        e.preventDefault();
-
 
446
        var slug_section = $(this).data('section');
-
 
447
 
-
 
448
        objFormGenerator.editQuestion(
438
        objFormGenerator.editQuestion(
449
            $(this).data('section'),
439
            $(this).data('section'),
450
            $(this).data('question'),
440
            $(this).data('question'),
451
                    false
441
            false
452
                );
442
        );
453
    });
443
    });
454
    
-
 
455
});
444
});
456
JS;
445
JS;
457
$this->inlineScript()->captureEnd();
446
$this->inlineScript()->captureEnd();
458
?>
447
?>