Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## [v3.1.1](https://github.com/neonexus/sails-react-bootstrap-webpack/compare/v3.1.0...v3.1.1) (2022-09-08)

### Features

* Made improvements to SASS files for new Bootstrap version.
* Updated dependencies.

## [v3.1.0](https://github.com/neonexus/sails-react-bootstrap-webpack/compare/v3.0.3...v3.1.0) (2022-09-05)

### Features
Expand Down
122 changes: 64 additions & 58 deletions assets/src/Admin/CreateUserModal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,21 +31,29 @@ class CreateUserModal extends React.Component {

this.setState({wasValidated: true, isLoading: true});

if (e.target.checkValidity() && (!this.state.setPassword || (this.state.password1 === this.state.password2))) {
this.props.onCreate({
firstName: this.state.firstName,
lastName: this.state.lastName,
email: this.state.email,
role: this.state.role,
setPassword: this.state.setPassword,
password: this.state.password1
}, () => this.handleClose(() => {}), () => this.setState({isLoading: false}));
if (e.target.checkValidity() && (!this.state.setPassword || (this.state.password1 === this.state.password2 && this.state.password1.length > 5))) {
this.props.onCreate(
{
firstName: this.state.firstName,
lastName: this.state.lastName,
email: this.state.email,
role: this.state.role,
setPassword: this.state.setPassword,
password: this.state.password1
},
this.handleClose,
() => this.setState({isLoading: false})
);
} else {
this.setState({isLoading: false});
}
}

handleClose(onClose) {
if (!onClose) {
onClose = _.noop;
}

this.setState({
firstName: '',
lastName: '',
Expand Down Expand Up @@ -150,62 +158,60 @@ class CreateUserModal extends React.Component {

<Collapse in={this.state.setPassword}>
<div className="mt-3 mb-2">
{
this.state.setPassword ?
<>
<Form.Group className="mb-3" controlId="password1">
<Form.Label>Password</Form.Label>
<Form.Control
type="password"
placeholder="Enter Password"
onChange={(e) => this.setState({password1: e.target.value})}
className={(this.state.password1 !== this.state.password2 && this.state.password1.length > 5 && this.state.password2.length > 5)
? 'is-invalid'
: null}
required
disabled={this.state.isLoading}
/>
<Form.Control.Feedback type="invalid" className={(this.state.password1 !== this.state.password2) ? 'd-none' : null}>Password is
required.
</Form.Control.Feedback>
</Form.Group>

<Form.Group controlId="password2">
<Form.Label>Verify Password</Form.Label>
<Form.Control
type="password"
placeholder="Verify Password"
onChange={(e) => this.setState({password2: e.target.value})}
className={(this.state.password1 !== this.state.password2 && this.state.password1.length > 5 && this.state.password2.length > 5)
? 'is-invalid'
: null}
required
disabled={this.state.isLoading}
/>
{
(this.state.password1 !== '') ?
<Form.Control.Feedback type="invalid">
{
(this.state.password1 !== this.state.password2)
? 'Passwords do not match.'
: 'Must verify password.'
}
</Form.Control.Feedback>
:
null
}
</Form.Group>
</>
: null
}
<Form.Group className="mb-3" controlId="password1">
<Form.Label>Password</Form.Label>
<Form.Control
type="password"
placeholder="Enter Password"
onChange={(e) => this.setState({password1: e.target.value})}
className={
(this.state.wasValidated && this.state.password1.length < 6)
? 'is-invalid'
: null
}
required
disabled={this.state.isLoading || !this.state.setPassword}
minLength="6"
maxLength="72"
/>
<Form.Control.Feedback type="invalid" className={(!this.state.wasValidated || this.state.password1.length > 5) ? 'd-none' : null}>
{
(this.state.password1.length)
? 'Password is too short.'
: 'Password is required.'
}
</Form.Control.Feedback>
</Form.Group>

<Form.Group controlId="password2">
<Form.Label>Verify Password</Form.Label>
<Form.Control
type="password"
placeholder="Verify Password"
onChange={(e) => this.setState({password2: e.target.value})}
className={
(this.state.wasValidated && this.state.password1 !== this.state.password2 && this.state.password2.length)
? 'is-invalid'
: null
}
required
disabled={this.state.isLoading || !this.state.setPassword}
minLength="6"
/>
{
(this.state.wasValidated && this.state.password1.length && this.state.password2.length)
? <Form.Control.Feedback type="invalid">Passwords do not match.</Form.Control.Feedback>
: null
}
</Form.Group>
</div>
</Collapse>
</Modal.Body>

<Modal.Footer className="justify-content-between">
<Button variant="secondary" onClick={() => this.handleClose(this.props.onClose)} disabled={this.state.isLoading}>Cancel</Button>
<Button variant="primary" type="submit" disabled={this.state.isLoading}>
{this.state.isLoading ? 'Loading...': 'Create'}
{this.state.isLoading ? 'Loading...' : 'Create'}
</Button>
</Modal.Footer>
</Form>
Expand Down
4 changes: 2 additions & 2 deletions assets/styles/admin/admin.scss
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
@import "~bootstrap/scss/functions";
// @import "functions";

@import "bootstrap-variable-overrides";
@import "~bootstrap/scss/variables";

@import "~bootstrap/scss/maps";

@import "~bootstrap/scss/mixins";
// @import "mixins";

@import "../common/bootstrap";

Expand Down
1 change: 1 addition & 0 deletions assets/styles/admin/bootstrap-variable-overrides.scss
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,7 @@ $enable-important-utilities: true;
// Prefix for :root CSS variables

$variable-prefix: bs-;
$prefix: $variable-prefix;

// Gradient
//
Expand Down
2 changes: 1 addition & 1 deletion assets/styles/common/_bootstrap.scss
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@
@import "~bootstrap/scss/offcanvas";
@import "~bootstrap/scss/placeholders";
@import "~bootstrap/scss/utilities";
@import "~bootstrap/scss/functions";
//@import "~bootstrap/scss/functions";
@import "~bootstrap/scss/helpers";
@import "~bootstrap/scss/utilities/api";
4 changes: 1 addition & 3 deletions assets/styles/common/_reboot.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ iframe {
border: 0;
}

figcaption,
figure,
main {
figcaption, figure, main {
display: block;
}

Expand Down
13 changes: 12 additions & 1 deletion assets/styles/common/common.scss
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,17 @@ select.prevent-validation:valid, select.prevent-validation.is-valid{
}

& ~ .form-check-label {
color: var(--#{$variable-prefix}body-color) !important;
color: var(--#{$prefix}body-color) !important;
}
}

// .is-invalid class enforcements
.was-validated .form-control.is-invalid {
border-color: $form-feedback-invalid-color !important;

background-image: escape-svg($form-feedback-icon-invalid) !important;

&:focus {
box-shadow: 0 0 0 0.25rem rgba($form-feedback-invalid-color, .25) !important;
}
}
1 change: 1 addition & 0 deletions assets/styles/marketing/bootstrap-variable-overrides.scss
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,7 @@ $enable-important-utilities: true;
// Prefix for :root CSS variables

$variable-prefix: bs-;
$prefix: $variable-prefix;

// Gradient
//
Expand Down
4 changes: 2 additions & 2 deletions assets/styles/marketing/marketing.scss
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
@import "~bootstrap/scss/functions";
//@import "functions";

@import "bootstrap-variable-overrides";
@import "~bootstrap/scss/variables";

@import "~bootstrap/scss/maps";

@import "~bootstrap/scss/mixins";
//@import "mixins";

@import "../common/bootstrap";

Expand Down
Loading