Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
afd897edfe | ||
|
|
efc79cb6e7 | ||
|
|
35efe39ea7 |
@@ -45,12 +45,22 @@ Meteor.methods({
|
|||||||
metaData: Object,
|
metaData: Object,
|
||||||
});
|
});
|
||||||
report.owner = this.userId;
|
report.owner = this.userId;
|
||||||
Reports.insert(report);
|
var id = Reports.insert(report);
|
||||||
|
var user = Meteor.users.findOne(this.userId);
|
||||||
|
var sender = user &&
|
||||||
|
user.emails &&
|
||||||
|
user.emails[0] &&
|
||||||
|
user.emails[0].address ||
|
||||||
|
"reports@dicecloud.com";
|
||||||
|
var bodyText = "Report ID: " + id +
|
||||||
|
"\nSeverity: " + report.severity +
|
||||||
|
"\nType: " + report.type +
|
||||||
|
"\n\n" + report.description;
|
||||||
Email.send({
|
Email.send({
|
||||||
from: "reports@dicecloud.com",
|
from: sender,
|
||||||
to: "stefan.zermatten@gmail.com",
|
to: "stefan.zermatten@gmail.com",
|
||||||
subject: "DiceCloud feedback - " + report.title,
|
subject: "DiceCloud feedback - " + report.title,
|
||||||
text: JSON.stringify(_.omit(report, "metaData"), null, '\t'),
|
text: bodyText,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
deleteReport: function(id) {
|
deleteReport: function(id) {
|
||||||
|
|||||||
@@ -1,25 +1,27 @@
|
|||||||
Template.registerHelper("valueString", function(value) {
|
Template.registerHelper("valueString", function(value) {
|
||||||
|
var intValue = Math.round(value * 100);
|
||||||
|
var cp = intValue % 10;
|
||||||
|
intValue -= cp;
|
||||||
|
cp = Math.round(cp);
|
||||||
|
sp = intValue % 100;
|
||||||
|
intValue -= sp;
|
||||||
|
sp = Math.round(sp / 10)
|
||||||
|
gp = Math.floor(value);
|
||||||
|
|
||||||
var resultArray = [];
|
var resultArray = [];
|
||||||
//sp
|
|
||||||
var gp = Math.floor(value);
|
|
||||||
if (gp > 0) {
|
if (gp > 0) {
|
||||||
resultArray.push(gp + "gp");
|
resultArray.push(gp + "gp");
|
||||||
}
|
}
|
||||||
//sp
|
|
||||||
var sp = Math.floor(10 * (value % 1));
|
|
||||||
if (sp > 0) {
|
if (sp > 0) {
|
||||||
resultArray.push(sp + "sp");
|
resultArray.push(sp + "sp");
|
||||||
}
|
}
|
||||||
//cp
|
|
||||||
var cp = 10 * ((value * 10) % 1);
|
|
||||||
cp = Math.round(cp * 1000) / 1000;
|
|
||||||
if (cp > 0) {
|
if (cp > 0) {
|
||||||
resultArray.push(cp + "cp");
|
resultArray.push(cp + "cp");
|
||||||
}
|
}
|
||||||
|
|
||||||
//build string with correct spacing
|
//build string with correct spacing
|
||||||
var result = "";
|
var result = "";
|
||||||
for (var i = 0; i < resultArray.length; i++) {
|
for (var i = 0, l = resultArray.length; i < l; i++) {
|
||||||
//add a space between values
|
//add a space between values
|
||||||
if (i !== 0) {
|
if (i !== 0) {
|
||||||
result += " ";
|
result += " ";
|
||||||
|
|||||||
Reference in New Issue
Block a user