Skip to content

Commit ebc11ba

Browse files
committed
workaround for bug #91
1 parent 783696a commit ebc11ba

2 files changed

Lines changed: 25 additions & 8 deletions

File tree

ui/App/components/Mods/search/ModSearch.jsx

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ import ModFoundOverview from './ModFoundOverview.jsx';
44
class ModSearch extends React.Component {
55
render() {
66
if(this.props.loggedIn) {
7-
return (
7+
//TODO switch back to currently commented out code, when the mod-portal-api is back with all features!!
8+
/*return (
89
<div className="box-body">
910
<form onSubmit={this.props.submitSearchMod}>
1011
<div className="input-group col-lg-5">
@@ -19,6 +20,18 @@ class ModSearch extends React.Component {
1920
{...this.props}
2021
/>
2122
</div>
23+
)*/
24+
return (
25+
<div className="box-body">
26+
<form onSubmit={this.props.loadDownloadList}>
27+
<div className="input-group col-lg-5">
28+
<input type="text" className="form-control" placeholder="Download mod by ID" name="modId" />
29+
<span className="input-group-btn">
30+
<input className="btn btn-default" type="submit" value="Go!"/>
31+
</span>
32+
</div>
33+
</form>
34+
</div>
2235
)
2336
} else {
2437
return (
@@ -44,7 +57,8 @@ class ModSearch extends React.Component {
4457
ModSearch.propTypes = {
4558
submitSearchMod: React.PropTypes.func.isRequired,
4659
loggedIn: React.PropTypes.bool.isRequired,
47-
submitFactorioLogin: React.PropTypes.func.isRequired
60+
submitFactorioLogin: React.PropTypes.func.isRequired,
61+
loadDownloadList: React.PropTypes.func.isRequired
4862
}
4963

5064
export default ModSearch;

ui/App/components/ModsContent.jsx

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -156,12 +156,15 @@ class ModsContent extends React.Component {
156156
});
157157
}
158158

159+
//TODO remove modIdInput, when the factorio-mod-portal-api is fixed
160+
// all outcommented needs to be reimplemented, when it will work again
159161
loadDownloadList(e) {
160162
e.preventDefault();
161-
let $button = $(e.target);
162-
let $loader = $("<div class='loader'></div>");
163-
$button.prepend($loader);
164-
let modId = $button.data("modId");
163+
// let $button = $(e.target);
164+
// let $loader = $("<div class='loader'></div>");
165+
// $button.prepend($loader);
166+
let modId = $(e.target).find("input[name=modId]").val();
167+
// let modId = $button.data("modId");
165168

166169
$.ajax({
167170
method: "POST",
@@ -171,7 +174,7 @@ class ModsContent extends React.Component {
171174
},
172175
dataType: "json",
173176
success: (data) => {
174-
$loader.remove();
177+
// $loader.remove();
175178

176179
let correctData = JSON.parse(data.data);
177180

@@ -244,7 +247,7 @@ class ModsContent extends React.Component {
244247
},
245248
error: (xhr, status, err) => {
246249
console.log('api/mods/details', status, err.toString());
247-
$loader.remove();
250+
// $loader.remove();
248251
}
249252
})
250253
}

0 commit comments

Comments
 (0)