Commit 03893040 authored by Denis Chenu's avatar Denis Chenu
Browse files

[feature] Improve look and css

parent 65ad5339
......@@ -4,4 +4,57 @@
* @copyright Denis Chenu <http://www.sondages.pro>
* @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL v3.0
*/
.pvtUi{table-layout:fixed;width:100%}
.pvtUi tr td:first-child,.pvtVertList{width:15em}
.pvtVals,.pvtRows{width:15em}
.pvtUi .ui-sortable{
list-style: none;
}
.pvtUi .ui-sortable-handle{width:100%;overflow:hidden;position:relative;}
.pvtUi .pvtHorizList .ui-sortable-handle{width:16em;}
.pvtUi .ui-sortable-handle{padding-left:2em;text-align:left}
.pvtUi .ui-sortable-handle .pvtTriangle{position:absolute;left:0.5em;top:0.5em}
.pvtUi .pvtVertList{min-height:25em}
/* filter part */
.pvtFilteredAttribute { font-style: italic }
.pvtFilterBox{
z-index: 100;
width: 30em;
position: absolute;
}
.pvtFilterBox h4{margin:0}
.pvtFilterBox .pvtCheckContainer p { margin: 0.2em; }
.pvtFilterBox label { font-weight: normal; }
.pvtFilterBox .count { font-style:italic;}
.pvtCheckContainer{
white-space: nowrap;
overflow-y: scroll;
width: 100%;
max-height: 20em;
}
/* pivot table */
table.pvtTable {
text-align: left;
border-collapse: collapse;
}
table.pvtTable thead tr th, table.pvtTable tbody tr th {
background-color: #e6EEEE;
border: 1px solid #CDCDCD;
padding: 0.5em;
}
table.pvtTable .pvtColLabel {text-align: center;}
table.pvtTable .pvtTotalLabel {text-align: right;}
table.pvtTable tbody tr td {
color: #3D3D3D;
padding: 0.5em;
background-color: #FFF;
border: 1px solid #CDCDCD;
vertical-align: top;
text-align: right;
}
.pvtTotal, .pvtGrandTotal { font-weight: bold; }
......@@ -5,6 +5,16 @@
* @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL v3.0
*/
/**
* Set first word to strong
* @link https://github.com/melbon/jquery.useWord
*/
$.fn.firstWord = function() {
var text = this.text().trim().split(" ");
var first = text.shift();
this.html((text.length > 0 ? "<strong>"+ first + "</strong> " : first) + text.join(" "));
};
$(function(){
var derivers = $.pivotUtilities.derivers;
var renderers = $.extend(
......@@ -17,8 +27,28 @@ $(function(){
$("#pivot-table").pivotUI(responses, {
renderers : renderers,
onRefresh: function() {
// @Todo : add bs css
$("#pivot-table-construct").fadeOut(400).remove();
$("#pivot-table .pvtUi").addClass('table table-condensed table-bordered');
$("#pivot-table .ui-sortable-handle").addClass('btn btn-default btn-sm btn-block');
$("#pivot-table select").addClass('form-control');
$("#pivot-table .pvtFilterBox input[type='text']").addClass('form-control input-sm');
$("#pivot-table .pvtFilterBox button").addClass('btn btn-default btn-sm');
$("#pivot-table .pvtVals").find("br").remove();
$("#pivot-table .pvtTriangle").addClass('label label-default');
$("#pivot-table table.pvtUi td").not(":last").addClass('active');
$("#pivot-table table.pvtUi td.pvtRendererArea").removeClass('active');
$("#pivot-table .pvtFilterBox").addClass("panel panel-default");
$("#pivot-table .pvtFilterBox h4").addClass("panel-heading");
$("#pivot-table .pvtFilterBox .pvtCheckContainer").addClass("panel-body");
$("#pivot-table .pvtFilterBox > p").addClass("panel-footer");
$("#pivot-table .pvtFilterBox .count").addClass("badge");
/* Commented : this brokepivotable.js
$("#pivot-table").find(".ui-sortable-handle").each(function(){
$(this).firstWord();
});
*/
}
});
});
});
......@@ -45,7 +45,7 @@ class jsonPivotWriter extends Writer
* @see Writer::getFullHeading , replace with code + abbreviated heading
*/
public function getFullHeading(SurveyObj $survey, FormattingOptions $oOptions, $fieldName){
$oOptions->headingTextLength=10;
$oOptions->headingTextLength=30;
$headingText=parent::getAbbreviatedHeading($survey,$oOptions,$fieldName);
$oOptions->useEMCode=true;
$headingCode=parent::getHeadingCode($survey,$oOptions,$fieldName);
......@@ -90,6 +90,8 @@ class jsonPivotWriter extends Writer
{
// Have only code : 5 point, arry 5 point, arry 10 point, language (this one can/must be fixed ?)
$aOnlyCode=array("5","A","B","I");
// Not need code
$aNotneedCode=array("G","Y");
// Have only text : Text and numeric + file upload language (this one can/must be fixed ?)
$aOnlyText=array("K","N","Q","S","T","U","X",'*',';',':',"|");
// No field type, but some can have specific answers (date) : maybe default must be true ?
......@@ -102,6 +104,8 @@ class jsonPivotWriter extends Writer
$aCommentType=array("O","P");
if(in_array($sFieldType,$aOnlyCode))
return false;
if(in_array($sFieldType,$aNotneedCode))
return false;
if(in_array($sFieldType,$aOnlyText))
return false;
if(in_array($sFieldName,$aInfoField) || in_array($sFieldName,$aDateField))
......
......@@ -115,7 +115,7 @@ class statsPivotTable extends \ls\pluginmanager\PluginBase
Yii::app()->clientScript->registerScriptFile($assetUrl."/statsPivotTable.js",CClientScript::POS_BEGIN);
Yii::app()->clientScript->registerCssFile($c3AssetUrl."/c3.css");
Yii::app()->clientScript->registerCssFile($pivotAssetUrl."/pivot.css");
//Yii::app()->clientScript->registerCssFile($pivotAssetUrl."/pivot.css");
Yii::app()->clientScript->registerCssFile($assetUrl."/statsPivotTable.css");
......
<div class="row">
<div class="col-lg-12 content-right">
<h3><?php echo $gT['title'];?></h3>
<div id="pivot-table-construct" class="text-center"><i class="fa fa-refresh fa-spin fa-5x" aria-hidden="true"></i><span class="sr-only"><?php echo gT("loading") ?></span></div>
<div id="pivot-table"></div>
</div>
</div>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment