Open full view…

displaying a list of heterogenous items

Mon, 05 Dec 2016 15:55:10 GMT

sorry about having multiple questions in a single post. I'm totally new to Riot. I need a tag to display a list of questions (only the last one will be unanswered). The problem is that there are different question types, which have different forms, and will need some different functionality. A few examples are: + yes-no-question (simply presents the user with 'yes' 'no' buttons to answer the question) + radio-question + checkbox-question + text-question + etc.. question1: is *mixins* the way to basically subclass my 'question' tag into these '*-question' tags? question2: in ember, i could use the helper {{component item.questionType}} which would basically delay the decision of which tag to display until it is time to render that particular item in the list. is this something which could be accomplished via: <virtual each={question in questions}> <virtual if={question.questionType == 'ynq'}> <yes-no-question/> </virtual> <virtual if={question.questionType == 'radio'}> <radio-question/> </virtual> ... </virtual> ?

Sat, 10 Dec 2016 16:21:23 GMT

regarding my 2nd question, I figured out that I can: --- <question-list> <ul> <li each={question in this.opts.question}> <div data-is={question.questionType}></div> </li> </ul> </question-list> --- although, unlike in my question, the value of question.questionType needs to be same as the intended custom tag's name, i.e. either the value of question.questionType needs to be 'yes-no-question' instead of 'ynq' or the tag needs to be 'ynq' instead of 'yes-no-question'