Skip to content

Commit

Permalink
Merge pull request #112 from openworm/feature/110
Browse files Browse the repository at this point in the history
Feature/110
  • Loading branch information
tarelli authored Nov 12, 2019
2 parents 42193b5 + 9ed770c commit 16eadaf
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
8 changes: 8 additions & 0 deletions js/common/GEPPETTO.Resources.js
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,14 @@ define(function (require) {
EXPORTING_MODEL : "Exporting Model",


/**
* Error Modal Message
*/
ERROR_MODAL_TITLE : "There was an error",
ERROR_MODAL_TWITTER_MESSAGE : "Whoops, I broke Geppetto! @geppettoengine help!",
ERROR_MODAL_TWITTER_URL : "http://geppetto.org",
ERROR_MODAL_NEW_ISSUE_URL : "https://github.com/openworm/org.geppetto/issues/new",

/**
* GEPPETTO resources
*/
Expand Down
16 changes: 9 additions & 7 deletions js/components/controls/modals/ErrorModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ define(function (require) {
var React = require('react');
var CreateClass = require('create-react-class'),
$ = require('jquery');

var GEPPETTO = require('geppetto');
require('../../../common/GEPPETTO.Resources')(GEPPETTO);

require("./ErrorModal.less");

return CreateClass({
Expand All @@ -17,26 +19,26 @@ define(function (require) {

getDefaultProps: function () {
return {
title: 'There was an error',
title: GEPPETTO.Resources.ERROR_MODAL_TITLE,
text: '',
code: '',
source: '',
exception: '',
githubButton : {
enabled : true,
url : "https://github.com/openworm/org.geppetto/issues/new"
url : GEPPETTO.Resources.ERROR_MODAL_NEW_ISSUE_URL
},
twitterButton : {
enabled : true,
url : "http://geppetto.org",
message : "Whoops, I broke Geppetto! @geppettoengine help!"
url : GEPPETTO.Resources.ERROR_MODAL_TWITTER_URL,
message : GEPPETTO.Resources.ERROR_MODAL_TWITTER_MESSAGE
}
}
},

// Searches for property in GEPPETTO_CONFIGURATION JSON object, if not found returns undefined.
getGeppettoConfigurationProperty: function (property) {
return property.split(".").reduce(function(o, x) {
return property.split(".").reduce(function (o, x) {
return (typeof o == "undefined" || o === null) ? o : o[x];
}, GEPPETTO_CONFIGURATION);
},
Expand All @@ -50,7 +52,7 @@ define(function (require) {
+ encodeURIComponent(message), '', 'left=0,top=0,width=550,height=450,personalbar=0,toolbar=0,scrollbars=0,resizable=0');
},

render: function (){
render: function () {
let twiButProp = (this.getGeppettoConfigurationProperty("properties.errorDialog.twitterButton.enabled") == undefined
? this.props.twitterButton.enabled : this.getGeppettoConfigurationProperty("properties.errorDialog.twitterButton.enabled"));
let twitterButtonVisible = ( twiButProp ? null : { display: "none" })
Expand Down

0 comments on commit 16eadaf

Please sign in to comment.