>-----Original Message----- >From: Scott Wilson [mailto:[email protected]] >Sent: Thursday, August 02, 2012 7:16 AM >To: [email protected] >Subject: Allowing users to add widgets without page refresh > >Hi everyone, > >We have a requirement from the OMELETTE project to add widgets to the >page without the user having to refresh the page - for example for a "page >helper" widget to find and then add a widget to the page for the user. (see >RAVE-743). > >The basic approach would seem to be adding an RPC method for adding a >widget to the page and then rendering it in the page. So, e.g. >rave.api.rpc.addWidgetToPageAndRender.
For what it is worth, IMO this is 2 calls. One to the API endpoint that already exists and another to a new rave function that does the rendering. I don't think that the api js namespace should be involved in rendering. > >I've looked into the requirements for this, and what I'm currently stuck >against >is the use of JSP tags to render the widget "chrome"; this isn't accessible >from >the client side so its not really possible at the moment to add a widget to the >page without a page refresh. > >One possibility is to move the region_widget.tag code into client-side JS >templating. However, there is then an issue with localization. Alternatively, >the logic could be moved from a JSP tag into a Java class and executed via RPC. >However, that will make for some really messy code. > >Can anyone think of any better solutions for this? I think that the best approach might be to generate a client side template for a widget using the JSP tags. This might take some tweaking of the existing template, but would allow you to make one more call to the tags to render out a hidden template that can be used to render new gadgets. > >S
