Skip to content

Commit

Permalink
Dev: moved classes, id and attribute to core, global check
Browse files Browse the repository at this point in the history
  • Loading branch information
LouisGac committed Aug 24, 2017
1 parent b5be97e commit bf84ac4
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 25 deletions.
23 changes: 19 additions & 4 deletions application/helpers/SurveyRuntimeHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -1748,24 +1748,34 @@ private function setClassAndIds()
$thissurvey['class']['questioncount'] = " number-of-questions text-muted ";
$thissurvey['class']['questioncounttext'] = " question-count-text ";

$thissurvey['attr']['questioncounttext'] = '';

// Warnings
$this->aSurveyInfo['class']['activealert'] = ' alert alert-warning alert-dismissible fade in alert-dismissible ';
$this->aSurveyInfo['class']['errorHtml'] = ' fade in alert-dismissible ls-questions-have-errors alert alert-danger ';
$this->aSurveyInfo['class']['activealert'] = ' alert alert-warning alert-dismissible fade in alert-dismissible ';
$this->aSurveyInfo['class']['errorHtml'] = ' fade in alert-dismissible ls-questions-have-errors alert alert-danger ';
$this->aSurveyInfo['class']['activealertbutton'] = ' close ';
$this->aSurveyInfo['class']['errorHtmlbutton'] = ' close ';
$this->aSurveyInfo['attr']['activealertbutton'] = ' type="button" data-dismiss="alert" aria-label="Close" ';
$this->aSurveyInfo['attr']['errorHtmlbutton'] = ' type="button" data-dismiss="alert" aria-label="Close" ';

$this->aSurveyInfo['attr']['activealert'] = 'role="alert"';

// Required
$this->aSurveyInfo['class']['required'] = ' text-danger asterisk fa fa-asterisk pull-left small ';
$this->aSurveyInfo['class']['requiredspan'] = ' sr-only text-danger asterisk ';
$this->aSurveyInfo['attr']['required'] = ' aria-hidden="true" ';
$this->aSurveyInfo['class']['required'] = '';

// Progress bar
$this->aSurveyInfo['class']['topcontainer'] = ' top-container ';
$this->aSurveyInfo['class']['topcontent'] = ' container top-content ';
$this->aSurveyInfo['class']['progress'] = ' progress ';
$this->aSurveyInfo['class']['progressbar'] = ' progress-bar ';
$this->aSurveyInfo['attr']['progressbar'] = ' ';
$this->aSurveyInfo['attr']['progressbar'] = $this->aSurveyInfo['attr']['topcontainer'] = $this->aSurveyInfo['class']['topcontent'] = $this->aSurveyInfo['attr']['progressbar'] = $this->aSurveyInfo['attr']['progress'] = ' ';

// No JS alert
$this->aSurveyInfo['class']['nojs'] = ' alert alert-danger ls-js-hidden warningjs ';
$this->aSurveyInfo['attr']['nojs'] = ' alert alert-danger ls-js-hidden warningjs ';

// NavBar
$this->aSurveyInfo['id']['navbar'] = 'navbar';
Expand All @@ -1786,6 +1796,8 @@ private function setClassAndIds()
$this->aSurveyInfo['class']['formcontrol'] = ' form-control ';
$this->aSurveyInfo['class']['aLCDWithForm'] = ' btn btn-default ls-js-hidden ';

$this->aSurveyInfo['attr']['languagechanger'] = $this->aSurveyInfo['attr']['formgroup'] = $this->aSurveyInfo['attr']['controllabel'] = '';

// Bootstrap Modal Alert
$this->aSurveyInfo['id']['alertmodal'] = 'bootstrap-alert-box-modal';
$this->aSurveyInfo['class']['alertmodal'] = ' modal fade ';
Expand All @@ -1807,10 +1819,13 @@ private function setClassAndIds()
// Assessments
$this->aSurveyInfo['class']['assessmenttable'] = ' assessment-table table ';
$this->aSurveyInfo['class']['assessmentstable'] = ' assessments table ';
$this->aSurveyInfo['class']['assessmentstablet'] = ' assessments table ';
$this->aSurveyInfo['class']['assessmentheading'] = ' assessment-heading ';
$this->aSurveyInfo['class']['assessmentscontainer'] = ' assessments-container ';

$this->aSurveyInfo['attr']['assessmenttable'] = $this->aSurveyInfo['attr']['assessmentheading'] = $this->aSurveyInfo['attr']['assessmentscontainer'] = $this->aSurveyInfo['attr']['assessmentstable'] = '';
$this->aSurveyInfo['attr']['assessmentstablet'] = 'align="center"';

$this->aSurveyInfo['attr']['assessmenttable'] = $this->aSurveyInfo['attr']['assessmentstablettr'] = $this->aSurveyInfo['attr']['assessmentstabletth'] = $this->aSurveyInfo['attr']['assessmentstablettd'] = $this->aSurveyInfo['attr']['assessmentstableth'] = $this->aSurveyInfo['attr']['assessmentstabletd'] = $this->aSurveyInfo['attr']['assessmentstabletd'] = $this->aSurveyInfo['attr']['assessmentheading'] = $this->aSurveyInfo['attr']['assessmentscontainer'] = $this->aSurveyInfo['attr']['assessmentstable'] = '';

// Questions
$this->aSurveyInfo['class']['questioncontainer'] = ' question-container row ';
Expand Down
18 changes: 9 additions & 9 deletions templates/default/views/subviews/assessments.twig
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@
{% for assessed in aAssessments.group[key] %}
{% if ( val >= assessed.min and val <= assessed.max ) %}
<table class='{{ aSurveyInfo.class.assessmentstable }}' {{ aSurveyInfo.attr.assessmentstable }}>
<tr >
<th>
<tr {{ aSurveyInfo.attr.assessmentstabletr }} >
<th {{ aSurveyInfo.attr.assessmentstableth }} >
{{ str_replace( [ "{PERC}", "{TOTAL}" ], [ val, aAssessments.total_score ], assessed.name) }}
</th>
</tr>

<tr>
<td>
<tr {{ aSurveyInfo.attr.assessmentstabletr }} >
<td {{ aSurveyInfo.attr.assessmentstabletd }} >
{{ str_replace( [ "{PERC}", "{TOTAL}" ], [ val, aAssessments.total_score ], assessed.message) }}
</td>
</tr>
Expand All @@ -64,15 +64,15 @@
{% if aAssessments.total.show %}
{% for assessed in aAssessments.total %}
{% if ( aAssessments.total_score >= assessed.min and aAssessments.total_score <= assessed.max ) %}
<table class='{{ aSurveyInfo.class.assessmentstable }}' align='center'>
<tr>
<th>
<table class='{{ aSurveyInfo.class.assessmentstablet }}' {{ aSurveyInfo.attr.assessmentstablet }} >
<tr {{ aSurveyInfo.attr.assessmentstablettr }}>
<th {{ aSurveyInfo.attr.assessmentstabletth }}>
{# Beleive it or not, val is defined in previous loop... -_- #}
{{ str_replace( [ "{PERC}", "{TOTAL}" ], [ val, aAssessments.total_score ], assessed.name) }}
</th>
</tr>
<tr>
<td>
<tr {{ aSurveyInfo.attr.assessmentstablettr }}>
<td {{ aSurveyInfo.attr.assessmentstablettd }}>
{{ str_replace( [ "{PERC}", "{TOTAL}" ], [ val, aAssessments.total_score ], assessed.message) }}
</td>
</tr>
Expand Down
6 changes: 3 additions & 3 deletions templates/default/views/subviews/language_changer.twig
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@
%}

<!-- Language Changer -->
<div class=" {{ aSurveyInfo.class.languagechanger }} " >
<label class="{{ aSurveyInfo.class.formgroup }}">
<span class="{{ aSurveyInfo.class.controllabel }}">{{ "Language:" | t }}</span>
<div class=" {{ aSurveyInfo.class.languagechanger }} " {{ aSurveyInfo.attr.languagechanger }} >
<label class="{{ aSurveyInfo.class.formgroup }} {{ aSurveyInfo.attr.formgroup }}">
<span class="{{ aSurveyInfo.class.controllabel }}" {{ aSurveyInfo.attr.controllabel }}>{{ "Language:" | t }}</span>
{{
C.Html.dropDownList(
'lang',
Expand Down
2 changes: 1 addition & 1 deletion templates/default/views/subviews/no_js_alert.twig
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@


<!-- No JavaScript alert -->
<div class='{{ aSurveyInfo.class.nojs }}' data-type='checkjavascript'>
<div class='{{ aSurveyInfo.class.nojs }}' {{ aSurveyInfo.attr.nojs }} data-type='checkjavascript'>
{{
"Caution: JavaScript execution is disabled in your browser or for this website. You may not be able to answer all questions in this survey. Please, verify your browser parameters."
| t
Expand Down
6 changes: 3 additions & 3 deletions templates/default/views/subviews/progess_bar.twig
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@

{% if aSurveyInfo.format != 'A' and aSurveyInfo.showprogress is defined and aSurveyInfo.showprogress == 'Y' %}
<!-- Top container -->
<div class="{{ aSurveyInfo.class.topcontainer }}">
<div class="{{ aSurveyInfo.class.topcontent }}">
<div class="{{ aSurveyInfo.class.topcontainer }}" {{ aSurveyInfo.attr.topcontainer }} >
<div class="{{ aSurveyInfo.class.topcontent }}" {{ aSurveyInfo.attr.topcontent }} >
{{ registerPublicCssFile('lime-progress.css') }}
{% set progressValue = ( aSurveyInfo.progress.total > 0 ) ? intval( (aSurveyInfo.progress.currentstep - 1) / aSurveyInfo.progress.total * 100 ) : 0 %}
<div class="{{ aSurveyInfo.class.progress }}">
<div class="{{ aSurveyInfo.class.progress }}" {{ aSurveyInfo.attr.progress }}>
<div class="{{ aSurveyInfo.class.progressbar }}" {{ aSurveyInfo.attr.progressbar }} role="progressbar" aria-valuenow="{{ progressValue }}" aria-valuemin="0" aria-valuemax="100" style="min-width: 2em; width: {{ progressValue }}%;">
{{ progressValue }}%
</div>
Expand Down
2 changes: 1 addition & 1 deletion templates/default/views/subviews/required.twig
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
<small class="{{ aSurveyInfo.class.required }}" {{ aSurveyInfo.attr.required }} ></small>
<span class="{{ aSurveyInfo.class.requiredspan }}"> ({{ gT("Mandatory")}})<span>
<span class="{{ aSurveyInfo.class.requiredspan }}" {{ aSurveyInfo.attr.requiredspan }} > ({{ gT("Mandatory")}})<span>
6 changes: 3 additions & 3 deletions templates/default/views/subviews/warnings.twig
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,16 @@
{# Preview mode warning #}
{% if aSurveyInfo.active != 'Y' %}
<!-- Preview mode warning -->
<div class="{{ aSurveyInfo.class.activealert }}" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
<div class="{{ aSurveyInfo.class.activealert }}" {{ aSurveyInfo.attr.activealert }} >
<button {{ aSurveyInfo.attr.activealertbutton }} class="{{ aSurveyInfo.class.activealertbutton }}" ><span aria-hidden="true">×</span></button>
{{ "This survey is currently not active. You will not be able to save your responses." | t }}
</div>
{% endif %}

{# Error Html warnings #}
{% if aSurveyInfo.errorHtml.show %}
<p class=' {# Uncomment to hide when popup is on { aSurveyInfo.errorHtml.hiddenClass } #} {{ aSurveyInfo.class.errorHtml }} {% if (aSurveyInfo.options.animatealert == "on") %} animated {{ aSurveyInfo.options.alertanimation }} {%endif%}' role='alert'>
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
<button {{ aSurveyInfo.attr.errorHtmlbutton }} class="{{ aSurveyInfo.class.errorHtmlbutton }}" ><span aria-hidden="true">×</span></button>
{% for aMessage in aSurveyInfo.errorHtml.messages %}
<!-- Error Html warnings -->
{{ aMessage }}
Expand Down
2 changes: 1 addition & 1 deletion templates/default/views/subviews/welcome.twig
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@

<!-- Question count -->
<div class="{{ aSurveyInfo.class.questioncount }}" {{ aSurveyInfo.attr.questioncount }}>
<div class='{{ aSurveyInfo.class.questioncounttext }}'>
<div class='{{ aSurveyInfo.class.questioncounttext }}' {{ aSurveyInfo.attr.questioncounttext }}>

{# If survey creator set "show x questions" in survey setting #}
{% if aSurveyInfo.bShowxquestions == true %}
Expand Down

0 comments on commit bf84ac4

Please sign in to comment.