diff --git a/openlibrary/catalog/edition_merge/templates/web_merge.html b/openlibrary/catalog/edition_merge/templates/web_merge.html index 97d781092a94..57eda0dd85ea 100644 --- a/openlibrary/catalog/edition_merge/templates/web_merge.html +++ b/openlibrary/catalog/edition_merge/templates/web_merge.html @@ -8,7 +8,7 @@

Merge {{ia}}

-Merging editions: {{ ekeys }} into {{ master }}

+

Merging editions: {{ ekeys }} into {{ master }}

merge listsskip

diff --git a/openlibrary/templates/covers/manage.html b/openlibrary/templates/covers/manage.html index 11e9dec30027..71bf3446ba19 100644 --- a/openlibrary/templates/covers/manage.html +++ b/openlibrary/templates/covers/manage.html @@ -15,7 +15,7 @@
- +
diff --git a/openlibrary/templates/lists/widget.html b/openlibrary/templates/lists/widget.html index 93892c061bdb..23a4bc0ea32e 100644 --- a/openlibrary/templates/lists/widget.html +++ b/openlibrary/templates/lists/widget.html @@ -11,651 +11,652 @@ $ container_id = 'widget-lists-wrapper-%s' % str(uid)

-$if "lists" not in ctx.features: - $return - -$code: - _user_lists = _user_lists or (ctx.user and ctx.user.get_lists(sort=True) or []) - - def get_seed_info(page): - """Takes a thing, determines what type it is, and returns a seed summary""" - if page.key.startswith("/subjects/"): - seed = page.key.split("/")[-1] - if seed.split(":")[0] not in ["place", "person", "time"]: - seed = "subject:" + seed - seed = seed.replace(",", "_").replace("__", "_") - seed_type = "subject" - title = page.name - else: - seed = {"key": page.key} - if page.key.startswith("/authors/"): - seed_type = "author" - title = page.get('name', 'name missing') - elif page.key.startswith("/works"): - seed_type = "work" - title = page.get("title", "untitled") + $if "lists" not in ctx.features: + $return + + $code: + _user_lists = _user_lists or (ctx.user and ctx.user.get_lists(sort=True) or []) + + def get_seed_info(page): + """Takes a thing, determines what type it is, and returns a seed summary""" + if page.key.startswith("/subjects/"): + seed = page.key.split("/")[-1] + if seed.split(":")[0] not in ["place", "person", "time"]: + seed = "subject:" + seed + seed = seed.replace(",", "_").replace("__", "_") + seed_type = "subject" + title = page.name else: - seed_type = "edition" - title = page.get("title", "untitled") - return { - "seed": seed, - "type": seed_type, - "title": title, - "remove_dialog_html": _('Are you sure you want to remove %(title)s from your list?', title=title) - } + seed = {"key": page.key} + if page.key.startswith("/authors/"): + seed_type = "author" + title = page.get('name', 'name missing') + elif page.key.startswith("/works"): + seed_type = "work" + title = page.get("title", "untitled") + else: + seed_type = "edition" + title = page.get("title", "untitled") + return { + "seed": seed, + "type": seed_type, + "title": title, + "remove_dialog_html": _('Are you sure you want to remove %(title)s from your list?', title=title) + } - def get_list_data(list, seed, include_cover_url=True): - d = storage({ - "name": list.name or "", - "key": list.key, - "active": list.has_seed(seed), - }) - if include_cover_url: - cover = list.get_cover() or list.get_default_cover() - d['cover_url'] = cover and cover.url("S") or "/images/icons/avatar_book-sm.png" - if 'None' in d['cover_url']: - d['cover_url'] = "/images/icons/avatar_book-sm.png" - owner = list.get_owner() - d['owner'] = storage(displayname=owner.displayname or "", key=owner.key) - return d - - def get_user_lists(seed_info): - return [get_list_data(list, seed_info['seed'], include_cover_url=True) for list in _user_lists] - - def get_page_lists(page, seed_info): - user_key = ctx.user and ctx.user.key - return [get_list_data(list, seed_info['seed']) for list in page.get_lists(sort=False)] - -$ seed_info = get_seed_info(page) -$ work_seed_info= edition and work and get_seed_info(work) -$ user_lists = get_user_lists(seed_info) -$if user_lists_only: - $ page_lists = [list for list in user_lists if list.active] -$else: - $ page_lists = get_page_lists(page, seed_info) -$ user_key = ctx.user and ctx.user.key -$ page_url = page.url() - -$var page_lists = page_lists - -$jsdef show_list(list, user_key): - $ remove = (list.owner.key == user_key) -
  • - - $ title = _('Cover of: %(listname)s', listname=list.name) - $title - - - - $list.name + def get_list_data(list, seed, include_cover_url=True): + d = storage({ + "name": list.name or "", + "key": list.key, + "active": list.has_seed(seed), + }) + if include_cover_url: + cover = list.get_cover() or list.get_default_cover() + d['cover_url'] = cover and cover.url("S") or "/images/icons/avatar_book-sm.png" + if 'None' in d['cover_url']: + d['cover_url'] = "/images/icons/avatar_book-sm.png" + owner = list.get_owner() + d['owner'] = storage(displayname=owner.displayname or "", key=owner.key) + return d + + def get_user_lists(seed_info): + return [get_list_data(list, seed_info['seed'], include_cover_url=True) for list in _user_lists] + + def get_page_lists(page, seed_info): + user_key = ctx.user and ctx.user.key + return [get_list_data(list, seed_info['seed']) for list in page.get_lists(sort=False)] + + $ seed_info = get_seed_info(page) + $ work_seed_info= edition and work and get_seed_info(work) + $ user_lists = get_user_lists(seed_info) + $if user_lists_only: + $ page_lists = [list for list in user_lists if list.active] + $else: + $ page_lists = get_page_lists(page, seed_info) + $ user_key = ctx.user and ctx.user.key + $ page_url = page.url() + + $var page_lists = page_lists + + $jsdef show_list(list, user_key): + $ remove = (list.owner.key == user_key) +
  • + + $ title = _('Cover of: %(listname)s', listname=list.name) + $title + + + + $list.name + $if remove: + [X] + $if remove: - [X] + from $_('You') + $else: + from $list.owner.displayname - $if remove: - from $_('You') +
  • + + $jsdef render_my_lists(lists, property='active'): + $for list in lists: + $if list[property]: +

    + $list.name +

    + + $jsdef render_widget_add(lists, work_key, edition_key, users_work_read_status, username, pageurl, readinglogonly, use_work): +
    + $if edition_key and not work_key: +
    $else: - from $list.owner.displayname - - - -$jsdef render_my_lists(lists, property='active'): - $for list in lists: - $if list[property]: -

    - $list.name -

    - -$jsdef render_widget_add(lists, work_key, edition_key, users_work_read_status, username, pageurl, readinglogonly, use_work): -
    - $if edition_key and not work_key: -
    - $else: -
    - $if work_key: -
    -
    - $if users_work_read_status == 3: - $ message = _("Already Read") - $elif users_work_read_status == 2: - $ message = _("Currently Reading") - $else: - $ message = _("Want to Read") - $if users_work_read_status: - - - - - $else: - - - - - - $if edition_key: - -
    - $if users_work_read_status: - -
    -
    - $else: - -
    -
    -
    - - -$jsdef render_widget_display(lists, limit, user_key): - $for i, list in enumerate(lists): - $if i < limit: - $:show_list(list, user_key) - -$jsdef render_head(seed_type, page_lists, page_url): - $if seed_type == "subject": -
    -

    Lists

    -
    $_('watch for edits or export all records')
    + $else: + +

    $('Add to List')

    +
    +
    - $else: -
    -

    - - $if len(page_lists) > 0: - $ msg = ungettext("%(count)d List", "%(count)d Lists", len(page_lists), count=len(page_lists)) - $(msg) - $else: - $_("Lists") -

    -$if include_header: -
    - $:render_head(seed_info['type'], page_lists, page_url) -
    + $jsdef render_widget_display(lists, limit, user_key): + $for i, list in enumerate(lists): + $if i < limit: + $:show_list(list, user_key) -$if include_widget: - $if ctx.user or not work_key: -
    - $:render_widget_add(user_lists, work_key, edition_key, users_work_read_status, ctx.user, page.url(), readinglog_only, False) -
    - $else: -
    -
    - $if work: -
    -
    - - $if edition_key: - - - -
    - -
    -
    + $jsdef render_head(seed_type, page_lists, page_url): + $if seed_type == "subject": +
    +

    Lists

    +
    $_('watch for edits or export all records')
    -
    -
    - $if work: - $if include_rating: - $:macros.StarRatings(work, edition) - - $if ctx.user and ctx.user.is_beta_tester(): - $:macros.UserMetadata(work, edition) - -$if include_showcase: -
      - $:render_widget_display(page_lists, 3, user_key) -
    - -$if render_once('lists/widget.remove-dialog'): - - -$if ctx.user and render_once('lists/widget.addList'): -