This commit is contained in:
108
wwwroot/js/app.trials.js
Normal file
108
wwwroot/js/app.trials.js
Normal file
@@ -0,0 +1,108 @@
|
||||
/*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;
|
||||
//----------------- END MODULE SCOPE VARIABLES ---------------
|
||||
|
||||
//------------------- BEGIN UTILITY METHODS ------------------
|
||||
|
||||
//-------------------- 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 = "trials";
|
||||
|
||||
//===================
|
||||
//Get trials
|
||||
app.api.get("trial/list", function(res) {
|
||||
if (res.error) {
|
||||
$.gevent.publish("app-show-error", res.msg);
|
||||
} else {
|
||||
var $appList = $("#rf-list");
|
||||
|
||||
$appList.append('<ul class="list-group">');
|
||||
|
||||
$.each(res, function(i, obj) {
|
||||
if (obj.fetched) {
|
||||
$appList.append(
|
||||
"<li class='rfc-list-item-inactive list-group-item'><a href=\"#!/trialView/" +
|
||||
obj.id +
|
||||
'">' +
|
||||
"<span class='text-muted'>" +
|
||||
(obj.trial
|
||||
? "Trial "
|
||||
: "") +
|
||||
app.utilB.genListColumn(obj.regto) +
|
||||
" " +
|
||||
app.utilB.genListColumn(
|
||||
app.utilB.epochToShortDate(obj.created)
|
||||
) +
|
||||
"</span>" +
|
||||
"</a></li>"
|
||||
);
|
||||
} else {
|
||||
$appList.append(
|
||||
"<li class='list-group-item'><a href=\"#!/trialView/" +
|
||||
obj.id +
|
||||
'">' +
|
||||
(obj.trial
|
||||
? "Trial "
|
||||
: "") +
|
||||
app.utilB.genListColumn(obj.regto) +
|
||||
" " +
|
||||
app.utilB.genListColumn(
|
||||
app.utilB.epochToShortDate(obj.created)
|
||||
) +
|
||||
"</a></li>"
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
$appList.append("</ul>");
|
||||
}
|
||||
});
|
||||
//=========/trials==============
|
||||
|
||||
app.nav.contextClear();
|
||||
};
|
||||
|
||||
//PUBLIC METHODS
|
||||
//
|
||||
return {
|
||||
configModule: configModule,
|
||||
initModule: initModule
|
||||
};
|
||||
//------------------- END PUBLIC METHODS ---------------------
|
||||
})();
|
||||
Reference in New Issue
Block a user