Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- name: Leer la versión del plugin
id: ver
run: |
V=$(grep -oiP '^\s*\*\s*Version:\s*\K[0-9][0-9.]*' magiclobby.php | head -1)
V=$(grep -oiP '^\s*\*\s*Version:\s*\K[0-9][0-9A-Za-z.\-]*' magiclobby.php | head -1)
echo "version=$V" >> "$GITHUB_OUTPUT"
echo "Versión detectada: $V"

Expand Down
4 changes: 2 additions & 2 deletions magiclobby.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: MagicLobby
* Plugin URI: https://github.com/kombicl/MagicLobby
* Description: Señalética digital para pantallas (estilo MagicInfo), como plugin de WordPress: pantallas, contenidos por categoría, listas de reproducción, programación horaria y un panel de gestión propio. Primera herramienta open source de Kombi.
* Version: 0.1.0
* Version: 0.2.0-beta.2
* Requires at least: 6.4
* Requires PHP: 8.0
* Author: Kombi
Expand All @@ -15,7 +15,7 @@

defined( 'ABSPATH' ) || exit;

define( 'MAGICLOBBY_VERSION', '0.1.0' );
define( 'MAGICLOBBY_VERSION', '0.2.0-beta.2' );
define( 'MAGICLOBBY_FILE', __FILE__ );
define( 'MAGICLOBBY_DIR', plugin_dir_path( __FILE__ ) );
define( 'MAGICLOBBY_URL', plugin_dir_url( __FILE__ ) );
Expand Down
44 changes: 25 additions & 19 deletions src/Panel/assets/panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@
var order = pl.querySelector( '[data-order]' );
var addSel = pl.querySelector( '[data-add]' );
var addBtn = pl.querySelector( '[data-add-btn]' );
var tpl = pl.querySelector( '[data-row-tpl]' );
// La plantilla vive fuera del <form>, así que se busca en todo el documento.
var tpl = document.querySelector( '[data-row-tpl]' );

var sync = function () {
order.value = Array.prototype.map.call( list.children, function ( li ) {
Expand All @@ -58,24 +59,29 @@
};
Array.prototype.forEach.call( list.children, attachRemove );

addBtn.addEventListener( 'click', function () {
var opt = addSel.options[ addSel.selectedIndex ];
var id = opt.value;
if ( ! +id ) {
return;
}
var html = tpl.innerHTML
.replace( /__id__/g, id )
.replace( '__title__', opt.textContent )
.replace( '__type__', opt.getAttribute( 'data-type' ) || '' );
var wrap = document.createElement( 'tbody' );
wrap.innerHTML = html.trim();
var li = wrap.firstChild;
list.appendChild( li );
attachRemove( li );
addSel.selectedIndex = 0;
sync();
} );
if ( addBtn && addSel && list && tpl ) {
addBtn.addEventListener( 'click', function () {
var opt = addSel.options[ addSel.selectedIndex ];
var id = opt.value;
if ( ! +id ) {
return;
}
var html = tpl.innerHTML
.replace( /__id__/g, id )
.replace( '__title__', opt.textContent )
.replace( '__type__', opt.getAttribute( 'data-type' ) || '' );
var wrap = document.createElement( 'ul' );
wrap.innerHTML = html.trim();
var li = wrap.firstChild;
if ( ! li ) {
return;
}
list.appendChild( li );
attachRemove( li );
addSel.selectedIndex = 0;
sync();
} );
}

// Arrastrar para ordenar (HTML5 drag & drop).
var dragged = null;
Expand Down
2 changes: 1 addition & 1 deletion src/Panel/views/layout.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,6 @@
· <a href="https://github.com/kombicl/MagicLobby" target="_blank" rel="noopener">GitHub</a>
</footer>

<script src="<?php echo esc_url( $assets . 'panel.js?ver=' . MAGICLOBBY_VERSION ); ?>"></script>
<script data-cfasync="false" src="<?php echo esc_url( $assets . 'panel.js?ver=' . MAGICLOBBY_VERSION ); ?>"></script>
</body>
</html>
Loading