- Posts: 23
- Thank you received: 2
Ask the community, share ideas, and connect with other LimeSurvey users!
The card sorting question theme does work with images. Simply replace the sub-question text with image tags.Omti90 wrote: ...and it would be nice if one could use images rather than text cards.
Thank you very much, I did not realize there was a complext text editor for the sub-questions. That's making things a lot easier.tpartner wrote:
The card sorting question theme does work with images. Simply replace the sub-question text with image tags.Omti90 wrote: ...and it would be nice if one could use images rather than text cards.
Thank you again, this is explaining what the XML part does really well. From looking at the CardSorting code, I suppose the CSS is for styling the elements while the java script defines the drag and drop function and the twig makes the custom properties interact with the original theme.As far as I know, the only (limited) documentation is here - github.com/LimeSurvey/LimeSurvey/tree/master/themes/question
It doesn't take the inputtype number (I googled that, but apparently that's wrong), what do I need to make it accept only (natural) numbers? Also is there some way to restrict these numbers? Like from 1-5?<attribute>
<name>columnCount</name>
<category>Custom options</category>
<sortorder>90</sortorder>
<inputtype>number</inputtype>
<default>1</default>
<help>Sets the number of Columns that are to be displayed by the cardsorting</help>
<caption>Number of Columns </caption>
<i18n>en</i18n>
</attribute>
<attribute>
<name>columnLabel</name>
<category>Custom options</category>
<sortorder>90</sortorder>
<inputtype>text</inputtype>
<default>Answer</default>
<help>Sets the labels for the Columns</help>
<caption>Column Labels</caption>
<i18n>en</i18n>
</attribute>
You could use <inputtype>integer</inputtype> but if values are limited to 1-5, I would use <inputtype>buttongroup</inputtype>....what do I need to make it accept only (natural) numbers? Also is there some way to restrict these numbers? Like from 1-5?
<attribute> <name>custom_attribute_2</name> <category>Custom options</category> <sortorder>1</sortorder> <inputtype>buttongroup</inputtype> <options> <one>1</one> <two>2</two> <three>3</three> <four>4</four> <five>5</five> </options> <default>three</default> <help>Just another test attribute...</help> <caption>Test attribute 2</caption> </attribute>
You will need to develop CSS in conjunction with the HTML elements introduced via TWIG or JavaScript.Or would I need to define additional style elements in the css first?
I tried to create some custom text field in css with the script above and then show it using the following twig code..card-sort-question .new-Text
{
position: absolute;
width: 20%;
max-width: 340px;
height: 120px;
border: 2px solid rgb(19, 170, 64);
background: #db1313;
}
I added the orange lines. This does sort of work since it prints the "labels" about where I would expect them.{% set names = question_template_attribute.area_names|split(',') %}
{% set labels = question_template_attribute.columnLabel %}
{% set columns = question_template_attribute.columnCount %}
<div class="card-sort-outer-wrapper">
<div class="droppable items-start"></div>
<div class ="new-Text">{{labels}}</div>
<div class="items-end-wrapper">
{% for index, item in names %}
<div class="items-end-inner">
<div class="items-end-text">{{item|trim}}</div>
<div class="droppable items-end items-end-{{index+1}}" data-items-end="{{index+1}}"></div>
</div>
{% endfor %}
</div>
</div>
Thank you. I had a look at it with the developer tools and the reason seems to be that the label "new-Text" simply isn't affected by the css (there is no entry for the css, as opposed to the wrapper elements).tpartner wrote: You can explore the DOM and styles with your browser developer tools (F12) to see what is affecting various elements.
I tried that, also tried changing the browser, but it remains unaffected. I'm not sure what I need to do to make some class in the twig use the styling I've defined in the css.tpartner wrote: Completely clear the browser cache and refresh?