Skip to content

Books Page List Design Refactor (for PR #10926) #10945

@ragipidavid

Description

@ragipidavid

Feature Request

Problem / Opportunity

PR #10926 has been merged and some of the code needs to be refactored due to redundancy and accessibility issues.
The main issue that needs to be resolved is refactoring the code that implements following in the list cards. We need to prevent a redirect to the followed/unfollowed user's profile after the follow/unfollow button is clicked and the user follows/unfollows another user on the platform.

Proposal

Breakdown

Related files

In order to switch the List feature's follow button to be "async" (meaning submit and update the page without a reload), we will need to implement a solution in javascript and our js files live in:
https://github.com/internetarchive/openlibrary/tree/master/openlibrary/plugins/openlibrary/js

One option is to use Partials

Async Follow

An example for reference is the Reading Log "Check-in" which is the "when did you read this" form that shows up after you click "Already Read":

https://github.com/internetarchive/openlibrary/blob/master/openlibrary/plugins/openlibrary/js/check-ins/index.js#L311-L334

  • We need to write some code that responds when the follow button is clicked
    • It will need to make an ajax request similar to the check-in code directly above and, on success, update the Card's follow button. Alternatively, instead of trying to manually update the List card, we could effectively call a "partial" API to re-request this list as html and replace the existing component on the page.
  • In our main index.js (for openlibrary), we'll need to check whether a list-follow-card exists on the page, and if so, instantiate the listcard.js file or whatever we call it e.g. module.initListCard.

Requirements Checklist

Checklist of requirements that need to be satisfied in order for this issue to be closed:

  • Refactor $ owner_username.
  • Switch to javascript to async submit "follow" action without reloading
  • Resolve image text accessibility issue.
  • Explore refactoring the @public get_user` method for something that exists
    • This is for fetching the user object of the owner of the list (as opposed to the current logged in user)

Stakeholders

@ragipidavid
@mekarpeles


Instructions for Contributors

Metadata

Metadata

Assignees

Labels

Lead: @jimchampIssues overseen by Jim (Front-end Lead, BookNotes) [managed]Needs: BreakdownThis big issue needs a checklist or subissues to describe a breakdown of work. [managed]Needs: DetailSubmitter needs to provide more detail for this issue to be assessed (see comments). [managed]Needs: Review AssigneeIssues that may have been abandoned by assigneesPriority: 3Issues that we can consider at our leisure. [managed]Type: Feature RequestIssue describes a feature or enhancement we'd like to implement. [managed]

Type

No type

Projects

Status

Done

Relationships

None yet

Development

No branches or pull requests

Issue actions