/*jslint browser : true, continue : true, devel : true, indent : 2, maxerr : 50, newcap : true, nomen : true, plusplus : true, regexp : true, sloppy : true, vars : false, white : true */ /*global $, app */ app.trials = (function () { "use strict"; //---------------- BEGIN MODULE SCOPE VARIABLES -------------- var stateMap = {}, configModule, initModule, statusText; //----------------- END MODULE SCOPE VARIABLES --------------- //------------------- BEGIN UTILITY METHODS ------------------ ////////////////// //Generate a card with collapsible middle section with more details // statusText = function (obj) { switch (obj.status) { case 0: return "NEW"; case 1: return "approved"; case 2: return "rejected"; default: return "BAD STATUS: " + obj.status; } }; //-------------------- END UTILITY METHODS ------------------- //------------------- BEGIN EVENT HANDLERS ------------------- //-------------------- END EVENT HANDLERS -------------------- //------------------- BEGIN PUBLIC METHODS ------------------- //CONFIGMODULE // configModule = function (context) { stateMap.context = context.context; if (stateMap.context.params.id) { stateMap.id = stateMap.context.params.id; } }; //INITMODULE // initModule = function ($container) { if (typeof $container === "undefined") { $container = $("#app-shell-main-content"); } $container.html(Handlebars.templates["app.trials"]({})); //case 3513 document.title = "Trial requests"; //=================== //Get trials app.api.get("trial/list", function (res) { if (res.error) { $.gevent.publish("app-show-error", res.msg); } else { var $appList = $("#rf-list"); if (res.length == 0) { $appList.append("