Plugins bloques
This commit is contained in:
@@ -0,0 +1,277 @@
|
||||
/**
|
||||
* Estilos del panel de administración - Bloques en Transición
|
||||
*/
|
||||
|
||||
/* === DASHBOARD === */
|
||||
.bloques-dashboard {
|
||||
max-width: 1200px;
|
||||
}
|
||||
|
||||
.bloques-dashboard h1 {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
color: #1E6B52;
|
||||
}
|
||||
|
||||
.bloques-dashboard h1 .dashicons {
|
||||
font-size: 32px;
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
}
|
||||
|
||||
.bloques-dashboard-welcome {
|
||||
background: linear-gradient(135deg, #1E6B52 0%, #2A9D8F 100%);
|
||||
color: white;
|
||||
padding: 30px;
|
||||
border-radius: 8px;
|
||||
margin: 20px 0;
|
||||
}
|
||||
|
||||
.bloques-dashboard-welcome h2 {
|
||||
color: white;
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.bloques-dashboard-welcome p {
|
||||
font-size: 16px;
|
||||
opacity: 0.9;
|
||||
}
|
||||
|
||||
/* === STATS CARDS === */
|
||||
.bloques-dashboard-stats {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
|
||||
gap: 20px;
|
||||
margin: 30px 0;
|
||||
}
|
||||
|
||||
.bloques-stat-card {
|
||||
background: white;
|
||||
border-radius: 8px;
|
||||
padding: 20px;
|
||||
box-shadow: 0 2px 8px rgba(0,0,0,0.08);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
text-align: center;
|
||||
transition: transform 0.2s, box-shadow 0.2s;
|
||||
}
|
||||
|
||||
.bloques-stat-card:hover {
|
||||
transform: translateY(-2px);
|
||||
box-shadow: 0 4px 12px rgba(0,0,0,0.12);
|
||||
}
|
||||
|
||||
.bloques-stat-icon {
|
||||
width: 60px;
|
||||
height: 60px;
|
||||
background: linear-gradient(135deg, #1E6B52 0%, #2A9D8F 100%);
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
.bloques-stat-icon .dashicons {
|
||||
font-size: 28px;
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.bloques-stat-content {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.bloques-stat-number {
|
||||
display: block;
|
||||
font-size: 36px;
|
||||
font-weight: 700;
|
||||
color: #1E6B52;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.bloques-stat-label {
|
||||
display: block;
|
||||
font-size: 14px;
|
||||
color: #666;
|
||||
margin-top: 5px;
|
||||
}
|
||||
|
||||
.bloques-stat-link {
|
||||
font-size: 13px;
|
||||
text-decoration: none;
|
||||
color: #2A9D8F;
|
||||
}
|
||||
|
||||
.bloques-stat-link:hover {
|
||||
color: #1E6B52;
|
||||
}
|
||||
|
||||
/* === TAXONOMIES === */
|
||||
.bloques-dashboard-taxonomies {
|
||||
margin: 30px 0;
|
||||
}
|
||||
|
||||
.bloques-dashboard-taxonomies h3 {
|
||||
color: #1E6B52;
|
||||
border-bottom: 2px solid #1E6B52;
|
||||
padding-bottom: 10px;
|
||||
}
|
||||
|
||||
.bloques-tax-cards {
|
||||
display: flex;
|
||||
gap: 20px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.bloques-tax-card {
|
||||
background: white;
|
||||
padding: 20px;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 2px 8px rgba(0,0,0,0.08);
|
||||
min-width: 200px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.bloques-tax-count {
|
||||
font-size: 24px;
|
||||
font-weight: 700;
|
||||
color: #1E6B52;
|
||||
}
|
||||
|
||||
/* === SHORTCUTS === */
|
||||
.bloques-dashboard-shortcuts {
|
||||
margin: 30px 0;
|
||||
}
|
||||
|
||||
.bloques-dashboard-shortcuts h3 {
|
||||
color: #1E6B52;
|
||||
border-bottom: 2px solid #1E6B52;
|
||||
padding-bottom: 10px;
|
||||
}
|
||||
|
||||
.bloques-shortcuts {
|
||||
display: flex;
|
||||
gap: 15px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.bloques-shortcuts .button-primary {
|
||||
background: #1E6B52;
|
||||
border-color: #1E6B52;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 5px;
|
||||
}
|
||||
|
||||
.bloques-shortcuts .button-primary:hover {
|
||||
background: #2A9D8F;
|
||||
border-color: #2A9D8F;
|
||||
}
|
||||
|
||||
/* === SHORTCODES TABLE === */
|
||||
.bloques-dashboard-shortcodes {
|
||||
margin: 30px 0;
|
||||
}
|
||||
|
||||
.bloques-dashboard-shortcodes h3 {
|
||||
color: #1E6B52;
|
||||
border-bottom: 2px solid #1E6B52;
|
||||
padding-bottom: 10px;
|
||||
}
|
||||
|
||||
.bloques-dashboard-shortcodes code {
|
||||
background: #f0f0f0;
|
||||
padding: 4px 8px;
|
||||
border-radius: 4px;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
/* === SEEDER PAGE === */
|
||||
.bloques-seeder {
|
||||
max-width: 800px;
|
||||
}
|
||||
|
||||
.bloques-seeder h1 {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
color: #1E6B52;
|
||||
}
|
||||
|
||||
.bloques-seeder-info {
|
||||
background: white;
|
||||
padding: 20px;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 2px 8px rgba(0,0,0,0.08);
|
||||
margin: 20px 0;
|
||||
}
|
||||
|
||||
.bloques-seeder-section {
|
||||
margin-bottom: 20px;
|
||||
padding-bottom: 20px;
|
||||
border-bottom: 1px solid #eee;
|
||||
}
|
||||
|
||||
.bloques-seeder-section:last-child {
|
||||
border-bottom: none;
|
||||
margin-bottom: 0;
|
||||
padding-bottom: 0;
|
||||
}
|
||||
|
||||
.bloques-seeder-section h3 {
|
||||
color: #1E6B52;
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.bloques-seeder-section ul {
|
||||
margin: 0;
|
||||
padding-left: 20px;
|
||||
}
|
||||
|
||||
.bloques-seeder-section li {
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.bloques-seeder-actions {
|
||||
background: #f8f9fa;
|
||||
padding: 20px;
|
||||
border-radius: 8px;
|
||||
margin: 20px 0;
|
||||
}
|
||||
|
||||
.bloques-seeder-actions .button-hero {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
background: #1E6B52;
|
||||
border-color: #1E6B52;
|
||||
}
|
||||
|
||||
.bloques-seeder-actions .button-hero:hover {
|
||||
background: #2A9D8F;
|
||||
border-color: #2A9D8F;
|
||||
}
|
||||
|
||||
.bloques-seeder-status {
|
||||
margin-top: 30px;
|
||||
}
|
||||
|
||||
.bloques-seeder-status h3 {
|
||||
color: #1E6B52;
|
||||
}
|
||||
|
||||
/* === ADMIN MENU STYLING === */
|
||||
#adminmenu .toplevel_page_bloques-dashboard .wp-menu-image:before {
|
||||
content: "\f512";
|
||||
}
|
||||
|
||||
#adminmenu .toplevel_page_bloques-dashboard.current,
|
||||
#adminmenu .toplevel_page_bloques-dashboard:hover {
|
||||
background: #1E6B52;
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,34 @@
|
||||
/**
|
||||
* Scripts del panel de administración - Bloques en Transición
|
||||
*/
|
||||
|
||||
(function($) {
|
||||
'use strict';
|
||||
|
||||
$(document).ready(function() {
|
||||
// Confirmación antes de cargar datos
|
||||
$('.bloques-seeder form').on('submit', function(e) {
|
||||
if (!confirm('¿Estás seguro de que quieres cargar los datos iniciales?')) {
|
||||
e.preventDefault();
|
||||
}
|
||||
});
|
||||
|
||||
// Copiar shortcode al portapapeles
|
||||
$('.bloques-dashboard-shortcodes code').on('click', function() {
|
||||
const text = $(this).text();
|
||||
navigator.clipboard.writeText(text).then(function() {
|
||||
// Feedback visual
|
||||
const $code = $(this);
|
||||
const originalBg = $code.css('background');
|
||||
$code.css('background', '#d4edda');
|
||||
setTimeout(function() {
|
||||
$code.css('background', originalBg);
|
||||
}, 500);
|
||||
}.bind(this));
|
||||
});
|
||||
|
||||
// Añadir cursor pointer a los shortcodes
|
||||
$('.bloques-dashboard-shortcodes code').css('cursor', 'pointer').attr('title', 'Clic para copiar');
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
@@ -0,0 +1,247 @@
|
||||
/**
|
||||
* Scripts del frontend - Bloques en Transición
|
||||
*/
|
||||
|
||||
(function($) {
|
||||
'use strict';
|
||||
|
||||
// Inicializar cuando el DOM esté listo
|
||||
$(document).ready(function() {
|
||||
initFilters();
|
||||
initLoadMore();
|
||||
initSearch();
|
||||
});
|
||||
|
||||
/**
|
||||
* Inicializar filtros tipo botonera
|
||||
*/
|
||||
function initFilters() {
|
||||
$('.bloques-filters').each(function() {
|
||||
const $filters = $(this);
|
||||
const containerId = $filters.data('container');
|
||||
const $container = $('#' + containerId);
|
||||
const $itemsContainer = $container.find('.bloques-items');
|
||||
|
||||
// Estado de filtros activos (incluye category para noticias)
|
||||
let activeFilters = {
|
||||
iniciativa: '',
|
||||
linea_trabajo: '',
|
||||
category: ''
|
||||
};
|
||||
|
||||
// Click en botones de filtro
|
||||
$filters.on('click', '.bloques-filter-btn', function() {
|
||||
const $btn = $(this);
|
||||
const taxonomy = $btn.data('taxonomy');
|
||||
const value = $btn.data('value');
|
||||
|
||||
// Actualizar estado activo en botones del mismo grupo
|
||||
$btn.closest('.bloques-filter-buttons')
|
||||
.find('.bloques-filter-btn')
|
||||
.removeClass('active');
|
||||
$btn.addClass('active');
|
||||
|
||||
// Actualizar filtros activos
|
||||
activeFilters[taxonomy] = value;
|
||||
|
||||
// Aplicar filtros
|
||||
applyFilters($container, $itemsContainer, activeFilters);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Aplicar filtros via AJAX
|
||||
*/
|
||||
function applyFilters($container, $itemsContainer, filters) {
|
||||
const type = $container.data('type');
|
||||
const widget = $container.data('widget');
|
||||
const upcoming = $container.data('upcoming');
|
||||
const search = $container.find('.bloques-search-input').val() || '';
|
||||
|
||||
// Mostrar loading
|
||||
$itemsContainer.addClass('bloques-loading');
|
||||
|
||||
$.ajax({
|
||||
url: bloquesData.ajaxUrl,
|
||||
type: 'POST',
|
||||
data: {
|
||||
action: 'bloques_filter',
|
||||
nonce: bloquesData.nonce,
|
||||
type: type,
|
||||
iniciativa: filters.iniciativa || '',
|
||||
linea_trabajo: filters.linea_trabajo || '',
|
||||
category: filters.category || '',
|
||||
search: search,
|
||||
widget: widget,
|
||||
upcoming: upcoming
|
||||
},
|
||||
success: function(response) {
|
||||
if (response.success) {
|
||||
$itemsContainer.html(response.data.html);
|
||||
|
||||
// Actualizar contador
|
||||
const $resultsNumber = $container.find('.bloques-results-number');
|
||||
const $resultsLabel = $container.find('.bloques-results-label');
|
||||
|
||||
if ($resultsNumber.length) {
|
||||
$resultsNumber.text(response.data.count);
|
||||
}
|
||||
if ($resultsLabel.length) {
|
||||
$resultsLabel.text(response.data.label);
|
||||
}
|
||||
|
||||
// Ocultar botón "Ver más" cuando hay filtros activos
|
||||
const hasActiveFilters = filters.iniciativa || filters.linea_trabajo || filters.category || search;
|
||||
$container.find('.bloques-load-more-wrapper').toggle(!hasActiveFilters);
|
||||
|
||||
// Resetear offset
|
||||
$container.data('offset', $container.data('limit'));
|
||||
|
||||
// Animar entrada
|
||||
animateItems($itemsContainer);
|
||||
}
|
||||
},
|
||||
error: function() {
|
||||
console.error('Error al filtrar contenido');
|
||||
},
|
||||
complete: function() {
|
||||
$itemsContainer.removeClass('bloques-loading');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Inicializar búsqueda con debounce
|
||||
*/
|
||||
function initSearch() {
|
||||
let searchTimeout;
|
||||
|
||||
$('.bloques-search-input').on('input', function() {
|
||||
const $input = $(this);
|
||||
const $filters = $input.closest('.bloques-filters');
|
||||
const containerId = $filters.data('container');
|
||||
const $container = $('#' + containerId);
|
||||
const $itemsContainer = $container.find('.bloques-items');
|
||||
|
||||
// Obtener filtros activos
|
||||
const activeFilters = {
|
||||
iniciativa: $filters.find('.bloques-filter-btn[data-taxonomy="iniciativa"].active').data('value') || '',
|
||||
linea_trabajo: $filters.find('.bloques-filter-btn[data-taxonomy="linea_trabajo"].active').data('value') || '',
|
||||
category: $filters.find('.bloques-filter-btn[data-taxonomy="category"].active').data('value') || ''
|
||||
};
|
||||
|
||||
// Debounce
|
||||
clearTimeout(searchTimeout);
|
||||
searchTimeout = setTimeout(function() {
|
||||
applyFilters($container, $itemsContainer, activeFilters);
|
||||
}, 300);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Inicializar botón "Ver más"
|
||||
*/
|
||||
function initLoadMore() {
|
||||
$(document).on('click', '.bloques-btn-load-more', function() {
|
||||
const $btn = $(this);
|
||||
const containerId = $btn.data('container');
|
||||
const $container = $('#' + containerId);
|
||||
const $itemsContainer = $container.find('.bloques-items');
|
||||
|
||||
const type = $container.data('type');
|
||||
const widget = $container.data('widget');
|
||||
const limit = parseInt($container.data('limit')) || 9;
|
||||
const offset = parseInt($container.data('offset')) || 0;
|
||||
const total = parseInt($container.data('total')) || 0;
|
||||
const upcoming = $container.data('upcoming');
|
||||
|
||||
// Obtener filtros activos si existen
|
||||
const $filters = $container.find('.bloques-filters');
|
||||
let iniciativa = '';
|
||||
let linea = '';
|
||||
let category = '';
|
||||
|
||||
if ($filters.length) {
|
||||
iniciativa = $filters.find('.bloques-filter-btn[data-taxonomy="iniciativa"].active').data('value') || '';
|
||||
linea = $filters.find('.bloques-filter-btn[data-taxonomy="linea_trabajo"].active').data('value') || '';
|
||||
category = $filters.find('.bloques-filter-btn[data-taxonomy="category"].active').data('value') || '';
|
||||
}
|
||||
|
||||
// Mostrar loading
|
||||
$btn.prop('disabled', true).text('Cargando...');
|
||||
|
||||
$.ajax({
|
||||
url: bloquesData.ajaxUrl,
|
||||
type: 'POST',
|
||||
data: {
|
||||
action: 'bloques_load_more',
|
||||
nonce: bloquesData.nonce,
|
||||
type: type,
|
||||
offset: offset,
|
||||
limit: limit,
|
||||
widget: widget,
|
||||
iniciativa: iniciativa,
|
||||
linea_trabajo: linea,
|
||||
category: category,
|
||||
upcoming: upcoming
|
||||
},
|
||||
success: function(response) {
|
||||
if (response.success) {
|
||||
// Añadir nuevos items
|
||||
$itemsContainer.append(response.data.html);
|
||||
|
||||
// Actualizar offset
|
||||
$container.data('offset', response.data.new_offset);
|
||||
|
||||
// Ocultar botón si no hay más
|
||||
if (!response.data.has_more) {
|
||||
$btn.closest('.bloques-load-more-wrapper').fadeOut();
|
||||
}
|
||||
|
||||
// Animar nuevos items
|
||||
animateItems($itemsContainer.find('.bloques-card:gt(' + (offset - 1) + '), .bloques-item:gt(' + (offset - 1) + ')'));
|
||||
}
|
||||
},
|
||||
error: function() {
|
||||
console.error('Error al cargar más contenido');
|
||||
},
|
||||
complete: function() {
|
||||
$btn.prop('disabled', false).html('Ver más <span class="bloques-arrow">→</span>');
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Animación de entrada para items
|
||||
*/
|
||||
function animateItems($container) {
|
||||
const $items = $container.find('.bloques-card, .bloques-item, .bloques-novedad-item, .bloques-agenda-item');
|
||||
|
||||
$items.each(function(index) {
|
||||
const $item = $(this);
|
||||
$item.css({
|
||||
'opacity': 0,
|
||||
'transform': 'translateY(20px)'
|
||||
});
|
||||
|
||||
setTimeout(function() {
|
||||
$item.css({
|
||||
'opacity': 1,
|
||||
'transform': 'translateY(0)',
|
||||
'transition': 'opacity 0.3s ease, transform 0.3s ease'
|
||||
});
|
||||
}, index * 50);
|
||||
});
|
||||
}
|
||||
|
||||
// Exponer funciones públicas
|
||||
window.BloquesTransicion = {
|
||||
initFilters: initFilters,
|
||||
initLoadMore: initLoadMore,
|
||||
applyFilters: applyFilters,
|
||||
animateItems: animateItems
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
Reference in New Issue
Block a user