- Posts: 162
- Thank you received: 14
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Show Ranking items as Ordered List
- teracomp
- Topic Author
- Offline
- Elite Member
Less
More
4 years 5 months ago #190370
by teracomp
Dave Phillips
Show Ranking items as Ordered List was created by teracomp
The default view for Ranking answers is an unordered list.
I have a survey that asks respondents to rank order a short list of options. For this survey, it would be helpful to see the number associated with each item.
Is there a simple way to change this to an ordered list (<ol>) when they drag and drop items to the right?
I have a survey that asks respondents to rank order a short list of options. For this survey, it would be helpful to see the number associated with each item.
Is there a simple way to change this to an ordered list (<ol>) when they drag and drop items to the right?
Dave Phillips
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13597
- Thank you received: 2487
4 years 5 months ago #190381
by DenisChenu
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Replied by DenisChenu on topic Show Ranking items as Ordered List
Right, it was an ol in previous release, but hard to show the number …
You can try :
1. Copy application/views/survey/questions/answer/ranking/answer.twig to your theme in survey/questions/answer/ranking/ survey directory
2. Update and set an ol
3. Find the best css
Maybe you can ask for a merge request to set ol in place of ul ?
You can try :
1. Copy application/views/survey/questions/answer/ranking/answer.twig to your theme in survey/questions/answer/ranking/ survey directory
2. Update and set an ol
3. Find the best css
Maybe you can ask for a merge request to set ol in place of ul ?
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.
- teracomp
- Topic Author
- Offline
- Elite Member
Less
More
- Posts: 162
- Thank you received: 14
4 years 5 months ago #190385
by teracomp
Dave Phillips
Replied by teracomp on topic Show Ranking items as Ordered List
Thank you! I'll give this a shot!
Dave Phillips
The topic has been locked.
- teracomp
- Topic Author
- Offline
- Elite Member
Less
More
- Posts: 162
- Thank you received: 14
4 years 5 months ago #191241
by teracomp
Dave Phillips
Replied by teracomp on topic Show Ranking items as Ordered List
It took me a while to get back to this request, but thanks for the direction DenisChenu!
I updated the answer.twig to show <ol> instead of <ul>:
then modified the css for the question by injecting this code:
What I like about this solution is that the <ol> is suppressed by default, display: block, so if you don't override the css in the question, the sortable answers don't show the numbers. For many instances, this is fine. In my case, for question #2049, I want the <ol> to show numbers so I add some padding and force the .list-group-item to display: list-item.
I updated the answer.twig to show <ol> instead of <ul>:
Code:
<!-- before --> <ul id="sortable-rank-{{qId}}" class="sortable-rank sortable-list list-group"> <li class="hidden ls-remove"></li> </ul> <!-- after --> <ol id="sortable-rank-{{qId}}" class="sortable-rank sortable-list list-group"> <li class="hidden ls-remove"></li> </ol>
then modified the css for the question by injecting this code:
Code:
<style type="text/css">#sortable-rank-2049 { padding-left: 2rem; } #sortable-rank-2049 .list-group-item { display: list-item; } </style>
What I like about this solution is that the <ol> is suppressed by default, display: block, so if you don't override the css in the question, the sortable answers don't show the numbers. For many instances, this is fine. In my case, for question #2049, I want the <ol> to show numbers so I add some padding and force the .list-group-item to display: list-item.
Dave Phillips
The following user(s) said Thank You: DenisChenu
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13597
- Thank you received: 2487
4 years 5 months ago #191303
by DenisChenu
Maybe a good idea to make a feature request about ol (and a pull request) ?
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Replied by DenisChenu on topic Show Ranking items as Ordered List
I'm happy to see a screenshot ?teracomp wrote: then modified the css for the question by injecting this code:
Maybe a good idea to make a feature request about ol (and a pull request) ?
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.
- teracomp
- Topic Author
- Offline
- Elite Member
Less
More
- Posts: 162
- Thank you received: 14
4 years 5 months ago #191310
by teracomp
Dave Phillips
Replied by teracomp on topic Show Ranking items as Ordered List
The attached screenshot shows the <ol> version of my answer.twig along with the modified css for the targeted question. I've also attached the question as exported from the original survey.
This is a pretty simple solution. I'm in the middle of several projects right now, but I will submit a pull-request when I get some time.
This is a pretty simple solution. I'm in the middle of several projects right now, but I will submit a pull-request when I get some time.
Dave Phillips
Attachments:
The following user(s) said Thank You: DenisChenu
The topic has been locked.