# Layouts Plugin

**URL:** https://meta.discourse.org/t/layouts-plugin/55208
**Category:** Plugin
**Tags:** pavilion, broken
**Created:** [2017 年 1 月 5 日午前 9:41 UTC](https://meta.discourse.org/t/layouts-plugin/55208 "2017-01-05T09:41:13Z")
**Posts on this page:** 20
**Page:** 6

<div class="post-metadata">

### Author: ![Pad\_Pors](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pad_pors/32/52016_2.png) [@Pad\_Pors](https://meta.discourse.org/u/Pad_Pors)
#### Post date: [2017 年 9 月 15 日午前 11:08 UTC](https://meta.discourse.org/t/layouts-plugin/55208/104 "2017-09-15T11:08:40Z")

</div>

I made a separate repository and made the changes proposed [here](https://github.com/lalehmb/buttons-widget).

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

---

<div class="post-metadata">

### Author: ![j.jaffeux](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/j.jaffeux/32/60297_2.png) [@j.jaffeux](https://meta.discourse.org/u/j.jaffeux)
#### Post date: [2017 年 9 月 15 日午前 11:46 UTC](https://meta.discourse.org/t/layouts-plugin/55208/105 "2017-09-15T11:46:08Z")

</div>

I think it should be more:

```plaintext
  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

```plaintext
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
	})
        )

```

---

<div class="post-metadata">

### Author: ![Pad\_Pors](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pad_pors/32/52016_2.png) [@Pad\_Pors](https://meta.discourse.org/u/Pad_Pors)
#### Post date: [2017 年 9 月 15 日午前 11:55 UTC](https://meta.discourse.org/t/layouts-plugin/55208/106 "2017-09-15T11:55:27Z")

</div>

tried it but still get errors with the rebuild.

---

<div class="post-metadata">

### Author: ![j.jaffeux](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/j.jaffeux/32/60297_2.png) [@j.jaffeux](https://meta.discourse.org/u/j.jaffeux)
#### Post date: [2017 年 9 月 15 日午後 12:20 UTC](https://meta.discourse.org/t/layouts-plugin/55208/107 "2017-09-15T12:20:39Z")

</div>

It’s working for me with the previous change:

 ![42](https://global.discourse-cdn.com/meta/original/3X/5/2/52a3cf25e09afc7d13c0b14299c31bdcb4978dac.png)

---

<div class="post-metadata">

### Author: ![Pad\_Pors](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pad_pors/32/52016_2.png) [@Pad\_Pors](https://meta.discourse.org/u/Pad_Pors)
#### Post date: [2017 年 9 月 15 日午後 12:32 UTC](https://meta.discourse.org/t/layouts-plugin/55208/108 "2017-09-15T12:32:18Z")

</div>

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 ☹ .

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

---

<div class="post-metadata">

### Author: ![j.jaffeux](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/j.jaffeux/32/60297_2.png) [@j.jaffeux](https://meta.discourse.org/u/j.jaffeux)
#### Post date: [2017 年 9 月 15 日午後 12:35 UTC](https://meta.discourse.org/t/layouts-plugin/55208/109 "2017-09-15T12:35:29Z")

</div>

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/lib/plugin/instance.rb at main · discourse/discourse · GitHub](https://github.com/discourse/discourse/blob/master/lib/plugin/instance.rb#L48)

---

<div class="post-metadata">

### Author: ![Pad\_Pors](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pad_pors/32/52016_2.png) [@Pad\_Pors](https://meta.discourse.org/u/Pad_Pors)
#### Post date: [2017 年 9 月 15 日午後 12:39 UTC](https://meta.discourse.org/t/layouts-plugin/55208/110 "2017-09-15T12:39:03Z")

</div>

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 👍 The problem was the naming, or as said alphabetic orders.

---

<div class="post-metadata">

### Author: ![Pad\_Pors](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pad_pors/32/52016_2.png) [@Pad\_Pors](https://meta.discourse.org/u/Pad_Pors)
#### Post date: [2017 年 9 月 15 日午後 1:00 UTC](https://meta.discourse.org/t/layouts-plugin/55208/111 "2017-09-15T13:00:40Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![exetico](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/exetico/32/119962_2.png) [@exetico](https://meta.discourse.org/u/exetico)
#### Post date: [2017 年 9 月 16 日午前 9:43 UTC](https://meta.discourse.org/t/layouts-plugin/55208/112 "2017-09-16T09:43:35Z")

</div>

Hi @angus  
Thanks for the last update, and please take a look at the following issue 🙂  
[https://github.com/angusmcleod/discourse-layouts/issues/3](https://github.com/angusmcleod/discourse-layouts/issues/3)

---

<div class="post-metadata">

### Author: ![angus](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/angus/32/341715_2.png) [@angus](https://meta.discourse.org/u/angus)
#### Post date: [2017 年 9 月 17 日午前 1:41 UTC](https://meta.discourse.org/t/layouts-plugin/55208/113 "2017-09-17T01:41:27Z")

</div>

Fixed 🙂

[https://github.com/angusmcleod/discourse-layouts/commit/dc24d1cfe04c6e60dab7bc30052801e0ace0ab9a](https://github.com/angusmcleod/discourse-layouts/commit/dc24d1cfe04c6e60dab7bc30052801e0ace0ab9a)

---

<div class="post-metadata">

### Author: ![Pad\_Pors](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pad_pors/32/52016_2.png) [@Pad\_Pors](https://meta.discourse.org/u/Pad_Pors)
#### Post date: [2017 年 9 月 17 日午前 4:15 UTC](https://meta.discourse.org/t/layouts-plugin/55208/114 "2017-09-17T04:15:52Z")

</div>

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

---

<div class="post-metadata">

### Author: ![angus](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/angus/32/341715_2.png) [@angus](https://meta.discourse.org/u/angus)
#### Post date: [2017 年 9 月 17 日午前 6:03 UTC](https://meta.discourse.org/t/layouts-plugin/55208/115 "2017-09-17T06:03:26Z")

</div>

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

[https://github.com/angusmcleod/discourse-layouts/commit/ec07ba181100843b67c2ff341b10049e4e31bd09](https://github.com/angusmcleod/discourse-layouts/commit/ec07ba181100843b67c2ff341b10049e4e31bd09)

---

<div class="post-metadata">

### Author: ![exetico](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/exetico/32/119962_2.png) [@exetico](https://meta.discourse.org/u/exetico)
#### Post date: [2017 年 9 月 17 日午後 12:38 UTC](https://meta.discourse.org/t/layouts-plugin/55208/116 "2017-09-17T12:38:06Z")

</div>

> [@exetico](#):
>
> I remember that i saw a screenshot with booksmarks in the widget - is that a public widget? Google and Github can’t help me find it 😉

@angus 😁? Can’t find it.

---

<div class="post-metadata">

### Author: ![Pad\_Pors](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pad_pors/32/52016_2.png) [@Pad\_Pors](https://meta.discourse.org/u/Pad_Pors)
#### Post date: [2017 年 9 月 17 日午後 1:03 UTC](https://meta.discourse.org/t/layouts-plugin/55208/117 "2017-09-17T13:03:38Z")

</div>

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

[https://github.com/Alavi1412/widget-bookmark](https://github.com/Alavi1412/widget-bookmark)

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.

---

<div class="post-metadata">

### Author: ![angus](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/angus/32/341715_2.png) [@angus](https://meta.discourse.org/u/angus)
#### Post date: [2017 年 9 月 18 日午前 3:24 UTC](https://meta.discourse.org/t/layouts-plugin/55208/118 "2017-09-18T03:24:49Z")

</div>

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

[https://github.com/angusmcleod/layouts-topic-list](https://github.com/angusmcleod/layouts-topic-list)

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

 ![01 AM](https://global.discourse-cdn.com/meta/original/3X/7/b/7b28f7859ad37a3a0f9d74492920c260944b819e.png)

You can see it in action in the [layouts category](https://discourse.angusmcleod.com.au/t/the-layout-of-brasillia-niemeyer/44) in my sandbox.

---

<div class="post-metadata">

### Author: ![8BIT](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/8bit/32/76872_2.png) [@8BIT](https://meta.discourse.org/u/8BIT)
#### Post date: [2017 年 9 月 18 日午前 3:36 UTC](https://meta.discourse.org/t/layouts-plugin/55208/119 "2017-09-18T03:36:31Z")

</div>

that `layouts category` link doesn’t work.

---

<div class="post-metadata">

### Author: ![angus](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/angus/32/341715_2.png) [@angus](https://meta.discourse.org/u/angus)
#### Post date: [2017 年 9 月 18 日午前 3:37 UTC](https://meta.discourse.org/t/layouts-plugin/55208/120 "2017-09-18T03:37:09Z")

</div>

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

---

<div class="post-metadata">

### Author: ![exetico](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/exetico/32/119962_2.png) [@exetico](https://meta.discourse.org/u/exetico)
#### Post date: [2017 年 9 月 18 日午後 1:39 UTC](https://meta.discourse.org/t/layouts-plugin/55208/121 "2017-09-18T13:39:57Z")

</div>

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 😉_) - 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](https://meta.discourse.org/t/user-custom-field-with-plugin/62035/3)] [[2](https://meta.discourse.org/t/custom-user-fields-for-plugins/14956)].

**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.

 ![image](https://global.discourse-cdn.com/meta/original/3X/f/a/fafce5118288c3e66da3bf9dbf4b1ff47995a6b7.png)

**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 🙂

 ![image](https://global.discourse-cdn.com/meta/original/3X/b/3/b3540b74061963b13d5a02e88008d3a79c64b70c.png)

---

<div class="post-metadata">

### Author: ![8BIT](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/8bit/32/76872_2.png) [@8BIT](https://meta.discourse.org/u/8BIT)
#### Post date: [2017 年 9 月 18 日午後 8:13 UTC](https://meta.discourse.org/t/layouts-plugin/55208/122 "2017-09-18T20:13:20Z")

</div>

> [@angus](#):
>
> Profile Widget  
> Map Navigation Widget

Map navigation widget link is broken in original post.

---

<div class="post-metadata">

### Author: ![angus](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/angus/32/341715_2.png) [@angus](https://meta.discourse.org/u/angus)
#### Post date: [2017 年 9 月 19 日午前 12:42 UTC](https://meta.discourse.org/t/layouts-plugin/55208/123 "2017-09-19T00:42:01Z")

</div>

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

[https://github.com/PavilionDev/pavilion-navigation](https://github.com/PavilionDev/pavilion-navigation)

[前のページ](https://meta.discourse.org/t/layouts-plugin/55208.md?page=5)

[次のページ](https://meta.discourse.org/t/layouts-plugin/55208.md?page=7)
