Skip to content

Commit

Permalink
[FEATURE] add news-carousel template for NEWS extension
Browse files Browse the repository at this point in the history
  • Loading branch information
dmh committed Jul 1, 2016
1 parent 0deded7 commit b442edd
Show file tree
Hide file tree
Showing 8 changed files with 455 additions and 29 deletions.
3 changes: 3 additions & 0 deletions dev/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
@import 'main/contentElements/carousel.js';
@import 'main/contentElements/parallax.js';

// plugins
@import 'main/plugins/news/newsCarousel.js';

@import 'main/suggest.js';

@import 'main/general.js';
42 changes: 42 additions & 0 deletions dev/js/main/plugins/news/newsCarousel.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
(function($) {
'use strict';

// document load event
$(document).ready(function() {

// initialize swiper when document ready
// http://idangero.us/swiper/api/
$('.js__news-carousel').swiper({
nextButton: '.js__news-carousel__btn-next',
prevButton: '.js__news-carousel__btn-prev',
pagination: '.js__news-carousel__pagination',
paginationClickable: true,
slidesPerView: 4,
preloadImages: false,
roundLengths: true,
spaceBetween: 30,

// Responsive breakpoints
breakpoints: {

// when window width is <= 480px
500: {
slidesPerView: 1
},
// when window width is <= 768px
767: {
slidesPerView: 2
},
// when window width is <= 992px
991: {
slidesPerView: 3
},
// when window width is <= 1199px
1199: {
slidesPerView: 4
}
}
});
});

})(jQuery);
1 change: 1 addition & 0 deletions dev/styles/main.less
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

// ext News
@import "main/plugins/news/news.less";
@import "main/plugins/news/newsCarousel.less";
// ext Search
@import "main/plugins/search/search.less";
@import "main/plugins/search/searchSuggest.less";
Expand Down
2 changes: 1 addition & 1 deletion dev/styles/main/plugins/news/news.less
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
}

.news .article h3 {
margin-bottom: 0;
// margin-bottom: 0;
}

.news .footer {
Expand Down
180 changes: 180 additions & 0 deletions dev/styles/main/plugins/news/newsCarousel.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,180 @@
.news-carousel {
position: relative;
margin: 40px 0 20px;
}

@media (min-width: 992px) and (max-width: 1090px) {
.news-carousel {
padding: 0 30px;
}
}
@media (min-width: 1200px) and (max-width: 1300px) {
.news-carousel {
padding: 0 30px;
}
}

.news-carousel__wrapper {
padding-bottom: 40px;
}

.news-carousel__media-preview {
min-height: 180px;
background-size: cover;
background-repeat: no-repeat;
background-position: 50% 50%;
margin-bottom: 20px;
}

.news-carousel__img-wrap {
position: relative;
}

//header
.news-carousel__slide .news-article-header h3 {
font-size: 18px;
}

//info
.news-carousel__item-info {
z-index: 90;
text-align: right;
right: 0;
position: absolute;
background-color: fade(shade(@main-color, 80%), 80%);
padding: 10px 10px;
bottom: 0;
text-transform: uppercase;
font-size: 14px;
}

.news-carousel__item-info .news-list-category{
color: @main-color;
}

.news-list-category:before{
font-family: 'icons';
speak: none;
position: relative;
display: inline-block;
top: 1px;
font-style: normal;
font-weight: normal;
font-variant: normal;
text-transform: none;
line-height: 1;
/* Better Font Rendering =========== */
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
// .icons();
content: "\f115";
padding-right: 6px;
}

.news-carousel__item-info .news-list-category:after {
border-right: 1px solid @main-color;
content: '';
height: 12px;
padding-right: 4px;
margin-top: 4px;
position: absolute;
}

.news-carousel__item-info .news-list-date {
padding-left: 8px;
color: #fff;
}

.news-carousel__btn-next, .news-carousel__btn-prev {
display: none;
}

@media (min-width: 992px) {
.news-carousel__btn-next, .news-carousel__btn-prev {
display: block;
background: none;
.icons();
color: @main-color;
-moz-osx-font-smoothing: grayscale;
height: auto;
font-size: 30px;
}
}

.news-carousel__btn-next{
right: -50px;
}
.news-carousel__btn-prev{
left: -50px;
}
@media (min-width: 992px) and (max-width: 1090px) {
.news-carousel__btn-next{
right: -12px;
}
.news-carousel__btn-prev{
left: -12px;
}
}
@media (min-width: 1200px) and (max-width: 1300px) {
.news-carousel__btn-next{
right: -16px;
}
.news-carousel__btn-prev{
left: -16px;
}
}

.news-carousel__btn-next:before{
content: '\e675';
}
.news-carousel__btn-prev:before{
content: '\e672';
}


.news-carousel__pagination .swiper-pagination-bullet-active {
background: @main-color;
}

.news-carousel__img-wrap a:after{
content:'';
top: 0;
left: 0;
z-index: 10;
width: 100%;
height: 100%;
display: block;
position: absolute;
background: @main-color;
opacity: 0;
visibility: hidden;
transition: opacity 0.5s ease, visibility 0.5s ease;
}
.news-carousel__img-wrap a:hover:after{
opacity: 0.7;
visibility: visible;
}
.news-carousel__img-wrap a:before{
.icons();
content:'zdfvzddz';
position: absolute;
font-size: 38px;
padding: 12px;
border: 2px solid tint(@main-color, 90%);
border-radius: 50%;
top: 50%;
left: 50%;
margin-left: -33px;
margin-top: -33px;
z-index: 110;
color: tint(@main-color, 90%);
opacity: 0;
visibility: hidden;
content: '\e943';
transition: opacity 0.5s ease, visibility 0.5s ease;
}

.news-carousel__img-wrap a:hover:before{
opacity: 1;
visibility: visible;
}
17 changes: 17 additions & 0 deletions dev/templates/pages/content/plugins/newsCarousel.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
#layout: default.hbs #by default it is default.hbs, but you can specify another one
title: News Carousel #title in menu
position: 4 #position in menu
hideInMenu: false #if true, will be hidden in menu
hideInBreadcrumbs: false #if true, will be hidden in breadcrumbs
externalLink: false #just add link (http://link.com) instead of "false" to use this page like a link to external page.
---
{{> breadcrumbs}}

<div class="container">
<div class="row">
<div class="col-md-12">
{{> newsCarousel}}
</div>
</div>
</div>
45 changes: 17 additions & 28 deletions dev/templates/pages/index.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -81,42 +81,24 @@ externalLink: false #just add link (http://link.com) instead of "false" to use t
<div class="parallax parallax-video" data-jarallax-video="https://www.youtube.com/watch?v=lu2oSpoRp60" style=" background-image: url('images/slider_image.jpg'); height:auto;">
<div class="inverse">
<div id="c181" class="container ">
<div class="row">
<div class="row">
<div class="col1 col-md-8 one-column-align-center">
<div class="blue-mountain-header">
<div id="c183" class="text-center margin-top-50">
<div class="blue-mountain-header margin-top-50">
<div id="c183" class="text-center ">
<h2>Lorem ipsum dolor sit amet markum</h2>
</div>
</div>
<div id="c183" class="text-center">
<div class="ce-textpic ce-right ce-intext">
<div class="ce-bodytext">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam in dui mauris. Vivamus hendrerit arcu sed erat molestie vehicula. Sed auctor neque eu tellus rhoncus ut eleifend nibh porttitfhghfhor. Ut in nulla enim. Phasellus class aptent taciti sociosqu.</p>
<div class="margin-bottom-30">
<div id="c183" class="text-center">
<div class="ce-textpic ce-right ce-intext">
<div class="ce-bodytext">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam in dui mauris. Vivamus hendrerit arcu sed erat molestie vehicula. Sed auctor neque eu tellus rhoncus ut eleifend nibh porttitfhghfhor. Ut in nulla enim. Phasellus class aptent taciti sociosqu.</p>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-6">
{{ renderContent 'bigIconTextButton'
bigTopIcon="users"
header="Content element 1"
text="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam in dui mauris. Vivamus hendrerit arcu sed erat molestie vehicula. Sed auctor neque eu tellus rhoncus ut eleifend nibh porttitfhghfhor. Ut in nulla enim. Phasellus class aptent taciti sociosqu."
buttonName="READ MORE"
btnAsLink=false
}}
</div>
<div class="col-md-6">
{{ renderContent 'bigIconTextButton'
bigTopIcon="tablet"
header="Content element 1"
text="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam in dui mauris. Vivamus hendrerit arcu sed erat molestie vehicula. Sed auctor neque eu tellus rhoncus ut eleifend nibh porttitfhghfhor. Ut in nulla enim. Phasellus class aptent taciti sociosqu."
buttonName="READ MORE"
btnAsLink=false
}}
</div>
</div>
</div>
</div>
</div>
</div>
Expand Down Expand Up @@ -590,6 +572,13 @@ externalLink: false #just add link (http://link.com) instead of "false" to use t
</div>
</div>

<div class="container">
<div class="row">
<div class="col-md-12">
{{>newsCarousel}}
</div>
</div>
</div>

<div class="container">
<div class="row">
Expand Down
Loading

0 comments on commit b442edd

Please sign in to comment.