Skip to content

Commit

Permalink
New feature #Default column width and table to same width
Browse files Browse the repository at this point in the history
Dev: some must be reviewed (with answertextright etc ....)
Dev: use fa in place of glyphicon in date => todo : move to date.css ?
Dev: remove some inlined js + some other little fix when i view it
  • Loading branch information
Shnoulle committed Oct 31, 2016
1 parent 5a84114 commit e34e2df
Show file tree
Hide file tree
Showing 12 changed files with 280 additions and 162 deletions.
4 changes: 2 additions & 2 deletions application/core/packages/limesurvey/survey.css
Expand Up @@ -81,11 +81,11 @@
.answer-item textarea[cols]{width:initial;max-width:100%}
.answer-item input[type='text'][size]{width:initial;max-width:100%}
.ls-input-sized .ls-input-group-extra{width:initial}

.ls-input-sized .ls-input-group{width:auto;max-width:100%;display:table}
/* in inline form : width need to be auto */
.form-inline .ls-input-group{display: inline-table;vertical-align: middle;width:auto}
.form-inline .input-group .ls-input-group-extra{width: auto;white-space: initial;}
.form-inline .ls-input-group .ls-input-group-extra{width: auto;white-space: initial;}
.form-inline .ls-input-group {width: auto;white-space: initial;}

/* index button */
.ls-index-buttons .list-group .list-group-item:first-child {
Expand Down
193 changes: 121 additions & 72 deletions application/helpers/qanda_helper.php

Large diffs are not rendered by default.

69 changes: 48 additions & 21 deletions application/helpers/questionHelper.php
Expand Up @@ -58,24 +58,26 @@ public static function getAttributesDefinitions()
"caption"=>gT('Sort answers alphabetically'));

self::$attributes["answer_width"]=array(
"types"=>"ABCEF1:;",
'category'=>gT('Display'),
'sortorder'=>100,
'inputtype'=>'integer',
'min'=>'1',
'max'=>'100',
"help"=>gT('Set the percentage width of the (sub-)question column (1-100)'),
"caption"=>gT('(Sub-)question width'));
"types"=>"ABCEF1:;",
'category'=>gT('Display'),
'sortorder'=>100,
'inputtype'=>'integer',
'min'=>'1',
'max'=>'100',
"help"=>gT('Set the percentage width of the (sub-)question column (1-100)'),
"caption"=>gT('(Sub-)question width')
);

self::$attributes["answer_width_bycolumn"]=array(
"types"=>"H",
'category'=>gT('Display'),
'sortorder'=>100,
'inputtype'=>'integer',
'min'=>'1',
'max'=>'100',
"help"=>gT('Set the percentage width of the answers column (1-100)'),
"caption"=>gT('Answers column width'));
"types"=>"H",
'category'=>gT('Display'),
'sortorder'=>100,
'inputtype'=>'integer',
'min'=>'0',
'max'=>'100',
"help"=>gT('Set the percentage width of the answers column (1-100)'),
"caption"=>gT('Answers column width')
);

self::$attributes["repeat_headings"]=array(
"types"=>"F:1;",
Expand Down Expand Up @@ -981,11 +983,12 @@ public static function getAttributesDefinitions()
11=>'92%',
12=>'100%'
),
"help"=>gT('Relative width of the input element'),
"caption"=>gT('Input box width'));
"help"=>gT('Relative width of the text input wrapper element'),
"caption"=>gT('Text input box width'));

/* Do EXACTLY the same than text_input_width for K(multinum): must move K here and rename in a DB update and remove it + fix when import*/
self::$attributes["text_input_columns"]=array(
"types"=>"Q",
"types"=>"QP",
'category'=>gT('Display'),
'sortorder'=>90,
'inputtype'=>'singleselect',
Expand All @@ -1005,8 +1008,8 @@ public static function getAttributesDefinitions()
11=>'92%',
12=>'100%'
),
"help"=>gT('Relative width of the input element'),
"caption"=>gT('Input box width'));
"help"=>gT('Relative width of the text input wrapper element'),
"caption"=>gT('Text input box width'));

self::$attributes["label_input_columns"]=array(
"types"=>"KQ",
Expand All @@ -1032,6 +1035,30 @@ public static function getAttributesDefinitions()
"help"=>gT('Relative width of the labels'),
"caption"=>gT('Label column width'));

/* Same than label_input_columns for multiple choice*/
self::$attributes["choice_input_columns"]=array(
"types"=>"P",
'category'=>gT('Display'),
'sortorder'=>90,
'inputtype'=>'singleselect',
'default'=>'',
'options'=>array(
''=>gT("Default"),
1=>'8%',
2=>'17%',
3=>'25%',
4=>'33%',
5=>'41%',
6=>'50%',
7=>'58%',
8=>'67%',
9=>'75%',
10=>'83%',
11=>'92%',
12=>'100%'
),
"help"=>gT('Relative width of checkbox wrapper element'),
"caption"=>gT('Choice column width'));

self::$attributes["use_dropdown"]=array(
"types"=>"1FO",
Expand Down
Expand Up @@ -79,7 +79,13 @@

// Integer
case 'integer':?>
<input type='number' min="1" step="1" pattern="\d+" class="form-control" id='<?php echo $aAttribute['name'];?>' name='<?php echo $aAttribute['name'];?>' value='<?php echo $aAttribute['value'];?>' />
<?php echo CHtml::numberField($aAttribute['name'],$aAttribute['value'],array(
'class'=>"form-control",
'step'=>1,
'pattern'=>'\d+',
'min'=>(isset($aAttribute['min'])?$aAttribute['min']:1),
'max'=>(isset($aAttribute['max'])?$aAttribute['max']:null)
)); ?>
<?php
break;

Expand Down
Expand Up @@ -40,7 +40,6 @@ class="form-control <?php echo $kpclass; ?>"
name="<?php echo $name; ?>"
id="<?php echo $id; ?>"
rows="<?php echo $tarows;?>"
cols="30"
><?php if($has_comment_saved):?><?php echo $comment_saved;?><?php endif;?></textarea>
</div>
</div>
Expand Down
Expand Up @@ -25,9 +25,8 @@
?>
<!-- answer_row -->
<li id="javatbd<?php echo $name; ?>" class='row checkbox-text-item form-group clearfix' <?php echo $sDisplayStyle ;?>>

<!-- Checkbox + label -->
<div class="col-sm-6 col-xs-12">
<div class="col-sm-<?php echo $sLabelWidth; ?> col-xs-12">
<div class="checkbox-item answer-item form-group">
<input
class="<?php echo $classes; echo $kpclass; ?>"
Expand All @@ -37,7 +36,6 @@ class="<?php echo $classes; echo $kpclass; ?>"
id="<?php echo $id;?>"
value="<?php echo $value?>"
<?php echo $checked;?>
onclick="<?php echo $checkconditionFunction;?>"
/>

<label id="label-<?php echo $id;?>" for="<?php echo $id;?>" class="control-label checkbox-label"><?php echo $labeltext;?></label>
Expand All @@ -55,16 +53,14 @@ class="<?php echo $classes; echo $kpclass; ?>"
</div>

<!-- Comment -->
<div class="col-sm-6 col-xs-12">
<div class="col-sm-<?php echo $sInputContainerWidth; ?> col-xs-12">
<div class="form-group answer-item text-item comment-item">
<input
class='form-control <?php echo $kpclass; ?>'
type='text'
size='40'
id='<?php echo $inputCommentId;?>'
name='<?php echo $inputCommentName; ?>'
value='<?php echo $inputCOmmentValue; ?>'
onkeyup='<?php echo $checkconditionFunctionComment;?>'
aria-labelled='label-<?php echo $id;?>'
/>
</div>
Expand Down
Expand Up @@ -27,41 +27,29 @@
<li id="javatbd<?php echo $name; ?>" class='row checkbox-text-item form-group other-item clearfix' <?php echo $sDisplayStyle ;?>>

<!-- Checkbox + label -->
<div class="col-sm-6 col-xs-12">
<div class="col-sm-<?php echo $sLabelWidth; ?> col-xs-12">
<div class="form-group answer-item text-item other-text-item ls-input-group"><!-- input-group from BS seems OK too -->
<label for="<?php echo $id;?>" class="label-text control-label ls-input-group-extra" id="label-<?php echo $id;?>" ><?php echo $labeltext;?></label>
<input
class="other-text form-control input-sm multipleco-other-topic <?php echo $classes; echo $kpclass;?>"
type="text"
name="<?php echo $name; ?>"
id="<?php echo $id;?>"
size="40"
onkeyup="<?php echo $checkconditionFunction;?>"
value="<?php echo $value; ?>"
data-number=<?php echo $otherNumber;?>
/>
<?php if($javainput):?>
<input
type='hidden'
name='<?php echo $javaname?>'
id='<?php echo $javaname?>'
value='<?php echo $javavalue;?>'
<?php echo $checked;?>
/>
<?php endif;?>
</div>
</div>

<!-- Comment -->
<div class="col-sm-6 col-xs-12 ">
<div class="col-sm-<?php echo $sInputContainerWidth; ?> col-xs-12 ">
<div class="form-group answer-item text-item comment-item">
<input
class='form-control <?php echo $kpclass; ?>'
type='text'
size='40'
id='<?php echo $inputCommentId;?>'
name='<?php echo $inputCommentName; ?>'
value='<?php echo $inputCOmmentValue; ?>'
onkeyup='<?php echo $checkconditionFunctionComment;?>'
aria-labelledby='label-<?php echo $id; ?> <?php echo $id; ?>'
/>
</div>
Expand Down
65 changes: 36 additions & 29 deletions application/views/survey/questions/shortfreetext/text/item.php
Expand Up @@ -14,38 +14,45 @@
*/
?>

<div class="<?php echo $coreClass; ?> <?php echo $extraclass; ?> form-horizontal short-free-text row">

<div class='col-sm-<?php echo $col; ?>'>
<!-- Label -->
<label class='control-label sr-only' for='answer<?php echo $name; ?>' >
<?php eT('Your answer'); ?>
</label>
<?php if ($prefix !== '' || $suffix !== ''): ?>
<div class="ls-input-group">
<?php if($withColumn): ?>
<div class='<?php echo $coreClass; ?> row'>
<div class="<?php echo $extraclass; ?>">
<?php else: ?>
<div class='<?php echo $coreClass; ?> <?php echo $extraclass; ?>'>
<?php endif; ?>
<!-- Label -->
<label class='control-label sr-only' for='answer<?php echo $name; ?>' >
<?php eT('Your answer'); ?>
</label>
<?php if ($prefix !== '' || $suffix !== ''): ?>
<div class="ls-input-group">
<?php endif; ?>
<!-- Prefix -->
<?php if ($prefix !== ''): ?>
<div class='ls-input-group-extra prefix-text prefix text-right'><?php echo $prefix; ?></div>
<?php endif; ?>
<!-- Prefix -->
<?php if ($prefix !== ''): ?>
<div class='ls-input-group-extra prefix-text prefix text-right'><?php echo $prefix; ?></div>
<?php endif; ?>

<!-- Input -->
<input
class="form-control <?php echo $kpclass;?>"
type="text"
name="<?php echo $name; ?>"
id="answer<?php echo $name;?>"
value="<?php echo $dispVal; ?>"
<?php echo ($inputsize ? 'size="'.$inputsize.'"': '') ; ?>
<?php echo ($maxlength ? 'maxlength='.$maxlength: ''); ?>
/>
<!-- Input -->
<input
class="form-control <?php echo $kpclass;?>"
type="text"
name="<?php echo $name; ?>"
id="answer<?php echo $name;?>"
value="<?php echo $dispVal; ?>"
<?php echo ($inputsize ? 'size="'.$inputsize.'"': '') ; ?>
<?php echo ($maxlength ? 'maxlength='.$maxlength: ''); ?>
/>

<!-- Suffix -->
<?php if ($suffix !== ''): ?>
<div class='ls-input-group-extra suffix-text suffix text-left'><?php echo $suffix; ?></div>
<?php endif; ?>
<?php if ($prefix !== '' || $suffix !== ''): ?>
</div>
<!-- Suffix -->
<?php if ($suffix !== ''): ?>
<div class='ls-input-group-extra suffix-text suffix text-left'><?php echo $suffix; ?></div>
<?php endif; ?>
<?php if ($prefix !== '' || $suffix !== ''): ?>
</div>
<?php endif; ?>
<?php if($withColumn): ?>
</div>
</div>
<?php else: ?>
</div>
<?php endif; ?>
14 changes: 10 additions & 4 deletions application/views/survey/questions/shortfreetext/textarea/item.php
Expand Up @@ -11,13 +11,15 @@
* @var $checkconditionFunction $checkconditionFunction.'(this.value, this.name, this.type)
* @var $dispVal
*/
tracevar($maxlength);
?>

<!-- Short free text, textarea item -->
<div class="<?php echo $coreClass; ?> <?php echo $extraclass; ?> form-horizontal short-free-text row">

<div class='col-sm-<?php echo $col; ?>'>
<?php if($withColumn): ?>
<div class='<?php echo $coreClass; ?> row'>
<div class="<?php echo $extraclass; ?>">
<?php else: ?>
<div class='<?php echo $coreClass; ?> <?php echo $extraclass; ?>'>
<?php endif; ?>
<!-- Label -->
<label class='control-label sr-only' for='answer<?php echo $name; ?>' >
<?php eT('Your answer'); ?>
Expand Down Expand Up @@ -46,5 +48,9 @@ class="form-control textarea <?php echo $kpclass; ?>"
<?php if ($prefix !== '' || $suffix !== ''): ?>
</div>
<?php endif; ?>
<?php if($withColumn): ?>
</div>
</div>
<?php else: ?>
</div>
<?php endif; ?>
3 changes: 3 additions & 0 deletions scripts/expressions/em_javascript.js
Expand Up @@ -47,6 +47,9 @@ $(document).on("change",".radio-item :radio:not([onclick]),.button-item :radio:n
//~ ExprMgr_process_relevance_and_tailoring("click",$(this).attr("name"),"radio");
//~ }
});
$(document).on("change",".checkbox-item :checkbox:not([onclick])",function(event){
checkconditions($(this).val(), $(this).attr('name'), 'checkbox', 'click')
});
function LEMcount()
{
// takes variable number of arguments - returns count of those arguments that are not null/empty
Expand Down

0 comments on commit e34e2df

Please sign in to comment.