Skip to content

Commit

Permalink
Dev #T976: Survey list - Survey Groups - 2 Tabs each one uses a diffe…
Browse files Browse the repository at this point in the history
…rent buttons which should be shown depening on where user is
  • Loading branch information
encuestabizdevgit committed Jul 12, 2021
1 parent ef773af commit 4fb8a09
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 10 deletions.
1 change: 1 addition & 0 deletions application/controllers/SurveyAdministrationController.php
Expand Up @@ -214,6 +214,7 @@ public function actionListsurveys()

$aData['pageTitle'] = 'Survey list';
$aData['fullpagebar']['listSurveys']['buttons']['createSurvey']['url'] = $this->createUrl("surveyAdministration/newSurvey");
$aData['fullpagebar']['listSurveys']['buttons']['createSurveyGroup']['url'] = $this->createUrl("admin/surveysgroups/sa/create");

$this->aData = $aData;
$this->render('listSurveys_view', $aData);
Expand Down
18 changes: 16 additions & 2 deletions application/views/layouts/fullpagebar_view.php
Expand Up @@ -14,14 +14,28 @@
<!-- List Surveys - Create a new Survey -->
<?php if(isset($fullpagebar['listSurveys']['buttons']['createSurvey']) &&
Permission::model()->hasGlobalPermission('surveys','create')):?>
<a class="btn btn-default"
<a class="btn btn-default tab-dependent-button"
data-tab="#surveys"
href="<?php echo $fullpagebar['listSurveys']['buttons']['createSurvey']['url']; ?>"
role="button"
style="margin-top: 10px; margin-bottom: 10px;">
style="margin-top: 10px; margin-bottom: 10px; display: none;">
<span class="icon-add text-success"></span>
<?php eT("Create a new survey");?>
</a>
<?php endif;?>

<!-- List Surveys - Create a new Survey group -->
<?php if(isset($fullpagebar['listSurveys']['buttons']['createSurveyGroup']) &&
Permission::model()->hasGlobalPermission('surveysgroups','create')):?>
<a class="btn btn-default tab-dependent-button"
data-tab="#surveygroups"
href="<?php echo $fullpagebar['listSurveys']['buttons']['createSurveyGroup']['url']; ?>"
role="button"
style="margin-top: 10px; margin-bottom: 10px; display: none;">
<span class="icon-add text-success"></span>
<?php eT("Create a new survey group");?>
</a>
<?php endif;?>
</div>


Expand Down
10 changes: 2 additions & 8 deletions application/views/surveyAdministration/listSurveys_view.php
Expand Up @@ -27,14 +27,6 @@
</div>

<div id="surveygroups" class="tab-pane">
<?php if(Permission::model()->hasGlobalPermission('surveysgroups','create')):?>
<div class="col-12">
<a class="btn btn-default" href="<?php echo $this->createUrl("admin/surveysgroups/sa/create"); ?>" role="button">
<span class="icon-add text-success"></span>
<?php eT("Create a new survey group");?>
</a>
</div>
<?php endif;?>
<div class="pagetitle h3 ls-space margin top-25"><?php eT('Survey groups'); ?></div>
<div class="row">
<div class="col-sm-12 content-right">
Expand All @@ -55,6 +47,8 @@
window.location.hash = $(this).attr('href');
e.preventDefault();
$(this).tab('show');
$('.tab-dependent-button').hide();
$('.tab-dependent-button[data-tab="' + window.location.hash + '"]').show();
});
$(document).on('ready pjax:scriptcomplete', function(){
if(window.location.hash){
Expand Down

0 comments on commit 4fb8a09

Please sign in to comment.