Merge branch 'develop' of https://github.com/grandeljay/wishthis into develop
This commit is contained in:
commit
a1d12caab1
9 changed files with 49 additions and 15 deletions
|
@ -8,7 +8,7 @@
|
|||
RewriteRule ^([a-z\-]+)/(\d+)$ /?page=$1&id=$2 [QSA,L]
|
||||
|
||||
# Wishlists
|
||||
RewriteRule ^([a-z\-]+)/(\d+)$ /?page=$1&wishlist=$2 [QSA,L]
|
||||
RewriteRule ^([a-z\-]+)/(\d+)$ /?page=$1&id=$2 [QSA,L]
|
||||
|
||||
# Wishlist
|
||||
RewriteRule ^wishlist/([a-z0-9]+)$ /?wishlist=$1 [QSA,L]
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* @author Jay Trees <github.jay@grandel.anonaddy.me>
|
||||
*/
|
||||
|
||||
define('VERSION', '0.6.0');
|
||||
define('VERSION', '0.5.0');
|
||||
define('ROOT', __DIR__);
|
||||
define('DEFAULT_LOCALE', 'en_GB');
|
||||
|
||||
|
|
|
@ -90,6 +90,8 @@ switch ($_SERVER['REQUEST_METHOD']) {
|
|||
SET `status` = "' . $_PUT['wish_status'] . '"
|
||||
WHERE `id` = ' . $_PUT['wish_id'] . '
|
||||
;');
|
||||
|
||||
$response['success'] = true;
|
||||
} elseif (isset($_PUT['wish_url_current'], $_PUT['wish_url_proposed'])) {
|
||||
/**
|
||||
* Update Wish URL
|
||||
|
@ -98,6 +100,8 @@ switch ($_SERVER['REQUEST_METHOD']) {
|
|||
SET `url` = "' . $_PUT['wish_url_proposed'] . '"
|
||||
WHERE `url` = "' . $_PUT['wish_url_current'] . '"
|
||||
;');
|
||||
|
||||
$response['success'] = true;
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -109,6 +113,8 @@ switch ($_SERVER['REQUEST_METHOD']) {
|
|||
WHERE `id` = ' . $_DELETE['wish_id'] . '
|
||||
;');
|
||||
}
|
||||
|
||||
$response['success'] = true;
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -101,6 +101,7 @@ switch ($_SERVER['REQUEST_METHOD']) {
|
|||
WHERE `id` = ' . $_PUT['wishlist_id'] . '
|
||||
;');
|
||||
|
||||
$response['success'] = true;
|
||||
break;
|
||||
|
||||
case 'DELETE':
|
||||
|
@ -110,6 +111,7 @@ switch ($_SERVER['REQUEST_METHOD']) {
|
|||
WHERE `id` = ' . $_DELETE['wishlistID'] . '
|
||||
;');
|
||||
|
||||
$response['success'] = true;
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -40,8 +40,8 @@ $(function() {
|
|||
placeholder: text.wishlist_no_selection
|
||||
})
|
||||
|
||||
if ($_GET.wishlist) {
|
||||
element.dropdown('set selected', $_GET.wishlist);
|
||||
if ($_GET.id) {
|
||||
element.dropdown('set selected', $_GET.id);
|
||||
} else {
|
||||
if (response.results[0]) {
|
||||
element.dropdown('set selected', response.results[0].value);
|
||||
|
|
|
@ -25,9 +25,25 @@ $(function() {
|
|||
}
|
||||
});
|
||||
|
||||
$('.ui.dropdown').dropdown();
|
||||
$('.ui.dropdown.channel').dropdown();
|
||||
$('.ui.dropdown.locale').dropdown({
|
||||
sortSelect : 'natural',
|
||||
});
|
||||
$('.ui.progress').progress();
|
||||
|
||||
var isPWA = navigator.standalone || window.matchMedia('(display-mode: standalone)').matches;
|
||||
|
||||
if (isPWA) {
|
||||
$('.ui.dropdown.channel').dropdown('set selected', 'stable');
|
||||
$('.ui.dropdown.channel').addClass('disabled');
|
||||
$('.ui.dropdown.channel').find('select').removeAttr('name');
|
||||
|
||||
if ('undefined' !== typeof CHANNELS) {
|
||||
CHANNELS.forEach(channel => {
|
||||
if (channel.host === location.host) {
|
||||
$('.ui.dropdown.channel').dropdown('set selected', channel.branch);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -17,8 +17,8 @@ $(function () {
|
|||
placeholder : text.wishlist_no_selection
|
||||
})
|
||||
|
||||
if ($_GET.wishlist) {
|
||||
element.dropdown('set selected', $_GET.wishlist);
|
||||
if ($_GET.id) {
|
||||
element.dropdown('set selected', $_GET.id);
|
||||
} else {
|
||||
if (wishlists[0]) {
|
||||
element.dropdown('set selected', wishlists[0].value);
|
||||
|
@ -43,7 +43,7 @@ $(function () {
|
|||
progress.addClass('indeterminate');
|
||||
|
||||
if (wishlistValue) {
|
||||
$_GET.wishlist = wishlistValue;
|
||||
$_GET.id = wishlistValue;
|
||||
|
||||
$('.wishlist-share').attr('href', '/?wishlist=' + wishlists[wishlistIndex].hash);
|
||||
|
||||
|
@ -53,9 +53,11 @@ $(function () {
|
|||
$('.wishlist-delete').removeClass('disabled');
|
||||
|
||||
/** Update URL */
|
||||
urlParams.set('wishlist', wishlistValue);
|
||||
urlParams.set('id', wishlistValue);
|
||||
|
||||
fetch('/src/api/url.php?url=' + btoa(urlParams.toString()), {
|
||||
console.log(wishlistValue);
|
||||
|
||||
fetch('/src/api/url.php?url=' + window.btoa(urlParams.toString()), {
|
||||
method: 'GET'
|
||||
})
|
||||
.then(handleFetchError)
|
||||
|
@ -272,7 +274,7 @@ $(function () {
|
|||
|
||||
wishlists.dropdown('clear');
|
||||
|
||||
urlParams.delete('wishlist');
|
||||
urlParams.delete('id');
|
||||
|
||||
$('body').toast({ message:text.toast_wishlist_delete });
|
||||
|
||||
|
@ -424,7 +426,7 @@ $(function () {
|
|||
.then(function(response) {
|
||||
modalWishlistCreate.modal('hide');
|
||||
|
||||
urlParams.set('wishlist', response.data.lastInsertId);
|
||||
urlParams.set('id', response.data.lastInsertId);
|
||||
|
||||
$('body').toast({ message: text.toast_wish_create });
|
||||
|
||||
|
|
|
@ -260,10 +260,14 @@ $page->navigation();
|
|||
</div>
|
||||
|
||||
<?php if (defined('CHANNELS') && is_array(CHANNELS)) { ?>
|
||||
<script type="text/javascript">
|
||||
var CHANNELS = <?= json_encode(CHANNELS) ?>;
|
||||
</script>
|
||||
|
||||
<div class="field">
|
||||
<label><?= __('Channel') ?></label>
|
||||
|
||||
<select class="ui search clearable dropdown" name="user-channel">
|
||||
<select class="ui search clearable dropdown channel" name="user-channel">
|
||||
<option value=""><?= __('Select channel') ?></option>
|
||||
|
||||
<?php foreach (CHANNELS as $channel) { ?>
|
||||
|
|
|
@ -35,7 +35,7 @@ if ('POST' === $_SERVER['REQUEST_METHOD'] && count($_POST) >= 0) {
|
|||
$page->messages[] = Page::success(__('Wish successfully updated.'), __('Success'));
|
||||
}
|
||||
|
||||
if (!$userIsAuthenticated || !$wish->exists) {
|
||||
if (!$wish->exists) {
|
||||
$page->errorDocument(404, $wish);
|
||||
}
|
||||
|
||||
|
@ -48,11 +48,15 @@ foreach ($wishlists as $wishlist) {
|
|||
}
|
||||
}
|
||||
|
||||
if (!$userIsAuthenticated) {
|
||||
$page->errorDocument(404, $wish);
|
||||
}
|
||||
|
||||
$page->header();
|
||||
$page->bodyStart();
|
||||
$page->navigation();
|
||||
|
||||
$referer = '/?page=wishlists&wishlist=' . $wish->wishlist;
|
||||
$referer = '/?page=wishlists&id=' . $wish->wishlist;
|
||||
?>
|
||||
|
||||
<main>
|
||||
|
|
Loading…
Reference in a new issue