← Back to team overview

dhis2-devs team mailing list archive

Re: Apps and Menu's (Relative) Location

 

Hey Timothy,

Have you added the baseUrl config above where you include dhis2.menu.js and dhis2.menu.ui.js? 

This should set a base url for  where the menu script will look to find your files. (By default this is set to .. which is likely the reason it looks in the wrong place)

You will have to change  “dhis” in the example below to your “root” path. In your i assume that would be “/“ since you’re serving from the localhost root and not a “dhis” subfolder.

<script>
 window.dhis2 = window.dhis2 || {};
 dhis2.settings = dhis2.settings || {};
 dhis2.settings.baseUrl = 'dhis’; //Change this where you want it to look. I guess in your case '/' should work.
</script>


Kind regards,

Mark Polak
mark@xxxxxxxxxxxxxxx
markpo@xxxxxxxxxx
+47 970 36 752

On 21 Apr 2015, at 05:40, Timothy Harding <hardingt@xxxxxxxxx> wrote:

> Hello,
> 
> I'm just getting started out with the app development and I started with the tutorial found here: https://www.dhis2.org/doc/snapshot/en/developer/html/ch02s07.html
> 
> I had to modify the scripts locations because instead of looking here:
> localhost:8080/
> It goes searching here:
> localhost:8080/api/apps
> 
> That worked fine (I had to strangely add three ../ to get it to go to the right place) e.g.
> <link type="text/css" rel="stylesheet" href="../../../dhis-web-commons/font-awesome/css/font-awesome.min.css"/>
> vs
> <link type="text/css" rel="stylesheet" href="./dhis-web-commons/font-awesome/css/font-awesome.min.css"/>
> 
> So the troubles comes in when it loads the file: ./dhis-web-commons/javascripts/dhis2/dhis2.menu.ui.js
> 
> LINE 954 url : "../dhis-web-commons/menu/getHelpPageLinkModule.action",
> 
> It is set to a relative path, but assumes I am in a different working directory. Because of that, I get a blank page, no menu, and one of these in the console log:
> 
> <Screen Shot 2015-04-20 at 8.39.42 PM.png>
> 
> Is there a good/sanctioned method to change the js working directory, should I rather just be including a copy of all these JS files in my app, or some other process?
> 
> Timothy Harding
> RPCV Vanuatu
> Skype: hardingt@xxxxxxxxx
> +1 (541) 632-6623
> _______________________________________________
> Mailing list: https://launchpad.net/~dhis2-devs
> Post to     : dhis2-devs@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~dhis2-devs
> More help   : https://help.launchpad.net/ListHelp


Follow ups

References