Artifact directory for rendering template in custom Grails 3 script - grails-3.0

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

Related

Project Organization

Below I have shared my current directory structure for my AngularJS application that I have been rewriting from the first time I wrote it while I was learning the javascript framework. I have been revising this project structure to be more of a component-based application in case I need to further add new features to the project.
I currently have two index.html files and trying to figure out which one I should keep. Should keep the file existing in the public directory or should I keep the file inside of the src directory? Keep in mind that I have run a build script to create my app.css and app.js file.
In both index.html files, I have an ng-include file where I am attempting to load view partials and none of them are loading. I do not receive any javascript errors.
<ng-include src="../app/components/employees/views/form.html"></ng-include>
<ng-include src="../app/components/employees/views/stats.html"></ng-include>
<ng-include src="../app/components/employees/views/table.html"></ng-include>
I was able to restructure my application and my build processes which easily removed the need for a public directory. By doing this I also was able to adjust the path to the partial files so they could render propertly.

cakephp 3 plugin localization

i wrote a plugin (AdminView) as a theme and i want to localize it.
i generate pot file using
bin\cake i18n extract --plugin AdminView
the pot file created by bake at
root/plugins/AdminView/src/Locale/default.pot
i moved it to
root/plugins/AdminView/src/Locale/fa_IR/default.po
and i set the locale to fa_IR
but cakephp dose not load it .
but when i move files to the
root/src/Locale/fa_IR/default.po
it loads perfectly.
the question is how can i load po files in the plugins directory ?
i cleared the root/tmp/cache/persistent every time i test
As mentioned in the comments, plugins cannot provide messages for the default domain unless their paths are included in your apps App.paths.locales config, or a custom loader is being defined for the default domain.
By default, plugins provide translations for their respective plugin domain, ie for AdminView that would be admin_view (admin_view.po or .mo accordingly), and you'd use it like __d('admin_view', 'message').
If all your translation function calls are inside of the plugins, then you should probably stick to the convention, and use the respective plugin domains, which you can always override at application level, or provide fallbacks for in your app level default.po.
See also
Cookbook > Internationalization & Localization > Language Files
Cookbook > Internationalization & Localization > Using Translation Functions

For sencha app build , do we need to include all js files related to view in main.js(portal.js)?

I am using sencha cmd 6 for building my application.
my folder structure is
classic
src
model
view
account
jobs
portal
portal.js
controller
store
production build process execution is successful but when i load that build its giving .js file not found error.
So i include all js files in folder structure into main js portal.js then .js error is removed and build works.
But i dont want to include all these list of files in one single js, so can we skip the js include part from portal.js and use any property or attribute to include all js files ?
You can specify with * like 'Ext.chart.*' in requires section of Ext.app.Application.
Hope this helps.

Recommended location for Domain Model classes

I am learning Angular 2 and I am using angular-cli to generate components and services. I am using the directory structure proposed by angular-cli (see screenshot below). I need to add some domain model object (e.g. User, Profile, etc.), but I don't know where to put them.
What is the recommended location for those objects in the directory structure?
You will want to have your app-wide models stored at the root level (default: src/app) except that those values should be in the shared directory (src/app/shared).
If you generate those models with the CLI (from the project root directory) you will run:
ng generate class shared/profile model
which will yield:
src/app/shared/profile.model.ts
src/app/shared/profile.model.spec.ts
and also add a reference to the profile exports to the index.ts within the shared directory, so you can reference them (from the root component)
import { Profile } from './shared';
If the domain model classes are used by all the components, it can be put in a model.ts file within shared folder.

sencha cmd extjs build does not include MVC controllers

When I 'compile' my extjs MVC app (version 4.1.1a, CMD ver 3.0.2.288), an all-classes.js file gets created however none of my custom code (controllers, views etc) gets included. They get dynamically loaded when I load the html page. I have another app that works fine. I can't post my hundreds of lines of code. What can I look for?
I tried the CMD build in debug mode and it seems to process and find all my app files, it just doesn't include in all-classes.js.
I tried
sencha -d app build
and
sencha compile -classpath=app/app.js,app,ext/src page -in=index.html -out=build/index.html
I used 'sencha generate app' to create the original directory structure etc.
I have exactly the same issue.
Maybe as a hint, I've got another project where I generated the whole application, and the build. And here, with the build-impl.xml, I've got everything I need in all-classes : my controllers, models, etc
Not sure why but it seems if I explicitly do a 'requires' on my controllers in my app.js file then the compile works
Ext.Loader.setConfig({ enabled: true });
Ext.require([
'AM.controller.myController1'
, 'AM.controller.myController2'
.
.

Resources