Scala-Play: How to dynamically generate a view? - scala

For a Web Service framework I am currently working on I'd like to add the possibility to test the generic Json services based on their metadata. It should be possible to dynamically build a view to let users test available Web Services. Is there a provision or some supported way to generate views dynamically in Play? if not and supposing that I simply make a template and generate it on the fly, how can this view be injected into the application at runtime?
I will be happy to see documentation/examples/pointers that could help develop such solution ...

I am assuming that you want to create a scala.html and use it on somewhere by taking the html created, is that?
If you create a scala template myView.scala.html then on MyController you can call views.html.myView.render().body(); Then you would have the html created by the template.
Template Documentation

Related

how to create my own sap.suite.ui.generic.template.ObjectPage

I'm trying to make my own Object Page for Smart template using UI5.
I tried using extensions, but it injects my custom view to existing objectpage,
but i want to add my own custom object page.
using smart template for sap.suite.ui.generic.template.ListReport.
The help states that you can completely replace the object page with your own by specifying your own custom component. You would then be free to code it up however you like.
See here: https://sapui5.ap1.hana.ondemand.com/#/topic/7e6e86984e6846bb8cfdfd3efb4d3e4b

How to make pluggable architecture ASP.NET5/MVC 6?

I want to build an web application(ASP.NET MVC 6) that can add modules/plugins without having to rewrite my source code.
Already read about MEF and Areas but are not helping much.
Someone who has overcome this problem that can help me?
Depends on which part of the web application you are targeting.
1.If it's in the request pipeline you would make a Middleware package.
2.It's it's in HTML you would make a TAG Helper package.
3.If it's an intrinsic functionality you would extend appropriate classes and throw them into a package. An example of this would be helpful extension methods or methods to add claims given a claims principal.
4.If you want to go even further you could create your own Visual Studio templates that you can use to pre-fill your options upon creation.

How to extend Alfresco Share existing activity list dashlet with my own activity type?

In Community 4.0.a, I'm posting my custom activities in the repo following this: http://wiki.alfresco.com/wiki/3.0_Activities_Developer_Guide
I have defined my own activity type, with custom bundles and pagelink to display custom needs in the activity dashlet.
But I face an issue, I need to specialize the output based on the activity-type in a similar way of what is done already in activity-list.get.js in the specialize() function.
I can't hack the js cause I'm packaging things in my own amp for Share.
What is the best way to do it? Is there some kind of extension point or do I need to override completely the dashlet?
The old way (3.x) to change the behaviour of a webscript controller is to copy the code and overwrite the Javascript by placing it under web-extension: alfresco/web-extension/site-webscripts/org/alfresco/components/dashlets/activity-list.get.js. There you can modify the specialize() function or whatever you need to do.
All files you place in the alfresco/web-extension/site-webscripts folder will replace original files in the share.war WEB-INF/classes/alfresco/site-webscripts classpath. Best practice is to place your customizations in the tomcat/shared/classes/alfresco/web-extension folder so you don't need to modify the WAR file.
Alfresco 4.0 provides a new way to change the javascript controllers of a webscript. You can add additional Javascript code that will run after the original code. This is preferable because you don't need to change original code and you can upgrade more easily later. To use it you need to get familiar with the new Share extension modules concept. See David Draper's Blog for more info on that.

Can you register a controller against multiple URLs in asp.net mvc?

I want to create an MVC application where by I can create areas of a site that use the same functionality but work under a seperate URL. e.g.
I want to use the same image gallery controller (type not instance) under two different URLs "/Event1/Gallery" and "ProductInformation/Gallery". However if I register this in the routes table and use the html helpers to create links would use the first registration found in the routes table as the link rather than being the actual URL that the controller is serving out at the time.
My questions are:
Is this the correct approach? If not what would be the better solution.
If it is the correct approach how do you stop the helpers from using the first registered controller name rather than the page it is on?
Thanks
Could you use named routes. That way you specify the route name instead of action, controller using the url helper and create the links yourself. Or you could create your own helper method to encapsulate each link.

How to extract labels from Symfony forms I18n Extract Task

I am quite aware that the extract task accepts application as a parameter, and thus one can't expect it too look into the forms folder.
However, I referred the link (below) and tried a couple of ways:
1. defining my proxy __() method
2. including the I18n helper in App Configuration
However, both aren't working.
Can anyone tell me how to extract these from the form classes?
Thanks
http://groups.google.com/group/symfony-devs/browse_thread/thread/1d034f5f7367fe0c
You need to use the i18n helper and add the translated strings manually to your XML/XLIFF files. The translations themselves work, it's just the i18n:extract task that doesn't look inside form classes so it has to be done manually. I hope they add this feature in Symfony 2.0.
See the first few paragraphs here: http://www.symfony-project.org/forms/1_4/en/08-Internationalisation-and-Localisation
There's a way to extract it altough it's not recommended by the developers:
In lib/i18n/extract/sfI18nApplicationExtract.class.php add:
$this->extractFromPhpFiles(sfConfig::get('sf_lib_dir').'/form');
to function extract()
In your form class's configure method add:
sfLoader::loadHelpers('I18N');
This way you can use the __() function in your form class.
I'm currently testing it. Will share my findings.