dvargas92495 / SmartBlocks

Useful examples from developer community for Roam42 SmartBlocks
147 stars 7 forks source link

Adding a "parameter" to feed to a SB called with the new {{->Button}} capabilities #78

Closed GitMurf closed 3 years ago

GitMurf commented 3 years ago

📋 Describe the new feature/idea/enhancement you are requesting

I have a big use case for using the {{->Button}} in my Daily Template because I like to structure my Daily notes with for example all my current clients/projects setup under a #Business parent block. Instead of listing each client with [[Client Name]], I would like to have a SB button there so I add the client name/page ref only when I click the button that day so that if I don't work on that client/project that day I don't have an orphaned page/tag for that client with nothing underneath it.

Below you will see screenshots of an example setup as well as a GIF showing it in practice. My problem is that currently I need to create a separate SB for each client just to put their tag in when I click its SB button. What I would like is a way to just have one SB for this task and give a parameter in the {{->SB Button}} to be able to pass "ClientABC" for one and then "Client123" for another, and so on.

image image image image gAwE5T0vTH

I suppose what I would like is a way to put something like {{->zz_Clients}}ABC in a block and then have that SB when clicked take the "other text" in the block (i.e. ABC) as a parameter, do something with it, but then replace ALL content from that block so the original ABC text isn't left there and instead would end with just the result from the SB which would be #ClientABC.

Something like this:

image

And would still end with this after clicking the 123 and 456 corresponding SB buttons:

image

Initial thought/idea would be something like in the {{->SB Button Name}} block you could add something like <%PARAMETERS:param1,param2,param3...x%> so the block may look like this:

image

I prefer the above option but maybe ANOTHER option that would solve my specific problem here (but still I think leave a need for real PARAMETER type capabilities) is to have some COMMAND like maybe <%REPLACEBLOCK%> or something that tells the SB to replace all text in that block assuming you either initiated an SB with ;;SBname with your cursor inside a block that already has text OR in my scenario above where you initiate via a {{->SB Button}} and have text in that block as well.

🔑 Why do you want this?

Screenshots and GIF above should answer all questions.

⚠️ Is your feature request related to a problem? Please describe.

Screenshots and GIF above should answer all questions.

🔨 Describe any alternatives you've considered

Screenshots and GIF above should answer all questions.

GitMurf commented 3 years ago

@roamhacker is the best! Already implemented this.