Skip to content

Commit

Permalink
fixed report function
Browse files Browse the repository at this point in the history
  • Loading branch information
Osile committed Apr 14, 2014
1 parent f3b81f0 commit ac5055e
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 10 deletions.
14 changes: 13 additions & 1 deletion gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,15 @@ module.exports = function(grunt) {
specs: 'tests/*.spec.js'
}
}
}
},
copy:{
main: {
files: [
{expand: true, flatten: true, src: ['build/rjs.min.js'], dest: '/Volumes/HDD/dev/mepantrag/www/js/libs', filter: 'isFile'},
{expand: true, flatten: true, src: ['build/rjs.min.js'], dest: '/Volumes/HDD/dev/mepauftrag/www/js/libs', filter: 'isFile'}
]
}
}
});

// Load the plugin that provides the "uglify" task.
Expand All @@ -28,7 +36,11 @@ module.exports = function(grunt) {
//jasmine Plugin
grunt.loadNpmTasks('grunt-contrib-jasmine');

//copy plugin
grunt.loadNpmTasks('grunt-contrib-copy');

// Default task(s).
grunt.registerTask('default', ['uglify']);


};
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
{
"name": "rjs",
"version": "0.0.3",
"version": "0.0.6",
"devDependencies": {
"grunt": "~0.4.2",
"grunt-contrib-jshint": "~0.6.3",
"grunt-contrib-nodeunit": "~0.2.0",
"grunt-contrib-uglify": "~0.2.2",
"grunt-contrib-jasmine": "^0.6.3"
"grunt-contrib-jasmine": "^0.6.3",
"grunt-contrib-copy": "^0.5.0"
}
}
14 changes: 8 additions & 6 deletions src/rjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ function _save(msg){


}
function _reportMail(msg){
function _reportMail(self,msg){
var body = 'Bug Report<br>'+ '_________________' + '<br>' +
msg.title +' : '+msg.body+ '<br>' +
'Model: ' + device.model + '<br>' +
Expand All @@ -70,19 +70,20 @@ function _reportMail(msg){
if (msg.dumpObject){
body += 'DumpObject: ' + JSON.stringify(dumpObject);
}

window.plugin.email.open({
to: [this.report.email],
to: [self.report.email],
cc: [],
bcc: [],
attachments: [],
subject: this.appName + ' Bug Report',
subject: self.appName + ' Bug Report',
body: body,
isHtml: true
});

return true;
}
function _show(msg){
var self = this;
if (this.report){
var buttons = [this.report.btnReport,this.report.btnOK];
}else{
Expand All @@ -93,14 +94,15 @@ function _show(msg){
if (btnIndex == 2){
// Do nothing, just closing the confirm dialog
}else if(btnIndex == 1){
_reportMail(msg);
this._reportMail(self,msg);
}
},msg.title,buttons);
}else{
console.log('Melden: ',JSON.stringify(msg));
}

}

function _remote(msg){
var http = new XMLHttpRequest();
var message = msg.title + ':' + msg.body;
Expand Down
14 changes: 13 additions & 1 deletion tests/rjs.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@ describe('R.js', function(){
var r = new rjs({
env: 'development',
level: 'silent',
remote: 'http://localhost:3000'
remote: 'http://localhost:3000',
appName: 'Dumpfbackenapp',
report: {
email: '[email protected]'
}
});
it('init response with object', function(){
expect(r).checkType('object');
Expand All @@ -35,4 +39,12 @@ describe('R.js', function(){
var res = r.log('Error','hi',{name:'peter'});
expect(res).toBe(true);
})
it('report possible', function(){
var res = r._reportMail({
title:'Dumpfbacke',
body:'blödel sack',
timestamp: Date.now()
})
expect(res).toBe(true);
})
})

0 comments on commit ac5055e

Please sign in to comment.