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

New carousel component #179

Closed
wants to merge 3 commits into from
Closed

Conversation

olivierauverlot
Copy link
Contributor

No description provided.

Comment on lines 20 to 28
'Name of the carousel.',
'TEXT',
TRUE,
FALSE
),
(
'carousel',
'title',
'Title of the carousel.',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The docs does not make it clear what the difference between name and title is.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed with 'An unique string to identify the caroussel component in the HTML page.' and 'A name to display at the top of the carousel.'

(
'carousel',
'indicators',
'Style of image indicators (e.g. square, dot).',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should list possible values exhaustively here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the moment, the carousel supports only dots and square indicators. I changed with 'Style of image indicators (square or dot).'

{{#if title}}
<div class="carousel-caption d-none d-md-block">
<h5>{{title}}</h5>
{{#if contents}}<p>{{contents}}</p>{{/if}}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add the possibility to render markdown descriptions ?

Like other components, with description and description_md

Olivier Auverlot added 2 commits January 8, 2024 21:32
@olivierauverlot
Copy link
Contributor Author

Requested changes done

Copy link
Collaborator

@lovasoa lovasoa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the double-review, but I didn't realize what name was.

'An unique string to identify the caroussel component in the HTML page.',
'TEXT',
TRUE,
FALSE
Copy link
Collaborator

@lovasoa lovasoa Jan 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We try to avoid having such requirements in sqlpage. We can do with it if there is no other choice, but it looks like this is an internal implementation technicality. Wouldn't it be better if the user didn't have to specify an id and make sure it is unique ? It is very easy to end up with duplicate identifiers and errors that are completely impossible to debug if you don't already understand html, javascript and the DOM. And the entire idea of sqlpage is to get rid of such prerequisites.

Couldn't we auto-generate an id like carousel_{{query_number}} where query_number comes from https://github.com/lovasoa/SQLpage/blob/main/src/render.rs ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it's possible to use an id like carousel_{{query_number}} but it seems to me not accessible in the template. If I understand the Rust code, the value of query_number is only initialized where an error is occured and only in development mode.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes render.rs needs to be updated to add query_number to the handlebars context.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can look at how row_index is added to the context.
query_number needs to be passed all the way down to the SplitTemplateRenderer

@lovasoa lovasoa force-pushed the main branch 2 times, most recently from b1c6716 to d38ca15 Compare January 30, 2024 13:35
@olivierauverlot olivierauverlot deleted the carousel branch January 30, 2024 20:59
@lovasoa lovasoa mentioned this pull request Feb 3, 2024
@lovasoa
Copy link
Collaborator

lovasoa commented Feb 3, 2024

I reopened this is #214 and implemented the changes we talked about.

lovasoa added a commit that referenced this pull request Feb 3, 2024
* Initial carousel component implementation

* change carousel example

* make the carousel text description more readable by adding a background

* update cat example

* carousel automatic cycling is now optional

* remove requirement for unique name attribute in carousel

see #179 (comment)

* fix carousel buttons

* uodate deps

* fix official site docs

* lint

* update changelog

---------

Co-authored-by: Olivier Auverlot <@olivierauverlot>
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

Successfully merging this pull request may close these issues.

2 participants