Skip to content

Commit

Permalink
Merge branch '3.x' into 2.16.0-beta-merge-to-3.x
Browse files Browse the repository at this point in the history
  • Loading branch information
escopecz committed Feb 4, 2020
2 parents 275d350 + c141206 commit 408a5df
Show file tree
Hide file tree
Showing 10 changed files with 186 additions and 121 deletions.
30 changes: 0 additions & 30 deletions app/bundles/CoreBundle/Assets/js/1a.content.js
Original file line number Diff line number Diff line change
Expand Up @@ -660,36 +660,6 @@ Mautic.onPageLoad = function (container, response, inModal) {
});
}

//activate shuffles
if (mQuery(container + ' .shuffle-grid').length) {
var grid = mQuery(container + " .shuffle-grid");

//give a slight delay in order for images to load so that shuffle starts out with correct dimensions
setTimeout(function () {
grid.shuffle({
itemSelector: ".shuffle",
sizer: false
});

// Update shuffle on sidebar minimize/maximize
mQuery("html")
.on("fa.sidebar.minimize", function () {
grid.shuffle("update");
})
.on("fa.sidebar.maximize", function () {
grid.shuffle("update");
});

// Update shuffle if in a tab
if (grid.parents('.tab-pane').length) {
var tabId = grid.parents('.tab-pane').first().attr('id');
var tab = mQuery('a[href="#' + tabId + '"]').on('shown.bs.tab', function() {
grid.shuffle("update");
});
}
}, 1000);
}

//prevent auto closing dropdowns for dropdown forms
if (mQuery(container + ' .dropdown-menu-form').length) {
mQuery(container + ' .dropdown-menu-form').on('click', function (e) {
Expand Down
19 changes: 15 additions & 4 deletions app/bundles/LeadBundle/Assets/js/lead.js
Original file line number Diff line number Diff line change
Expand Up @@ -1166,10 +1166,21 @@ Mautic.updateLeadList = function () {
if (response.indexMode == 'list') {
mQuery('#leadTable tbody').prepend(response.leads);
} else {
var items = mQuery(response.leads);
mQuery('.shuffle-grid').prepend(items);
mQuery('.shuffle-grid').shuffle('appended', items);
mQuery('.shuffle-grid').shuffle('update');
if (mQuery('.shuffle-grid').length) {
//give a slight delay in order for images to load so that shuffle starts out with correct dimensions
var Shuffle = window.Shuffle,
element = document.querySelector('.shuffle-grid'),
shuffleOptions = {
itemSelector: '.shuffle-item'
};

// Using global variable to make it available outside of the scope of this function
window.leadsShuffleInstance = new Shuffle(element, shuffleOptions);
var items = mQuery(response.leads);
mQuery('.shuffle-grid').prepend(items);
window.leadsShuffleInstance.shuffle('appended', items.children(shuffleOptions.itemSelector).toArray());
window.leadsShuffleInstance.shuffle('update');
}

mQuery('#liveModeButton').data('max-id', response.maxId);
}
Expand Down
2 changes: 2 additions & 0 deletions app/bundles/LeadBundle/Config/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -1249,11 +1249,13 @@
'mautic.lead.fixture.test.page_hit' => [
'class' => \Mautic\LeadBundle\Tests\DataFixtures\ORM\LoadPageHitData::class,
'tag' => \Doctrine\Bundle\FixturesBundle\DependencyInjection\CompilerPass\FixturesCompilerPass::FIXTURE_TAG,
'optional' => true,
],
'mautic.lead.fixture.test.segment' => [
'class' => \Mautic\LeadBundle\Tests\DataFixtures\ORM\LoadSegmentsData::class,
'tag' => \Doctrine\Bundle\FixturesBundle\DependencyInjection\CompilerPass\FixturesCompilerPass::FIXTURE_TAG,
'arguments' => ['mautic.lead.model.list', 'mautic.lead.model.lead'],
'optional' => true,
],
],
],
Expand Down
26 changes: 19 additions & 7 deletions app/bundles/PluginBundle/Assets/js/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,18 +140,19 @@ Mautic.filterIntegrations = function(update) {
}

//activate shuffles
if (mQuery('.shuffle-integrations').length) {
if (mQuery('.native-integrations').length) {
//give a slight delay in order for images to load so that shuffle starts out with correct dimensions
setTimeout(function () {
var Shuffle = window.Shuffle,
element = document.querySelector('.shuffle-integrations'),
element = document.querySelector('.native-integrations'),
shuffleOptions = {
itemSelector: '.shuffle-item'
};

var shuffleInstance = new Shuffle(element, shuffleOptions);
// Using global variable to make it available outside of the scope of this function
window.nativeIntegrationsShuffleInstance = new Shuffle(element, shuffleOptions);

shuffleInstance.filter(function($el) {
window.nativeIntegrationsShuffleInstance.filter(function($el) {
if (filter) {
return mQuery($el).hasClass('plugin' + filter);
} else {
Expand All @@ -165,11 +166,22 @@ Mautic.filterIntegrations = function(update) {
// Update shuffle on sidebar minimize/maximize
mQuery("html")
.on("fa.sidebar.minimize", function() {
shuffleInstance.update();
setTimeout(function() {
window.nativeIntegrationsShuffleInstance.update();
}, 1000);
})
.on("fa.sidebar.maximize", function() {
shuffleInstance.update();
})
setTimeout(function() {
window.nativeIntegrationsShuffleInstance.update();
}, 1000);
});

// This delay is needed so that the tab has time to render and the sizes are correctly calculated
mQuery('#plugin-nav-tabs a').click(function () {
setTimeout(function() {
window.nativeIntegrationsShuffleInstance.update();
}, 500);
});
}, 500);
}
};
Expand Down
2 changes: 1 addition & 1 deletion app/bundles/PluginBundle/Views/Integration/grid.html.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
?>
<?php if (count($items)): ?>
<div class="pa-md bg-auto">
<div class="row shuffle-integrations">
<div class="row shuffle-integrations native-integrations">
<?php foreach ($items as $item):
if (array_key_exists($item['plugin'], $plugins)) {
$pluginTitle = $plugins[$item['plugin']]['name'].' - '.$item['display'];
Expand Down
18 changes: 18 additions & 0 deletions app/config/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,24 @@
// Check for a single config file
$config = (file_exists($directory.'/Config/config.php')) ? include $directory.'/Config/config.php' : [];

// Remove optional services (has argument optional = true) if the service class does not exist
if (isset($config['services'])) {
$config['services'] = (new \Tightenco\Collect\Support\Collection($config['services']))
->mapWithKeys(function (array $serviceGroup, string $groupName) {
$serviceGroup = (new \Tightenco\Collect\Support\Collection($serviceGroup))
->reject(function ($serviceDefinition) {
// Rejects services defined as optional where the service class does not exist.
return is_array($serviceDefinition)
&& isset($serviceDefinition['optional'])
&& true === $serviceDefinition['optional']
&& isset($serviceDefinition['class'])
&& false === class_exists($serviceDefinition['class']);
})->toArray();

return [$groupName => $serviceGroup];
})->toArray();
}

// Services need to have percent signs escaped to prevent ParameterCircularReferenceException
if (isset($config['services'])) {
array_walk_recursive(
Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,8 @@
"knplabs/knp-menu-bundle": "^2.0",
"guzzlehttp/oauth-subscriber": "^0.3.0",
"helios-ag/fm-elfinder-bundle": "~9",
"ricardofiorani/guzzle-psr18-adapter": "^1.0"
"ricardofiorani/guzzle-psr18-adapter": "^1.0",
"tightenco/collect": "^6.13"
},
"require-dev": {
"symfony/web-profiler-bundle": "~3.4.0",
Expand Down
Loading

0 comments on commit 408a5df

Please sign in to comment.