Commit 4b403a0d authored by i.mashevskyi@internetdevels.com's avatar i.mashevskyi@internetdevels.com
Browse files

Fix code

parent e917b795
......@@ -473,6 +473,7 @@ display:
header: false
style: false
row: false
css_class: false
displays:
block_1: block_1
attachment_position: after
......@@ -504,6 +505,7 @@ display:
inline: { }
separator: ''
hide_empty: false
css_class: top-product-5
cache_metadata:
max-age: -1
contexts:
......@@ -785,7 +787,7 @@ display:
plugin_id: field
title: 'Most popular product'
header: { }
css_class: top-product-5
css_class: ''
cache_metadata:
max-age: -1
contexts:
......
......@@ -13,7 +13,6 @@ dependencies:
- statistics
- text
- user
- views_fieldsets
id: top_5_products
label: 'Top 5 products'
module: views
......@@ -63,7 +62,7 @@ display:
type: default
options:
grouping: { }
row_class: row--prod
row_class: ''
default_row_class: true
row:
type: fields
......@@ -337,64 +336,6 @@ display:
title: false
header: false
fields:
fieldset:
id: fieldset
table: views
field: fieldset
relationship: none
group_type: group
admin_label: ''
label: ''
exclude: false
alter:
alter_text: false
text: ''
make_link: false
path: ''
absolute: false
external: false
replace_spaces: false
path_case: none
trim_whitespace: false
alt: ''
rel: ''
link_class: ''
prefix: ''
suffix: ''
target: ''
nl2br: false
max_length: 0
word_boundary: true
ellipsis: true
more_link: false
more_link_text: ''
more_link_path: ''
strip_tags: false
trim: false
preserve_tags: ''
html: false
element_type: ''
element_class: ''
element_label_type: ''
element_label_class: ''
element_label_colon: true
element_wrapper_type: ''
element_wrapper_class: ''
element_default_classes: true
empty: ''
hide_empty: false
empty_zero: false
hide_alter_empty: true
fields:
- title
- field_image
- body
wrapper: div
legend: ''
classes: list--prod
collapsible: 1
collapsed: 0
plugin_id: fieldset
title:
id: title
table: node_field_data
......
.list--prod {
padding: 5px 5px 5px 0px;
width: 100%;
}
.show-more {
cursor: pointer;
background-color: #0a7bc1;
......@@ -12,4 +8,10 @@
padding-top: 4px;
color: white;
margin: auto;
transition: 0.7s;
}
.show-more:hover {
background-color: #001f90;
box-shadow: 0 5px 7px black;
}
\ No newline at end of file
(function ($) {
Drupal.behaviors.showMoreButton = {
attach: function (context,settings) {
$( ".top-product" ).once().after( "<div class='show-more'>Show more</div>" );
$( ".top-product-5" ).once().after( "<div class='show-more'>Show more</div>" );
if ($('.list--prod').length > 3) {
$('.list--prod:gt(2)').hide();
$('.show-more').show();
}
attach: function (context, settings) {
var $view = $(".view-id-top_5_products .view-content, .view-display-id-attachment_2 .view-content");
$view.once().after("<div class='show-more'>Show more</div>");
var $rows = $('.views-row', $view);
if ($rows.length > 3) {
$('.views-row:gt(2)', $view).hide();
$('.show-more', $view).show();
$('.show-more').on('click', function() {
$('.list--prod:gt(2)').toggle();
$(this).text() === 'Show more' ? $(this).text('Show less') : $(this).text('Show more');
});
$('.show-more').once().on('click', function () {
$('.views-row:gt(2)', $view).slideToggle();
$(this).text() === 'Show more' ? $(this).text('Show less') : $(this).text('Show more');
});
}
}
};
})(jQuery, Drupal);
\ No newline at end of file
})(jQuery, Drupal);
......@@ -6,5 +6,5 @@ global-scripts:
- core/drupal
global-styling:
css:
module:
component:
css/show_more_button.css: {}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment