Custom Layouts Plugin


(Pad Pors) #104

I made a separate repository and made the changes proposed here.

but it seems that the plugin has caused the rebuild process to crash (when I remove it the rebuild is going ok).


(Joffrey Jaffeux) #105

I think it should be more:

  contents.push(
    this.attach('button', {
      action: 'toggleBookmark',
      title: tooltip,
      label: label,
      icon: 'bookmark',
      className: buttonClass
    })
  );

  contents.push(
    new ComponentConnector(this,'topic-notifications-button', {
      topic,
      appendReason: true,
      showFullTitle: false
    })
  );

than

contents.push(
          this.attach('button', {
            action: 'toggleBookmark',
            title: tooltip,
            label: label,
            icon: 'bookmark',
            className: buttonClass
        }),
          new ComponentConnector(this,'topic-notifications-button', {
	     topic: topic,
	     appendReason: true,
	     showFullTitle: false
	})
        )

(Pad Pors) #106

tried it but still get errors with the rebuild.


(Joffrey Jaffeux) #107

It’s working for me with the previous change:


(Pad Pors) #108

It seems to work for Angus as well, as he shows in his snapshot. but as soon as I add the repository, the rebuild fails :frowning: .

I’ll double check the codes with the proposed changes and test again.


(Joffrey Jaffeux) #109

I’m almost certain this is failing because your plugin is named “buttons-widget” and you are using DiscourseLayouts from plugin.rb of your plugin, which will cause a constant loading error.

ATM plugins are loaded in the alphabetical order of the folder name: discourse/instance.rb at master · discourse/discourse · GitHub


(Pad Pors) #110

I’ll rename it the same as the one Angus has done (profile-widget!), as it’s the best description for the widget!

Many thanks :+1: The problem was the naming, or as said alphabetic orders.


(Pad Pors) #111

just a double check: the topic-timeline has disappeared from the topic page. is it a change in the layout plugin or should I look for the reason somewhere else?

we only have the left sidebar activated and there is space for the timeline.


(Tobias) #112

Hi @angus
Thanks for the last update, and please take a look at the following issue :slight_smile:


(Angus McLeod) #113

Fixed :slight_smile:


(Pad Pors) #114

Is the topic-timeline removed from the topic page in the layout plugin?
@angus


(Angus McLeod) #115

Yes, this broke after the cleanup. Fixed. Thanks.


(Tobias) #116

@angus :grin:? Can’t find it.


(Pad Pors) #117

we’d previously developed something similar. it’s here:

but it’s slight issues (it’s not shown as a selection in the layout admin page), and the developer is not around.

a bookmark filter (which exists in the discourse-app) would do the same job.


(Angus McLeod) #118

@exetico Yes that widget has taken various forms. I’ve cleaned it up and made it available again as layouts-topic-list.

You can list bookmarks and / or suggested topics (when viewing a topic). Both lists can be toggled with settings.

You can see it in action in the layouts category in my sandbox.


#119

that layouts category link doesn’t work.


(Angus McLeod) #120

My site is rebuilding. I’m testing a sysadmin issue. Give it 30 minutes.


(Tobias) #121

Thanks. Fast response as always!

Have you an overview with all known widgets/layouts (other than the ones, made by you)?

It could also definatly be a good idéa to make a new template for layouts, other people could jump on (Remember comments :wink:) - and also recommend to put something like “discourse-layouts” as topic in their Git’s.

Update:
I think a lot of people will appreciate an example where custom_fields for plugins is included, too (user-editable options) [1] [2].

Update2:
Just a tip - I think you need to update the code behind the Twitter-solution. The widget showing up one more time, after each page-visit (without reload). I had the same issue with $( document ).ready(function() {}); after you improved how the scripts is handled. I’m not using the Twitter-widget feature at the moment.

Update3:
If you prefer to have the a-link in the Bookmarks-title, it would be nice if there was a call to the users bookmarks as well :slight_smile:
image


#122

Map navigation widget link is broken in original post.


(Angus McLeod) #123

I can no longer edit the original post. The map navigation widget is here if you’re interested:

https://github.com/PavilionDev/pavilion-navigation