View Issue Details

IDProjectCategoryView StatusLast Update
11909Development Templatespublic2016-11-17 10:48
ReporterDenisChenu Assigned To 
PrioritynoneSeverityminor 
Status newResolutionopen 
Product Version3.x 
Summary11909: Templates views (questions) : same method for all
DescriptionI want to start a discussion about template/questions view. Preparing twig and have same method.

Actual situation (2.5X or 3.0):
1. have all call of renderPartial in qanda, final call just do some echo of other renderPartial : https://github.com/LimeSurvey/LimeSurvey/blob/master/application/views/survey/questions/arrays/array/no_dropdown/answer.php
2. Have whole HTML in one file only : https://github.com/LimeSurvey/LimeSurvey/blob/master/application/views/survey/questions/language/answer.php (and some other)
3. Have one file for all + using some foreach and renderPartial : https://github.com/LimeSurvey/LimeSurvey/blob/master/application/views/survey/questions/arrays/dualscale/answer.php
4. Have one file for all and some foreach (don't remind the question type for now)
Steps To ReproduceWorking on 3.0 : i found

1. solution is really difficult to use : must open qanda_helper + all views to update a little html part. Sometimes , some files seems not used or are diffciult to find.
2. Clearly not the better solution except for 'little HTML' question.
4. Make very big files

I think 3. solution is the best : easy to find file in only one view file (other are included here). We must/can have some rewrite to have lesser big file.
Additional InformationrenderPartial can be extended in https://github.com/LimeSurvey/LimeSurvey/blob/develop/application/controllers/SurveysController.php : and take same logic than https://github.com/LimeSurvey/LimeSurvey/blob/develop/application/helpers/qanda_helper.php#L6536 . Then it's not an issue to use Yii::app()->getController()->renderPartial directly for next release. (I can do the SurveysController->renderPartial function : no problem (easy).

But : we need to extend twig if we use it : http://twig.sensiolabs.org/doc/advanced.html add a function to call Yii::app()->getController()->renderPartial (or another way).

About 1+2+3+4 solution : when decision is take : we can rewrite partially each view one by one to use the new system.


Vote
Denis : solution 3 , step by step when we update a view (and have some times)
Louis : solution 3
Tagstemplate, twig

Activities

DenisChenu

DenisChenu

2016-11-15 09:57

developer   ~41950

Another question about some 'method'.

Yesterday i do a /survey/questions/global/table/cell/head-header /survey/questions/global/table/cell/head-information . I think it's a good idea BUT must be updated like https://github.com/LimeSurvey/LimeSurvey/blob/develop/application/views/survey/frontpage/saveForm/error.php

All item must have an html view in his directory. But this view can just call another 'global' view with params.
OK with this ?
DenisChenu

DenisChenu

2016-11-15 10:00

developer   ~41951

PS : sorry for "monitoring" but think dev decision must be whole team working on php files decision .
LouisGac

LouisGac

2016-11-15 10:34

developer   ~41953

Last edited: 2016-11-15 11:49

View 2 revisions

Indeed, solution 3/ is very close to the existing flow in 2.50.
Only difference is that in 2.50, the foreach statements remained in quanda.
So solution 3/ is like a new cycle of dev, it's for sure the best way to go.

DenisChenu

DenisChenu

2016-11-15 11:24

developer   ~41954

About cycle of dev: it's more "when you work on questions/views : if you can take some time to move to new method". Because the real cycle of dev happen when we move to twig.

BUt : we need to be sure to have a good way to have a twig->renderPartial system

About twig : seems we can use !
$twig->render(answers.twig,$aAnswers)

and then
{% for answer in aAnswers %}
{% include 'answer.twig' with {'answer.code': 'answer.text'} %}
{% endfor %}


But i'm unsure here :).
LouisGac

LouisGac

2016-11-15 11:50

developer   ~41956

yes, it's possible. So, for me, you're going the right way.
DenisChenu

DenisChenu

2016-11-17 00:08

developer   ~42007

Wait for twig decision.
LouisGac

LouisGac

2016-11-17 10:48

developer   ~42018

For the question view part: your choice is the good one.

The waiting decision is about the PSTPL files. We need to do some testing internally to see if it's possible in a reasonable time to replace the replacement_helper and part of survey_runtime by a twig implementation.

Again: The question views part doesn't depend on that.

Issue History

Date Modified Username Field Change
2016-11-15 09:51 DenisChenu New Issue
2016-11-15 09:57 DenisChenu Note Added: 41950
2016-11-15 10:00 DenisChenu Note Added: 41951
2016-11-15 10:01 DenisChenu Tag Attached: template
2016-11-15 10:01 DenisChenu Tag Attached: twig
2016-11-15 10:34 LouisGac Note Added: 41953
2016-11-15 11:24 DenisChenu Note Added: 41954
2016-11-15 11:49 LouisGac Note Edited: 41953 View Revisions
2016-11-15 11:50 LouisGac Note Added: 41956
2016-11-15 12:30 DenisChenu Additional Information Updated View Revisions
2016-11-17 00:08 DenisChenu Note Added: 42007
2016-11-17 10:48 LouisGac Note Added: 42018