Add Colors in questions

Mehr
3 Monate 3 Wochen her - 3 Monate 3 Wochen her #157647 von mistercitrus
mistercitrus erstellte das Thema Add Colors in questions
I'm wondering what the easiest way to accomplish on the form what I've done in mspaint.exe here (see attachment)
Just need to add some colors to a number of questions, the entire survey would share the same color scheme and each question would always have 5 responses if that makes things simpler.







Open to other solutions such as graphic 'buttons' or just colored text to
The closest I've seen is this example -

LouisGac schrieb: Hi,

It should be possible to adapt old survey template with the new system without too much difficulties.
We're working on it for the future.

Here basically the work that must be done (you can help with it) :

1. All the question types, less arrays, have now separated views :
github.com/LimeSurvey/LimeSurvey/tree/ma...ews/survey/questions

In a close future, this will give the possibility to any LimeSurvey user with some skill in PHP/JS/CSS to add new question rendering, with its own HTML, JS files, and CSS, and to share them as question modules.

Have a look to the YES/NO question or GENDER question and their new question attribute to see how it works. Basically, for gender question, you can see that we added new 'button' views :
github.com/LimeSurvey/LimeSurvey/tree/ma...vey/questions/gender



accessible via the 'display' question attribute.



2. So, we must finish to export the array question HTML to view

3. Then we must add the old question HTML of 2.0x as views accessible via a display option


For now, I will advise you just to build new template on the base of one of the new ones. They use Bootstrap (easy to use), and are fully responsive.

Anhang:
Letzte Änderung: 3 Monate 3 Wochen her von mistercitrus.

Bitte Anmelden um an der Konversation teilzunehmen.

Mehr
3 Monate 3 Wochen her - 3 Monate 3 Wochen her #157649 von Joffm
Joffm antwortete auf das Thema: Add Colors in questions
Hi, mistercitrus,

here is a solution for array. Only example with three colored columns.
Insert into the sourcecode of the question:
<style type="text/css">
.answer_cell_001,
.answer_cell_1
{
	Background-color: red !important;
}
.answer_cell_003,
.answer_cell_3
{
	Background-color: yellow !important;
}
.answer_cell_006,
.answer_cell_6
{
	Background-color: #DDDDDD !important;
}
</style>
You see the cells are hard coded. So you have to adapt. You get e.g. the following (screenshot)
And the smileys? Well, that's something different.
Of course I used an existing question of one of our questionnaires.
Anhang:
Letzte Änderung: 3 Monate 3 Wochen her von Joffm.

Bitte Anmelden um an der Konversation teilzunehmen.

Mehr
3 Monate 3 Wochen her #157658 von tpartner
tpartner antwortete auf das Thema: Add Colors in questions
From your mock-up, it appears that you also want to colour the header labels.

1) Assign a question class "coloured-array".


2) Add something like this to the end of template.js:
$(document).ready(function() {
	$('.coloured-array').each(function(i) {
		// Assign column-specific classes
		$('table.subquestion-list tr', this).each(function(i) {
			$('> *:gt(0)', this).each(function(i){
				$(this).addClass('column-'+(i+1));
			});
		});
	});
});

3) Add something like this to the end of template.css:
.coloured-array .column-1 {	background-color: #FF5B5B;}
 
.coloured-array .column-2 {	background-color: #FF9B57;}
 
.coloured-array .column-3 {	background-color: #F4F781;}
 
.coloured-array .column-4 {	background-color: #99FDA3;}
 
.coloured-array .column-5 {	background-color: #53C170;}





Cheers,
Tony Partner
Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

Bitte Anmelden um an der Konversation teilzunehmen.

Mehr
3 Monate 3 Wochen her #157674 von mistercitrus
mistercitrus antwortete auf das Thema: Add Colors in questions
www.limesurvey.org/media/kunena/attachme...11021/capture-11.png example looks spot-on
Just having some trouble getting it to activate the css changes
I've created a new template (copy of default) and made those changes, adding
/*** Array Colors are defined here***/
 
.coloured-array .column-1 { background-color: #FF5B5B;}
 
.coloured-array .column-2 {	background-color: #FF9B57;}
 
.coloured-array .column-3 {	background-color: #F4F781;}
 
.coloured-array .column-4 {	background-color: #99FDA3;}
 
.coloured-array .column-5 {	background-color: #53C170;}

to the end of the new template's css/template.css and then
$('.coloured-array').each(function(i) {
		// Assign column-specific classes
		$('table.subquestion-list tr', this).each(function(i) {
			$('> *:gt(0)', this).each(function(i){
				$(this).addClass('column-'+(i+1));
			});
		});
	});

just before the error section of scripts/template.js (line 138)

my array questions all have "coloured-array" without quotes in the CSSClass(es) in the advanced settings. I have gone over it a couple of times and don't think I've missed anything but when I perform a preview of the survey or question group I can see no changes and the source for the page if I view it doesn't show the entries in the css.

Bitte Anmelden um an der Konversation teilzunehmen.

Mehr
3 Monate 3 Wochen her #157675 von mistercitrus
mistercitrus antwortete auf das Thema: Add Colors in questions
A better way of explaining the issue is if I preview then 'view source' in the browser the CSS points to "/tmp/assets/8ca1ef2c/css/template.css" and if i inspect that file none of the changes I've made to template.css are reflected, is this a caching issue?

Bitte Anmelden um an der Konversation teilzunehmen.

Mehr
3 Monate 3 Wochen her #157676 von mistercitrus
mistercitrus antwortete auf das Thema: Add Colors in questions
Nevermind! I fixed it, Just needed to make a new survey with the new template (applying to an existing survey doesn't work) but excellent solution, thank you!

Bitte Anmelden um an der Konversation teilzunehmen.

Mehr
2 Wochen 3 Tage her #160942 von Els_Severens
Els_Severens antwortete auf das Thema: Add Colors in questions
Hello

I also want to do something like that, but I cannot find what names my cells have. Can you tell me where I can find that?

thanks!

Bitte Anmelden um an der Konversation teilzunehmen.

Mehr
2 Wochen 3 Tage her #160946 von Joffm
Joffm antwortete auf das Thema: Add Colors in questions
Hello,
you want to do something like that. What exactly?

And to answer your question about the names of cells:
Use a web inspector which is included in all new browsers.

But better to tell us what is different from the solution tpartner provided.

And - of course - your LS version.

Regards
Joffm

Bitte Anmelden um an der Konversation teilzunehmen.

Jetzt loslegen!

Melden Sie sich jetzt an, und erstellen Sie in wenigen Minuten Ihre erste Umfrage.

Account einrichten

Abonnieren Sie unseren Newsletter

Abonnieren Sie unseren Newsletter für alle Neuigkeiten rund um LimeSurvey
captcha