Symfony4 Override FosUserBundle Template - fosuserbundle

I'm following this : https://symfony.com/doc/current/bundles/FOSUserBundle/overriding_templates.html
I found the default template inside vendor/friendsofsymfony/user-bunfle/views/layout.html.twig
The documentation is then saying to place your new layout template at app/Resources/FOSUserBundle/views/layout.html.twig. Thing is, in Symfony4 there is nore more app folder I think. How should I do that then ? Thanks

You are right, and this is because the documentation is not updated for Symfony 4. What you need to do is copy all the templates files from vendor/friendsofsymfony/user-bundle/Resources/views and put them in a directory you create in /templates/bundles/FOSUserBundle. You can then edit the files in your newly created directory which will override the default templates.

In Symfony4, you can override it by placing your template in src/Resources/FOSUserBundle/views instead of templates/bundles/FOSUserBundle (yes, sadly not in templates directory)

In Symfony 4.4 the right place to override the FOSUserBundle templates is :
app/Ressources/FOSUserBundle/views
This work perfect in my project

Related

Artifact directory for rendering template in custom Grails 3 script

In the Grails 3.2.3 documentation, it shows this piece of code as an example of a custom script:
def scriptName = args[0]
def model = model(scriptName)
def overwrite = flag('force') ? true : false
render template: template('artifacts/Script.groovy'),
destination: file("src/main/scripts/${model.lowerCaseName}.groovy"),
model: model,
overwrite: overwrite
Where is the artifacts directory in the grails-app or src hierarchies?
For the example you cite, the artifacts directory is in the profile's jar file.
(the relevant source is: https://github.com/grails-profiles/base/tree/master/templates)
In general any profile or plugin that has a templates directory, it will be found in the jar for the profile or the plugin.
But your project can override anything from a profile or a plugin. You follow the same pattern for the different kinds of templates rooted in your project at src/main/templates.
For example, if you say
grails install-templates
A directory src/main/templates/scaffolding will be created containing copies of the templates applied by the scaffolding plugin that you can edit to customize how scaffolding views, generated controllers and so on, render.
For script templates, the path is artifacts not scaffolding, so if you have a script template or a domain class template you like better than the default one, you would put it in
src/main/templates/artifacts

CakePHP 3 - set different layout from plugin controller

How to set different layout from an Action of a plugin controller. The layout files are in the general Template/Layout directory of the app.
I tried:
$this->viewBuilder()->layout('login_layout');
and it didn't worked.
I am not sure but you can try with below code
$this->ViewBuilder()->layoutPath("");
$this->viewBuilder()->layout('login_layout');

Create new Project in Angular-js

I am new to AngularJs. I want to create a new project in angular-js . So , How can i create it using command prompt ?
I have tried ng new myProject. But it is giving some error like
ng new myProject
? Select project blueprint: (Use arrow keys)
> Default template
Ui Router template
Your own template from git
How can i create it ?
Take a look at http://yeoman.io/ there are plenty of project template for angular.
You need node and npm for runn it
This are just options to choose.
You can choose between the Default Project Setup, a Setup with ui-router configured or you can provide some own template from git.
I you are new to Anggular you may should try the Default Template. This will give you some impressions on best practices and how to structure you application

DNN custom skin and css deployment

I am new to this and trying to figure this out. I have created a internal.ascx page and a Internal.css file for my internal page for a website. If I create a new page in DNN and apply this new skin it doesnt seem to apply the CSS. I copied the both ascx and css file to the _default/Skins/ folder.
Have also tried adding in the css via the following code
<dnn:DnnCssInclude runat="server" FilePath="/Internal.css" PathNameAlias="SkinPath" />
Nothing seems to be working. Have cleared my cache and tried different machine to view the page. But the style is still not coming through.
Thanks in advance
Create a new folder in the _default/Skins/. For example, call the folder "Internal" (/Portals/_default/Skins/Internal). Copy your ascx and css skin files into there. Rename the css to "skin.css". You shouldn't need to reference it in the ascx since DNN will pick it up based on the name.
Also, the reason your CSS include statement may not have worked was because filepath "/Internal.css" was probably trying to look for it in the root of the website. I would think it would simply be "Internal.css". But you could verify in Firebug what path it generated.

Grails Asset-pipeline does not load angular partial templates

Im using angular-ui-bootstrap with Grails 2.3.x asset-pipeline:1.6.1 plugin. One of the components - alert.js is attempting to load /template/alert/alert.html but this resolves to 404.
I tried including grails.assets.includes=[*/.html], did not help.
Any workaround for this? Anyway to let asset-pipeline include partial templates?
Is template located in assets, if so remember the first level folders inside of assets are flattened so you may want to nest your templates one more level or adjust your path
I have tried putting the /partials directory under /web-app. It ends up like:
/web-app/partials/content.html
I don't need to mess about with asset-pipeline, it just works!
The versions I use are:
Grails: 2.4.2
compile ":asset-pipeline:1.8.11"
Hope this helps anyone who upgrades their Grails version as well.
thanks for your great blog about AngularJS and Grails, which jumpstarted me on this topic.
Regarding partials, I assume the assets directory is not the right place to put them, because they get concatenated and minified in production mode.
Instead, I use GSP templates as AngularJS partials. For example, I have
views/partials/login.gsp
<div>Hello World!</div>
conf/UrlMappings.groovy
static mappings = {
...
'/partials/login'(view:'/partials/_login')
}
grails-app/assets/javascript/
...
templateUrl: 'partials/login',
...
Advantage: You may even use script lets and taglibs in the partials.
An alternative to using GSP directly would be James Kleeh's approach in this thread.
Best regards,
Björn

Resources