This is a "seed" project intended to be used as a template for creating "Apps" in My UW in a new way.
Rather than creating a Portlet, developers can clone this project and write a Servlet 3 web application that can deployed with My UW Madison.
This application assumes you are familiar with Maven, have it installed, and have a settings.xml appropriate for interacting with UW's Maven Artifact Repository.
git clone git@github.com:UW-Madison-DoIT/my-app-seed.git your-app-name
cd your-app-name
mvn install jetty:run-war
Point your browser at http://localhost:8080 and you'll see the familiar My UW frame.
The unique aspect about this project is that it overlays angularjs-portal-frame. That project provides us the frame that My UW uses: the header, the sidebar, and the footer. It provides us an extension point in a file with a specific name: my-app.js.
That file is expected to be a require.js module, i.e. enclosed within a define()
function. RequireJS can be used to include more javascript resources from within my-app.js. For example:
var myWidget = require(['my-widget.js'], function() {
alert('Require runs my-widget.js first, and then this function.');
});
For more detailed information, see the require.js quickstart guide and API documentation.
In my-app.js, you can see that we reference a variable named app
; this variable is the result of angular.module
that was provided by angularjs-portal-frame.
With that reference we can use Angular to register controllers, services, directives, you name it.
The example in this project simply adds a new Angular Route called 'default' that loads the contents of my-app.html into the frame.
Generally, projects that use this seed are a little larger in nature and have other modules encapsulating parts of the code base. You would see other modules that are siblings of the war module like:
- api
- impl
- security
- integration
If your application won't have these things, you probably should consider a portlet instead.