Front end UI

>Made error message look pretty
>Fixed urls on user pastes list
>Added prompt for paste deletion.
>Greentext'd on github.
This commit is contained in:
aftercase 2021-08-15 22:47:06 +01:00
parent cb5520c40d
commit 6e0b286c2b
2 changed files with 28 additions and 11 deletions

View file

@ -19,9 +19,29 @@
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<script src="theme/bulma/js/bulma-tagsinput.min.js"></script>
<script>
function setupTagsInput() {
function setupTagsInput() {
const tagsInput = document.getElementById('tags-with-source');
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) {
// Value equal input value
// We can then use it to request data from external API
@ -169,7 +189,7 @@
<?php if ($_SERVER['REQUEST_METHOD'] == 'POST') {
if (isset($error)) { ?>
<!-- Error Panel -->
<i class="fa fa-exclamation-circle" aria-hidden=" true"></i> <?php echo $error; ?>
<div class="notification is-info"><i class="fa fa-exclamation-circle" aria-hidden=" true"></i> <?php echo $error; ?></div>
<?php }
}
?>
@ -245,10 +265,6 @@
<label class="label">Tags</label>
<div class="control">
<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" ?>">
</div>
</div>

View file

@ -109,10 +109,10 @@ $protocol = paste_protocol();
if (isset($_GET['del'])) {
if (isset($success)) {
// Deleted
echo '<p class="help is-success subtitle is-6">' . $success . '</p>';
echo '<div class="notification is-info"><i class="fa fa-exclamation-circle" aria-hidden=" true"></i> ' . $success . '</div>';
} // Errors
elseif (isset($error)) {
echo '<p class="help is-danger subtitle is-6">' . $error . '</p>';
echo '<div class="notification is-danger"><i class="fa fa-exclamation-circle" aria-hidden=" true"></i> ' . $error . '</div>';
}
}
?>
@ -191,6 +191,7 @@ $protocol = paste_protocol();
2 => $lang['private']
};
$p_link = urlForPaste($p_id);
$p_delete_message = "'Are you sure you want to delete this paste?'";
$p_delete_link = (PP_MOD_REWRITE) ? "user.php?del&user=$profile_username&id=$p_id" : "user.php?del&user=$profile_username&id=$p_id";
$p_tag_link = (PP_MOD_REWRITE) ? "user.php?user=$profile_username&q=$p_tags" : "user.php?user=$profile_username&q=$tags";
$title = truncate($title, 20, 50);
@ -224,7 +225,7 @@ $protocol = paste_protocol();
} else {
echo '<tr>
<td>
<a href="' . $protocol . $baseurl . '/' . $p_link . '" title="' . $title . '">' . ($title) . '</a>
<a href="' . urlForPaste($p_id) . '" title="' . $title . '">' . ($title) . '</a>
</td>
<td data-sort="' . $p_date->format('U') . '" class="td-center">
<span>' . $p_dateui . '</span>
@ -238,8 +239,8 @@ $protocol = paste_protocol();
<td class="td-center">
' . strtoupper($p_code) . '
</td>
<td class="td-center">
<a href="' . $protocol . $baseurl . '/' . $p_delete_link . '" title="' . $title . '"><i class="far fa-trash-alt fa-lg" aria-hidden="true"></i></a>
<td class="td-center">
<a href="' . $protocol . $baseurl . '/' . $p_delete_link . '" title="' . $title . '" onClick="return confirm(' . $p_delete_message. ')"><i class="far fa-trash-alt fa-lg" aria-hidden="true"></i></a>
</td>
</tr>';
}