Skip to content

Commit

Permalink
Merge pull request #2 from bolt/master
Browse files Browse the repository at this point in the history
sync bolt/core with this fork
  • Loading branch information
LordSimal committed Nov 15, 2020
2 parents 11b6353 + 7adc176 commit bbaa26b
Show file tree
Hide file tree
Showing 24 changed files with 749 additions and 421 deletions.
4 changes: 4 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ trim_trailing_whitespace = false
indent_style = space
indent_size = 4

[*.scss]
indent_style = space
indent_size = 2

[*.sh]
indent_style = tab
indent_size = 4
Expand Down
65 changes: 39 additions & 26 deletions assets/js/app/editor/Components/Collection.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,28 @@
</div>
</div>

<div v-for="element in elements" :key="element.hash" class="collection-item">
<details :open="variant === 'expanded'" class="card">
<summary class="d-block">
<div class="card-header d-flex align-items-center">
<!-- Initial title. This is replaced by dynamic title in JS below. -->
<i class="card-marker-caret fa fa-caret-right"></i>
<div class="collection-item-title" :data-label="element.label">
<i :class="[element.icon, 'fas fa-fw']" />
{{ element.label }}
</div>

<!-- Navigation buttons -->
<div :is="compile(element.buttons)"></div>
<div
v-for="element in elements"
:key="element.hash"
class="collection-item"
v-bind:class="{ collapsed: variant !== 'expanded' }"
>
<div class="d-block summary">
<div class="card-header d-flex align-items-center">
<!-- Initial title. This is replaced by dynamic title in JS below. -->
<i class="card-marker-caret fa fa-caret-right"></i>
<div class="collection-item-title" :data-label="element.label">
<i :class="[element.icon, 'fas fa-fw']" />
{{ element.label }}
</div>
</summary>

<!-- Navigation buttons -->
<div :is="compile(element.buttons)"></div>
</div>
</div>
<div class="card details">
<!-- The actual field -->
<div :is="compile(element.content)" class="card-body"></div>
</details>
</div>
</div>

<div class="row">
Expand Down Expand Up @@ -145,15 +148,24 @@ export default {
* This is a jQuery event listener, because Vue cannot handle an event emitted by a non-vue element.
* The collection items are not Vue elements in order to initialise them correctly within their twig template.
*/
window
.$(document)
.on('click', vueThis.selector.collectionContainer + ' .collection-item .summary', function(e) {
e.preventDefault();
let thisCollectionItem = vueThis.getCollectionItemFromPressedButton(this);
thisCollectionItem.toggleClass('collapsed');
});
window.$(document).on('click', vueThis.selector.collectionContainer + vueThis.selector.remove, function(e) {
e.preventDefault();
e.stopPropagation();
let collectionContainer = window.$(this).closest(vueThis.selector.collectionContainer);
vueThis.getCollectionItemFromPressedButton(this).remove();
vueThis.setAllButtonsStates(collectionContainer);
vueThis.counter--;
});
window.$(document).on('click', vueThis.selector.collectionContainer + vueThis.selector.moveUp, function(e) {
e.preventDefault();
e.stopPropagation();
let thisCollectionItem = vueThis.getCollectionItemFromPressedButton(this);
let prevCollectionitem = vueThis.getPreviousCollectionItem(thisCollectionItem);
window.$(thisCollectionItem).after(prevCollectionitem);
Expand All @@ -162,6 +174,7 @@ export default {
});
window.$(document).on('click', vueThis.selector.collectionContainer + vueThis.selector.moveDown, function(e) {
e.preventDefault();
e.stopPropagation();
let thisCollectionItem = vueThis.getCollectionItemFromPressedButton(this);
let nextCollectionItem = vueThis.getNextCollectionItem(thisCollectionItem);
window.$(thisCollectionItem).before(nextCollectionItem);
Expand All @@ -171,14 +184,14 @@ export default {
window.$(document).on('click', vueThis.selector.collectionContainer + vueThis.selector.expandAll, function(e) {
e.preventDefault();
const collection = $(e.target).closest(vueThis.selector.collectionContainer);
collection.find('details').attr('open', '');
collection.find('.collection-item').removeClass('collapsed');
});
window
.$(document)
.on('click', vueThis.selector.collectionContainer + vueThis.selector.collapseAll, function(e) {
e.preventDefault();
const collection = $(e.target).closest(vueThis.selector.collectionContainer);
collection.find('details').removeAttr('open');
collection.find('.collection-item').addClass('collapsed');
});
/**
* Update the title dynamically.
Expand Down Expand Up @@ -214,14 +227,14 @@ export default {
/**
* Open newly inserted collection items.
*/
$(document).on('DOMNodeInserted', function(e) {
if ($(e.target).hasClass('collection-item')) {
$(e.target)
.find('details')
.first()
.attr('open', '');
}
});
// $(document).on('DOMNodeInserted', function(e) {
// if ($(e.target).hasClass('collection-item')) {
// $(e.target)
// .find('details')
// .first()
// .attr('open', '');
// }
// });
},
updated() {
this.setAllButtonsStates(window.$(this.$refs.collectionContainer));
Expand Down
2 changes: 1 addition & 1 deletion assets/js/app/editor/Components/Select.vue
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export default {
if (this.selected === null) {
return JSON.stringify([]);
} else if (this.selected.map) {
} else if (this.selected.length > 0) {
filtered = this.selected.map(item => item.key);
return JSON.stringify(filtered);
} else {
Expand Down
11 changes: 6 additions & 5 deletions assets/scss/init/_base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,6 @@ small {
a:not(.btn):not(.dropdown-item) {
text-decoration: underline;
}

ul,
ol {
padding-left: 1rem;
}
}

.custom-select {
Expand All @@ -85,3 +80,9 @@ input.flatpickr-input[disabled] {
input::placeholder {
font-style: italic;
}

.field-error {
color: $danger;
margin-top: -1.5rem;
margin-bottom: 2rem;
}
5 changes: 5 additions & 0 deletions assets/scss/modules/admin/_widgets.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
.widget {
margin-bottom: $spacer*1.625;

ul,
ol {
padding-left: 1rem;
}
}
15 changes: 12 additions & 3 deletions assets/scss/modules/editor/fields/_collection.scss
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@
.collection-item {
margin-bottom: 1rem;

summary {
.summary {
padding: 0;
background: transparent;
cursor: pointer;

&::-webkit-details-marker {
display: none;
Expand All @@ -28,11 +29,14 @@

i.card-marker-caret {
margin-right: 0.75rem;
transform: rotate(90deg);
}
}

details[open] summary i.card-marker-caret {
transform: rotate(90deg);
&.collapsed {
.summary i.card-marker-caret {
transform: rotate(0);
}
}

.collection-item-title {
Expand All @@ -41,6 +45,11 @@
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
user-select: none;
}

&.collapsed .details {
display: none;
}

.card-body {
Expand Down
6 changes: 6 additions & 0 deletions config/bolt/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -193,3 +193,9 @@ fixtures_seed: 87654
# Globally enable / disable the validator for Fields
validator_options:
enable: true

# Options for user's avatar
user_avatar:
upload_path: avatars
extensions_allowed: ['png', 'jpeg', 'jpg', 'gif']
default_avatar: '' # Put path of file locate in files directory
4 changes: 4 additions & 0 deletions config/services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ services:
tags:
- { name: doctrine.event_listener, event: postLoad }

Bolt\Event\Listener\UserAvatarLoadListener:
tags:
- { name: doctrine.event_listener, event: postLoad }

Bolt\Extension\RoutesLoader:
tags: [routing.loader]

Expand Down
117 changes: 0 additions & 117 deletions src/Controller/Backend/ProfileController.php

This file was deleted.

Loading

0 comments on commit bbaa26b

Please sign in to comment.