Simple Sidebar Theme


(Benjamin Kampmann) #1

broken in current versions of discourse

As mentioned in the widget-driven Sidebar Plugin post, the sidebar only provides the widget facility but requires third party plugins to actually decide where and how to show the sidebar.

With the Simple Sidebar Theme, this plugin provides the most obvious use case: Wrapping a Sidebar around the entire app’s content:


From the Readme:

A theme adding a global sidebar to the right onto discourse. Requires the sidebar plugin to be installed.

Attention: not having the sidebar plugin installed will break your discourse frontend!

Installation

Docker

To install in docker, add the following to your app.yml in the plugins section:

hooks:
  after_code:
    - exec:
        cd: $home/plugins
        cmd:
          - mkdir -p plugins
          - git clone https://github.com/discourse/docker_manager.git
          - git clone https://github.com/ligthyear/discourse-plugin-sidebar.git sidebar
          - git clone https://github.com/ligthyear/discourse-plugin-simple-sidebar-theme.git simple-sidebar-theme

and rebuild docker via

cd /var/discourse
./launcher rebuild app

Enjoy!


What should on-site chat look like?
Custom Layouts Plugin
(Joe Seyfried) #2

Awesome! I have to give this a test drive soon… Thanks!

Is there any easy way to restrict the sidebar to, e.g. the latest post or categories page (i.e. not on the thread views)?


(Benjamin Kampmann) #3

THIS plugin does not do that, no. BUT, as mentioned, the main sidebar-plugin provides the infrastructure “theme” plugins can use. And if you look at what this plugin does/has to do to make the sidebar appear (just overwrite the application.hbs with one that contains a Discourse.SidebarView), you can easily make a plugin that could do that, yes.


(mountain) #4

How does this work with the single topic view’s right gutter for linked/related threads and posts?


(Benjamin Kampmann) #5

IF the sidebar wraps around it (as it does in this case), neither is shown at the moment. There is, however, a sidebar widget to show the links of the entire topic and there is an extra Post-Action “replyAsNew” to be configured. So you can have both of these features, if you want.


(mountain) #6

Does this mean I can remove the meta bar below the OP and stick the info in a topic-only widget instead?

This sounds like something I can really put all my time into.


(Lowell Heddings) #7

I’d imagine you already know this, but this plugin is not working on the latest Discourse.

  1. I installed a new, blank Discourse instance, signed in.
  2. Added the plugin lines to the config file exactly as instructed, rebuilt, and got this error.

I also tested just installing the Sidebar plugin, logging in, checking the Sidebar options (which worked), and then enabling this plugin again, rebuilding, and got the same error again.

It’s worth noting that I have no idea what I’m doing with Discourse plugins.


(Benjamin Kampmann) #8

I can confirm this sometimes happens. As it stands right now, it appears that the order of loading es6-files of plugins in DC is non-deterministic. Meaning it depends on the (file-)system in which order files are put together. As one depends on the other in this plugin, a wrong order can clearly break it. Unfortunately I do not know of any way to fix that at the moment.


(Lowell Heddings) #9

That’s frustrating. I have a great design sketched out using @sam’s minimal design and a sidebar for secondary navigation. Oh well, will have to wait.


(Jacob Chapel) #10

Mind sharing your sketch? Curious what you’re thinking.


Minimal Topic List Design with Sidebar for Navigation
#11

@geek try putting “//= require …/helpers/sidebar_widgets” at the first line of sidebar.js.es6 that fixed it for me.


(Sam Saffron) #12

Yeah, what exactly are you trying to do with the sidebar? if its static content you should not even need a full-blown plugin


(Lowell Heddings) #13

I could probably deal with just having static content there. The biggest thing I would like to do is put a category list there to help navigation for people. Would only want it on the topic list type of pages in that case. No need for a sidebar on the topic view page if it is static.

I assume there is a template I can override but I don’t know what I’m looking at.

Not high priority though.


(Angus McLeod) #14

@lightyear Any further thoughts on how to fix the issue @geek identified above? I’ve been trying various things, ripping out parts of the underlying sidebar plugin, different templates, even throwing in an “onload” event into sidebar.js.es6, without any luck.

My assumption has been that the error is thrown because this import in sidebar.js.es6 fails

import Widgets from "discourse/plugins/sidebar/discourse/helpers/sidebar_widgets";

Perhaps I can combine the widget views and the container view in a single module…? (I actually tried that already, but didn’t manage to get it working). Any tips or pointers would be appreciated.

Cheers.

And thanks for your various plugins! They’re invaluable, both functionally and pedagogically.

ps. @sysanski is “//= require …/helpers/sidebar_widgets” still working for you?. Its inclusion seems to not solve the issue.

pps. I’m using docker, if that matters re the order of the file compilation.


(Angus McLeod) #15

@lightyear I figured it out.

The sidebar view should be inserted as {{view "sidebar"}} instead of {{view Discourse.SidebarView}}

See further here

@geek if you still want to use this I have submitted a pr

Or just make the change I mentioned above in the application.hbs in the theme plugin.


(Sam Saffron) #16

@lightyear is this supported/working?