Personally I don’t use Eclipse very much, but I believe if you right-click on the “index.htm” file, you should see an option that’s something like “Open With → Editor” that should allow you to view the HTML. But note that that page only gets displayed when you don’t have UI installed and from your screen shot, it looks like you have the reference app installed on your SDK server, more on that below.
So the page you’re showing in the screenshot here is the RefApp home page, which means we should be fairly easily able to do something to it.
So the first thing we need to do is replace the version of the Reference Application module on your server with one running from local source code. To do that, you want to checkout this GitHub repo to your local machine and then run mvn clean install openmrs-sdk:watch
. This should prompt you to select your SDK installed server and then do the setup that’s necessary to reload changes live. However, for this to kick in, you need to actually restart the SDK server, which you can do by killing it in the terminal window (ctrl-c
normally) and then simply re-running it with mvn openmrs-sdk:run
.
Now, if you open the openmrs-module-referenceapplication source code in your preferred editor and navigate to omod/src/main/webapp/pages/home.gsp
, we should be able to modify the page. For these purposes, I’m just going to add something short and ugly to the bottom of the home page. To do this, I added a line at the bottom of the file that looks like this:
<div class="row col-12">Look, Ma! I added some text!</div>
And on refreshing the page in my browser, I can now see the text I’ve added:
Now, lets go for something a little more dramatic. Say, for example, I want to change the color of the header bar to a different color.
In my browser, I can right-click on the header and select “Inspect Element” and then ensuring I’ve selected the header
element, I see these CSS properties:
Hovering over the referenceapplication.css
file above, I can see that the full URL is: http://localhost:8686/openmrs/ms/uiframework/resource/referenceapplication/styles/referenceapplication.css (My server is running on port 8686; yours will likely say 8081, since that’s the port you’ve configured it to run on). Ignoring most of that URL for the moment, we can see that it’s loading the CSS file from the referenceapplication module and the file is called styles/referenceapplication.css
. Going back to the referenceapplication module source code, we can find the corresponding file in omod/src/main/webapp/resources/styles/referenceapplication.css
and if I move down to line 766 I can see a block that defines the styles for the header
element, including this line:
background-color: #00463f;
Let’s change that to something else, for instance:
background-color: darkred;
And once again refreshing the page, I can see the result reflected:
Hopefully that’s enough to start playing around with. Note that the whole of the reference application UI is a bit convoluted and focusing on the home page is a bit of a simpler experience that focusing on some of the other pages, but that’s maybe a topic for another day.
Let me know if you have any questions!
cc: @rainbow I think I mentioned something about having some task-focused beginning developer documentation. While I’m not sure that what I’ve outlined above meets any real-world needs, maybe this could serve as a starting-point for some of that? At least it seems like a fairly simply way to make some changes you can see.