From d0ab0dca61c6fe975dcc4d2bb4cc247d0e63f75a Mon Sep 17 00:00:00 2001 From: Olle Haerstedt Date: Thu, 22 Sep 2016 15:22:35 +0200 Subject: [PATCH] Dev: Small misc fixes (CPDB) --- .../participants/displayParticipants_view.php | 1 + .../massive_actions/_selector.php | 18 ++++++++++--- .../modal_subviews/_editParticipant.php | 2 +- .../modal_subviews/_shareParticipant.php | 2 +- .../_showParticipantSurveys.php | 8 +++--- .../admin/participants/sharePanel_view.php | 14 ++++++----- scripts/admin/participantpanel.js | 25 +++++++++++++++++-- 7 files changed, 52 insertions(+), 18 deletions(-) diff --git a/application/views/admin/participants/displayParticipants_view.php b/application/views/admin/participants/displayParticipants_view.php index d998b151223..3fdfe1b97d3 100644 --- a/application/views/admin/participants/displayParticipants_view.php +++ b/application/views/admin/participants/displayParticipants_view.php @@ -69,6 +69,7 @@ echo ""; $this->widget('bootstrap.widgets.TbGridView', array( 'id' => 'list_central_participants', + 'emptyText'=>gT('No participants found.'), 'itemsCssClass' => 'table table-striped items', 'dataProvider' => $model->search(), 'columns' => $model->columns, diff --git a/application/views/admin/participants/massive_actions/_selector.php b/application/views/admin/participants/massive_actions/_selector.php index b0eac442c7b..915cb79b145 100644 --- a/application/views/admin/participants/massive_actions/_selector.php +++ b/application/views/admin/participants/massive_actions/_selector.php @@ -41,12 +41,15 @@ ), ), + // Separator + array('type' => 'separator'), + // Export array( 'type' => 'action', 'action' => 'export', 'url' => '', // Not relevant - 'iconClasses' => 'icon-exportcsv text-success', + 'iconClasses' => 'icon-exportcsv', 'text' => gT('Export'), 'grid-reload' => 'no', @@ -57,7 +60,7 @@ array( 'type' => 'action', 'action' => 'share', - 'url' => App()->createUrl('/admin/participants/sa/share'), + 'url' => '', // Not relevant 'iconClasses' => 'fa fa-share', 'text' => gT('Share'), 'grid-reload' => 'no', @@ -65,11 +68,18 @@ 'actionType' => 'custom', 'custom-js' => '(function(itemIds) { LS.CPDB.shareMassiveAction(itemIds); })' ), - /* // Add to survey array( + 'type' => 'action', + 'action' => 'add-to-survey', + 'url' => '', // Not relevant + 'iconClasses' => 'fa fa-user-plus', + 'text' => gT('Add participants to survey'), + 'grid-reload' => 'no', + + 'actionType' => 'custom', + 'custom-js' => '(function(itemIds) {})' ) - */ ) )); diff --git a/application/views/admin/participants/modal_subviews/_editParticipant.php b/application/views/admin/participants/modal_subviews/_editParticipant.php index 13cefe469b6..c636569a410 100644 --- a/application/views/admin/participants/modal_subviews/_editParticipant.php +++ b/application/views/admin/participants/modal_subviews/_editParticipant.php @@ -9,7 +9,7 @@ array( 'id' => 'editPartcipantActiveForm', 'action' => array('admin/participants/sa/editParticipant'), - 'htmlOptions' => array('class' => 'well form-horizontal'), // for inset effect + 'htmlOptions' => array('class' => 'form-horizontal'), // for inset effect ) ); ?> diff --git a/application/views/admin/participants/modal_subviews/_shareParticipant.php b/application/views/admin/participants/modal_subviews/_shareParticipant.php index 0c6c67559fc..bc42b3b6e3e 100644 --- a/application/views/admin/participants/modal_subviews/_shareParticipant.php +++ b/application/views/admin/participants/modal_subviews/_shareParticipant.php @@ -9,7 +9,7 @@ array( 'id' => 'shareParticipantActiveForm', 'action' => array('admin/participants/sa/shareParticipants'), - 'htmlOptions' => array('class' => 'well form-horizontal'), // for inset effect + 'htmlOptions' => array('class' => 'form-horizontal'), // for inset effect ) ); ?> diff --git a/application/views/admin/participants/modal_subviews/_showParticipantSurveys.php b/application/views/admin/participants/modal_subviews/_showParticipantSurveys.php index 94be4f9cb46..ac2739e9008 100644 --- a/application/views/admin/participants/modal_subviews/_showParticipantSurveys.php +++ b/application/views/admin/participants/modal_subviews/_showParticipantSurveys.php @@ -1,6 +1,6 @@ endWidget(); -?> \ No newline at end of file +?> diff --git a/application/views/admin/participants/sharePanel_view.php b/application/views/admin/participants/sharePanel_view.php index e968a5e6dfe..08637415d74 100644 --- a/application/views/admin/participants/sharePanel_view.php +++ b/application/views/admin/participants/sharePanel_view.php @@ -6,6 +6,7 @@ widget('bootstrap.widgets.TbGridView', array( 'id' => 'share_central_participants', + 'emptyText' => gT('No shared participants found'), 'itemsCssClass' => 'table table-striped items', 'htmlOptions' => array('class'=> 'table-responsive'), 'dataProvider' => $model->search(), @@ -14,13 +15,14 @@ 'filter'=>$model, 'ajaxType' => 'POST', 'afterAjaxUpdate' => 'LS.CPDB.bindButtons', + 'template' => "{items}\n
{pager}
{summary}
", 'summaryText' => gT('Displaying {start}-{end} of {count} result(s).').' '. sprintf(gT('%s rows per page'), - CHtml::dropDownList( - 'pageSizeShareParticipantView', - $pageSizeShareParticipantView, - Yii::app()->params['pageSizeOptions'], - array('class'=>'changePageSize form-control', 'style'=>'display: inline; width: auto')) - ), + CHtml::dropDownList( + 'pageSizeShareParticipantView', + $pageSizeShareParticipantView, + Yii::app()->params['pageSizeOptions'], + array('class'=>'changePageSize form-control', 'style'=>'display: inline; width: auto')) + ), )); ?> diff --git a/scripts/admin/participantpanel.js b/scripts/admin/participantpanel.js index 0712c94fc6f..aa1f78300f1 100644 --- a/scripts/admin/participantpanel.js +++ b/scripts/admin/participantpanel.js @@ -321,12 +321,11 @@ LS.CPDB = (function() { }, /** - * Modal for sharing checked items + * Modal for sharing checked items, massive action * @param {array} participantIds - Array of participant ids * @return */ shareMassiveAction = function(participantIds) { - console.log('participantIds', participantIds); var data = { modalTarget: 'shareparticipant', participantIds: participantIds @@ -340,6 +339,26 @@ LS.CPDB = (function() { ); }, + /** + * Modal for adding participants to a survey. + * Used by massive action. + * @param {array} participantIds - Array of participant ids + * @return + */ + addParticipantToSurvey = function(participantIds) { + var data = { + modalTarget: 'addParticipantToSurvey', + participantIds: participantIds + }; + runBaseModal( + openModalParticipantPanel, + data, + 'action_save_modal_shareparticipant', + 'shareParticipantActiveForm', + 'list_central_participants' + ); + }, + /** * Bind all JS functions to button clicks * @return @@ -354,6 +373,8 @@ LS.CPDB = (function() { * @TODO rewrite export */ $('#export').click(onClickExport); + + doToolTip(); }; return {