How to create a plugin, that overrides the landingpage


(André Karge) #1

Hi there

I want to write a plugin that overrides the landing page of my discourse-server in order to display another web-page but keeps the discourse header.
This is what I have done already:

  • created a plugin and a modified application.hbs with a new plugin-outlet and a button to test functions
  • created a simple Ember controller to handle the button click

My problem is that whenever I click on the test-button an error occurs that nothing is handled by my action.
Everything of the plugin.hbs shows up, but the function cannot be executed.
Did I forget something?
I followed this tutorial: Beginner’s Guide to Creating Discourse Plugins

This is my overridden application.hbs:

{{render "header"}}

<div id="main-outlet">
  <div class="container">
    {{#if showTop}}
      {{custom-html "top"}}
    {{/if}}
  </div>
  {{outlet}}
  {{render "user-card"}}
</div>

{{#if showFooter}}
  {{custom-html "footer"}}
{{/if}}

{{render "modal"}}
{{render "topic-entrance"}}
{{render "composer"}}
{{plugin-outlet "disraptor"}}

this is the plugin hbs:

<h1>Disraptor</h1>
{{#if connected}}
  <h2>connected</h2>
{{else}}
  <h2>not connected</h2>
{{/if}}
<div class="buttons">
  {{d-button label="disraptor.show" action="disraptorSwitch"}}
</div

and this is the controller:

export default Ember.Controller.extend({
  connected: true,
  
  actions: {
    disraptorSwitch() {
      console.log("test");
      return false;
    }
  }
});

Thanks for any help.
Greetings, André


(André Karge) #2

Maybe this question is a little bit too fuzzy.

The point is: how do I add a route-map for my plugin for functions on the “/” route?