Skip to content

Commit

Permalink
Dev: Small misc fixes (CPDB)
Browse files Browse the repository at this point in the history
  • Loading branch information
olleharstedt committed Sep 22, 2016
1 parent 7432d83 commit d0ab0dc
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 18 deletions.
Expand Up @@ -69,6 +69,7 @@
echo "<input type='hidden' id='searchcondition' name='searchcondition[]' value='".join("||",$searchcondition)."' />";
$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,
Expand Down
18 changes: 14 additions & 4 deletions application/views/admin/participants/massive_actions/_selector.php
Expand Up @@ -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',

Expand All @@ -57,19 +60,26 @@
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',

'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) {})'
)
*/
)
));

Expand Down
Expand Up @@ -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
)
);
?>
Expand Down
Expand Up @@ -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
)
);
?>
Expand Down
@@ -1,6 +1,6 @@
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="participant_edit_modal"><?php echo $model->firstname."&nbsp;".$model->lastname; ?></h4>
<h4 class="modal-title" id="participant_edit_modal"><?php eT('List active surveys'); ?></h4>
</div>
<div class="modal-body form-horizontal">
<?php
Expand All @@ -9,7 +9,7 @@
array(
'id' => 'participantSurveysActiveForm',
'action' => array('admin/participants/sa/editValueParticipantPanel'),
'htmlOptions' => array('class' => 'well form-horizontal'), // for inset effect
'htmlOptions' => array('class' => 'form-horizontal'), // for inset effect
)
);
?>
Expand All @@ -27,7 +27,7 @@
'afterAjaxUpdate' => 'bindButtonsInsideSurveys',
'ajaxType' => 'POST',
'summaryText' => gT('Displaying {count} survey(s).'),
'blankDisplay' => gT("This PArticipant is not active in any survey")
'emptyText' => gT("This participant is not active in any survey")

));
?>
Expand All @@ -38,4 +38,4 @@
</div>
<?php
$this->endWidget();
?>
?>
14 changes: 8 additions & 6 deletions application/views/admin/participants/sharePanel_view.php
Expand Up @@ -6,6 +6,7 @@
<?php
$this->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(),
Expand All @@ -14,13 +15,14 @@
'filter'=>$model,
'ajaxType' => 'POST',
'afterAjaxUpdate' => 'LS.CPDB.bindButtons',
'template' => "{items}\n<div id='tokenListPager'><div class=\"col-sm-4\" id=\"massive-action-container\"></div><div class=\"col-sm-4 pager-container \">{pager}</div><div class=\"col-sm-4 summary-container\">{summary}</div></div>",
'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'))
),
));
?>
</div>
Expand Down
25 changes: 23 additions & 2 deletions scripts/admin/participantpanel.js
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -354,6 +373,8 @@ LS.CPDB = (function() {
* @TODO rewrite export
*/
$('#export').click(onClickExport);

doToolTip();
};

return {
Expand Down

0 comments on commit d0ab0dc

Please sign in to comment.