This commit is contained in:
Floorb 2021-08-16 11:52:30 -04:00
parent 38c4d7db04
commit bb3536f4fb
4 changed files with 14 additions and 23 deletions

View file

@ -0,0 +1,4 @@
<?php
class NonRetardedSSP {
}

View file

@ -65,6 +65,7 @@ if (!$row) {
'code' => $paste_code, 'code' => $paste_code,
'tags' => getPasteTags($conn, $paste_id) 'tags' => getPasteTags($conn, $paste_id)
]; ];
var_dump($paste);
$p_content = $row['content']; $p_content = $row['content'];
$p_visible = $row['visible']; $p_visible = $row['visible'];
$p_expiry = Trim($row['expiry']); $p_expiry = Trim($row['expiry']);

View file

@ -20,28 +20,9 @@
<script src="theme/bulma/js/bulma-tagsinput.min.js"></script> <script src="theme/bulma/js/bulma-tagsinput.min.js"></script>
<script> <script>
function setupTagsInput() { function setupTagsInput() {
BulmaTagsInput.attach();
const tagsInput = document.getElementById('tags-with-source'); const tagsInput = document.getElementById('tags-with-source');
new BulmaTagsInput(tagsInput, { new BulmaTagsInput(tagsInput, {
allowDuplicates: false,
caseSensitive: false,
clearSelectionOnTyping: false,
closeDropdownOnItemSelect: true,
delimiter: ',',
freeInput: true,
highlightDuplicate: true,
highlightMatchesString: true,
itemText: 'name',
maxTags: 10,
maxChars: 40,
minChars: 1,
noResultsLabel: 'No results found',
placeholder: '10',
removable: true,
searchMinChars: 1,
searchOn: 'text',
selectable: true,
tagClass: 'is-rounded',
trim: true,
source: async function (value) { source: async function (value) {
// Value equal input value // Value equal input value
// We can then use it to request data from external API // We can then use it to request data from external API
@ -189,7 +170,7 @@ function setupTagsInput() {
<?php if ($_SERVER['REQUEST_METHOD'] == 'POST') { <?php if ($_SERVER['REQUEST_METHOD'] == 'POST') {
if (isset($error)) { ?> if (isset($error)) { ?>
<!-- Error Panel --> <!-- Error Panel -->
<div class="notification is-info"><i class="fa fa-exclamation-circle" aria-hidden=" true"></i> <?php echo $error; ?></div> <i class="fa fa-exclamation-circle" aria-hidden=" true"></i> <?php echo $error; ?>
<?php } <?php }
} }
?> ?>
@ -265,6 +246,10 @@ function setupTagsInput() {
<label class="label">Tags</label> <label class="label">Tags</label>
<div class="control"> <div class="control">
<input id="tags-with-source" name="tag_input" class="input" <input id="tags-with-source" name="tag_input" class="input"
data-max-tags="10"
data-max-chars="40" type="text" data-item-text="name"
data-item-value="name"
data-case-sensitive="false" placeholder="10 Tags Maximum"
value="<?php echo (isset($_POST['tag_input'])) ? $_POST['tag_input'] : ''; // Pre-populate if we come here on an error" ?>"> value="<?php echo (isset($_POST['tag_input'])) ? $_POST['tag_input'] : ''; // Pre-populate if we come here on an error" ?>">
</div> </div>
</div> </div>

View file

@ -246,6 +246,7 @@ $selectedloader = "$bg[$i]"; // set variable equal to which random filename was
<div class="columns is-desktop is-centered"> <div class="columns is-desktop is-centered">
<?php <?php
$tags = $paste['tags']; $tags = $paste['tags'];
var_dump($tags);
if (count($tags) != 0) { if (count($tags) != 0) {
foreach ($tags as $tag) { foreach ($tags as $tag) {
$tagName = ucfirst(pp_html_escape($tag['name'])); $tagName = ucfirst(pp_html_escape($tag['name']));