Skip to content
This repository has been archived by the owner on Jan 8, 2019. It is now read-only.

Commit

Permalink
Use appPrefixed on React components. Fixes #1009
Browse files Browse the repository at this point in the history
  • Loading branch information
Edmundo Alvarez committed Dec 17, 2014
1 parent 543c295 commit 85adff7
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 7 deletions.
3 changes: 2 additions & 1 deletion javascript/gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ gulp.task('test', function () {
moduleFileExtensions: [
"js",
"jsx"
]
],
setupTestFrameworkScriptFile: "<rootDir>/jest-shim-globals.js"
}));
});

Expand Down
3 changes: 3 additions & 0 deletions javascript/jest-shim-globals.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
window.appPrefixed = function(url) {
return url;
};
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

'use strict';

/* global appPrefixed */

var React = require('react');
var Markdown = require('markdown').markdown;

Expand All @@ -16,10 +18,10 @@ var ConfigurationBundlePreview = React.createClass({

if (this.props.sourceTypeDescription) {
preview = this.props.sourceTypeDescription;
apply_action = <form action={"/a/system/contentpacks/" + this.props.sourceTypeId + "/apply"} method="POST">
apply_action = <form action={appPrefixed("/a/system/contentpacks/" + this.props.sourceTypeId + "/apply")} method="POST">
<input type="submit" value="Apply content" className="btn btn-small btn-success"/>
</form>;
delete_action = <form action={"/a/system/contentpacks/" + this.props.sourceTypeId + "/delete"} method="POST" onSubmit={this._confirmDeletion} className="pull-right">
delete_action = <form action={appPrefixed("/a/system/contentpacks/" + this.props.sourceTypeId + "/delete")} method="POST" onSubmit={this._confirmDeletion} className="pull-right">
<input type="submit" value="Remove pack" className="btn btn-mini btn-warning"/>
</form>;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

'use strict';

/* global appPrefixed */

var React = require('react');
var BootstrapAccordion = require('../bootstrap/BootstrapAccordion');
var BootstrapAccordionGroup = require('../bootstrap/BootstrapAccordionGroup');
Expand All @@ -21,7 +23,7 @@ var ConfigurationBundles = React.createClass({
this.setState({sourceTypeId: sourceTypeId, sourceTypeDescription: sourceTypeDescription});
},
componentDidMount() {
$.get('/a/system/contentpacks', (result) => {
$.get(appPrefixed('/a/system/contentpacks'), (result) => {
if (this.isMounted()) {
this.setState({
bundles: result
Expand Down
4 changes: 3 additions & 1 deletion javascript/src/stores/sources/HistogramDataStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

'use strict';

/* global appPrefixed */

var mergeInto = require('../../lib/util').mergeInto;
var AbstractEventSendingStore = require('../AbstractEventSendingStore');
var $ = require('jquery'); // excluded and shimed
Expand All @@ -21,7 +23,7 @@ var HistogramDataStore = {
},

loadHistogramData(range, sourceNames, maxDataPoints) {
var url = HISTOGRAM_URL;
var url = appPrefixed(HISTOGRAM_URL);
if (typeof maxDataPoints === 'undefined') {
maxDataPoints = DEFAULT_MAX_DATA_POINTS;
}
Expand Down
4 changes: 3 additions & 1 deletion javascript/src/stores/sources/SourcesStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

'use strict';

/* global appPrefixed */

var mergeInto = require('../../lib/util').mergeInto;
var AbstractEventSendingStore = require('../AbstractEventSendingStore');
var $ = require('jquery'); // excluded and shimed
Expand All @@ -16,7 +18,7 @@ var processSourcesData = (sources) => {
};

var SourcesStore = {
SOURCES_URL: '/a/sources',
SOURCES_URL: appPrefixed('/a/sources'),

setSources(sources) {
this._sources = sources;
Expand Down
4 changes: 3 additions & 1 deletion javascript/src/stores/users/PreferencesStore.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
'use strict';

/* global appPrefixed */

var mergeInto = require('../../lib/util').mergeInto;
var AbstractEventSendingStore = require('../AbstractEventSendingStore');
var $ = require('jquery'); // excluded and shimed

var PreferencesStore = {
URL: '/a/system/user/',
URL: appPrefixed('/a/system/user/'),
DATA_SAVED_EVENT: 'DATA_SAVED_EVENT',
DATA_LOADED_EVENT: 'DATA_LOADED_EVENT',

Expand Down

0 comments on commit 85adff7

Please sign in to comment.