Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1
  • 2

TOPIC: willing to donate for quick solution - drag/drop ranking headers

willing to donate for quick solution - drag/drop ranking headers 2 years 10 months ago #67920

  • bwoo5
  • bwoo5's Avatar
  • OFFLINE
  • Expert Lime
  • Posts: 80
  • Thank you received: 4
  • Karma: 0
I am using the language selector for a multi-language survey. The survey has multiple ranking questions. The headings for the ranking questions are "your choices:" and "your rankings:" and these are being translated when the language is changed using the selector.

I have implemented the drag and drop ranking question style as explained in the documentation. However, the heading no longer get updated with the language selector. As the drag and drop ranking solution looks much better and works great I need for the headings to translate like the headings in the default ranking question.

Quick solution would be great as to what code I need to update in the drag drop ranking code to pull in the headers that update with the language selector. Willing to donate since you have helped out so much =)

Thanks.
The administrator has disabled public write access.

Re: willing to donate for quick solution - drag/drop ranking headers 2 years 10 months ago #67927

  • Mazi
  • Mazi's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 5325
  • Thank you received: 296
  • Karma: 249
Problem is that the texts are hardcoded at the Javascript code, see
<span class="dragDropHeader">Choices:</span><br /> \
OR
<span class="dragDropHeader">Ranking:</span><br /> \

A solution could be to copy the according code into the source code of each language version of your question and adjust the text strings at the source of each question.

Best regards/Beste Grüße,
Dr. Marcel Minke
(Limesurvey Head of Support)
Need Help? We offer professional Limesurvey support
Contact: marcel.minke(at)limesurvey.org'"
The administrator has disabled public write access.

Re: willing to donate for quick solution - drag/drop ranking headers 2 years 10 months ago #67928

  • bwoo5
  • bwoo5's Avatar
  • OFFLINE
  • Expert Lime
  • Posts: 80
  • Thank you received: 4
  • Karma: 0
what code exactly would I need to copy to each of my versions? If this will work where I can put the text I want for each ranking question heading at the question level it would be perfect so that all ranking questions don't have to have the same heading.

I see where they current setup has them hard coded into the template, so yes I need something at the question level to override this.
The administrator has disabled public write access.

Re: willing to donate for quick solution - drag/drop ranking headers 2 years 10 months ago #67930

  • tpartner
  • tpartner's Avatar
  • NOW ONLINE
  • LimeSurvey Team
  • Posts: 4180
  • Thank you received: 784
  • Karma: 358
I think it would be safer to keep the code in one place and use variables dependent on the displayed lang (and/or questions) to adjust the text.

Can you give me a list of languages and your desired corresponding text?
Cheers,
Tony Partner

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

LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project.
The administrator has disabled public write access.

Re: willing to donate for quick solution - drag/drop ranking headers 2 years 10 months ago #67932

  • bwoo5
  • bwoo5's Avatar
  • OFFLINE
  • Expert Lime
  • Posts: 80
  • Thank you received: 4
  • Karma: 0
We work with all languages which is why I am looking for the drag and drop to have the same functionality as the standard ranking question where the your choices and your ranking change with the language selection. If it is possible to change those headings per question that would be ideal for us since we deal with a lot of ranking questions. If not customizable at the question source code level then they need to change like the default ranking. We are happy with the your choices and your ranking headings since it is already taken care of in all the language files,just need it to apply to the drag and drop code. Thanks
The administrator has disabled public write access.

Re: willing to donate for quick solution - drag/drop ranking headers 2 years 10 months ago #67935

  • tpartner
  • tpartner's Avatar
  • NOW ONLINE
  • LimeSurvey Team
  • Posts: 4180
  • Thank you received: 784
  • Karma: 358
Okay, here's what we do...automatically pipe in the built-in LimeSurvey translations for the choices and ranking labels and also add some parameters so they can be overridden for specific questions.

In template.js, change this:
function dragDropRank(qID) {
To:
function dragDropRank(qID, choiceText, rankText) {
 
	if(!choiceText) {
		choiceText = $('#question'+qID+' td.label label').text();
	}
	if(!rankText) {
		rankText = $('#question'+qID+' td.output tr:first td:eq(1)').text();
	}

And this:
<span class="dragDropHeader">Choices:</span><br /> \
To:
<span class="dragDropHeader choicesLabel">'+choiceText+'</span><br /> \

And this:
<span class="dragDropHeader">Ranking:</span><br /> \
To:
<span class="dragDropHeader rankingLabel">'+rankText+'</span><br /> \


So, then if you call the function as follows (where "QQ" is the question ID) the LS translations will be piped into the drag-n-drop interface:
<script type="text/javascript" charset="utf-8">
	$(document).ready(function() {  		
		dragDropRank(QQ);	
	});
</script>

But if you call it as follows, your custom text will be piped in:
<script type="text/javascript" charset="utf-8">
	$(document).ready(function() {  		
		dragDropRank(QQ, 'Custom choice label', 'Custom rank label');	
	});
</script>
Cheers,
Tony Partner

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

LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project.
The administrator has disabled public write access.

Re: willing to donate for quick solution - drag/drop ranking headers 2 years 10 months ago #67936

  • bwoo5
  • bwoo5's Avatar
  • OFFLINE
  • Expert Lime
  • Posts: 80
  • Thank you received: 4
  • Karma: 0
Thanks so much this is a big help. I will test it asap and when all is good we will be donating. Limesurvey is working out to be perfect for our company.
The administrator has disabled public write access.

Re: willing to donate for quick solution - drag/drop ranking headers 2 years 10 months ago #67940

  • Mazi
  • Mazi's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 5325
  • Thank you received: 296
  • Karma: 249
Tony, can you overwork the workaround or add a hint about how to best deal with multilingual surveys?

Best regards/Beste Grüße,
Dr. Marcel Minke
(Limesurvey Head of Support)
Need Help? We offer professional Limesurvey support
Contact: marcel.minke(at)limesurvey.org'"
The administrator has disabled public write access.

Re: willing to donate for quick solution - drag/drop ranking headers 2 years 10 months ago #67953

  • tpartner
  • tpartner's Avatar
  • NOW ONLINE
  • LimeSurvey Team
  • Posts: 4180
  • Thank you received: 784
  • Karma: 358
Cheers,
Tony Partner

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

LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project.
The administrator has disabled public write access.
The following user(s) said Thank You: bwoo5

Re: willing to donate for quick solution - drag/drop ranking headers 2 years 10 months ago #67963

  • bwoo5
  • bwoo5's Avatar
  • OFFLINE
  • Expert Lime
  • Posts: 80
  • Thank you received: 4
  • Karma: 0
Thanks again for the quick solution, it worked out great.
The administrator has disabled public write access.
  • Page:
  • 1
  • 2
Moderators: ITEd
Time to create page: 0.139 seconds
Donation Image