Simple Machines Community Forum

SMF Development => Feature Requests => Topic started by: Arantor on February 19, 2022, 10:31:15 AM

Title: Portal style blocks
Post by: Arantor on February 19, 2022, 10:31:15 AM
I'd love to see the introduction of blocks, widgets, whatever you want to call them as a core concept.

Now before we get into the 'whoa making a portal core' OMG BLOAT, hear me out.

Firstly, I'm not really talking about a full blown portal, I'm talking about a system of reusable widgets you can place in different parts of the site. The reality is there are several parts of the system that should have been built this way originally and weren't for reasons.

Think about it: when you add 'who is viewing this thread' via theme settings, isn't that really adding a block of self-contained functionality? (Right now it's mashed in with the topic listing or the topic view itself)

Or the moderation area, which is really a collection of blocks. Or the admin front page, which has two blocks on it (one of which was also awkwardly duplicated to the 2.0 moderation centre)

So that's the first step, refactor out widgets of functionality into their own pieces of code and make it possible to drop them into the page in various places. Leaving it to a portal makes it feel like an afterthought when it could easily be a very nice core feature.

You could even go a bit further and implement a block that contains other blocks. Which would mean you could turn the entire info centre's *sections* into blocks, group them into a single block whose permissions you could control easily.

Think about that for a moment: how often do people ask about hiding the info centre or changing what's in it? Wouldn't it be great if that were possible without too much pain? Well, there's no fundamental reason why not.

And from a bloat perspective, it's actually *not*. Because half of the stuff that should be blocks is already sort-of blocks in the code except not in a reusable, pluggable way and this would get you so much potential for comparatively little work.
Title: Re: Portal style blocks
Post by: Arantor on February 19, 2022, 11:19:58 AM
And really, https://www.simplemachines.org/community/index.php?topic=580808.0 is just another example of the concept: make a calendar events widget, display it wherever you like. Can even be the same actual code the proposed info centre rework uses.

Just to add, making it part of the core means you can also do nice things about collapsibility of the blocks with flexboxes so that the content flows naturally and theme authors can rely on this functionality being available in the core rather than having to be boxed in with the usual portal vs theme dramas.
Title: Re: Portal style blocks
Post by: Doug Heffernan on February 19, 2022, 04:38:09 PM
Do you mean like some sort of a cms type of thing @Arantor? This will make Smf 2.1. even better. It will give the paid forums a run for their money.
Title: Re: Portal style blocks
Post by: Arantor on February 19, 2022, 04:52:39 PM
Not a CMS exactly, more turning what's already there into something more modular.

XF already does this - their info centre on the front page is made of several widgets and there is a defined list of places widgets can be added.

I'm really not thinking about a full blown CMS here, just logical evolution of what is there.
Title: Re: Portal style blocks
Post by: Doug Heffernan on February 19, 2022, 05:10:18 PM
Quote from: Arantor on February 19, 2022, 04:52:39 PMNot a CMS exactly, more turning what's already there into something more modular.

XF already does this - their info centre on the front page is made of several widgets and there is a defined list of places widgets can be added.

I'm really not thinking about a full blown CMS here, just logical evolution of what is there.

I know what you mean now. Hopefully it will be taken into consideration and implemented. Smf will have to change its name to Advanced Machines Forum if all these cool stuff will be added :D
Title: Re: Portal style blocks
Post by: Diego Andrés on February 19, 2022, 05:20:55 PM
You already have a similar topic and you mention the moodle blocks and that's really nice
Title: Re: Portal style blocks
Post by: Arantor on February 19, 2022, 05:50:16 PM
Did I have a previous topic? I didn't look. But consider this a reinforcement of how much value I think the idea really has. (I haven't touched Moodle in almost a year. I've worked on multiple Laravel code bases plus WordPress since then. Come to think of it, that's how Gutenberg approaches content too.)

It's not like this is theoretical either, even down to the 'multi block holding the info centre' because I have a working prototype but adapting it back to SMF would be painful at this point.
Title: Re: Portal style blocks
Post by: Diego Andrés on February 19, 2022, 06:12:53 PM
No idea why it was posted in coding discussion: https://www.simplemachines.org/community/index.php?topic=569958.0
Love the concept
Title: Re: Portal style blocks
Post by: Kindred on February 19, 2022, 07:17:28 PM
Actually, ot would not take that much... I'm already doing part of that with my custom theme via css
Title: Re: Portal style blocks
Post by: Diego Andrés on February 19, 2022, 07:19:50 PM
Kindred writing css in 2022, off to a good start this year huh
Title: Re: Portal style blocks
Post by: Antechinus on February 19, 2022, 07:22:41 PM
He had to start learning sometime. ;)
Title: Re: Portal style blocks
Post by: Arantor on February 19, 2022, 07:42:31 PM
That's really really not what I mean though.

Can you place the info centre on another page entirely with CSS? That's what I'm proposing here: take hunks of content/functionality that already exist and decouple them from the pages they're currently hard-coded to be on.
Title: Re: Portal style blocks
Post by: Antechinus on February 19, 2022, 08:06:23 PM
Yes, completely different concept. And you did explain it clearly in your OP. :)

It seems like a good idea in principle. If you think it can be done with next to no bloat or performance penalty, then it's probably worth doing. Out of curiosity: how hard do you think it would be to do as a mod?
Title: Re: Portal style blocks
Post by: Arantor on February 19, 2022, 08:25:00 PM
Do I think it can be done with next to no bloat? You know you already saw a screenshot of it, right? I already implemented a version of this ;)

Could it be done as a mod? It already has, several times, it's called SimplePortal/TinyPortal/LightPortal etc. etc.

The whole point is to not write yet another mod reinventing the same concept and instead implementing the most useful part as a framework for the future, as part of the core.
Title: Re: Portal style blocks
Post by: Kindred on February 19, 2022, 08:34:15 PM
No, I understood what you meant.
I was just saying that it's already partially started, in terms of the ability to style some of that as a block and hide/display that block.

Adding a modular functionality to add or remove that display from a page (based on the action, probably) is not a bad idea for 3.0


As for the other comments...   😜

Title: Re: Portal style blocks
Post by: tmachu on March 02, 2022, 04:55:06 AM
I like @Arantor suggestion, just want to mention it. The feature will be useful and practical, so I think it's a good idea.