@pfaffman is working on customizing the Subscription Plugin pages for PfaffManager, aiming to replace an existing webpage with a Discourse page. They’ve encountered several challenges, including:
Customizing the <h1> title and button text, which currently share the same discourse_subscriptions.subscribe.title key.
Adding navigation to /pfaffmanager/servers on the page.
@justin suggested creating a PR to add more subscription-specific classes to the subscription plugin and offered to accept PRs for the proposed changes.
@pfaffman discovered that adding a {{plugin-outlet}} in the s.hbs template is possible and explored ways to use it to customize the page. They also considered wrapping the entire s.hbs template in a <div class="subscription"> to enable easier CSS customization.
@justin confirmed that @pfaffman’s approach looks close to correct. With the addition of plugin outlets, @pfaffman believes a theme component could add per-subscription links.
I’m getting closer to having PfaffManager be a product. My MVP is to just have Discourse replace https://www.literatecomputing.com/discourse-installation-packages/ so that people can purchase an installation (as they do now through WordPress), which will kick off the installation in Discourse (working) where they can additionally get live updates on the installation process (working), and then also be able to click a button to kick off a rebuild (working) for some period of time.
I used a add_model_callback(GroupUser, :after_save) to see that when a user gets aded to the CreateServer group, it creates the server (in the model that my plugin adds) and removes them from the group (so that they could, theoretically, buy another server installation). I think that this technique could be used to make discourse-subscriptions a fairly general purpose payment system.
the <h1> title and the button share the same discourse_subscriptions.subscribe.title–I’d like to have the <h1> say something like “Purchase an installation or service” for the header and something like “Pay Now” for the button.
if the <h1> had a subscription-title class, then I could use CSS to hide the existing title and replace it with a ::before, which might solve the above problem.
I’d like to add navigation to /pfaffmanager/servers somewhere on this page in a header or footer and I don’t see any way to do that. I tried adding something like {{~raw-plugin-outlet name="subscription-header-before"~}} to the s.hbs template, but it’s not that simple.
I think that it’s reasonable to wish for a bit more subscription-specific class stuff in the subscription plugin, but I’m still bad enough at CSS that I’m not exactly sure if I’m right or what it should look like.
Ah! Rather than wishing for plugin outlets in the subscription plugin, perhaps I should contrive to make my own template that still calls the stripe stuff from the subscription plugin? Would that make sense?
I’d accept a PR for these changes. They’re pretty simple.
You should be able to add a {{plugin-outlet}} in that file. Would also accept a PR if there’s a reasonable case for it. Plugin outlets are lightweight enough. A raw plugin outlet won’t work though because it’s not a raw file.
<script type="text/x-handlebars" data-template-name="/connectors/after-go-to-billing/foobar">
<div class="pfaffmanager-product"> maybe a link using {{product.id}}</div>
</script>
Or you could even hide and replace pretty much all of those product blocks.
I may make sense of plugin outlets after all.
CSS changes
So just wrap the whole s.hbs template in a <div class="subscription">, and then you could do stuff like