diff --git a/config/mosaic_grid.settings.json b/config/mosaic_grid.settings.json
index f642325..e4c3e99 100644
--- a/config/mosaic_grid.settings.json
+++ b/config/mosaic_grid.settings.json
@@ -1,13 +1,12 @@
{
"_config_name": "mosaic_grid.settings",
"loader_style": "spinning_ring",
- "loader_color": "#cccccc",
+ "loader_color": "#aaaaaa",
"caption_style_override": false,
"caption_font_color": "#ffffff",
"caption_opacity": 50,
"caption_font_size": 12,
"caption_padding": 10,
- "show_empty_images": false,
"lazyload_enabled": true,
"lazyload_edgeY": 0
-}
\ No newline at end of file
+}
diff --git a/js/mosaic_grid.js b/js/mosaic_grid.js
index e3b8fd5..8548fd4 100644
--- a/js/mosaic_grid.js
+++ b/js/mosaic_grid.js
@@ -9,6 +9,10 @@
for(var i in settings.mosaic_grid) {
if(i == 'lazyload') {
+ // In views preview force start lazyLoadXT.
+ if(settings.mosaic_grid.lazyload.editing){
+ $(window).lazyLoadXT();
+ }
// Configure lazyLoadXT.
$.extend($.lazyLoadXT, {
edgeY: settings.mosaic_grid.lazyload.edgeY,
@@ -25,7 +29,7 @@
itemDiv.children('.mosaic-grid-loader').remove();
}
},
- });
+ });
}
else {
// Initiate grid on a page.
@@ -39,7 +43,7 @@
});
}
}
-
+
}
};
diff --git a/mosaic_grid.admin.inc b/mosaic_grid.admin.inc
index bb76010..d018c56 100644
--- a/mosaic_grid.admin.inc
+++ b/mosaic_grid.admin.inc
@@ -110,15 +110,6 @@ function mosaic_grid_admin_form($form, &$form_state) {
),
),
);
-
- $form['appearance']['show_empty_images'] = array(
- '#type' => 'checkbox',
- '#title' => t('Show empty images'),
- '#description' => t("Enable this to show empty space with warning for images
- that have their file missing. By default such images are ignored and
- not displayed in the grid."),
- '#default_value' => $config->get('show_empty_images'),
- );
$form['lazyload'] = array(
'#type' => 'fieldset',
@@ -177,7 +168,6 @@ function mosaic_grid_admin_form_submit($form, &$form_state) {
$config->set('caption_opacity', $form_state['values']['caption_opacity']);
$config->set('caption_padding', $form_state['values']['caption_padding']);
$config->set('caption_font_size', $form_state['values']['caption_font_size']);
- $config->set('show_empty_images', $form_state['values']['show_empty_images']);
$config->set('lazyload_enabled', $form_state['values']['lazyload_enabled']);
$config->set('lazyload_edgeY', $form_state['values']['lazyload_edgeY']);
diff --git a/mosaic_grid.info b/mosaic_grid.info
index f2874dd..cfbbf06 100644
--- a/mosaic_grid.info
+++ b/mosaic_grid.info
@@ -3,6 +3,6 @@ description = Provides views style plugin for building image galleries layed out
backdrop = 1.x
package = Views
type = module
-version = 1.x-2.0.1
+version = 1.x-2.0.2
dependencies[] = views
configure = admin/config/media/mosaic_grid
diff --git a/mosaic_grid.module b/mosaic_grid.module
index 1193b45..b799eff 100644
--- a/mosaic_grid.module
+++ b/mosaic_grid.module
@@ -168,7 +168,7 @@ function template_preprocess_views_view_mosaic_grid(&$vars) {
break;
}
}
- elseif ($config->get('show_empty_images')) {
+ elseif (empty($options['hide_empty'])) {
// Fill in values needed for empty image warning display.
$items_rendered[$i] = FALSE;
$items_width[$i] = 100;
@@ -199,6 +199,7 @@ function template_preprocess_views_view_mosaic_grid(&$vars) {
'mosaic_grid' => array(
'lazyload' => array(
'edgeY' => $config->get('lazyload_edgeY'),
+ 'editing' => $view->editing,
),
$mosaic_id => array (
'max_row_height' => $options['max_row_height'],
@@ -260,13 +261,14 @@ SPIN;
.mosaic-grid-loader:before,
.mosaic-grid-loader:after {
background: {$color_hex};
- color: {$color_hex};
- }
+ color: {$color_hex};}
SPIN;
break;
}
if($loader_css)
+ $loader_css = minify($loader_css);
backdrop_add_css($loader_css, array('type' => 'inline'));
+ $vars['loader_css'] = $loader_css;
}
// Create style overrides if caption style is set to custom.
@@ -291,12 +293,20 @@ SPIN;
}
CAP;
// Add the css as inline style sheet.
+ $custom_caption_css = minify($custom_caption_css);
backdrop_add_css($custom_caption_css, array('type' => 'inline'));
// Store it for template. It will be used for views preview.
$vars['custom_caption_css'] = $custom_caption_css;
}
}
+/*
+ * Removes unnesessary symbols from code string.
+ */
+function minify($string){
+ return str_replace(array(" ", "\r", "\n"), '', $string);
+}
+
/**
* Implements hook_preprocess_image().
diff --git a/views-view-mosaic-grid.tpl.php b/views-view-mosaic-grid.tpl.php
index 2e272e6..7038598 100644
--- a/views-view-mosaic-grid.tpl.php
+++ b/views-view-mosaic-grid.tpl.php
@@ -17,11 +17,13 @@
editing): ?>
-
diff --git a/views_plugin_style_mosaic_grid.inc b/views_plugin_style_mosaic_grid.inc
index 3b5d8c7..8442707 100644
--- a/views_plugin_style_mosaic_grid.inc
+++ b/views_plugin_style_mosaic_grid.inc
@@ -17,6 +17,7 @@ class views_plugin_style_mosaic_grid extends views_plugin_style {
$options['caption'] = array('default' => 'none');
$options['max_rows'] = array('default' => 0);
$options['truncate'] = array('default' => false);
+ $options['hide_empty'] = array('default' => true);
return $options;
}
@@ -85,6 +86,13 @@ class views_plugin_style_mosaic_grid extends views_plugin_style {
'#description' => t("Hide incomplete last row of items."),
'#default_value' => $this->options['truncate'],
);
+
+ $form['hide_empty'] = array(
+ '#type' => 'checkbox',
+ '#title' => t('Hide empty fields'),
+ '#description' => t("Do not display items that are empty."),
+ '#default_value' => $this->options['hide_empty'],
+ );
}
/**