Skip to content

Commit

Permalink
Move code at sidebar.ctp file
Browse files Browse the repository at this point in the history
  • Loading branch information
Ioannis committed Apr 3, 2024
1 parent 864a2aa commit 8bd174c
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 35 deletions.
4 changes: 3 additions & 1 deletion Lib/lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,10 @@
'pl.grouperlite.action.close' => 'Close',
'pl.grouperlite.action.clear' => 'Clear',
'pl.grouperlite.action.add-user' => 'Add',
'pl.grouperlite.action.act-as' => 'Act As',
'pl.grouperlite.action.remove-user' => 'Remove',
'pl.grouperlite.action.enable-act-as' => 'Enable',
'pl.grouperlite.action.enable' => 'Enable',
'pl.grouperlite.action.find' => 'Find',
'pl.grouperlite.message.user-not-found-error' => 'Error: User not found.',
'pl.grouperlite.message.user-not-added-error' => 'Error: Unable to add user.',
'pl.grouperlite.message.user-not-removed-error' => 'Error: Unable to remove user.',
Expand Down
3 changes: 3 additions & 0 deletions View/Elements/ActAsPeopleAutocomplete.ctp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ $suffix = Configure::read('debug') > 0 ? '?time=' . time() : '';
url: "<?= $actionUrl ?? 'null' ?>",
grouperUrl: "<?= $grouperUrlBase ?>",
view: "<?= $this->action ?>",
hasActAs: <?= (int)!empty($vv_act_as_people) ?>,
actAsPerson: <?= json_encode($vv_act_as_people ?? []) ?>,
permissions: <?= json_encode($permissions, JSON_THROW_ON_ERROR) ?>,
txt: {
adhocHeading: "<?= $vv_config['CoGrouperLiteWidget']['adhoc_heading'] ?? 'Ad-hoc groups' ?>",
wgHeading: "<?= $vv_config['CoGrouperLiteWidget']['wg_heading'] ?? 'Working groups' ?>",
Expand Down
33 changes: 32 additions & 1 deletion View/Elements/ActionSideBar.ctp
Original file line number Diff line number Diff line change
@@ -1,2 +1,33 @@
<?php
<div id="right-sidebar">
<div class="sidebar-content">
<div class="font-weight-bold d-inline-flex align-items-center w-100">
<em class="material-icons lg" aria-hidden="true">transfer_within_a_station</em>
<span class="ml-1"><?= _txt('pl.grouperlite.action.act-as')?></span>
<a data-toggle="collapse"
href="#people-picker-container"
role="button"
aria-expanded="false"
aria-controls="people-picker-container"
class="ignore-invalid ml-auto order-2">
<span class="ui-icon ui-icon-search"></span><?= _txt('pl.grouperlite.action.find')?>
</a>
</div>
<div class="collapse mb-1 mt-2" id="people-picker-container">
<?= $this->element('ActAsPeopleAutocomplete',
compact('vv_config',
'vv_coid',
'vv_is_user_owner',
'htmlId')
)?>
</div>
<?php if(!empty($vv_act_as_people)):?>
<hr style="border-top: dotted 1px;" />
<?php foreach($vv_act_as_people as $person): ?>
<?= $this->element('ActionItem', compact('person')) ?>
<?php endforeach; ?>
<?php endif; ?>
<hr>
</div>
</div>


43 changes: 10 additions & 33 deletions View/GrouperGroups/index.ctp
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ $suffix = Configure::read('debug') > 0 ? '?time=' . time() : '';
url: "<?= $actionUrl ?? 'null' ?>",
grouperUrl: "<?= $grouperUrlBase ?>",
view: "<?= $this->action ?>",
hasActAs: <?= (int)!empty($vv_act_as_people) ?>,
actAsPerson: <?= json_encode($vv_act_as_people ?? []) ?>,
permissions: <?= json_encode($permissions, JSON_THROW_ON_ERROR) ?>,
txt: {
adhocHeading: "<?= $vv_config['CoGrouperLiteWidget']['adhoc_heading'] ?? 'Ad-hoc groups' ?>",
wgHeading: "<?= $vv_config['CoGrouperLiteWidget']['wg_heading'] ?? 'Working groups' ?>",
Expand Down Expand Up @@ -124,7 +127,6 @@ $suffix = Configure::read('debug') > 0 ? '?time=' . time() : '';
JSON_THROW_ON_ERROR) ?>,
},
api: {
permissions: <?= json_encode($permissions, JSON_THROW_ON_ERROR) ?>,
co: <?= $vv_coid ?>,
glid: <?= $vv_config['CoGrouperLiteWidget']['id'] ?>,
mode: "<?= PeoplePickerModeEnum::All ?>",
Expand Down Expand Up @@ -158,37 +160,12 @@ $suffix = Configure::read('debug') > 0 ? '?time=' . time() : '';
<router-view></router-view>
</div>
<?php if(isset($permissions['actAsAction']) && $permissions['actAsAction']): ?>
<div id="right-sidebar">
<div class="sidebar-content">
<div class="font-weight-bold d-inline-flex align-items-center w-100">
<em class="material-icons lg" aria-hidden="true">transfer_within_a_station</em>
<span class="ml-1">Act As</span>
<a data-toggle="collapse"
href="#people-picker-container"
role="button"
aria-expanded="false"
aria-controls="people-picker-container"
class="ignore-invalid ml-auto order-2">
<span class="ui-icon ui-icon-search"></span>Find
</a>
</div>
<div class="collapse mb-1 mt-2" id="people-picker-container">
<?= $this->element('ActAsPeopleAutocomplete',
compact('vv_config',
'vv_coid',
'vv_is_user_owner',
'htmlId')
)?>
</div>
<!-- Current choices we got from the database -->
<?php if(!empty($vv_act_as_people)):?>
<hr style="border-top: dotted 1px;" />
<?php foreach($vv_act_as_people as $person): ?>
<?= $this->element('ActionItem', compact('person')) ?>
<?php endforeach; ?>
<?php endif; ?>
<hr>
</div>
</div>
<?= $this->element('ActionSideBar',
compact('vv_config',
'vv_act_as_people',
'vv_coid',
'vv_is_user_owner',
'htmlId')
) ?>
<?php endif; ?>
</div>

0 comments on commit 8bd174c

Please sign in to comment.