Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pagination of cms-loop #126

Open
pandaulait opened this issue Mar 3, 2023 · 12 comments
Open

Pagination of cms-loop #126

pandaulait opened this issue Mar 3, 2023 · 12 comments

Comments

@pandaulait
Copy link

pandaulait commented Mar 3, 2023

Is your feature request related to a problem? Please describe.

I would like best practices in creating pagination with pagination like below

スクリーンショット 2023-03-03 15 31 02

The current spear only has the next button and the previous button, and even if you try to implement a page number button, it is difficult to know the total number of contents unless you use the API.

Pattern

[prev] [next]

[prev] [1] [2] ... [5] [6] [7] ... [12] [13] [next]

 [1] [2] ... [5] [6] [7] ... [12] [13]

Describe the solution you'd like

Describe alternatives you've considered

Additional context

@mantaroh
Copy link
Collaborator

mantaroh commented Mar 3, 2023

@pandaulait

Thank you for filing this issue!
We have forget this feature completely.

As your proposal, we should implement this feature. But we need to consider the specification for it. 🤔

@yoannes
Copy link
Contributor

yoannes commented Mar 3, 2023

Something like this would be nice.

<ul>
  <li cms-loop cms-content-type="feedback">
    <h1>{%= feedback_[フィールドID1] %}</h1>
    <p>{%= feedback_[フィールドID2] %}</p>
    <img data-src="{%= feedback_[フィールドID3] %}">

    <!-- Add here some kind of pagination -->
    <!-- Using component and maybe auto inject the data, it might be useful to create custom pagination -->
    <Pagination></Pagination>
  </li>
</ul>

<!-- The <Pagination> component -->
<ul>
  <li cms-pagination-loop>
    {%= #pagination_no %}
    {%= #pagination_total %}
    {%= #pagination_link %}
    {%= #pagination_current %}
  </li>
</ul>

@mantaroh

This comment was marked as off-topic.

@mantaroh
Copy link
Collaborator

mantaroh commented Mar 7, 2023

Sorry It's my mistake. I write the wrong spec here.

an above comment is #123.

@qst-exe
Copy link
Contributor

qst-exe commented Mar 7, 2023

Not a suggestion, but a question.
How do I specify the Pagination Size(10, 30, 50)? 🤔

@mantaroh
Copy link
Collaborator

mantaroh commented Mar 7, 2023

Not a suggestion, but a question.
How do I specify the Pagination Size(10, 30, 50)? 🤔

Thanks @qst-exe .

It's nice question. In above specification, there are not exist for specifying the pagination size.

How do we have the cms-pagination-size or cms-pagination-perpage like:

<li cms-pagination-loop cms-pagination-size="10">

@qst-exe
Copy link
Contributor

qst-exe commented Mar 7, 2023

Looks great!
I agree to you! 👌

@yoannes
Copy link
Contributor

yoannes commented Mar 7, 2023

@oxo-yuta
Copy link

oxo-yuta commented Mar 9, 2023

Don't we need the id for loop??
Since I thought, Pagination will be outside of the loop, like

<ul>
  <li cms-loop cms-content-type="feedback">
    <h1>{%= feedback_[フィールドID1] %}</h1>
    <p>{%= feedback_[フィールドID2] %}</p>
    <img data-src="{%= feedback_[フィールドID3] %}">

  </li>
</ul>

<Pagination></Pagination>

=========

<!-- The <Pagination> component -->
<ul>
  <li cms-pagination-loop>
    {%= #pagination_no %}
    {%= #pagination_total %}
    {%= #pagination_link %}
    {%= #pagination_current %}
  </li>
</ul>

I think we need id thing to connect Paginnation and Loop 🤔

@mantaroh

This comment was marked as outdated.

@qst-exe
Copy link
Contributor

qst-exe commented Oct 25, 2023

Can we also use cms-pagination-size as a variable?

#126 (comment)

@vladinomo
Copy link
Contributor

vladinomo commented Oct 26, 2023

Regarding attributes passed to spear tag, we need more parameters to meet demands for showing a variety of UI components.
MUI - Pagination ranges gave me inspiration.

  • In some cases, we must show sibling items of a current page.
  • Also, we want to define the numbers of items around first/last items.

So, I propose additional attributes.

  • siblingCount
  • boundaryCount

spearタグに渡される属性に関して再現したいUIの多様性の観点から追加した方がいい要素をまとめました。

  • siblingCount
  • boundaryCount

の2つです。

以下のような用例で草案の内容だと表現できないと思いました。

  • 選択中のページの前後のページへのリンクを生成したいとき
  • 最初と最後のページに隣り合うリンクを生成/ないし数を指定したいとき

イメージとしてはMUI - Pagination ranges が参考になるかと思います

mantaroh added a commit that referenced this issue Nov 16, 2023
This PR will support pagination generating which relating with #126.

This PR support the following features:

---------

Co-authored-by: qst-exe <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants