enter submits modals (#945)

This commit is contained in:
Colin Megill
2019-09-25 15:18:33 -07:00
committed by GitHub
parent 32feb36172
commit e64f4f06fb
2 changed files with 118 additions and 91 deletions
@@ -76,7 +76,9 @@ class Categories extends React.Component {
>
{/* READ ONLY CATEGORICAL FIELDS */}
{/* this is duplicative but flat, could be abstracted */}
{_.map(allCategoryNames, catName =>
{_.map(
allCategoryNames,
catName =>
!schema.annotations.obsByName[catName].writable ? (
<Category
key={catName}
@@ -87,7 +89,9 @@ class Categories extends React.Component {
) : null
)}
{/* WRITEABLE FIELDS */}
{_.map(allCategoryNames, catName =>
{_.map(
allCategoryNames,
catName =>
schema.annotations.obsByName[catName].writable ? (
<Category
key={catName}
@@ -104,6 +108,12 @@ class Categories extends React.Component {
title="Create new category"
isOpen={createAnnoModeActive}
onClose={this.handleDisableAnnoMode}
>
<form
onSubmit={e => {
e.preventDefault();
this.handleCreateUserAnno();
}}
>
<div className={Classes.DIALOG_BODY}>
<div style={{ marginBottom: 20 }}>
@@ -124,7 +134,9 @@ class Categories extends React.Component {
items={allCategoryNames}
filterable={false}
itemRenderer={(d, { handleClick }) => {
return <MenuItem onClick={handleClick} key={d} text={d} />;
return (
<MenuItem onClick={handleClick} key={d} text={d} />
);
}}
noResults={<MenuItem disabled text="No results." />}
onItemSelect={d => {
@@ -143,13 +155,20 @@ class Categories extends React.Component {
<div className={Classes.DIALOG_FOOTER}>
<div className={Classes.DIALOG_FOOTER_ACTIONS}>
<Tooltip content="Close this dialog without creating a category.">
<Button onClick={this.handleDisableAnnoMode}>Cancel</Button>
<Button onClick={this.handleDisableAnnoMode}>
Cancel
</Button>
</Tooltip>
<Button onClick={this.handleCreateUserAnno} intent="primary">
<Button
onClick={this.handleCreateUserAnno}
intent="primary"
type="submit"
>
Create new category
</Button>
</div>
</div>
</form>
</Dialog>
<Button onClick={this.handleEnableAnnoMode} intent="primary">
Create new category
@@ -311,6 +311,12 @@ class Category extends React.Component {
title="Add new label"
isOpen={annotations.isAddingNewLabel}
onClose={this.disableAddNewLabelMode}
>
<form
onSubmit={e => {
e.preventDefault();
this.handleAddNewLabelToCategory();
}}
>
<div className={Classes.DIALOG_BODY}>
<div style={{ marginBottom: 20 }}>
@@ -340,11 +346,13 @@ class Category extends React.Component {
}
onClick={this.handleAddNewLabelToCategory}
intent="primary"
type="submit"
>
Add new label to category
</Button>
</div>
</div>
</form>
</Dialog>
<Popover
interactionKind={PopoverInteractionKind.HOVER}