6006604
6006604

Reputation: 7789

add a custom view to JHipster app

Is there a Yeoman way of creating all the necessary templates required when adding a new view in a JHipster app? I want a simple static page, or a page that doesn't require a new entity. Let's say I want to add an "About" page, I believe I would need to do the following:

Add the "About" link to src/main/webapp/app/layouts/navbar/navbar.html:

<li ui-sref-active="active">
    <a ui-sref="about" ng-click="vm.collapseNavbar()">
        <span class="glyphicon glyphicon-wrench"></span>
        <span class="hidden-sm" data-translate="global.menu.about">About</span>
    </a>
</li>

Create the following new files:

... and add the following lines in webapp/index.html:

<script src="app/about/about.state.js"></script>
<script src="app/about/about.controller.js"></script>

... and any necessary content to src/main/webapp/i18n/en/global.json.

Am I forgetting something?

Does this need to be done manually? Is there a Yeoman command for creating a new view that is independent of an entity? I know that this question has been asked, but I'm hoping that things have changed since then.

Upvotes: 4

Views: 7361

Answers (3)

Xavi Torrens
Xavi Torrens

Reputation: 347

The jhipster module Nav Element do it automatically for us. In addition it creates an angular component too for the new item in the menu.

Upvotes: 3

Nico
Nico

Reputation: 505

Here is instruction how to add static page: https://codefitter2.blogspot.com/2016/09/how-to-add-new-menu-and-static-page-in.html

Upvotes: 2

Andrii Shakhov
Andrii Shakhov

Reputation: 39

You may try creating an entity without any fields or relations and with "--skip-server" option.

yo jhipster:entity about --skip-server

Upvotes: 1

Related Questions