Created
March 24, 2017 10:29
-
-
Save akmad/465ee4d34b17a842ce4e24869f83ecb8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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