Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Data Field options as a combobox #22

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
9 changes: 8 additions & 1 deletion js/edit-slide-admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,14 @@ jQuery( document ).ready( function( $ ) {
$( '#slides' ).on( 'click.add-data', '.button.add-data', function( e ) {
var table_body = $(this).closest( 'table.slide-data-attributes-table' ).find( 'tbody' );
var slide_index = $(this).closest( '.stuffbox' ).find( 'input[name="slide-index"]' ).val();
var data_row = '<tr><td class="left newdataleft"><input type="text" name="slide-data[' + slide_index + '][]"></td><td><input type="text" name="slide-data-value[' + slide_index + '][]"></td></tr>';
var data_row = '<tr>';
data_row += '<td class="left newdataleft">';
data_row += '<input type="text" name="slide-data[' + slide_index + '][]" list="slide-data-options">';
data_row += '</td>';
data_row += '<td>';
data_row += '<input type="text" name="slide-data-value[' + slide_index + '][]">';
data_row += '</td>';
data_row += '</tr>';

table_body.append( data_row );
} );
Expand Down
6 changes: 6 additions & 0 deletions presenter.php
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,12 @@ public function slides_meta_box( $post ) {
</p>
<div class="data-attributes" id="slide-data-attributes-<?php echo $slide->number; ?>">
<p><strong>Slide Data Attributes</strong></p>
<p>See <a href="https://github.com/hakimel/reveal.js#image-backgrounds" target="_blank">the revealjs readme for your options</a>. If you don't see a list of options when selecting the "name" box, double click or tap the box again.</p>
<datalist id="slide-data-options">
<?php foreach (['background-image','background-size','background-position','background-repeat','background-opacity','background-video','background-video-loop','background-video-muted','transition','transition-speed'] as $item) {
echo "<option value=\"$item\">$item</option>";
} ?>
</datalist>
<table class="slide-data-attributes-table">
<thead>
<tr>
Expand Down