Sam's personal "minimal" topic list design


(Evgeny) #265

Do not know where to add, I want to share. In this example, you can see how to change the individual elements in the design. I do not know how true this approach is.



import { registerUnbound } from 'discourse-common/lib/helpers';

var get = Em.get,
    escapeExpression = Handlebars.Utils.escapeExpression;

export function categoryBadgeHTML(category, opts) {
  opts = opts || {};

  let categoryID = escapeExpression(get(category, 'id'));
  let img = Discourse.Category.findById(categoryID).uploaded_logo.url;
  let categoryName = escapeExpression(get(category, 'name'));
  let url = opts.url ? opts.url : Discourse.getURL("/c/") + Discourse.Category.slugFor(category); 
  return `<a class="catid-url" title="${categoryName}" href="${url}"><img src="${img}" alt="${categoryName}" class="catid-logo"></a>`;

export function categoryLinkHTML(category, options) {
  var categoryOptions = {};
  return new Handlebars.SafeString(categoryBadgeHTML(category, categoryOptions));

registerUnbound('catid-img', categoryLinkHTML);



{{catid-img topic.category}}

The output of category icons:

P.S. perhaps this can be done in another way, more easier, but it is easier for me to add 1 file to the plugin.


How can we contribute translations to the theme?

(Tungki Reza Prasakti) #267

How to fix this, i already disable the Topic List Preview plugin but still same as picture below

Replies Last Post are on wrong section, and view count still visible



pushing this :slight_smile:

the same issue appeared for me today. My discourse runs on 2.1.3.

(Joe) #269

Do you use the Topic List Previews plugin on your install?


In fact I do
Just disabled it in the settings, but that didn’t help.

(Joe) #271

The template from the plugin is loaded even if the plugin is disabled in the settings. So, you don’t get the template modifications that this component adds, but you get the CSS, which is why you end up with the broken layout.


So there is no workaround to use Topic List Previews plugin with Sam’s Theme?

(Eric Freytag) #274

I can’t for the life of me figure out how to install this as the default for my community. Seems like it would be in the admin panel, under “customize” and “Themes”, but can’t find it. Anyone have any tips?

(Kris) #275

The buttons are over here

(Eric Freytag) #276

Thanks for the help. When I add a new one, I’m not seeing Sam’s theme anywhere

Am I supposed to be importing here? If so, how can I find the url to the repository for sam’s theme?

(Kris) #277

Yes, you need to import it. The URL is in the original post at the top of this topic.

(Eric Freytag) #278

Is this the url to add? GitHub - SamSaffron/discourse-simple-theme: Sam's simple discourse theme

(Kris) #280

Yep, that’s the one (you could just try it and find out, nothing bad happens if you use the wrong URL you just get an error).