mirror of
https://github.com/Oreolek/ifhub.club.git
synced 2024-06-28 20:45:00 +03:00
Компонент media перенесен во фреймворк
This commit is contained in:
parent
d821eecd92
commit
da032e459d
|
@ -1,3 +0,0 @@
|
||||||
# Компонент media
|
|
||||||
|
|
||||||
Загрузка/управление медиа-файлами для последующей вставки в редактор (компонент editor).
|
|
|
@ -1,27 +0,0 @@
|
||||||
{
|
|
||||||
"name": "media",
|
|
||||||
"version": "1.0.0",
|
|
||||||
"dependencies": {
|
|
||||||
"modal": "*",
|
|
||||||
"tabs": "*",
|
|
||||||
"uploader": "*"
|
|
||||||
},
|
|
||||||
"templates": {
|
|
||||||
"content": "media-content.tpl",
|
|
||||||
"media": "media.tpl",
|
|
||||||
"pane.insert": "panes/pane.insert.tpl",
|
|
||||||
"pane.photoset": "panes/pane.photoset.tpl",
|
|
||||||
"pane.preview": "panes/pane.preview.tpl",
|
|
||||||
"pane": "panes/pane.tpl",
|
|
||||||
"pane.url": "panes/pane.url.tpl",
|
|
||||||
"uploader-block.insert.image": "uploader/uploader-block.insert.image.tpl",
|
|
||||||
"uploader-block.photoset": "uploader/uploader-block.photoset.tpl",
|
|
||||||
"uploader": "uploader/uploader.tpl"
|
|
||||||
},
|
|
||||||
"scripts": {
|
|
||||||
"media": "js/media.js"
|
|
||||||
},
|
|
||||||
"styles": {
|
|
||||||
"media": "css/media.css"
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,47 +0,0 @@
|
||||||
/**
|
|
||||||
* Media
|
|
||||||
*/
|
|
||||||
|
|
||||||
.ls-modal.ls-media {
|
|
||||||
max-width: 1130px;
|
|
||||||
border: none;
|
|
||||||
background: #222;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Nav */
|
|
||||||
.ls-media-nav .ls-tab-list {
|
|
||||||
width: 160px;
|
|
||||||
padding-top: 15px;
|
|
||||||
}
|
|
||||||
.ls-media-nav .ls-tab {
|
|
||||||
padding: 10px 15px;
|
|
||||||
background: #222;
|
|
||||||
color: #eee;
|
|
||||||
}
|
|
||||||
.ls-media-nav .ls-tab:hover {
|
|
||||||
background: #2a2a2a;
|
|
||||||
}
|
|
||||||
.ls-media-nav .ls-tab.active {
|
|
||||||
background: #333;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Panes */
|
|
||||||
.ls-media-nav .ls-tabs-panes {
|
|
||||||
overflow: hidden;
|
|
||||||
margin-left: 160px;
|
|
||||||
background: #fff;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Content */
|
|
||||||
.ls-media-pane-content {
|
|
||||||
min-height: 300px;
|
|
||||||
padding: 15px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Footer */
|
|
||||||
.ls-media-pane-footer {
|
|
||||||
padding: 15px;
|
|
||||||
background: #fafafa;
|
|
||||||
border-top: 1px solid #eee;
|
|
||||||
text-align: right;
|
|
||||||
}
|
|
|
@ -1,351 +0,0 @@
|
||||||
/**
|
|
||||||
* Media
|
|
||||||
*
|
|
||||||
* @module ls/media
|
|
||||||
*
|
|
||||||
* @license GNU General Public License, version 2
|
|
||||||
* @copyright 2013 OOO "ЛС-СОФТ" {@link http://livestreetcms.com}
|
|
||||||
* @author Denis Shakhov <denis.shakhov@gmail.com>
|
|
||||||
*
|
|
||||||
* TODO: Фильтрация файлов по типу при переключении табов
|
|
||||||
*/
|
|
||||||
|
|
||||||
(function($) {
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
$.widget( "livestreet.lsMedia", $.livestreet.lsComponent, {
|
|
||||||
/**
|
|
||||||
* Дефолтные опции
|
|
||||||
*/
|
|
||||||
options: {
|
|
||||||
// Редактор к которому привязано текущее окно
|
|
||||||
editor: $(),
|
|
||||||
|
|
||||||
// Ссылки
|
|
||||||
urls: {
|
|
||||||
// Вставка файла
|
|
||||||
insert: aRouter.ajax + 'media/submit-insert/',
|
|
||||||
// Вставка фотосета
|
|
||||||
photoset: aRouter.ajax + 'media/submit-create-photoset',
|
|
||||||
// Загрузка файла по ссылке
|
|
||||||
url_upload: aRouter.ajax + 'media/upload-link/',
|
|
||||||
// Вставка файла по ссылке
|
|
||||||
url_insert: aRouter.ajax + 'media/upload-insert/'
|
|
||||||
},
|
|
||||||
|
|
||||||
// Селекторы
|
|
||||||
selectors: {
|
|
||||||
nav: '.js-media-nav',
|
|
||||||
uploader: '.js-media-uploader',
|
|
||||||
block: '.js-media-info-block',
|
|
||||||
blocks: '.js-media-uploader .js-media-info-block',
|
|
||||||
insert_submit: '.js-media-insert-submit',
|
|
||||||
photoset_submit: '.js-media-photoset-submit',
|
|
||||||
url: {
|
|
||||||
form: '.js-media-url-form',
|
|
||||||
url: '.js-media-url-form-url',
|
|
||||||
block_container: '.js-media-url-settings-blocks',
|
|
||||||
blocks: '.js-media-url-settings-blocks .js-media-info-block',
|
|
||||||
submit_upload: '.js-media-url-submit-upload',
|
|
||||||
submit_insert: '.js-media-url-submit-insert',
|
|
||||||
image_preview: '.js-media-url-image-preview'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
uploader_options: {},
|
|
||||||
|
|
||||||
params: {}
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Конструктор
|
|
||||||
*
|
|
||||||
* @constructor
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
_create: function () {
|
|
||||||
this._super();
|
|
||||||
|
|
||||||
// Получаем редактор
|
|
||||||
! this.option( 'editor' ).length && this.option( 'editor', $( '#' + this.element.data( 'media-editor') ) );
|
|
||||||
|
|
||||||
// Иниц-ия загрузчика
|
|
||||||
this.elements.uploader.lsUploader( $.extend( {}, this.option( 'uploader_options' ), {
|
|
||||||
autoload: false,
|
|
||||||
params: {
|
|
||||||
security_ls_key: LIVESTREET_SECURITY_KEY
|
|
||||||
},
|
|
||||||
filebeforeactivate: this._onFileBeforeActivate.bind( this )
|
|
||||||
}));
|
|
||||||
|
|
||||||
this._list = this.elements.uploader.lsUploader( 'getElement', 'list' );
|
|
||||||
this._originalTargetType = this.elements.uploader.lsUploader( 'option', 'params.target_type' );
|
|
||||||
|
|
||||||
// Табы
|
|
||||||
this.elements.nav.lsTabs({
|
|
||||||
tabactivate: this._onTabActivate.bind( this )
|
|
||||||
});
|
|
||||||
|
|
||||||
// Иниц-ия модального окна
|
|
||||||
this.element.lsModal({
|
|
||||||
aftershow: this.reload.bind( this )
|
|
||||||
});
|
|
||||||
|
|
||||||
//
|
|
||||||
// INSERT
|
|
||||||
//
|
|
||||||
|
|
||||||
this._on( this.elements.insert_submit, { click: '_onInsertSubmit' } );
|
|
||||||
this._on( this.elements.photoset_submit, { click: '_onPhotosetSubmit' } );
|
|
||||||
|
|
||||||
//
|
|
||||||
// INSERT FROM URL
|
|
||||||
//
|
|
||||||
|
|
||||||
this._on( this.elements.url.type, { click: 'onUrlTypeChange' } );
|
|
||||||
this._on( this.elements.url.url, { keyup: 'onUrlChange', change: 'onUrlChange' } );
|
|
||||||
this._on( this.elements.url.submit_upload, { click: this.urlInsert.bind( this, true ) } );
|
|
||||||
this._on( this.elements.url.submit_insert, { click: this.urlInsert.bind( this, false ) } );
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
_onInsertSubmit: function( event ) {
|
|
||||||
this.insertSelectedFiles( 'insert', this.getSettings() );
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
_onPhotosetSubmit: function( event ) {
|
|
||||||
this.insertSelectedFiles( 'photoset', this.getSettings() );
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
_onFileBeforeActivate: function( event, data ) {
|
|
||||||
this.activateInfoBlock( data.element );
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
_onTabActivate: function( event, data ) {
|
|
||||||
var type = data.element.data( 'media-name' );
|
|
||||||
|
|
||||||
this.moveUploader( data );
|
|
||||||
|
|
||||||
if ( type === 'photoset' ) {
|
|
||||||
this._list.lsUploaderFileList( 'option', 'multiselect_ctrl', false );
|
|
||||||
this.elements.uploader.lsUploader( 'filterFilesByType', [ '1' ] );
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( type === 'url' ) {
|
|
||||||
this.disableUrlButtons( ! this.elements.url.url.val());
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Перемещение uploader'а из одного таба в другой
|
|
||||||
*/
|
|
||||||
moveUploader: function( tab ) {
|
|
||||||
this.resetUploader();
|
|
||||||
|
|
||||||
// Перемещение
|
|
||||||
if ( tab.element.hasClass( 'js-tab-show-gallery' ) ) {
|
|
||||||
this.elements.uploader
|
|
||||||
.lsUploader( 'resetFilter' )
|
|
||||||
.lsUploader( 'unselectAll' )
|
|
||||||
.lsUploader( 'setTargetTypeFilter', 'uploaded' )
|
|
||||||
.appendTo( this.getPaneContent( tab ) );
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
resetUploader: function() {
|
|
||||||
this._list.lsUploaderFileList( 'option', 'params.target_type', this._originalTargetType );
|
|
||||||
this._list.lsUploaderFileList( 'option', 'multiselect_ctrl', true );
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
getPaneContent: function( tab ) {
|
|
||||||
return tab.getPane().find( '.js-media-pane-content' );
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
show: function() {
|
|
||||||
this.element.lsModal( 'show' );
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
hide: function() {
|
|
||||||
this.element.lsModal( 'hide' );
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
getSettings: function() {
|
|
||||||
return this.elements.blocks
|
|
||||||
.filter( ':visible' )
|
|
||||||
.find( 'form' )
|
|
||||||
.serializeJSON();
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
insertSelectedFiles: function( url, params ) {
|
|
||||||
this.insertFiles( url, params, this.elements.uploader.lsUploader( 'getSelectedFiles' ) );
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Вставляет выделенные файлы в редактор
|
|
||||||
*/
|
|
||||||
insertFiles: function( url, params, files ) {
|
|
||||||
if ( ! files.length ) return;
|
|
||||||
|
|
||||||
// Формируем список ID файлов
|
|
||||||
var ids = $.map( files, function ( file ) {
|
|
||||||
return $( file ).lsUploaderFile( 'getProperty', 'id' );
|
|
||||||
});
|
|
||||||
|
|
||||||
this._load( url, $.extend( true, {}, { ids: ids }, params || {} ), function( response ) {
|
|
||||||
this.option( 'editor' ).lsEditor( 'insert', response.sTextResult );
|
|
||||||
this.element.lsModal( 'hide' );
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
activateInfoBlock: function( file ) {
|
|
||||||
this.elements.blocks.hide();
|
|
||||||
|
|
||||||
// Показываем блок настроек только для активного типа файла
|
|
||||||
this.elements.blocks
|
|
||||||
.filter( '[data-type=' + this.getActiveTabName() + ']' )
|
|
||||||
.filter( '[data-filetype=' + file.lsUploaderFile( 'getProperty', 'type' ) + ']' )
|
|
||||||
.show();
|
|
||||||
|
|
||||||
// Обновляем настройки
|
|
||||||
if ( this.getActiveTabName() == 'insert' && file.lsUploaderFile( 'getProperty', 'type' ) == '1' ) {
|
|
||||||
var block = this.elements.blocks.filter('.js-media-info-block-image-options');
|
|
||||||
var sizes = block.find( 'select[name=size]' );
|
|
||||||
|
|
||||||
sizes.find( 'option:not([value=original])' ).remove();
|
|
||||||
sizes.append($.map( file.data('mediaImageSizes'), function ( v, k ) {
|
|
||||||
// Расчитываем пропорциональную высоту изображения
|
|
||||||
var height = v.h || parseInt( v.w * file.lsUploaderFile( 'getProperty', 'height' ) / file.lsUploaderFile( 'getProperty', 'width' ) );
|
|
||||||
|
|
||||||
return '<option value="' + v.w + 'x' + ( v.h ? v.h : '' ) + ( v.crop ? 'crop' : '' ) + '">' + v.w + ' × ' + height + '</option>';
|
|
||||||
}).join( '' ));
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: Add hook
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
reload: function() {
|
|
||||||
this.elements.uploader.lsUploader( 'reload' );
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
getActiveTab: function() {
|
|
||||||
return this.elements.nav.lsTabs( 'getActiveTab' );
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
getActiveTabName: function() {
|
|
||||||
return this.getActiveTab().data( 'media-name' );
|
|
||||||
},
|
|
||||||
|
|
||||||
//
|
|
||||||
// INSERT FROM URL
|
|
||||||
//
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
onUrlTypeChange: function ( event ) {
|
|
||||||
this.elements.url.blocks.hide();
|
|
||||||
this.elements.url.blocks.filter( '[data-filetype=' + this.elements.url.type.val() + ']' ).show();
|
|
||||||
this.elements.url.url.val( '' );
|
|
||||||
this.elements.url.image_preview.hide().empty();
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
onUrlChange: function ( event ) {
|
|
||||||
var _this = this,
|
|
||||||
url = this.elements.url.url.val();
|
|
||||||
|
|
||||||
this.disableUrlButtons( ! url);
|
|
||||||
|
|
||||||
$('<img />', {
|
|
||||||
src: url,
|
|
||||||
style: 'max-width: 50%',
|
|
||||||
error: function () {
|
|
||||||
_this.elements.url.image_preview.hide().empty();
|
|
||||||
},
|
|
||||||
load: function () {
|
|
||||||
_this.elements.url.image_preview.show().html( $( this ) );
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
disableUrlButtons: function ( disable ) {
|
|
||||||
this.elements.url.submit_insert.prop( 'disabled', disable );
|
|
||||||
this.elements.url.submit_upload.prop( 'disabled', disable );
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
urlInsert: function ( upload ) {
|
|
||||||
var upload = upload || false,
|
|
||||||
params = $.extend(
|
|
||||||
{},
|
|
||||||
{ upload: upload },
|
|
||||||
this.elements.url.form.serializeJSON(),
|
|
||||||
this.elements.url.blocks.filter( ':visible' ).find('form').serializeJSON(),
|
|
||||||
this.elements.uploader.lsUploader( 'option', 'params' )
|
|
||||||
);
|
|
||||||
|
|
||||||
this.disableUrlButtons(true);
|
|
||||||
|
|
||||||
this._load( 'url_upload', params, function ( response ) {
|
|
||||||
this.option( 'editor' ).lsEditor( 'insert', response.sText );
|
|
||||||
this.element.lsModal( 'hide' );
|
|
||||||
this.reload();
|
|
||||||
}, {
|
|
||||||
// TODO: Fix validation
|
|
||||||
validate: false,
|
|
||||||
submitButton: this.elements.url[ upload ? 'submit_upload' : 'submit_insert' ],
|
|
||||||
onComplete: function () {
|
|
||||||
this.disableUrlButtons(false);
|
|
||||||
}.bind(this)
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
})(jQuery);
|
|
|
@ -1,11 +0,0 @@
|
||||||
{**
|
|
||||||
* Media content
|
|
||||||
*}
|
|
||||||
|
|
||||||
<div class="ls-media ls-clearfix {$smarty.local.classes}">
|
|
||||||
{component 'tabs' classes='ls-media-nav js-media-nav' mods='align-left' tabs=[
|
|
||||||
[ 'text' => {lang 'media.nav.insert'}, 'body' => {component 'media' template='pane.insert'}, 'classes' => 'js-tab-show-gallery', 'attributes' => [ 'data-media-name' => 'insert' ] ],
|
|
||||||
[ 'text' => {lang 'media.nav.photoset'}, 'body' => {component 'media' template='pane.photoset'}, 'classes' => 'js-tab-show-gallery', 'attributes' => [ 'data-media-name' => 'photoset' ] ],
|
|
||||||
[ 'text' => {lang 'media.nav.url'}, 'body' => {component 'media' template='pane.url'}, 'attributes' => [ 'data-media-name' => 'url' ] ]
|
|
||||||
]}
|
|
||||||
</div>
|
|
|
@ -1,13 +0,0 @@
|
||||||
{**
|
|
||||||
* Загрузка медиа-файлов
|
|
||||||
*}
|
|
||||||
|
|
||||||
{extends 'Component@modal.modal'}
|
|
||||||
|
|
||||||
{block 'modal_options' append}
|
|
||||||
{$classes = "$classes ls-media js-modal-media"}
|
|
||||||
{$title = {lang name='media.title'}}
|
|
||||||
{$options = array_merge( $options|default:[], [ 'center' => 'false' ] )}
|
|
||||||
{$showFooter = false}
|
|
||||||
{$body = {component 'media' template='content'}}
|
|
||||||
{/block}
|
|
|
@ -1,22 +0,0 @@
|
||||||
{extends './pane.tpl'}
|
|
||||||
|
|
||||||
{block 'media_pane_options' append}
|
|
||||||
{$id = 'tab-media-insert'}
|
|
||||||
{/block}
|
|
||||||
|
|
||||||
{block 'media_pane_content'}
|
|
||||||
{component 'media' template='uploader'
|
|
||||||
attributes = [ 'id' => 'media-uploader' ]
|
|
||||||
classes = 'js-media-uploader'
|
|
||||||
targetParams = $aTargetParams
|
|
||||||
targetType = $sMediaTargetType
|
|
||||||
targetId = $sMediaTargetId
|
|
||||||
targetTmp = $sMediaTargetTmp}
|
|
||||||
{/block}
|
|
||||||
|
|
||||||
{block 'media_pane_footer' prepend}
|
|
||||||
{component 'button'
|
|
||||||
mods = 'primary'
|
|
||||||
classes = 'js-media-insert-submit'
|
|
||||||
text = {lang name='media.insert.submit'}}
|
|
||||||
{/block}
|
|
|
@ -1,12 +0,0 @@
|
||||||
{extends './pane.tpl'}
|
|
||||||
|
|
||||||
{block 'media_pane_options' append}
|
|
||||||
{$id = 'tab-media-photoset'}
|
|
||||||
{/block}
|
|
||||||
|
|
||||||
{block 'media_pane_footer' prepend}
|
|
||||||
{component 'button'
|
|
||||||
mods = 'primary'
|
|
||||||
classes = 'js-media-photoset-submit'
|
|
||||||
text = {lang name='media.photoset.submit'}}
|
|
||||||
{/block}
|
|
|
@ -1,23 +0,0 @@
|
||||||
{extends './pane.tpl'}
|
|
||||||
|
|
||||||
{block 'media_pane_options' append}
|
|
||||||
{$id = 'tab-media-preview'}
|
|
||||||
{/block}
|
|
||||||
|
|
||||||
{block 'media_pane_content'}
|
|
||||||
{if $aTargetItems}
|
|
||||||
{foreach $aTargetItems as $oTarget}
|
|
||||||
<p class="ls-mb-20">
|
|
||||||
<a href="#" class="button" onclick="ls.media.removePreviewFile({$oTarget->getMediaId()}); return false;">Удалить превью</a>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
{$aPreview = $oTarget->getPreviewImageItemsWebPath()}
|
|
||||||
|
|
||||||
{foreach $aPreview as $sPreviewFile}
|
|
||||||
<img src="{$sPreviewFile}" alt=""><br>
|
|
||||||
{/foreach}
|
|
||||||
{/foreach}
|
|
||||||
{else}
|
|
||||||
Превью можно <a href="#" onclick="jQuery('.js-tab-show-gallery').first().click(); return false;">выбрать из галереи</a>.
|
|
||||||
{/if}
|
|
||||||
{/block}
|
|
|
@ -1,11 +0,0 @@
|
||||||
{block 'media_pane_options'}
|
|
||||||
{component_define_params params=[ 'id' ]}
|
|
||||||
{/block}
|
|
||||||
|
|
||||||
<div class="ls-media-pane-content js-media-pane-content">
|
|
||||||
{block 'media_pane_content'}{/block}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="ls-media-pane-footer">
|
|
||||||
{block 'media_pane_footer'}{/block}
|
|
||||||
</div>
|
|
|
@ -1,43 +0,0 @@
|
||||||
{extends './pane.tpl'}
|
|
||||||
|
|
||||||
{block 'media_pane_options' append}
|
|
||||||
{$id = 'tab-media-url'}
|
|
||||||
{/block}
|
|
||||||
|
|
||||||
{block 'media_pane_content'}
|
|
||||||
<form method="post" action="" enctype="multipart/form-data" class="ls-mb-20 js-media-url-form">
|
|
||||||
{* Типы файлов *}
|
|
||||||
{* TODO: Add hook *}
|
|
||||||
{*component 'field' template='select'
|
|
||||||
name = 'filetype'
|
|
||||||
label = 'Type'
|
|
||||||
inputClasses = 'ls-width-300 js-media-url-type'
|
|
||||||
items = [
|
|
||||||
[ 'value' => '1', 'text' => 'Image' ]
|
|
||||||
]*}
|
|
||||||
|
|
||||||
{* Ссылка *}
|
|
||||||
{component 'field' template='text'
|
|
||||||
name = 'url'
|
|
||||||
inputClasses = 'js-media-url-form-url'
|
|
||||||
label = {lang 'media.url.fields.url.label'}}
|
|
||||||
</form>
|
|
||||||
|
|
||||||
<div class="ls-mb-15 js-media-url-image-preview" style="display: none"></div>
|
|
||||||
|
|
||||||
<div class="js-media-url-settings-blocks">
|
|
||||||
{component 'media' template='uploader-block.insert.image' useSizes=false}
|
|
||||||
</div>
|
|
||||||
{/block}
|
|
||||||
|
|
||||||
{block 'media_pane_footer' prepend}
|
|
||||||
{component 'button'
|
|
||||||
mods = 'primary'
|
|
||||||
classes = 'js-media-url-submit-insert'
|
|
||||||
text = {lang 'media.url.submit_insert'}}
|
|
||||||
|
|
||||||
{component 'button'
|
|
||||||
mods = 'primary'
|
|
||||||
classes = 'js-media-url-submit-upload'
|
|
||||||
text = {lang 'media.url.submit_upload'}}
|
|
||||||
{/block}
|
|
|
@ -1,36 +0,0 @@
|
||||||
{**
|
|
||||||
* Опции вставки
|
|
||||||
*
|
|
||||||
* @param boolean $useSizes
|
|
||||||
*}
|
|
||||||
|
|
||||||
{component_define_params params=[ 'useSizes' ]}
|
|
||||||
|
|
||||||
{capture 'block_content'}
|
|
||||||
<form method="post" action="" enctype="multipart/form-data">
|
|
||||||
{* Выравнивание *}
|
|
||||||
{component 'field' template='select'
|
|
||||||
name = 'align'
|
|
||||||
label = {lang name='media.image_align.title'}
|
|
||||||
items = [
|
|
||||||
[ 'value' => '', 'text' => {lang name='media.image_align.no'} ],
|
|
||||||
[ 'value' => 'left', 'text' => {lang name='media.image_align.left'} ],
|
|
||||||
[ 'value' => 'right', 'text' => {lang name='media.image_align.right'} ],
|
|
||||||
[ 'value' => 'center', 'text' => {lang name='media.image_align.center'} ]
|
|
||||||
]}
|
|
||||||
|
|
||||||
{* Размер *}
|
|
||||||
{if $useSizes|default:true}
|
|
||||||
{component 'field' template='select'
|
|
||||||
name = 'size'
|
|
||||||
label = {lang name='media.insert.settings.fields.size.label'}
|
|
||||||
items = [[ 'value' => 'original', 'text' => {lang name='media.insert.settings.fields.size.original'} ]]}
|
|
||||||
{/if}
|
|
||||||
</form>
|
|
||||||
{/capture}
|
|
||||||
|
|
||||||
{component 'uploader' template='block'
|
|
||||||
title = {lang 'media.insert.settings.title'}
|
|
||||||
content = $smarty.capture.block_content
|
|
||||||
classes = 'js-media-info-block js-media-info-block-image-options'
|
|
||||||
attributes = [ 'data-type' => 'insert', 'data-filetype' => '1' ]}
|
|
|
@ -1,24 +0,0 @@
|
||||||
{**
|
|
||||||
* Опции фотосета
|
|
||||||
*}
|
|
||||||
|
|
||||||
{capture 'block_content'}
|
|
||||||
<form method="post" action="" enctype="multipart/form-data">
|
|
||||||
{* Показывать ленту с превьюшками *}
|
|
||||||
{component 'field' template='checkbox'
|
|
||||||
name = 'use_thumbs'
|
|
||||||
checked = true
|
|
||||||
label = {lang name='media.photoset.settings.fields.use_thumbs.label'}}
|
|
||||||
|
|
||||||
{* Показывать описания фотографий *}
|
|
||||||
{component 'field' template='checkbox'
|
|
||||||
name = 'show_caption'
|
|
||||||
label = {lang name='media.photoset.settings.fields.show_caption.label'}}
|
|
||||||
</form>
|
|
||||||
{/capture}
|
|
||||||
|
|
||||||
{component 'uploader' template='block'
|
|
||||||
title = {lang 'media.photoset.settings.title'}
|
|
||||||
content = $smarty.capture.block_content
|
|
||||||
classes = 'js-media-info-block'
|
|
||||||
attributes = [ 'data-type' => 'photoset', 'data-filetype' => '1' ]}
|
|
|
@ -1,19 +0,0 @@
|
||||||
{extends 'Component@uploader.uploader'}
|
|
||||||
|
|
||||||
{block 'uploader_options' append}
|
|
||||||
{component_define_params params=[ 'targetType', 'targetId', 'targetTmp' ]}
|
|
||||||
|
|
||||||
{$attributes = array_merge( $attributes|default:[], [
|
|
||||||
'data-param-target_type' => {json var=$targetType},
|
|
||||||
'data-param-target_id' => {json var=$targetId},
|
|
||||||
'data-param-target_tmp' => {json var=$targetTmp}
|
|
||||||
])}
|
|
||||||
{/block}
|
|
||||||
|
|
||||||
{block 'uploader_aside' append}
|
|
||||||
{* Основные настройки *}
|
|
||||||
{component 'media' template='uploader-block.insert.image'}
|
|
||||||
|
|
||||||
{* Опции фотосета *}
|
|
||||||
{component 'media' template='uploader-block.photoset'}
|
|
||||||
{/block}
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit f8f411f865e78f77a1f63bb687023247fab36425
|
Subproject commit 753410e04acd92c1c3e5c25b74970b47412f8731
|
Loading…
Reference in a new issue