Skip to content

Commit

Permalink
Dev: added comments to language_changer_top_menu.twig
Browse files Browse the repository at this point in the history
  • Loading branch information
LouisGac committed Jan 17, 2017
1 parent 598b90b commit 036602c
Showing 1 changed file with 24 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,25 +1,39 @@
{#
Language Changer for Top Menu.
LimeSurvey
Copyright (C) 2007-2017 The LimeSurvey Project Team / Louis Gac
All rights reserved.
License: GNU/GPL License v2 or later, see LICENSE.php
LimeSurvey is free software. This version may have been modified pursuant
to the GNU General Public License, and as distributed it includes or
is derivative of works licensed under the GNU General Public License or
other free or open source software licenses.
See COPYRIGHT.php for copyright notices and details.
(¯`·._.·(¯`·._.· Language Changer for Top Menu ·._.·´¯)·._.·´¯)
Show a language changer inside the top menu
It's a typical bootstrap dropdown button.
@see: http://getbootstrap.com/components/#dropdowns
@var array aSurveyInfo.alanguageChangerDatas.aListLang : contains the list of available languages for this survey, 'language_code' => 'language name'
@var string aSurveyInfo.alanguageChangerDatas.sSelected : the language code of the selected language
The language change is done via javascript
#}

{# There is many condition where the language changer should not be shown. Eg: there is only one language available #}
{% if aSurveyInfo.alanguageChangerDatas != false %}
{% set aLCD = aSurveyInfo.alanguageChangerDatas %} {# shortcut for aSurveyInfo.alanguageChangerDatas #}

{#
It generates a bootstrap dropdown button.
@see: http://getbootstrap.com/components/#dropdowns
#}
{# we set a shortcut for aSurveyInfo.alanguageChangerDatas #}
{% set aLCD = aSurveyInfo.alanguageChangerDatas %}

<!-- Language Changer, top menu version -->
<li class="dropdown ls-no-js-hidden">
<a class="dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false">
{{ "Language:" | t }} {{ aLCD.aListLang[aLCD.sSelected] | t }} {# {{ aLCD.aListLang[aLCD.sSelected] | t }}: retreives the language name of the selected language and translates it#}

{# NOTE: {{ aLCD.aListLang[aLCD.sSelected] | t }}: retreives the language name of the selected language and translates it#}
{{ "Language:" | t }} {{ aLCD.aListLang[aLCD.sSelected] | t }}
<span class="caret"></span>
</a>

Expand All @@ -36,7 +50,8 @@
</li>

{#
Generates a simple bootstrap HTML button using the Yii widget. @see: http://www.yiiframework.com/wiki/48/by-example-chtml/#hh2
Generates a simple bootstrap HTML button using the Yii widget.
@see: http://www.yiiframework.com/wiki/48/by-example-chtml/#hh2
You can add remove attribute to the button via the array aButtonhtmlOptions
#}
{% set aButtonhtmlOptions = {
Expand All @@ -58,6 +73,7 @@

{% endif %}

{# TODO: add a javascript file, and register it here #}
<script>
// Method for link
$(document).ready(function(){
Expand Down

0 comments on commit 036602c

Please sign in to comment.