Topic List Previews


(Angus McLeod) #1

This is a continuation of the old Topic List Previews topic, which ran over 1000 posts (too big!).

GitHub-Mark-32px Repository: get the code here

sandbox Example: see it in action here

:heart: Donate: support it here

Overview

Topic List Previews allows you to:

  • Add images, excerpts, buttons and topic stats to topic list items; and

  • Change the layout and style of topic list items

  • Add ‘Featured’ topics above topic lists and topics.

These settings can be applied to all or selected topic lists on a site-wide or category-specific basis.

This flexible feature-set allows you create a variety of different topic list styles, including

Reddit Style

Relevant settings
  • topic list thumbnail
  • topic list excerpt
  • topic list action

Social Media Style

Relevant settings
  • topic list social
  • topic list thumbnail
  • topic list excerpt
  • topic list action
  • topic list thumbnail width
  • topic list thumbnail height

Pinterest (Masonry) Style

Relevant settings
  • topic list tiles
  • topic list thumbnail
  • topic list excerpt
  • topic list action
  • topic list thumbnail width
  • topic list thumbnail height

Featured Topics

Relevant settings
  • topic list featured images tag
  • topic list featured images count
  • topic list featured width
  • topic list featured height
  • topic list featured title
  • topic list featured excerpt
  • topic list featured order

Examples in the Wild :seedling:

Support :heart:

You can donate to support the development of this plugin. Select “Topic list Previews” as the “Cause”. If you have an account on my sandbox, you will appear as a project “Backer” in the Topic List Previews category description on my sandbox. All donations are split equally between current maintainers.

Contributors :raised_hands:

Many folks have contributed to the development of this plugin through both feedback and direct development work. In particular


[ARCHIVE] Topic List Previews
[ARCHIVE] Topic List Previews
(Chris Beach) #2

Hi @Angus and @merefield - thanks for this awesome plugin.

One observation - lately I’ve seen a lot of errors in my logs along these lines:

TypeError: undefined is not an object (evaluating 'e.layout')
Url: https://se23.life/assets/plugin-third-party-6ad4371fbb4eb40935dcbc8eecc1cbdf0c880c3bed7517e91485a3f1887a06be.js
Line: 14
Column: 21951

I believe this originates in the TLP plugin as this is where I found e.layout in the referenced javascript.


(Angus McLeod) #3

Hey!

hm, could you show me a screenshot / or line reference?

@merefield It might not be the culprit, but looking at the Masonry code, we’ll need to put a check around masonryObserver so that it only triggers applyMasonry when tilesStyle is enabled.


(Chris Beach) #4

Hi Angus,

It’s line 14 in the following file: https://se23.life/assets/plugin-third-party-6ad4371fbb4eb40935dcbc8eecc1cbdf0c880c3bed7517e91485a3f1887a06be.js

The e.layout reference appears to be within “masonry” code, and although I can’t say for sure that it’s TLP related (thee code is minified and quite hard to interpret), it does seem to be right next to other TLP code


#5

OK let me deal with these separately (if they are indeed separate issues!):

Apologies, currently some of the masonry code is running on routes without a tile grid. This will generate a javascript error but is probably otherwise harmless because the grid element is missing, so there is no work. I’ll fix this on next release. Not sure how that slipped through! (Well I do, only happens on non-tiles routes when you scroll down far enough to pull in more records).

However, that error is this one:

TypeError: msnry is undefined[Learn More] plugin-third-party.js:176:17
applyMasonry/< javascripts/discourse/initializers/preview-edits:176:17 t.emitEvent javascripts/discourse/lib/imagesloaded/imagesloaded:13:845 o.prototype.complete javascripts/discourse/lib/imagesloaded/imagesloaded:13:3635 o.prototype.check javascripts/discourse/lib/imagesloaded/imagesloaded:13:3174 <anonymous> self-hosted:972:17 

@ChrisBeach it might be worth me pushing a fix for that and then re-checking.


(Chris Beach) #6

Thanks @merefield. Depending on the browser and the situation, JavaScript errors can have quite serious consequences for Discourse.

A couple of people have complained of issues lately (unable to sign up, unable to post etc) and although I haven’t got to the bottom of their problems yet, I’m nervous when I see heaps of errors in the logs.


#7

I’m not seeing “heaps of errors” though, just that one, at each pull of new records. Are you using Tiles?


(Chris Beach) #8

No, I’m not using tiles.

My error log page looks like this:


#9

It could be related Chris, I will address this bug and ask you to check again.


#10

@ChrisBeach bug fix merged, please let me know if this solves your probem


(Chris Beach) #11

Serious probs now “undefined method custom_thumbnail_height”

Forum is down :fearful:


(Dan) #12

Same for me :confused:
What to do?


(Chris Beach) #13


(Chris Beach) #14

remove TLP plugin for now in your app.yml and ./launcher rebuild app – will mean a few mins more downtime but will hopefully rescue your forum. That’s what I’m scrambling to do


(Chris Beach) #15

Vital IMO that we have automated smoke tests on plugin CI (or during forum upgrade, prior to new version being put live) to avoid this happening again.

Edit: tried copying pasting link to previous discussion here but copy/paste not working on iPhone (even after refreshing browser)

Edit (from desktop): here’s the discussion:

Edit:

My forum is now back up, after I removed the TLP plugin and rebuilt the forum. For your reference, this is the error that brought the forum down:


#16

Thanks. There have been some other commits to TLP in last 24 hours … will have to discuss this issue with @angus asap. Sorry for your troubles.


(Angus McLeod) #17

Completely my fault. Apologies! Fixed.

cc @merefield @RoldanLT


(Chris Beach) #18

Thanks @angus :+1:

Have scheduled an overnight rebuild and will let you know if there are any probs.


(Chris Beach) #19

All looks good now. Thanks @angus and @merefield for your swift turnaround on the fix :+1: