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

feat(plugin/page_vote): add page_vote plugin #983

Merged
merged 8 commits into from
Oct 8, 2024

Conversation

Liumingxun
Copy link
Contributor

@Liumingxun Liumingxun commented Sep 21, 2024

I believe the "vote up/down page" button should be appended to a specified element. Style and update vote count still have some problem, but it's a work in progress.

Feel free to discuss with me and share your thoughts.

close #944

@pull-request-size pull-request-size bot added size/L and removed size/M labels Sep 22, 2024
ui/artalk/src/plugins/page-vote.ts Outdated Show resolved Hide resolved
ui/artalk/src/style/_action-btn.scss Outdated Show resolved Hide resolved
@Liumingxun Liumingxun marked this pull request as ready for review September 22, 2024 07:58
@qwqcode qwqcode force-pushed the master branch 5 times, most recently from 6706fce to db960aa Compare October 3, 2024 16:31
qwqcode added a commit that referenced this pull request Oct 6, 2024
A new HTTP API endpoint `GET /votes/:target_name/:target_id` is now available.

Response example:

```
{"up":1,"down":1,"is_up":true,"is_down":false}
```

- Implement GET endpoint for retrieving vote status
- Add tests for vote functionality

Related to: PR#997

This is a prerequisite PR for #983.
qwqcode added a commit that referenced this pull request Oct 6, 2024
A new HTTP API endpoint `GET /votes/:target_name/:target_id` is now available. (See https://artalk.js.org/http-api.html#tag/Vote/operation/GetVote)

- Implement GET endpoint for retrieving vote status
- Add tests for vote functionality

Related to: #997

This is a prerequisite PR for #983.
- Introduce page voting functionality
- Update configuration to enable/disable page voting
- Retrieve html elements for voting buttons and counts
- Enhance customization options for voting elements
- Reference: #983, #998, #997
@qwqcode
Copy link
Member

qwqcode commented Oct 6, 2024

Thank you for your PR. You provided me with a design idea for this feature. I took some time to think and made some modifications based on your code, including:

  • Support for voted state style options (pageVote.activeClass)
  • Support for custom element selectors (pageVote.upBtnEl, etc.)
  • Prevent users from setting pageVote on the client from the Dashboard
  • Execute cleanup during unmounting
  • Added some documentation

I have performed some basic manual testing on the frontend.

If you have any additional insights or suggestions, I’d love to hear them! Feel free to discuss! 😉

@qwqcode qwqcode merged commit baa6386 into ArtalkJS:master Oct 8, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[功能请求] 文章点赞功能
2 participants