Skip to content

Commit

Permalink
Merge pull request #262 from dragomano/v2.9.1
Browse files Browse the repository at this point in the history
Update to 2.9.1
  • Loading branch information
dragomano authored Jan 18, 2025
2 parents f76a902 + dbdb37a commit ddf83d4
Show file tree
Hide file tree
Showing 156 changed files with 1,827 additions and 1,948 deletions.
6 changes: 0 additions & 6 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,6 @@
<exclude name="Sources/LightPortal/Plugins/Uicons/**" />
<exclude name="Sources/LightPortal/Plugins/VkComments/**" />
<exclude name="Sources/LightPortal/Plugins/YandexTurbo/**" />
<exclude name="Sources/LightPortal/Compilers/Less.php" />
<exclude name="Sources/LightPortal/Compilers/Sass.php" />
<exclude name="Sources/LightPortal/development.config.php" />
<exclude name="Sources/LightPortal/composer.json" />
<exclude name="Sources/LightPortal/composer.lock" />
<exclude name="Sources/LightPortal/create_index.php" />
Expand Down Expand Up @@ -134,9 +131,6 @@
<include name="Sources/**" />
<exclude name="Sources/index.php" />
<exclude name="Sources/LightPortal/Plugins/**" />
<exclude name="Sources/LightPortal/Compilers/Less.php" />
<exclude name="Sources/LightPortal/Compilers/Sass.php" />
<exclude name="Sources/LightPortal/development.config.php" />
<exclude name="Sources/LightPortal/composer.json" />
<exclude name="Sources/LightPortal/composer.lock" />
<exclude name="Sources/LightPortal/create_index.php" />
Expand Down
4 changes: 2 additions & 2 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
},
"devDependencies": {
"@nolebase/vitepress-plugin-enhanced-readabilities": "^2.12.0",
"@rive-app/canvas": "^2.25.3",
"@rive-app/canvas": "^2.25.4",
"release-timeline": "^0.6.0",
"sass": "^1.83.0",
"sass": "^1.83.4",
"vitepress": "^1.5.0",
"vitepress-sidebar": "^1.30.2"
},
Expand Down
705 changes: 385 additions & 320 deletions docs/pnpm-lock.yaml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/src/getting-started/updating.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ If there are no notes in the changelog of the latest version, it is enough to ex

:::info Note

Since version 2.4 you can upgrade without uninstalling the previous version. Simply download the new archive, go to the Package Manager and click "Upgrade" button next to the uploaded package.
If the new version can be installed without removing the previous one, you'll see the "Upgrade" button instead of the "Install" button:

![Updating](upgrade.png)

Expand Down
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@
"alpinejs": "^3.14.8",
"alpinejs-slug": "^1.1.3",
"axios": "^1.7.9",
"sass": "^1.83.0",
"sass": "^1.83.4",
"sortablejs": "^1.15.6",
"svelecte": "^5.1.1",
"svelte": "^5.16.0",
"svelte-check": "^4.1.1",
"svelecte": "^5.1.4",
"svelte": "^5.19.0",
"svelte-check": "^4.1.4",
"svelte-i18n": "^4.0.1",
"svelte-showdown": "^0.3.0",
"svelte-showdown": "^0.4.1",
"svelte-toggle": "^4.0.1",
"vanilla-lazyload": "^19.1.3",
"virtual-select-plugin": "^1.0.46",
"vite": "^6.0.6",
"virtual-select-plugin": "^1.0.47",
"vite": "^6.0.7",
"vite-plugin-minify": "^2.1.0",
"vite-plugin-static-copy": "^2.2.0"
}
Expand Down
398 changes: 199 additions & 199 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions resources/.editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,7 @@ indent_style = space
indent_size = 2
trim_trailing_whitespace = true
charset = utf-8

[*.scss]
indent_style = tab
indent_size = tab
28 changes: 20 additions & 8 deletions resources/components/comments/CommentItem.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -46,33 +46,44 @@
editMode = false;
};
const itemType = 'https://schema.org/Comment';
const even = index % 2 === 0;
const odd = !even;
</script>

<li
transition:fade
bind:this={parent}
id={`comment${comment.id}`}
class={`col-xs-12 generic_list_wrapper bg ${index % 2 === 0 ? 'even' : 'odd'}`}
class="col-xs-12 generic_list_wrapper bg"
class:even
class:odd
data-id={comment.id}
data-author={comment.poster.id}
itemprop="comment"
itemscope
itemtype={itemType}
itemtype={'https://schema.org/Comment'}
>
<div class="comment_wrapper" id={`comment=${comment.id}`}>
<div class="comment_avatar">
<span>{@html comment.poster.avatar}</span>

{#if comment.authorial}
<span class="new_posts">{$_('author')}</span>
{/if}
</div>
<div class="comment_entry bg {index % 2 === 0 ? 'odd' : 'even'}">

<div class="comment_entry bg" class:even={odd} class:odd={even}>
<div class="comment_title">
<span class="bg {index % 2 === 0 ? 'even' : 'odd'}" data-id={comment.id} itemprop="creator"
>{comment.poster.name}</span
<span
class="bg"
class:even
class:odd
data-id={comment.id}
itemprop="creator"
>
<div class="comment_date bg {index % 2 === 0 ? 'even' : 'odd'}">
{comment.poster.name}
</span>
<div class="comment_date bg" class:even class:odd>
<span itemprop="datePublished" content={comment.published_at}>
{@html comment.human_date}
<a class="bbc_link" href={`#comment=${comment.id}`}>#{comment.id}</a>
Expand All @@ -86,9 +97,10 @@
<MarkdownPreview
content={comment.message}
class="comment_content"
style="border: none;"
style="border: none"
itemprop="text"
/>

{#if userId}
<div class="comment_buttons">
{#if showReplyButton}
Expand Down
16 changes: 12 additions & 4 deletions resources/components/comments/CommentList.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,14 @@
};
</script>

{#snippet pagination()}
<Pagination bind:start={$start} totalItems={parentsCount} itemsPerPage={limit} />
{/snippet}

{#snippet replies()}
<ReplyForm submit={addComment} />
{/snippet}

<aside class="comments">
<div class="cat_bar">
<h3 class="catbg">
Expand All @@ -119,10 +127,10 @@
</div>
<div>
{#if showReplyFormOnTop}
<ReplyForm submit={addComment} />
{@render replies()}
{/if}

<Pagination bind:start={$start} totalItems={parentsCount} itemsPerPage={limit} />
{@render pagination()}

{#if comments.length}
<ul class="comment_list row">
Expand All @@ -133,11 +141,11 @@
{/if}

{#if showBottomPagination}
<Pagination bind:start={$start} totalItems={parentsCount} itemsPerPage={limit} />
{@render pagination()}
{/if}

{#if !showReplyFormOnTop}
<ReplyForm submit={addComment} />
{@render replies()}
{/if}
</div>
</aside>
3 changes: 2 additions & 1 deletion resources/components/comments/MarkdownPreview.svelte
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<script>
import { slide } from 'svelte/transition';
import { SvelteShowdown } from 'svelte-showdown';
const classMap = {
Expand Down Expand Up @@ -29,6 +30,6 @@
let { content = '', ...rest } = $props();
</script>

<fieldset {...rest}>
<fieldset transition:slide {...rest}>
<SvelteShowdown {content} extensions={[bindings]} {options} />
</fieldset>
20 changes: 12 additions & 8 deletions resources/components/plugins/PluginItem.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,18 @@
/>
{/if}
{#if item.special}
<a
href={item.special === 'can_donate' ? donateLink : downloadLink}
rel="noopener"
target="_blank"
>
{@html item.special === 'can_donate' ? donateIcon : downloadIcon}
{#snippet specialLink(link, icon)}
<a href={link} rel="noopener" target="_blank">
{@html icon}
</a>
{/snippet}
{#if item.special}
{#if item.special === 'can_donate'}
{@render specialLink(donateLink, donateIcon)}
{:else}
{@render specialLink(downloadLink, downloadIcon)}
{/if}
{/if}
{#if showToggle}
Expand All @@ -98,7 +102,7 @@
{#if show && item.settings.length}
<br class="clear" />
<PluginOptionList {item} hide={() => (show = false)} />
<PluginOptionList {item} />
{/if}
</div>
</div>
10 changes: 4 additions & 6 deletions resources/components/plugins/PluginOptionList.svelte
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<script>
import { _ } from 'svelte-i18n';
import { fade } from 'svelte/transition';
import { slide } from 'svelte/transition';
import { useContextStore, useAppStore } from '../../js/stores.js';
import { PluginOptionItem } from './index.js';
import Button from '../BaseButton.svelte';
/** @type {{ item: { snake_name: string, saveable: boolean, settings: array } }} */
let { item, hide } = $props();
let { item } = $props();
let success = $state(false);
let form = $state();
Expand All @@ -33,7 +33,7 @@
};
</script>

<div class="roundframe" id={blockId} transition:fade>
<div class="roundframe" id={blockId} transition:slide>
<div class="title_bar">
<h5 class="titlebg">{$_('settings')}</h5>
</div>
Expand All @@ -54,10 +54,8 @@
{$_('settings_saved')}
</span>

<Button icon="close" onclick={hide}>{$_('find_close')}</Button>

{#if item.saveable}
<Button icon="save" form={formId} type="submit">
<Button icon="save" form={formId} type="submit" onclick={(e) => e.target.blur()}>
{$_('save')}
</Button>
{/if}
Expand Down
11 changes: 10 additions & 1 deletion resources/sass/admin_tabs.scss
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,15 @@
}
}

.roundframe {
&.smalltext {
box-shadow: inset 0 2px 2px rgba(0, 0, 0, 0.1),
inset 0 -2px 2px rgba(0, 0, 0, 0.1),
inset 2px 0 2px rgba(0, 0, 0, 0.1),
inset -2px 0 2px rgba(0, 0, 0, 0.1);
}
}

@media (max-width: 600px) {
flex: 1 100%;
text-align: center;
Expand Down Expand Up @@ -180,4 +189,4 @@
}
}
}
}
}
5 changes: 2 additions & 3 deletions src/Sources/LightPortal/Actions/AbstractPageList.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
use Bugo\Compat\Lang;
use Bugo\Compat\User;
use Bugo\Compat\Utils;
use Bugo\LightPortal\Lists\CategoryList;
use Bugo\LightPortal\Utils\Avatar;
use Bugo\LightPortal\Utils\Content;
use Bugo\LightPortal\Utils\DateTime;
Expand All @@ -32,8 +33,6 @@

abstract class AbstractPageList implements PageListInterface
{
abstract public function show(CardListInterface $cardList);

abstract public function showAll();

abstract public function getAll(int $start, int $limit, string $sort): array;
Expand Down Expand Up @@ -79,7 +78,7 @@ protected function getPreparedResults(array $rows = []): array

private function getSectionData(array $row): array
{
if (empty($categories = app('category_list')))
if (empty($categories = app(CategoryList::class)))
return [];

if (isset($row['category_id'])) {
Expand Down
22 changes: 17 additions & 5 deletions src/Sources/LightPortal/Actions/CardList.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
<?php
<?php declare(strict_types=1);

/**
* @package Light Portal
* @link https://dragomano.ru/mods/light-portal
* @author Bugo <bugo@dragomano.ru>
* @copyright 2019-2025 Bugo
* @license https://spdx.org/licenses/GPL-3.0-or-later.html GPL-3.0-or-later
*
* @version 2.9
*/

namespace Bugo\LightPortal\Actions;

Expand All @@ -14,6 +24,8 @@
use Bugo\LightPortal\Utils\RequestTrait;
use Bugo\LightPortal\Utils\Setting;
use Bugo\LightPortal\Utils\Str;
use Bugo\LightPortal\Utils\Weaver;
use WPLake\Typed\Typed;

class CardList implements CardListInterface
{
Expand All @@ -24,16 +36,16 @@ public function show(PageListInterface $entity): void
if (empty(Config::$modSettings['lp_show_items_as_articles']))
return;

$start = (int) $this->request('start');
$start = Typed::int($this->request()->get('start'));
$limit = Setting::get('lp_num_items_per_page', 'int', 12);

$itemsCount = $entity->getTotalCount();

$front = app('front_page');
$front = app(FrontPage::class);
$front->updateStart($itemsCount, $start, $limit);

$sort = $this->getOrderBy();
$articles = app('weaver')(static fn() => $entity->getPages($start, $limit, $sort));
$articles = app(Weaver::class)(static fn() => $entity->getPages($start, $limit, $sort));

Utils::$context['page_index'] = new PageIndex(
Utils::$context['canonical_url'], $start, $itemsCount, $limit
Expand Down Expand Up @@ -66,7 +78,7 @@ public function getOrderBy(): string
'num_views' => 'p.num_views',
];

Utils::$context['current_sorting'] = $this->request('sort', 'created;desc');
Utils::$context['current_sorting'] = $this->request()->get('sort') ?? 'created;desc';

return $sortingTypes[Utils::$context['current_sorting']];
}
Expand Down
Loading

0 comments on commit ddf83d4

Please sign in to comment.