Skip to content

Commit

Permalink
Add Masonry to dashboard modules
Browse files Browse the repository at this point in the history
  • Loading branch information
C-Lodder committed Jul 21, 2017
1 parent 9c1649c commit f718788
Show file tree
Hide file tree
Showing 7 changed files with 2,521 additions and 17 deletions.
9 changes: 7 additions & 2 deletions Gruntfile.js
Expand Up @@ -59,6 +59,7 @@ module.exports = function(grunt) {
'media/vendor/flying-focus-a11y/*',
'media/vendor/diff/**',
'media/vendor/polyfills/**',
'media/vendor/masonry-layout/js/**',
],
expand: true,
options: {
Expand All @@ -83,10 +84,12 @@ module.exports = function(grunt) {
],
expand: true
},
allMinJs: ['media/**/*.min.js', '!media/vendor/*.min.js',
allMinJs: [
'media/**/*.min.js', '!media/vendor/*.min.js',
'media/**/**/*.min.js', '!media/vendor/**/*.min.js',
'media/**/**/**/*.min.js', '!media/vendor/**/**/*.min.js',
'media/**/**/**/**/*.min.js', '!media/vendor/**/**/**/*.min.js']
'media/**/**/**/**/*.min.js', '!media/vendor/**/**/**/*.min.js'
]
},

// Update all the packages to the version specified in assets/package.json
Expand Down Expand Up @@ -193,6 +196,8 @@ module.exports = function(grunt) {
{ expand: true, cwd: '<%= folder.node_module %>diff/dist', src: ['*.js'], dest: 'media/vendor/diff/js/', filter: 'isFile'},
// XPath polyfill js files
{ expand: false, src: '<%= folder.node_module %>wicked-good-xpath/dist/wgxpath.install.js', dest: 'media/vendor/polyfills/js/polyfill-wgxpath.js', filter: 'isFile'},
// Masonry js files
{ expand: true, cwd: '<%= folder.node_module %>masonry-layout/dist', src: ['*.js'], dest: 'media/vendor/masonry/js/', filter: 'isFile'},

// Licenses
{ src: ['<%= folder.node_module %>jquery/LICENSE.txt'], dest: 'media/vendor/jquery/LICENSE.txt'},
Expand Down
15 changes: 1 addition & 14 deletions administrator/components/com_cpanel/tmpl/cpanel/default.php
Expand Up @@ -28,24 +28,11 @@
</div>
<?php endif; ?>
</div>
<div class="row">

<div class="row grid" data-masonry='{ "itemSelector": ".grid-item", "columnWidth": ".grid-sizer", "percentPosition": true }'>
<?php
$cols = 0;
foreach ($this->modules as $module)
{
// Get module parameters
$params = new Registry;
$params->loadString($module->params);
$bootstrapSize = $params->get('bootstrap_size', 6);

$cols += $bootstrapSize;
if ($cols > 12)
{
echo '</div><div class="row">';
$cols = $bootstrapSize;
}

echo JModuleHelper::renderModule($module, array('style' => 'well'));
}
?>
Expand Down
2 changes: 1 addition & 1 deletion administrator/templates/atum/html/modules.php
Expand Up @@ -61,7 +61,7 @@ function modChrome_well($module, &$params, &$attribs)
$headerClass = $params->get('header_class');
$headerClass = ($headerClass) ? ' ' . htmlspecialchars($headerClass) : '';

echo '<div class="' . $moduleClass . '">';
echo '<div class="' . $moduleClass . ' grid-item grid-sizer">';
echo '<' . $moduleTag . ' class="card card-block mb-3' . $moduleClassSfx . '">';

if ($canEdit)
Expand Down
1 change: 1 addition & 0 deletions administrator/templates/atum/index.php
Expand Up @@ -19,6 +19,7 @@
// Add JavaScript
JHtml::_('bootstrap.framework');
JHtml::_('script', 'media/vendor/flying-focus-a11y/js/flying-focus.min.js', ['version' => 'auto']);
JHtml::_('script', 'media/vendor/masonry/js/masonry.pkgd.min.js', ['version' => 'auto']);
JHtml::_('script', 'template.js', ['version' => 'auto', 'relative' => true]);

// Load template CSS file
Expand Down
3 changes: 3 additions & 0 deletions grunt-settings.yaml
Expand Up @@ -28,6 +28,9 @@ vendors:
'mediaelement':
'version': '4.2.2'
'dependencies': 'jquery'
'masonry-layout':
'version': '4.2.0'
'dependencies': ''
'punycode':
'version': '1.4.1'
'dependencies': ''
Expand Down

0 comments on commit f718788

Please sign in to comment.