Skip to content

Instantly share code, notes, and snippets.

@akmad
Created March 24, 2017 10:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save akmad/465ee4d34b17a842ce4e24869f83ecb8 to your computer and use it in GitHub Desktop.
Save akmad/465ee4d34b17a842ce4e24869f83ecb8 to your computer and use it in GitHub Desktop.
package org.openmrs.module.openhmis.commons.fragment.controller;
import org.openmrs.module.Module;
import org.openmrs.module.ModuleFactory;
import org.openmrs.module.ModuleUtil;
import org.openmrs.ui.framework.fragment.FragmentModel;
/**
* Fragment controller for the loadReusableModules.gsp fragment.
*/
public class LoadReusableModulesFragmentController {
/**
* The module id for the UI Framework mod.
*/
public static final String UI_FRAMEWORK_MODULE_ID = "uiframework";
/**
* Adds the angular version as an model attribute and renders the fragment.
*/
public void controller(FragmentModel model) {
Module module = ModuleFactory.getModuleById(UI_FRAMEWORK_MODULE_ID);
String angularVersion;
if (module == null) {
angularVersion = "0.0";
} else {
String currentVersion = module.getVersion();
if (ModuleUtil.compareVersion(currentVersion, "3.9") >= 0) {
angularVersion = "1.5";
} else {
angularVersion = "1.3";
}
}
model.addAttribute("angularVersion", angularVersion);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment