<form>
<label
htmlFor="file-upload"
- className={`${UserService.Instance.user &&
- 'pointer'} d-inline-block float-right text-muted font-weight-bold`}
+ className={`${
+ UserService.Instance.user && 'pointer'
+ } d-inline-block float-right text-muted font-weight-bold`}
data-tippy-content={i18n.t('upload_image')}
>
<svg class="icon icon-inline">
)}
{this.state.postForm.body && (
<button
- className={`mt-1 mr-2 btn btn-sm btn-secondary ${this.state
- .previewMode && 'active'}`}
+ className={`mt-1 mr-2 btn btn-sm btn-secondary ${
+ this.state.previewMode && 'active'
+ }`}
onClick={linkEvent(this, this.handlePreviewToggle)}
>
{i18n.t('preview')}
value={this.state.postForm.community_id}
onInput={linkEvent(this, this.handlePostCommunityChange)}
>
+ <option>{i18n.t('select_a_community')}</option>
{this.state.communities.map(community => (
<option value={community.id}>{community.name}</option>
))}
)}
<div class="form-group row">
<div class="col-sm-10">
- <button type="submit" class="btn btn-secondary mr-2">
+ <button
+ disabled={!this.state.postForm.community_id}
+ type="submit"
+ class="btn btn-secondary mr-2"
+ >
{this.state.loading ? (
<svg class="icon icon-spinner spin">
<use xlinkHref="#icon-spinner"></use>
).id;
this.state.postForm.community_id = foundCommunityId;
} else {
- this.state.postForm.community_id = data.communities[0].id;
+ // By default, the null valued 'Select a Community'
}
this.setState(this.state);
let selector = new Selectr(selectId, { nativeDropdown: false });
selector.on('selectr.select', option => {
this.state.postForm.community_id = Number(option.value);
+ this.setState(this.state);
});
}
} else if (res.op == UserOperation.CreatePost) {
"communities": "Communities",
"users": "Users",
"create_a_community": "Create a community",
+ "select_a_community": "Select a community",
"create_community": "Create Community",
"remove_community": "Remove Community",
"subscribed_to_communities": "Subscribed to <1>communities</1>",