diff --git a/js/components/controls/modals/ErrorModal.js b/js/components/controls/modals/ErrorModal.js index b3f571354..2258a6196 100644 --- a/js/components/controls/modals/ErrorModal.js +++ b/js/components/controls/modals/ErrorModal.js @@ -21,15 +21,45 @@ define(function (require) { text: '', code: '', source: '', - exception: '' + exception: '', + githubButton : { + enabled : true, + url : "https://github.com/openworm/org.geppetto/issues/new" + }, + twitterButton : { + enabled : true, + url : "http://geppetto.org", + message : "Whoops, I broke Geppetto! @geppettoengine help!" + } } }, + + // Searches for property in GEPPETTO_CONFIGURATION JSON object, if not found returns undefined. + getGeppettoConfigurationProperty: function (property) { + return property.split(".").reduce(function(o, x) { + return (typeof o == "undefined" || o === null) ? o : o[x]; + }, GEPPETTO_CONFIGURATION); + }, shareTwitter: function () { - GEPPETTO.Share.twitter('http://geppetto.org','Whoops, I broke Geppetto! @geppettoengine help!'); + let urlProperty = this.getGeppettoConfigurationProperty("properties.errorDialog.twitterButton.url"); + let url = ( urlProperty != undefined ? urlProperty : this.props.twitterButton.url) + let messageProperty = this.getGeppettoConfigurationProperty("properties.errorDialog.twitterButton.message"); + let message = ( messageProperty != undefined ? messageProperty : this.props.twitterButton.message) + window.open('http://twitter.com/share?url=' + encodeURIComponent(url) + '&text=' + + encodeURIComponent(message), '', 'left=0,top=0,width=550,height=450,personalbar=0,toolbar=0,scrollbars=0,resizable=0'); }, 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" }) + let gitButProp = (this.getGeppettoConfigurationProperty("properties.errorDialog.githubButton.enabled") == undefined + ? this.props.githubButton.enabled : this.getGeppettoConfigurationProperty("properties.errorDialog.githubButton.enabled")); + let githubButtonVisible = ( gitButProp ? null : { display: "none" }) + let confGitURL = this.getGeppettoConfigurationProperty("properties.errorDialog.githubButton.url"); + let githubButtonURL = (confGitURL != undefined ? confGitURL : this.props.githubButton.url) + let githubMessage = this.getGeppettoConfigurationProperty("properties.errorDialog.message") return (
@@ -39,7 +69,7 @@ define(function (require) {

- {this.props.message} + {githubMessage != undefined ? githubMessage : this.props.message}

@@ -56,10 +86,10 @@ define(function (require) {