Merge remote-tracking branch 'site/1.1' into 1.1
This commit is contained in:
commit
1936c4451f
|
|
@ -77,7 +77,7 @@ class Post extends ComponentBase
|
|||
{
|
||||
$this->categoryPage = $this->page['categoryPage'] = $this->property('categoryPage');
|
||||
$this->post = $this->page['post'] = $this->loadPost();
|
||||
$this->page['meta_title'] = $this->post->title;
|
||||
//$this->page['meta_title'] = $this->post->title;
|
||||
if (!$this->post) {
|
||||
$this->setStatusCode(404);
|
||||
return $this->controller->run('404');
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@ secondaryTabs:
|
|||
author:
|
||||
label: 'Post author'
|
||||
span: auto
|
||||
default: 'ORIENT news'
|
||||
type: text
|
||||
tab: 'rainlab.blog::lang.post.tab_manage'
|
||||
featured:
|
||||
|
|
|
|||
|
|
@ -0,0 +1,19 @@
|
|||
# MIT license
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
of the Software, and to permit persons to whom the Software is furnished to do
|
||||
so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
<?php namespace RainLab\BlogVideo;
|
||||
|
||||
use Backend;
|
||||
use Controller;
|
||||
use Backend\Classes\BackendController;
|
||||
use System\Classes\PluginBase;
|
||||
use RainLab\Blog\Controllers\Posts as PostsController;
|
||||
use RainLab\Blog\Classes\TagProcessor;
|
||||
|
||||
class Plugin extends PluginBase
|
||||
{
|
||||
public $require = ['RainLab.Blog'];
|
||||
|
||||
public function pluginDetails()
|
||||
{
|
||||
return [
|
||||
'name' => 'Blog Video Extension',
|
||||
'description' => 'Adds responsive video embedding features to the RainLab Blog module.',
|
||||
'author' => 'Alexey Bobkov, Samuel Georges',
|
||||
'icon' => 'icon-video-camera',
|
||||
'homepage' => 'https://github.com/rainlab/blogvideo-plugin'
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Register method, called when the plugin is first registered.
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
PostsController::extend(function($controller) {
|
||||
if (!in_array(BackendController::$action, ['create', 'update'])) return;
|
||||
$controller->addJs('/plugins/rainlab/blogvideo/assets/js/blog-video.js');
|
||||
$controller->addCss('/plugins/rainlab/blogvideo/assets/css/blog-video.css');
|
||||
});
|
||||
|
||||
/*
|
||||
* Register the video tag processing callback
|
||||
*/
|
||||
TagProcessor::instance()->registerCallback(function($input, $preview) {
|
||||
if (!$preview) return $input;
|
||||
|
||||
$popup = file_get_contents(__DIR__.'/partials/popup.htm');
|
||||
|
||||
return preg_replace('|\<img src="video" alt="([0-9]+)" \/>|m',
|
||||
'<span class="video-placeholder" data-index="$1">
|
||||
<a href="#">Click to embed a video...</a>
|
||||
'.$popup.'
|
||||
</span>',
|
||||
$input);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
# Blog Video plugin
|
||||
|
||||
This plugin extends the [RainLab Blog plugin](/plugin/rainlab-blog) with the responsive video embedding features. The plugin was tested with Vimeo and YouTube videos, but in theory it can be used with any video service which uses iframes for embedding.
|
||||
|
||||
## Adding video to a post
|
||||
|
||||
Use the following syntax to insert a video placeholder to a blog post:
|
||||
|
||||

|
||||
|
||||
The number in the first part is the placeholder index. If you use multiple videos in a post you should use unique indexes:
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
## Styling the responsive videos
|
||||
|
||||
The plugin adds a wrapping DIV element around the embedded iframe element. The wrapper allows to make the video responsive, fit the containing column and maintain the aspect ratio.
|
||||
|
||||
<div class="video-wrapper ratio-16-9"><iframe ...></iframe></div>
|
||||
|
||||
Add the following CSS code to your website in order to support the video wrapper:
|
||||
|
||||
.video-wrapper {
|
||||
position: relative;
|
||||
padding-top: 25px;
|
||||
margin-bottom: 15px;
|
||||
height: 0;
|
||||
}
|
||||
|
||||
.video-wrapper.ratio-5-4 {padding-bottom: 80%;}
|
||||
.video-wrapper.ratio-4-3 {padding-bottom: 70%;}
|
||||
.video-wrapper.ratio-16-10 {padding-bottom: 62.5%;}
|
||||
.video-wrapper.ratio-16-9 {padding-bottom: 56.25%;}
|
||||
|
||||
.video-wrapper iframe {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%!important;
|
||||
height: 100%!important;
|
||||
}
|
||||
|
|
@ -0,0 +1,72 @@
|
|||
.blog-post-preview span.video-placeholder {
|
||||
background: #ecf0f1;
|
||||
display: block;
|
||||
border: 1px solid #e5e9ec;
|
||||
padding: 25px;
|
||||
min-height: 123px;
|
||||
position: relative;
|
||||
text-align: center;
|
||||
cursor: pointer;
|
||||
margin-bottom: 20px;
|
||||
-webkit-box-sizing: border-box;
|
||||
-moz-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.blog-post-preview span.video-placeholder a {
|
||||
color: #b1b9be;
|
||||
font-size: 16px;
|
||||
display: inline-block;
|
||||
margin-top: 25px;
|
||||
text-decoration: none;
|
||||
}
|
||||
.blog-post-preview span.video-placeholder:before {
|
||||
display: inline-block;
|
||||
font-family: FontAwesome;
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
text-decoration: inherit;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
*margin-right: .3em;
|
||||
content: "\f03d";
|
||||
position: absolute;
|
||||
left: 25px;
|
||||
top: 25px;
|
||||
line-height: 100%;
|
||||
font-size: 73px;
|
||||
color: #d1d3d4;
|
||||
}
|
||||
.blog-post-preview span.video-placeholder.hover,
|
||||
.blog-post-preview span.video-placeholder:hover {
|
||||
background: #2f99da;
|
||||
}
|
||||
.blog-post-preview span.video-placeholder.hover:before,
|
||||
.blog-post-preview span.video-placeholder:hover:before,
|
||||
.blog-post-preview span.video-placeholder.hover a,
|
||||
.blog-post-preview span.video-placeholder:hover a {
|
||||
color: white;
|
||||
}
|
||||
.blog-post-preview .video-wrapper {
|
||||
position: relative;
|
||||
padding-top: 25px;
|
||||
margin-bottom: 15px;
|
||||
height: 0;
|
||||
}
|
||||
.blog-post-preview .video-wrapper.ratio-5-4 {
|
||||
padding-bottom: 80%;
|
||||
}
|
||||
.blog-post-preview .video-wrapper.ratio-4-3 {
|
||||
padding-bottom: 70%;
|
||||
}
|
||||
.blog-post-preview .video-wrapper.ratio-16-10 {
|
||||
padding-bottom: 62.5%;
|
||||
}
|
||||
.blog-post-preview .video-wrapper.ratio-16-9 {
|
||||
padding-bottom: 56.25%;
|
||||
}
|
||||
.blog-post-preview .video-wrapper iframe {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%!important;
|
||||
height: 100%!important;
|
||||
}
|
||||
|
|
@ -0,0 +1,126 @@
|
|||
+function ($) { "use strict";
|
||||
var VideoTagProcessor = function() {
|
||||
this.$form = $('#post-form')
|
||||
this.$markdownEditor = $('[data-field-name=content] [data-control=markdowneditor]:first', this.$form)
|
||||
|
||||
this.addToolbarButton()
|
||||
this.initHandlers()
|
||||
}
|
||||
|
||||
VideoTagProcessor.prototype.addToolbarButton = function() {
|
||||
this.buttonClickCount = 1
|
||||
|
||||
var self = this,
|
||||
$button = this.$markdownEditor.markdownEditor('addToolbarButton', 'blogvideo', {
|
||||
label: 'markdowneditor.video',
|
||||
icon: 'video-camera',
|
||||
action: 'insertLine',
|
||||
template: '\n\n\n',
|
||||
insertAfter: 'image'
|
||||
})
|
||||
|
||||
$button.on('click', function() {
|
||||
$button.data('button-template', '\n\n\n')
|
||||
self.buttonClickCount++
|
||||
})
|
||||
}
|
||||
|
||||
VideoTagProcessor.prototype.initHandlers = function() {
|
||||
var self = this
|
||||
|
||||
this.$markdownEditor.on('click', '.editor-preview span.video-placeholder', function() {
|
||||
var $this = $(this)
|
||||
|
||||
/*
|
||||
* This is an unusual way to display a popup.
|
||||
* We use it because the popup contents
|
||||
* is loaded from the hidden script element
|
||||
*/
|
||||
$this.popup({
|
||||
content: $('script[type="text/template"]', $this).html()
|
||||
})
|
||||
|
||||
var popup = $this.data('oc.popup'),
|
||||
$textarea = $('textarea', popup.$content),
|
||||
placeholderIndex = $this.data('index')
|
||||
|
||||
setTimeout(function(){
|
||||
popup.setLoading(false)
|
||||
$textarea.focus()
|
||||
}, 500)
|
||||
|
||||
$('button[type=submit]', popup.$target).click(function() {
|
||||
self.embedVideo($textarea, placeholderIndex, $this, popup)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
VideoTagProcessor.prototype.embedVideo = function($textarea, placeholderIndex, $placeholder, popup) {
|
||||
var text = $.trim($textarea.val())
|
||||
|
||||
if (!text.length) {
|
||||
alert('Please paste the video code to embed.')
|
||||
$textarea.focus()
|
||||
return
|
||||
}
|
||||
|
||||
/*
|
||||
* Calculate the aspect ratio from the iframe width and height
|
||||
*/
|
||||
var widthRegex = /width\s*=\s*"([0-9]+)"/g,
|
||||
heightRegex = /height\s*=\s*"([0-9]+)"/g,
|
||||
widthMatch = widthRegex.exec(text),
|
||||
heightMatch = heightRegex.exec(text),
|
||||
ratioClass = null,
|
||||
padding = null;
|
||||
|
||||
if (widthMatch && heightMatch && widthMatch.length >= 1 && heightMatch.length >= 1) {
|
||||
var ratio = heightMatch[1] / widthMatch[1] * 100
|
||||
|
||||
ratioClass = this.getRatioClass(ratio)
|
||||
|
||||
padding = ratio + '%'
|
||||
}
|
||||
|
||||
var $wrapper = $('<div class="video-wrapper"></div>')
|
||||
if (ratioClass)
|
||||
$wrapper.addClass(ratioClass)
|
||||
else
|
||||
$wrapper.css('padding-bottom', padding)
|
||||
|
||||
$wrapper.html(text)
|
||||
|
||||
var wrapperText = $('<div>').append($wrapper.clone()).html()
|
||||
|
||||
$.oc.blogPostForm.replacePlaceholder(
|
||||
$placeholder,
|
||||
wrapperText,
|
||||
'',
|
||||
wrapperText
|
||||
);
|
||||
|
||||
popup.hide()
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
VideoTagProcessor.prototype.getRatioClass = function(ratio) {
|
||||
if (Math.abs(ratio-80) < 1)
|
||||
return 'ratio-5-4'
|
||||
|
||||
if (Math.abs(ratio-70) < 1)
|
||||
return 'ratio-4-3'
|
||||
|
||||
if (Math.abs(ratio-62.5) < 1)
|
||||
return 'ratio-16-10'
|
||||
|
||||
if (Math.abs(ratio-56.25) < 1)
|
||||
return 'ratio-16-9'
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
$(document).ready(function(){
|
||||
new VideoTagProcessor()
|
||||
})
|
||||
}(window.jQuery);
|
||||
|
|
@ -0,0 +1,75 @@
|
|||
@import "../../../../../modules/backend/assets/less/core/boot.less";
|
||||
|
||||
.blog-post-preview {
|
||||
span.video-placeholder {
|
||||
background: #ecf0f1;
|
||||
display: block;
|
||||
border: 1px solid #e5e9ec;
|
||||
padding: 25px;
|
||||
min-height: 123px;
|
||||
position: relative;
|
||||
text-align: center;
|
||||
cursor: pointer;
|
||||
margin-bottom: 20px;
|
||||
|
||||
.box-sizing(border-box);
|
||||
|
||||
a {
|
||||
color: #b1b9be;
|
||||
font-size: 16px;
|
||||
display: inline-block;
|
||||
margin-top: 25px;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
&:before {
|
||||
display: inline-block;
|
||||
.icon(@video-camera);
|
||||
position: absolute;
|
||||
left: 25px;
|
||||
top: 25px;
|
||||
line-height: 100%;
|
||||
font-size: 73px;
|
||||
color: #d1d3d4;
|
||||
}
|
||||
|
||||
&.hover, &:hover {
|
||||
background: #2f99da;
|
||||
|
||||
&:before, a {
|
||||
color: white;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.video-wrapper {
|
||||
position: relative;
|
||||
padding-top: 25px;
|
||||
margin-bottom: 15px;
|
||||
height: 0;
|
||||
|
||||
&.ratio-5-4 {
|
||||
padding-bottom: 80%;
|
||||
}
|
||||
|
||||
&.ratio-4-3 {
|
||||
padding-bottom: 70%;
|
||||
}
|
||||
|
||||
&.ratio-16-10 {
|
||||
padding-bottom: 62.5%;
|
||||
}
|
||||
|
||||
&.ratio-16-9 {
|
||||
padding-bottom: 56.25%;
|
||||
}
|
||||
}
|
||||
|
||||
.video-wrapper iframe {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%!important;
|
||||
height: 100%!important;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"name": "rainlab/blogvideo-plugin",
|
||||
"type": "october-plugin",
|
||||
"description": "None",
|
||||
"require": {
|
||||
"composer/installers": "~1.0"
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
<script type="text/template" class="popup hide">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="popup">×</button>
|
||||
<h4 class="modal-title">Add video</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="form-group">
|
||||
<label>Video iframe code</label>
|
||||
<textarea class="form-control field-textarea size-small" name="embed-text"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button
|
||||
type="submit"
|
||||
class="btn btn-primary">
|
||||
Add
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="btn btn-default"
|
||||
data-dismiss="popup">
|
||||
Cancel
|
||||
</button>
|
||||
</div>
|
||||
</script>
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
1.0.1: First version of Blog Video plugin
|
||||
1.0.2: Fixes issue where videos cannot be uploaded caused by latest Markdown library.
|
||||
1.1.0: Adds a new Video button to the Markdown editor toolbar.
|
||||
1.1.1: Minor styling update.
|
||||
1.1.2: Update toolbar icon.
|
||||
|
|
@ -457,4 +457,5 @@
|
|||
'System\\Twig\\MailPartialNode' => 'modules/system/twig/MailPartialNode.php',
|
||||
'System\\Models\\MailPartial' => 'modules/system/models/MailPartial.php',
|
||||
'Cms\\Twig\\DefaultNode' => 'modules/cms/twig/DefaultNode.php',
|
||||
'rainlab\\blogvideo\\Plugin' => 'plugins/rainlab/blogvideo/Plugin.php',
|
||||
);
|
||||
|
|
@ -9,5 +9,5 @@ title = "Contact us"
|
|||
<div class="main__sidebar-title">Contacts</div>
|
||||
<div class="address">
|
||||
<div class="address__inner">Address: Turkmenistan, Ashgabat city, Makhtumkuli avenue, 72</div>
|
||||
<div class="address__inner"><span>Phone:</span> <a href="">(+99312) </a>211059</div>
|
||||
<div class="address__inner"><span>Phone:</span> <a href="">(+99312) </a>211059</div>
|
||||
<div class="address__inner"><span>Email:</span> <a href="#">info@orient.tm</a></div></div>
|
||||
|
|
@ -1,11 +1,12 @@
|
|||
[viewBag]
|
||||
title = "Связаться с нами"
|
||||
url = "/contact-us"
|
||||
url = "/habarlash"
|
||||
layout = "contacts"
|
||||
is_hidden = 0
|
||||
navigation_hidden = 0
|
||||
robot_index = "index"
|
||||
robot_follow = "follow"
|
||||
localeUrl[en] = "/habarlash"
|
||||
==
|
||||
{% put form %}
|
||||
<div class="form__title">Обратная связь</div>
|
||||
|
|
@ -16,5 +17,5 @@ robot_follow = "follow"
|
|||
<div class="main__sidebar-title">Наши контакты:</div>
|
||||
<div class="address">
|
||||
<div class="address__inner"><span>Наш адрес:</span> Туркменистан, г.Ашхабад, проспект Махтумкули, 72</div>
|
||||
<div class="address__inner"><span>Тел:</span> <a href="">(+99312) </a>211059</div>
|
||||
<div class="address__inner"><span>Тел:</span> <a href="">(+99312) </a>211059</div>
|
||||
<div class="address__inner"><span>Email:</span> <a href="#">info@orient.tm</a></div></div>
|
||||
|
|
@ -103,10 +103,10 @@ random = 0
|
|||
<div class="main__banner">
|
||||
{% component 'adv_center_5' %}
|
||||
</div>
|
||||
{% partial 'index/partner_news' %}
|
||||
|
||||
</div>
|
||||
<div class="main__sidebar">
|
||||
|
||||
{% partial 'index/partner_news' %}
|
||||
{% component 'right_top' css_class= 'main__sidebar-adv' %}
|
||||
{% partial 'tags' %}
|
||||
{% component 'right_middle' css_class = 'main__sidebar-adv' %}
|
||||
|
|
@ -117,7 +117,4 @@ random = 0
|
|||
</div>
|
||||
</section>
|
||||
<!-- main end
|
||||
================================================ -->
|
||||
|
||||
|
||||
|
||||
================================================ -->
|
||||
|
|
@ -9,8 +9,7 @@ maxItems = 6
|
|||
{{'partner_news'|_}}
|
||||
</div>
|
||||
<div class="main__body-row ">
|
||||
<div class="main__body-column border">
|
||||
{% for news in rssItems.items.slice(0,3) %}
|
||||
{% for news in rssItems.items %}
|
||||
|
||||
<div class="card other">
|
||||
<div class="card__header">
|
||||
|
|
@ -34,33 +33,6 @@ maxItems = 6
|
|||
</div>
|
||||
|
||||
{% endfor %}
|
||||
</div>
|
||||
<div class="main__body-column border">
|
||||
{% for news in rssItems.items.slice(3) %}
|
||||
|
||||
<div class="card other">
|
||||
<div class="card__header">
|
||||
<div class="card__header-category ">
|
||||
{{news.source}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="card__header">
|
||||
<div class="card__header-date"><span>{{news.published_at|date('d.m.Y')}}</span>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="4" height="4"
|
||||
viewBox="0 0 4 4">
|
||||
<path id="Polygon_1" data-name="Polygon 1" d="M2,0,4,2,2,4,0,2Z"
|
||||
fill="#a2a2a2" />
|
||||
</svg>
|
||||
<span>{{news.published_at|date('H:i')}}</span>
|
||||
</div>
|
||||
</div>
|
||||
<a href="{{news.link}}" class="card__link" target="_blank">
|
||||
{{news.title}}
|
||||
</a>
|
||||
</div>
|
||||
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
|
@ -10,23 +10,23 @@ postPage = "post"
|
|||
|
||||
[blogPosts featuredPosts]
|
||||
pageNumber = "{{ :page }}"
|
||||
postsPerPage = 8
|
||||
featured = 1
|
||||
postsPerPage = 4
|
||||
noPostsMessage = "No posts found"
|
||||
sortOrder = "published_at desc"
|
||||
categoryPage = "category"
|
||||
postPage = "post"
|
||||
featured = 1
|
||||
==
|
||||
<div class="marquee">
|
||||
<a href="#" class="marquee__link">
|
||||
{{'Главное'|_}}
|
||||
</a>
|
||||
<div>{% for post in featuredPosts %} <a href="{{'post'|page({id:post.id,slug:post.slug})}}">{{post.title}}</a> {% endfor %}</div>
|
||||
<div>{% for post in featuredPosts.posts %} <a href="{{'post'|page({id:post.id,slug:post.slug})}}">{{post.title}}</a> {% endfor %}</div>
|
||||
</div>
|
||||
<div class="swiper-container mySwiper">
|
||||
<div class="swiper-wrapper">
|
||||
|
||||
{% for post in posts.slice(0,3) %}
|
||||
{% for post in blogPosts.posts.slice(0,3) %}
|
||||
<div class="swiper-slide">
|
||||
<div class="swiper-slide-image" style=" background: url({{post.featured_image|media_cdn}}) no-repeat center center ;background-size: cover;
|
||||
-webkit-background-size: cover;
|
||||
|
|
@ -93,7 +93,7 @@ featured = 1
|
|||
</svg>
|
||||
</div>
|
||||
<div class="newsSlider">
|
||||
{% for post in posts.slice(3) %}
|
||||
{% for post in blogPosts.posts.slice(3) %}
|
||||
<div class="newsSlider__item">
|
||||
<img src="{{post.featured_image|media_cdn}}" alt="{{post.title}}">
|
||||
<div class="newsSlider__item-content">
|
||||
|
|
@ -112,4 +112,4 @@ featured = 1
|
|||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
Loading…
Reference in New Issue