@import "../config/variables.less"; @import "responsive-utilities.less"; @import "grid.less"; @import "../modules/vc_buttons.less"; @import "../modules/vc_modals.less"; @import "../modules/vc_panels.less"; @import "../modules/vc_messages.less"; @import "../modules/vc_preloader.less"; @import "utils.less"; @import "../modules/vc_table.less"; @import "../modules/ui/vc_ui-loaders.less"; @import "media-gallery.less"; @import "../../fonts/vc_icons/init.less"; @import "../modules/ui/vc_ui-badges.less"; .vc_badge { .badge(); } .vc_nav { .nav(); } .vc_inappropriate { display: none !important; } .vc_off { .opacity(.7); } @import "vc_pointer.less"; @import "../modules/ui/vc_ui-panel/vc_ui-panel.less"; @import "../modules/ui/vc_ui-panel-edit-element.less"; @import "../modules/ui/vc_ui-panel-row-layout.less"; // REMOVE @import "resizable_modal.less"; .vc-disable-editor { pointer-events: none; z-index: 0; position: absolute; opacity: 0; left: -10000px; } [dir="rtl"] .vc-disable-editor { right: -10000px; left: auto; } [dir="rtl"] .vc_control.column_move, [dir=rtl] .vc_control .vc-controls-move { float: right; } [dir="rtl"] .vc_controls-row .column_add, [dir=rtl] .vc_controls-row .vc_control-add-column { float: right; } [dir="rtl"] .vc_controls-row .vc_row_edit_clone_delete .vc_control { float: left; } [dir="rtl"] { .vc_controls-row { .vc_row_layouts, .vc_control-row-layout { &:hover { left: inherit; right: 76px; } } } } ( function ( $ ) { 'use strict'; window.InlineShortcodeView_vc_tta_accordion = window.InlineShortcodeViewContainer.extend({ events: {}, childTag: 'vc_tta_section', activeClass: 'vc_active', // controls_selector: '#vc_controls-template-vc_tta_accordion', defaultSectionTitle: window.i18nLocale.section, initialize: function () { _.bindAll( this, 'buildSortable', 'updateSorting' ); window.InlineShortcodeView_vc_tta_accordion.__super__.initialize.call( this ); }, render: function () { window.InlineShortcodeViewContainer.__super__.render.call( this ); this.content(); // just to remove span inline-container anchor.. this.buildPagination(); return this; }, addControls: function () { this.$controls = $( '
' ); this.$controls.appendTo( this.$el ); return this; }, /** * Add new element to Accordion. * @param e */ addElement: function ( e ) { if ( e && e.preventDefault ) { e.preventDefault(); } this.addSection( 'parent.prepend' === $( e.currentTarget ).data( 'vcControl' ) ); }, appendElement: function ( e ) { return this.addElement( e ); }, prependElement: function ( e ) { return this.addElement( e ); }, addSection: function ( prepend ) { var shortcode, params, i; shortcode = this.childTag; params = { shortcode: shortcode, parent_id: this.model.get( 'id' ), isActiveSection: true, params: { title: this.defaultSectionTitle } }; if ( prepend ) { vc.activity = 'prepend'; params.order = this.getSiblingsFirstPositionIndex(); } vc.builder.create( params ); // extend default params with settings presets if there are any for ( i = vc.builder.models.length - 1; i >= 0; i -- ) { shortcode = vc.builder.models[ i ].get( 'shortcode' ); } vc.builder.render(); }, getSiblingsFirstPositionIndex: function () { var order, first_shortcode; order = 0; first_shortcode = vc.shortcodes.sort().findWhere({ parent_id: this.model.get( 'id' ) }); if ( first_shortcode ) { order = first_shortcode.get( 'order' ) - 1; } return order; }, changed: function () { vc.frame_window.vc_iframe.buildTTA(); window.InlineShortcodeView_vc_tta_accordion.__super__.changed.call( this ); _.defer( this.buildSortable ); this.buildPagination(); }, updated: function () { window.InlineShortcodeView_vc_tta_accordion.__super__.updated.call( this ); _.defer( this.buildSortable ); this.buildPagination(); }, buildSortable: function () { if ( !vc_user_access().shortcodeEdit( this.model.get( 'shortcode' ) ) ) { return; } if ( this.$el ) { this.$el.find( '.vc_tta-panels' ).sortable({ forcePlaceholderSize: true, placeholder: 'vc_placeholder-row', // TODO: fix placeholder start: this.startSorting, over: function ( event, ui ) { ui.placeholder.css({ maxWidth: ui.placeholder.parent().width() }); ui.placeholder.removeClass( 'vc_hidden-placeholder' ); }, items: '> .vc_element', handle: '.vc_tta-panel-heading, .vc_child-element-move',// TODO: change vc_column to vc_tta_section update: this.updateSorting }); } }, startSorting: function ( event, ui ) { ui.placeholder.width( ui.item.width() ); }, updateSorting: function () { var self = this; this.getPanelsList().find( '> .vc_element' ).each( function () { var shortcode, model_id, $this; $this = $( this ); model_id = $this.data( 'modelId' ); shortcode = vc.shortcodes.get( model_id ); shortcode.save({ 'order': self.getIndex( $this ) }, { silent: true }); }); // re-render pagination this.buildPagination(); }, getIndex: function ( $element ) { return $element.index(); }, getPanelsList: function () { return this.$el.find( '.vc_tta-panels' ); }, parentChanged: function () { window.InlineShortcodeView_vc_tta_accordion.__super__.parentChanged.call( this ); if ( 'undefined' !== typeof ( vc.frame_window.vc_round_charts ) ) { vc.frame_window.vc_round_charts( this.model.get( 'id' ) ); } if ( 'undefined' !== typeof ( vc.frame_window.vc_line_charts ) ) { vc.frame_window.vc_line_charts( this.model.get( 'id' ) ); } }, buildPagination: function () { }, removePagination: function () { this.$el.find( '.vc_tta-panels-container' ).find( ' > .vc_pagination' ).remove(); // TODO: check this }, getPaginationList: function () { var $accordions, classes, style_chunks, that, html, params; params = this.model.get( 'params' ); if ( !_.isUndefined( params.pagination_style ) && params.pagination_style.length ) { $accordions = this.$el.find( '[data-vc-accordion]' ); classes = []; classes.push( 'vc_general' ); classes.push( 'vc_pagination' ); style_chunks = params.pagination_style.split( '-' ); classes.push( 'vc_pagination-style-' + style_chunks[ 0 ]); classes.push( 'vc_pagination-shape-' + style_chunks[ 1 ]); if ( !_.isUndefined( params.pagination_color ) && params.pagination_color.length ) { classes.push( 'vc_pagination-color-' + params.pagination_color ); } html = []; html.push( '' ); return $( html.join( '' ) ); } return null; } }); })( window.jQuery );