Prettified all remaining detail boxes to be view -> edit
This commit is contained in:
27
rpg-docs/client/globalHelpers/openParentDialog.js
Normal file
27
rpg-docs/client/globalHelpers/openParentDialog.js
Normal file
@@ -0,0 +1,27 @@
|
||||
openParentDialog = function(parent, charId, heroId){
|
||||
var detail;
|
||||
if(parent.collection === "Characters" && parent.group === "racial"){
|
||||
detail = {
|
||||
template: "raceDialog",
|
||||
data: {charId: parent.id},
|
||||
};
|
||||
} else if( parent.collection === "Features" ){
|
||||
detail = {
|
||||
template: "featureDialog",
|
||||
data: {featureId: parent.id},
|
||||
};
|
||||
} else if( parent.collection === "Classes" ){
|
||||
detail = {
|
||||
template: "classDialog",
|
||||
data: {classId: parent.id},
|
||||
};
|
||||
} else if( parent.collection === "Items" ){
|
||||
detail = {
|
||||
template: "itemDialog",
|
||||
data: {itemId: parent.id},
|
||||
};
|
||||
}
|
||||
detail.heroId = heroId;
|
||||
detail.charId = charId;
|
||||
GlobalUI.setDetail(detail);
|
||||
};
|
||||
@@ -21,4 +21,29 @@ Template.registerHelper("valueString", function(value){
|
||||
result += resultArray[i];
|
||||
}
|
||||
return result;
|
||||
});
|
||||
});
|
||||
|
||||
Template.registerHelper("longValueString", function(value){
|
||||
var resultArray = [];
|
||||
//sp
|
||||
var gp = Math.floor(value);
|
||||
if(gp > 0) resultArray.push(gp + "gp");
|
||||
//sp
|
||||
var sp = Math.floor(10 * (value % 1));
|
||||
if(sp > 0 || resultArray.length) resultArray.push(sp + "sp");
|
||||
//cp
|
||||
var cp = 10 * ((value * 10) % 1);
|
||||
cp = Math.round(cp * 1000) / 1000;
|
||||
if(cp > 0 || resultArray.length) resultArray.push(cp + "cp");
|
||||
|
||||
//build string with correct spacing
|
||||
var result = "";
|
||||
for(var i = 0; i < resultArray.length; i++){
|
||||
//add a space between values
|
||||
if(i !== 0){
|
||||
result += " ";
|
||||
}
|
||||
result += resultArray[i];
|
||||
}
|
||||
return result;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user