Skip to content

Commit

Permalink
Re-Implemented the group function for crud; Updated card styles to su…
Browse files Browse the repository at this point in the history
…pport toggle icon; Closes #1455
  • Loading branch information
TheMaaarc committed Sep 19, 2017
1 parent 67aba6a commit 184de7a
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ All notable changes to this project will be documented in this file. This projec

### Fixed

- [#1455](https://github.com/luyadev/luya/issues/1455) Re-Implemented the group function for crud; Updated card styles to support toggle icon
- [#1504](https://github.com/luyadev/luya/issues/1504) Added is-empty class to zaa-list directives and updated flag positions based on this class.
- [#1503](https://github.com/luyadev/luya/issues/1503) Deleted news are now hidden in getAvailableNews() method.
- [#1486](https://github.com/luyadev/luya/issues/1486) Toast messages displayed correctly with multiple lines.
Expand Down
2 changes: 1 addition & 1 deletion modules/admin/src/resources/dist/css/admin.css

Large diffs are not rendered by default.

30 changes: 30 additions & 0 deletions modules/admin/src/resources/scss/components/_card.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
.card-body > *:last-child {
margin-bottom: 0;

.form-group {
margin-bottom: 0;
}
}

.card-header {
span {
vertical-align: middle;
}
}

.card-toggle-indicator {
position: relative;
font-size: 24px !important;
transition: .25s ease-in-out color, .2s ease-in-out transform;

.card-closed & {
transform: rotate(-90deg);
}
}

.card-body {

.card-closed & {
display: none;
}
}
4 changes: 4 additions & 0 deletions modules/admin/src/resources/scss/components/_crud.scss
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@
}
}

.crud-card {
margin-bottom: 25px;
}

.crud-toolbar {

.btn-group {
Expand Down
28 changes: 23 additions & 5 deletions modules/admin/src/views/ngrest/_crudform.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,29 @@
<div class="tab-pane tab-padded" role="tabpanel" ng-if="crudSwitchType==<?= $type; ?>" ng-class="{'active' : crudSwitchType==<?= $type; ?>}" <?php if (!$isInline): ?>zaa-esc="closeUpdate()"<?php endif; ?>>
<form name="formCreate" class="js-form-side-by-side" ng-submit="<?php if ($type==2):?>submitUpdate()<?php else: ?>submitCreate()<?php endif; ?>">
<?php foreach ($this->context->forEachGroups($renderer) as $key => $group): ?>
<?php foreach ($group['fields'] as $field => $fieldItem): ?>
<?php foreach ($this->context->createElements($fieldItem, $renderer) as $element): ?>
<?= $element['html']; ?>
<?php endforeach; ?>
<?php endforeach; ?>

<?php if (!$group['is_default']): ?>
<div class="card crud-card" ng-init="groupToggler[<?= $key; ?>] = <?= (int) !$group['collapsed']; ?>" ng-class="{'card-closed': !groupToggler[<?= $key; ?>]}">
<div class="card-header" ng-click="groupToggler[<?= $key; ?>] = !groupToggler[<?= $key; ?>]">
<span class="material-icons card-toggle-indicator">keyboard_arrow_down</span>
<?= $group['name']; ?>
</div>
<div class="card-body">
<?php endif; ?>


<?php foreach ($group['fields'] as $field => $fieldItem): ?>
<?php foreach ($this->context->createElements($fieldItem, $renderer) as $element): ?>
<?= $element['html']; ?>
<?php endforeach; ?>
<?php endforeach; ?>


<?php if (!$group['is_default']): ?>
</div> <!-- /.card-body -->
</div> <!-- /.card -->
<?php endif; ?>

<?php endforeach; ?>
<button type="submit" class="btn btn-save btn-icon"><?= Module::t($type == 2 ? 'button_save' : 'ngrest_crud_btn_create'); ?></button>
</form>
Expand Down

0 comments on commit 184de7a

Please sign in to comment.