Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

Rev 329 | Rev 333 | Ir a la última revisión | | Comparar con el anterior | Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
306 geraldo 1
import React from "react";
2
import Option from "../option/Option";
3
 
4
const Question = (props) => {
310 geraldo 5
 
306 geraldo 6
    // get props
332 geraldo 7
    const { question, backendVars } = props;
306 geraldo 8
 
9
    return (
313 geraldo 10
        <div className="col-md-12 col-sm-12 col-xs-12 np-padding">
310 geraldo 11
            <div className="form-group" >
332 geraldo 12
                <h6>{backendVars.LBL_QUESTION} #{question.position+1}</h6>
310 geraldo 13
                <div
14
                    dangerouslySetInnerHTML={{ __html: question.text }}
15
                    className="title"
16
                />
17
            </div>
306 geraldo 18
            {question.type == 'open' &&
310 geraldo 19
                <div className="form-group">
306 geraldo 20
                    {question.multiline == 1 ? (
21
                        <textarea
22
                            className="form-control"
23
                            rows="5"
24
                            maxLength={question.maxlength}
25
                            name={question.slug_question}
26
                            id={question.slug_question}
27
                        ></textarea>
28
                    ) : (
29
                        <input
30
                            type="text"
31
                            className="form-control"
32
                            maxLength={question.maxlength}
33
                            name={question.slug_question}
34
                            id={question.slug_question} />
35
                    )}
36
                </div>
37
            }
38
            {question.type == 'rating-range' &&
310 geraldo 39
                <div className="form-group">
306 geraldo 40
                    {Array.apply(0, Array(question.range)).map((_, i) => {
41
                        return (
42
                            <div className="radio radio-inline">
43
 
44
                                <input
45
                                    key={i}
46
                                    type="radio"
47
                                    name={question.slug_question}
48
                                    id={question.slug_question}
49
                                    value={i} />
50
                                {i}
51
 
52
                            </div>
53
                        )
54
                    })}
55
                </div>
56
            }
323 geraldo 57
            { (question.type == 'simple' || question.type == 'rating-open' || question.type == 'multiple') &&
310 geraldo 58
                <div className="form-group">
323 geraldo 59
                    {question.options.length > 0 &&
306 geraldo 60
                        <Option question={question} />
61
                    }
62
                </div>
63
            }
310 geraldo 64
 
306 geraldo 65
        </div>
66
 
310 geraldo 67
 
306 geraldo 68
    )
69
}
70
 
71
export default Question;