Static source file(.html) update does not working to application - jhipster

I am just a newbee to jhipster. finally I generated jhipster and runned an application. I tried to change static file(.html) for test.
What I did as follows.
I changed src/main/webapp/app/layouts/footer/footer.component.html file content.
('This is your footer' --> 'This is your footer !!!!!')
Executed command yarn start. Application running without problem.
I found running application footer still' This is your footer'. But footer.component.html file content still 'This is your footer !!!!!'.
I tried many times but application's footer still unchanged.
I tried compile executing command yo jhipster.
Terminal Ask overwriting footer.component.html file? so I typed 'y'
After compile I checked footer.component.html file content. but it rolled back to the original file ('This is your footer'. not 'This is your footer !!!!!')
Please Teach me what I had missed. How can I change contents of static files.
This problem makes me crazy for last 2days.
Thanks in advance.

Please let us know if you installed any language while creating the project.
If yes then jhipster uses this following library for translations, so the actual String comes from a json file.
https://angular-translate.github.io/
You can do the following.
Instead of
<div class="footer" ng-cloak>
<p data-translate="footer">This is your footer</p>
</div>
Try the following.
<div class="footer" ng-cloak>
<p>This is your footer!!!</p>
</div>
Or a better option would be to change the json file.
src/main/webapp/i18n/en/global.json
"footer": "This is your footer"
to
"footer": "This is your footer!!!"

Related

Nest.js - process.env.npm_package_description does not return correct value

When running Nest.js application process.env.npm_package_description returns
[Nest](https://github.com/nestjs/nest) framework TypeScript starter repository.
instead of description that is in package.json
So, I don't know the why yet, will update when I can find the code, but it looks like what is happening is that when the description in your package.json is empty then process.env.npm_package_description gets set to the first line (or close to it) of your README.
pnpm seems to not do this.
npm brings back a value like <p align="center"> <img src="https://nestjs.com/img/logo-small.svg" width="200" alt="Nest Logo" /> </p>
yarn brings back a value of [Nest](https://github.com/nestjs/nest) framework TypeScript starter repository. (this is the first line under the ## Description tag in the README, might be related)

Creating Custom Component using Moqui and mount using MoquiConf.xml

I'm fairly new to moqui and reaching out for some help with creating custom component using moqui and mount the application on webroot using MoquiConf.xml
I had read https://www.moqui.org/MakingAppsWithMoqui-1.0.pdf and created tutorial component and successfully mounted using the below section from https://www.moqui.org/MakingAppsWithMoqui-1.0.pdf
Add a subscreens-item element under the subscreens element in the apps.xml file like:
location="component://tutorial/screen/tutorial.xml"/>
However my understanding based on the reading from Moqui Documentation below -->
https://www.moqui.org/docs/framework/User+Interface/XML+Screen is that i should be able to mount a custom component using MoquiConf.xml -> screen-facade in my custom component directory, without having to make changes in apps.xml under webroot (i really like this idea)
For #4 (Moqui Conf XML File) you can put these elements in any of the Moqui Conf XML files that get merged into that runtime configuration. The main way to do this is in a MoquiConf.xml file in your component directory so the configuration is in the same component as the screens and you don't have to modify and maintain files elsewhere. See more details about the Moqui Conf XML options in the Run and Deploy instructions. Here is an example from the MoquiConf.xml file in the moqui/example component:
<screen-facade>
<screen location="component://webroot/screen/webroot/apps.xml">
<subscreens-item name="example" menu-title="Example" menu-index="97"
location="component://example/screen/ExampleApp.xml"/>
</screen>
</screen-facade>
However i was not able to get this to work, i tried the MoquiConf.xml approach in tutorial component and also made a copy of example component and still no joy, Appreciate any pointers
My Configuration from my attempt with tutorial project
component/tutorial/MoquiConf.xml
<?xml version="1.0" encoding="UTF-8" ?>
<!-- No copyright or license for configuration file, details here are not considered a creative work. -->
<moqui-conf xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://moqui.org/xsd/moqui-conf-2.1.xsd">
<screen-facade>
<screen location="component://webroot/screen/webroot/apps.xml">
<subscreens-item name="tutorial" menu-title="Tutorial" menu-index="98" location="component://tutorial/screen/tutorial.xml"/>
</screen>
</screen-facade>
</moqui-conf>
component/tutorial/screen/tutorial.xml
<screen xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://moqui.org/xsd/xml-screen-2.1.xsd"
require-authentication="false" include-child-content="true" menu-image="glyphicon glyphicon-wrench" menu-image-type="icon">
<subscreens default-item="hello">
</subscreens>
<widgets>
<label type="h1" text="Hello world with Sub Screens!"/>
<subscreens-panel id="hello-app" type="popup"/>
<subscreens-active/>
</widgets>
</screen>
component/tutorial/screen/tutorial/hello.xml
<screen>
<widgets>
<render-mode>
<text type="html"
location="component://tutorial/screen/tutorial/hello.html"/>
</render-mode>
</widgets>
</screen>
component/tutorial/screen/tutorial/hello.html
<h1>Hello world! (from the hello.html file)</h1>
With the above MoquiConf.xml configuration, the Tutorial component would not even show in the Applications --> AppList (Menu), but works when i load using below change in base-component/webroot/screen/webroot/apps.xml
<subscreens default-item="AppList">
<subscreens-item name="tutorial" menu-title="Tutorial"
location="component://tutorial/screen/tutorial.xml"/>
</subscreens>
Pretty sure i'm missing a config as the above seems to work in example, tools and possibly other components, Appreciate any pointers
Sorry for the delay, i was able to use the online tutorial -> moqui.org/docs/framework/Quick+Tutorial included in David's comments, and was successful in completing the tutorial, Thanks David.

Fix inaccurate reported error with ReSharper 9.0

I have recently installed ReSharper 9.0 for use with VS 2010 from version 7 and am now seeing reported problems and error with RS that are not correct. These are all in the .cshtml files. First, for something like
$(".previous").prop("disabled", true);
The named class previous is kind of greyed out and the warning is that the class is never used, but it is. How do I fix this and get RS to not report this wrong warning?
The next problem is more severe. I have a line in the HTML like
<input class="last" type="button" id="btnLast" onclick="last()" value=">>" />
from this line down in the file are nothing but red lines on the side panel and wrong errors like tag table not closed, tag div not closed, and so on. If I remove the ">>" then everything is fine in the file. Is there a new setting that I cannot find for RS 9?
First analysis often gives false positive results, so it will be removed in upcoming 9.1 version.
Second issue is already logged in our tracker https://youtrack.jetbrains.com/issue/RSRP-429055. Over there workaround is provided. In short - use html entities.
<input class="last" type="button" id="btnLast" onclick="last()" value=">>" />

Chutzpah in Visual Studio 2012 Not Scanning HTML Test Harnesses

Using Chutzpah with Visual Studio 2012. I have an HTML test harness with tests inline. But Chutzpah doesn't seem to "scan" these files so that they appear in Test Explorer.
Here's the body of my HTML. I am including the qunit.js files. But the test "Can I find a div named myDiv?" never appears in Test Explorer. Do I need to put the HTML files in a certain folder in order to be detected?
In Tools->Options->Chutzpah, I have the Testing Mode set to "All"
<div id="myDiv"></div>
<div id="qunit"></div>
<div id="qunit-fixture"></div>
<script>
test("Can I find a div named myDiv?", function () {
var myDivLength = $('#myDiv').length;
equal(myDivLength, 1, "expected 1, got " + myDivLength);
});
</script>
Has anyone experienced a simliar issue? I feel like Chutzpah is putting my Javascript in its own test harness HTML file rather than using mine. But with version 2.1, the documentation states it should use those files:
http://matthewmanela.com/

Using a Twig Extension

I am trying to use teh Twig i18n Extension.
As far as I can tell the file I need is here:
https://github.com/fabpot/Twig-extensions/blob/master/lib/Twig/Extensions/Extension/I18n.php
Now I am not quite sure where to save this file
I have Twig in a folder called includes/lib (/includes/lib/Twig). I see a folder Extension under Twig. Do I save it here?
After I save it, do I need to do a "require_once" to the file or will Twig_Autoloader do the job for me?
I am not using Symfony2
Thanks
Craig
Here is the complete answer that worked for me:
Copy the file in Twig-Verzeichnis (extract i18n.zip in Twig).
For the I18n extension it would be Twig/Extensions/Extension/I18n.php
Eventually add other files requred by I18n. You will see what these are by the error messages that come. I had to add "Twig/Extensions/Node/Trans.php" and "Twig/Extensions/TokenParser/Trans.php".
In your config file add the following:
// Set language to German
putenv('LC_ALL=de_DE');
setlocale(LC_ALL, 'de_DE');
// Specify location of translation tables
bindtextdomain("project_de_DE", "./locale");
// Choose domain
textdomain("projectl_de_DE");
Register the Twig Extension
$twig->addExtension(new Twig_Extensions_Extension_I18n());
Create the directory locale/de_DE/LC_MESSAGES
Create the PO file (the easisest is to have a sample file to start from)
Open the file in a normal text editor (be sure to use utf-8 encoding) and start translating
Open the PO-Datei with PoEdit (www.poedit.net/)
Save to locale/de_DE/LC_MESSAGES (a MO-Datei will be created).
Add the translation to the appropriate places in the Twig-Template with
{% trans 'Text in the original language' %}`
You need to register this extension with Twig:
$twig->addExtension(new Twig_Extensions_Extension_I18n());
If your installation is configured correctly, the autoloader should do the job of including the file. If not, you could include the file manually or make the installation with composer.
It seems the "proper" way to install these extensions without Composer is as follows:
Download a release from https://github.com/fabpot/Twig-extensions/releases
Copy the contents of the lib/ directory somewhere to your project
include the file .../Twig/Extensions/Autoloader.php
Register autoloader: Twig_Extensions_Autoloader::register();
Continue as explained in the doc: http://twig.sensiolabs.org/doc/extensions/i18n.html

Resources