mirror of
https://github.com/Neetpone/ponepaste.git
synced 2025-03-12 14:40:09 +01:00
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:
parent
cb5520c40d
commit
6e0b286c2b
2 changed files with 28 additions and 11 deletions
|
@ -19,9 +19,29 @@
|
||||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
|
<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 src="theme/bulma/js/bulma-tagsinput.min.js"></script>
|
||||||
<script>
|
<script>
|
||||||
function setupTagsInput() {
|
function setupTagsInput() {
|
||||||
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
|
||||||
|
@ -169,7 +189,7 @@
|
||||||
<?php if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
<?php if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
||||||
if (isset($error)) { ?>
|
if (isset($error)) { ?>
|
||||||
<!-- Error Panel -->
|
<!-- 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 }
|
<?php }
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
@ -245,10 +265,6 @@
|
||||||
<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>
|
||||||
|
|
|
@ -109,10 +109,10 @@ $protocol = paste_protocol();
|
||||||
if (isset($_GET['del'])) {
|
if (isset($_GET['del'])) {
|
||||||
if (isset($success)) {
|
if (isset($success)) {
|
||||||
// Deleted
|
// 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
|
} // Errors
|
||||||
elseif (isset($error)) {
|
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']
|
2 => $lang['private']
|
||||||
};
|
};
|
||||||
$p_link = urlForPaste($p_id);
|
$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_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";
|
$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);
|
$title = truncate($title, 20, 50);
|
||||||
|
@ -224,7 +225,7 @@ $protocol = paste_protocol();
|
||||||
} else {
|
} else {
|
||||||
echo '<tr>
|
echo '<tr>
|
||||||
<td>
|
<td>
|
||||||
<a href="' . $protocol . $baseurl . '/' . $p_link . '" title="' . $title . '">' . ($title) . '</a>
|
<a href="' . urlForPaste($p_id) . '" title="' . $title . '">' . ($title) . '</a>
|
||||||
</td>
|
</td>
|
||||||
<td data-sort="' . $p_date->format('U') . '" class="td-center">
|
<td data-sort="' . $p_date->format('U') . '" class="td-center">
|
||||||
<span>' . $p_dateui . '</span>
|
<span>' . $p_dateui . '</span>
|
||||||
|
@ -239,7 +240,7 @@ $protocol = paste_protocol();
|
||||||
' . strtoupper($p_code) . '
|
' . strtoupper($p_code) . '
|
||||||
</td>
|
</td>
|
||||||
<td class="td-center">
|
<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>
|
<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>
|
</td>
|
||||||
</tr>';
|
</tr>';
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue