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

A widget to embed Open Library Lists in external websites #698

Closed
mekarpeles opened this Issue Dec 29, 2017 · 14 comments

Comments

Projects
5 participants
@mekarpeles
Member

mekarpeles commented Dec 29, 2017

A widget for embedding an Open Library list in one's own website (grid of covers and titles, or text list, etc.).
https://twitter.com/samwilson/status/946652503277367298

@mekarpeles

This comment has been minimized.

Member

mekarpeles commented Feb 7, 2018

We could make a new endpoint in /plugins/openlibrary/code.py for class Widget which takes a url like... openlibrary.org/works/OL....W/embed. This will do a template render of, let's say, a file in openlibrary/templates/types/work/widget.html. You can see an end-to-end example of a OL view rendering a template in openlibrary/plugins/openlibrary/home.py in I think the home class. render_template(...) is what renders the template from the html directory.

I think the tough part is going to be adding the route -- we'll need something like path = "(/works/OL\d+W)/.*/widget"

class widget(delegate.page):
    path = "(/works/OL\d+W)/.*/widget"

    def GET(self, work_id):
        work = web.ctx.site.get(work_id) # get the work here
        return ???(work) # render template code (without header / footer which you get from render_template)  

e.g. Kirubakaran has a website https://kirubakaran.com/bookshelf/ where he might want to embed an iframe representation of a book which includes a (a) bookcover, (b) title, (c) author, and (d) availability button

@jacobandresen

This comment has been minimized.

jacobandresen commented Feb 7, 2018

Sounds interesting . I'd like to try implementing this widget. Anyone else working on it?

@mekarpeles

This comment has been minimized.

Member

mekarpeles commented Feb 7, 2018

@html5cat was taking a look at it though I don't think he started yet. It may be worth taking a stab at it -- in the worst case you two can pair the feature! I'm also around to help.

@html5cat

This comment has been minimized.

Contributor

html5cat commented Feb 7, 2018

@jacobandresen

This comment has been minimized.

jacobandresen commented Feb 7, 2018

okidoki. I'll poke around here and report back about my findings before monday :)

@jacobandresen

This comment has been minimized.

jacobandresen commented Feb 10, 2018

I just took a look at the Open Library code base . been trying to grok the infogami page / app / view structure. when you say "endpoint" are you refering to the api described here : https://github.com/internetarchive/openlibrary/wiki/Endpoints ? I don't fully understand what's going on ;)

Looks like there is a endpoint related to lists endpoint in openlibrary/plugins/openlibrary/lists.py ? This looks for me to be more directly related to the usecase of lists? (Note that I do not fully grok the openlibrary api yet) Maybe the "html" export can be used directly .. or extended ?

@mekarpeles

This comment has been minimized.

Member

mekarpeles commented Feb 11, 2018

@jacobandresen endpoint in this case meaning, the a url that a user submits which maps to a new class you'll write within the file /plugins/openlibrary/code.py which follows this general template:

class widget(delegate.page):
    path = "(/works/OL\d+W)/.*/widget"  # this is the regex which matches the url the user enters 

    def GET(self, work_id):
        work = web.ctx.site.get(work_id) # get the work here
        return ???(work) # render template code (without header / footer which you get from render_template)

The fact that widget inherits from delegate.page is enough to register it with infogami; you don't have to do anything other than add a class like this one.

@mekarpeles

This comment has been minimized.

Member

mekarpeles commented Feb 14, 2018

@jacobandresen any other questions / progress on this? Happy to code review when its ready

@mekarpeles

This comment has been minimized.

Member

mekarpeles commented Feb 20, 2018

:) @jacobandresen, any progress or questions on this feature? @html5cat interested in continuing exploration on this?

@jacobandresen

This comment has been minimized.

jacobandresen commented Feb 21, 2018

Sorry. I have been busy at work . No progress. . @html5cat feel free to grab this

@jacobandresen

This comment has been minimized.

jacobandresen commented Feb 21, 2018

I'll continue poking around here . expect progress to be a bit slow. Still learning about infogami here. @html5cat any thoughts?

@mekarpeles mekarpeles added this to @mekarpeles in 2018 Q2 Mar 13, 2018

@mekarpeles mekarpeles moved this from @mekarpeles to Prioritized in 2018 Q2 Mar 13, 2018

@mekarpeles

This comment has been minimized.

Member

mekarpeles commented Mar 16, 2018

@whatisgalen -- do you want to give this one a shot?

@mekarpeles mekarpeles moved this from Q2 Todos (Prioritized) to In Progress in 2018 Q2 Mar 17, 2018

@mekarpeles

This comment has been minimized.

Member

mekarpeles commented Mar 22, 2018

We likely need some UI for customizing the widget as well, e.g. https://www.goodreads.com/user/edit?format=html. I imagine this will probably be some modal which is triggered on the /works page

2018 Q2 automation moved this from In Progress to Done Apr 27, 2018

@Zacharius

This comment has been minimized.

Zacharius commented Jul 10, 2018

Is there any way to supress the read button in the iframe. I love this feature but the button kinda clashes with my website design

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment