Merge branch 'develop' into save-user-wishlists

This commit is contained in:
Jay Trees 2022-04-08 15:00:40 +02:00
commit d4ce6f0571
22 changed files with 15740 additions and 14198 deletions

View file

@ -27,31 +27,32 @@
"grid",
"button",
"calendar",
"card",
"divider",
"dimmer",
"divider",
"dropdown",
"form",
"header",
"icon",
"image",
"input",
"label",
"loader",
"list",
"list",
"loader",
"menu",
"message",
"modal",
"popup",
"progress",
"segment",
"sidebar",
"statistic",
"step",
"tab",
"text",
"toast",
"form",
"menu",
"calendar",
"popup",
"message",
"list",
"tab",
"api",
"transition"

700
semantic/dist/components/step.css vendored Normal file

File diff suppressed because one or more lines are too long

9
semantic/dist/components/step.min.css vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

12560
semantic/dist/semantic.js vendored

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -56,21 +56,25 @@ switch ($_SERVER['REQUEST_METHOD']) {
$wishlist_id = $_POST['wishlist_id'];
$wish_title = trim($_POST['wish_title']);
$wish_description = $_POST['wish_description'] ?: '';
$wish_description = trim($_POST['wish_description']);
$wish_url = trim($_POST['wish_url']);
$wish_priority = isset($_POST['wish_priority']) && $_POST['wish_priority'] ? $_POST['wish_priority'] : 'NULL';
$database->query('INSERT INTO `wishes`
(
`wishlist`,
`title`,
`description`,
`url`
) VALUES ('
. $wishlist_id . ',
"' . $wish_title . '",
"' . $wish_description . '",
"' . $wish_url . '"
)
$database
->query('INSERT INTO `wishes`
(
`wishlist`,
`title`,
`description`,
`url`,
`priority`
) VALUES (
' . $wishlist_id . ',
"' . $wish_title . '",
"' . $wish_description . '",
"' . $wish_url . '",
' . $wish_priority . '
)
;');
$response['data'] = array(

View file

@ -0,0 +1,8 @@
$(function () {
/**
* Priority
*/
$('.dropdown.priority').dropdown();
});

View file

@ -25,6 +25,39 @@ $(function() {
}
});
$(document).on('change', '[name="user-password"]', function() {
var password = $(this).val();
if (password.length > 8) {
$('.step.long')
.removeClass('disabled')
.addClass('completed');
} else {
$('.step.long')
.removeClass('completed')
.addClass('disabled');
}
var hasSpecialCharacter = false;
password.split('').forEach(character => {
if (character.match(/\W/)) {
hasSpecialCharacter = true;
return;
}
});
if (hasSpecialCharacter) {
$('.step.special')
.addClass('completed')
.removeClass('disabled');
} else {
$('.step.special')
.removeClass('completed')
.addClass('disabled');
}
});
$('.ui.dropdown.channel').dropdown();
$('.ui.dropdown.locale').dropdown({
sortSelect : 'natural',

View file

@ -144,9 +144,4 @@ $(function () {
});
});
/**
* Priority
*/
$('.dropdown.priority').dropdown();
});

View file

@ -55,8 +55,6 @@ $(function () {
/** Update URL */
urlParams.set('id', wishlistValue);
console.log(wishlistValue);
fetch('/src/api/url.php?url=' + window.btoa(urlParams.toString()), {
method: 'GET'
})
@ -368,8 +366,8 @@ $(function () {
modalWishlistWishAdd.find('[name="wishlist_id"]').val($('.ui.dropdown.wishlists').dropdown('get value'));
modalWishlistWishAdd
.modal({
autoShow : true,
onApprove: function (buttonAdd) {
autoShow : true,
onApprove : function (buttonAdd) {
buttonAdd.addClass('loading');
var form = $('.form.wishlist-wish-add');

View file

@ -31,7 +31,7 @@ switch ($step) {
<p><?= __('Welcome to the wishthis installer.') ?></p>
<p><?= __('wishthis needs a database to function properly. Please enter your credentials.') ?></p>
<form class="ui form" action="/?page=install" method="post">
<form class="ui form" action="/?page=install" method="POST">
<input type="hidden" name="install" value="true" />
<input type="hidden" name="step" value="<?= $step + 1; ?>" />
@ -101,7 +101,7 @@ switch ($step) {
<h2 class="ui header"><?= sprintf(__('Step %d'), $step) ?></h2>
<p><?= __('Click continue to test the database connection.') ?></p>
<form class="ui form" action="?page=install" method="post">
<form class="ui form" action="?page=install" method="POST">
<input type="hidden" name="install" value="true" />
<input type="hidden" name="step" value="<?= $step + 1; ?>" />

View file

@ -43,7 +43,7 @@ $page->navigation();
?>
<div class="ui segment">
<form class="ui form" method="post">
<form class="ui form" method="POST">
<div class="field">
<label><?= __('Email') ?></label>
<input type="email" name="email" placeholder="john.doe@domain.tld" />

View file

@ -105,7 +105,7 @@ $page->navigation();
<div class="column">
<h2 class="ui header"><?= __('Credentials') ?></h2>
<form class="ui form login" method="post">
<form class="ui form login" method="POST">
<div class="field">
<label><?= __('Email') ?></label>
@ -147,7 +147,7 @@ $page->navigation();
<?php if ($options->getOption('mjml_api_key') && $options->getOption('mjml_api_secret')) { ?>
<p>
<form class="ui form reset" method="post">
<form class="ui form reset" method="POST">
<div class="field">
<div class="ui action input">
<div class="ui left icon action input">

View file

@ -0,0 +1,71 @@
<?php
/**
* @author Jay Trees <github.jay@grandel.anonaddy.me>
*/
use wishthis\Wish;
$scriptPart = '/src/assets/js/parts/wish-priority.js';
?>
<script defer src="<?= $scriptPart ?>?m=<?= filemtime(ROOT . $scriptPart) ?>"></script>
<div class="stackable row">
<div class="column">
<div class="field">
<label><?= __('Title') ?></label>
<div class="ui input">
<input type="text"
name="wish_title"
placeholder="<?= $wish->title ?? '' ?>"
value="<?= $wish->title ?? '' ?>"
maxlength="128"
/>
</div>
</div>
<div class="field">
<label><?= __('Description') ?></label>
<textarea name="wish_description"
placeholder="<?= $wish->description ?? '' ?>"
><?= $wish->description ?? '' ?></textarea>
</div>
</div>
<div class="column">
<div class="field">
<label><?= __('URL') ?></label>
<input type="url"
name="wish_url"
placeholder="<?= $wish->url ?? '' ?>"
value="<?= $wish->url ?? '' ?>"
maxlength="255"
/>
</div>
<div class="field">
<label><?= __('Priority') ?></label>
<select class="ui selection clearable dropdown priority"
name="wish_priority"
>
<option value=""><?= __('Select priority') ?></option>
<?php foreach (Wish::$priorities as $priority => $item) { ?>
<?php if (isset($wish->priority) && $wish->priority === $priority) { ?>
<option value="<?= $priority ?>" selected><?= $item['name'] ?></option>
<?php } else { ?>
<option value="<?= $priority ?>"><?= $item['name'] ?></option>
<?php } ?>
<?php } ?>
</select>
</div>
</div>
</div>

View file

@ -8,7 +8,7 @@ use wishthis\Wish;
$scriptPart = '/src/assets/js/parts/wishlist-filter.js';
?>
<script defer src="/src/assets/js/parts/wishlist-filter.js?m=<?= filemtime(ROOT . $scriptPart) ?>"></script>
<script defer src="<?= $scriptPart ?>?m=<?= filemtime(ROOT . $scriptPart) ?>"></script>
<div>
<div class="ui stackable grid">

View file

@ -228,6 +228,30 @@ $page->navigation();
title="<?= __('Save') ?>"
/>
</form>
</div>
<h3 class="ui header"><?= __('Safe password checklist') ?></h3>
<div class="ui basic fitted segment">
<div class="ui three steps">
<div class="disabled step long">
<i class="times icon"></i>
<div class="content">
<div class="title"><?= __('Long') ?></div>
<div class="description"><?= __('Over eight characters in length.') ?></div>
</div>
</div>
<div class="disabled step special">
<i class="times icon"></i>
<div class="content">
<div class="title"><?= __('Special') ?></div>
<div class="description"><?= __('Contains special characters.') ?></div>
</div>
</div>
</div>
</div>
</div>

View file

@ -164,7 +164,7 @@ $page->navigation();
<?= $page->messages() ?>
<div class="ui segment">
<form class="ui form" method="post">
<form class="ui form" method="POST">
<div class="ui divided relaxed stackable two column grid">
<div class=" row">

View file

@ -67,7 +67,7 @@ $page->navigation();
<h2 class="ui header"><?= __('Database migration') ?></h2>
<p><?= __('Thank you for updating wishthis! To complete this update, some changes are required to the database structure.') ?></p>
<form class="ui form" method="post">
<form class="ui form" method="POST">
<button class="ui orange button"
type="submit"
title="<?= sprintf(__('Migrate to %s'), 'v' . VERSION) ?>"

View file

@ -106,66 +106,7 @@ $referer = '/?page=wishlists&id=' . $wish->wishlist;
<input type="hidden" name="wish_image" value="<?= $wish->image ?>" />
<div class="ui two column grid">
<div class="stackable row">
<div class="column">
<div class="field">
<label><?= __('Title') ?></label>
<div class="ui input">
<input type="text"
name="wish_title"
placeholder="<?= $wish->title ?>"
value="<?= $wish->title ?>"
maxlength="128"
/>
</div>
</div>
<div class="field">
<label><?= __('Description') ?></label>
<textarea name="wish_description"
placeholder="<?= $wish->description ?>"
><?= $wish->description ?></textarea>
</div>
</div>
<div class="column">
<div class="field">
<label><?= __('URL') ?></label>
<input type="url"
name="wish_url"
placeholder="<?= $wish->url ?>"
value="<?= $wish->url ?>"
maxlength="255"
/>
</div>
<div class="field">
<label><?= __('Priority') ?></label>
<select class="ui selection clearable dropdown priority"
name="wish_priority"
>
<option value=""><?= __('Select priority') ?></option>
<?php foreach (Wish::$priorities as $priority => $item) { ?>
<?php if ($wish->priority === $priority) { ?>
<option value="<?= $priority ?>" selected><?= $item['name'] ?></option>
<?php } else { ?>
<option value="<?= $priority ?>"><?= $item['name'] ?></option>
<?php } ?>
<?php } ?>
</select>
</div>
</div>
</div>
<?php include 'parts/wish-add.php' ?>
<div class="stackable row">
<div class="sixteen wide column">

View file

@ -175,25 +175,11 @@ $page->navigation();
<div class="description">
<p><?= __('Fill out any or all of the below fields to add your new wish.') ?></p>
<form class="ui form wishlist-wish-add" method="post">
<input type="hidden" name="wishlist_id" />
<form class="ui form wishlist-wish-add" method="POST">
<input type="hidden" name="wishlist_id" value="<?= $_GET['id'] ?>" />
<div class="field">
<label><?= __('Title') ?></label>
<input type="text" name="wish_title" maxlength="128" />
</div>
<div class="field">
<label><?= __('Description') ?></label>
<textarea name="wish_description"></textarea>
</div>
<div class="field">
<label><?= __('URL') ?></label>
<div class="ui input url">
<input type="url" name="wish_url" maxlength="255" />
</div>
<div class="ui two column grid">
<?php include 'parts/wish-add.php' ?>
</div>
</form>
</div>