Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Small fixes to PodeWebTextbox #251

Open
wants to merge 12 commits into
base: develop
Choose a base branch
from
Open

Conversation

ittchmh
Copy link

@ittchmh ittchmh commented Dec 20, 2021

Description of the Change

Updates:

  • function Update-PodeWebTextbox: update rows property
  • default.js: form stepper ignore enter key press for multi line textbox, update rows property
  • textbox.pode: set textbox value

@ittchmh ittchmh changed the base branch from develop to master December 20, 2021 09:44
@ittchmh ittchmh changed the title Master Small fixes to PodeWebTextbox Dec 20, 2021
@Badgerati
Copy link
Owner

Hey @ittchmh,

I should be able to review this tomorrow, one quick thing though, could you update the PR to point at the develop branch? :)

@@ -31,7 +31,7 @@
$events = ConvertTo-PodeWebEvents -Events $data.Events

if ($data.Multiline) {
$element = "<textarea class='form-control $(if ($data.NoForm) { 'no-form' })' id='$($data.ID)' name='$($data.Name)' pode-object='$($data.ObjectType)' placeholder='$($data.Placeholder)' rows='$($data.Size)' style='$($width) $($data.CssStyles)' $($describedBy) $($readOnly) $($required) $($value) $($events)></textarea>"
$element = "<textarea class='form-control $(if ($data.NoForm) { 'no-form' })' id='$($data.ID)' name='$($data.Name)' pode-object='$($data.ObjectType)' placeholder='$($data.Placeholder)' rows='$($data.Size)' style='$($width) $($data.CssStyles)' $($describedBy) $($readOnly) $($required) $($value) $($events)>$($data.Value)</textarea>"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably worth removing the $($value) property being set here.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

Comment on lines 517 to 519
[Alias('Height')]
[int]
$Size = 4,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd make it so the default here is 0, so we can skip updating the textarea if no Size is passed.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

Comment on lines 543 to 545
if ($Size -le 0) {
$Size = 4
}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can remove this part if default size is 0.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

Comment on lines 2798 to 2800
if (Number.isInteger(action.Size)) {
txt[0].rows = action.Size;
}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Size parameter is an [int] so the Number check isn't needed. It was also be worth checking that the textbox is a textarea as well, something like:

if (action.Multiline && action.Size > 0) {
    txt[0].rows = action.Size;
}

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@@ -409,7 +409,7 @@ function setupSteppers() {
btn = stepper.find('.bs-stepper-content .bs-stepper-pane.active button.step-submit');
}

if (btn) {
if (btn && !isEnterKey(e)) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is the !isEnterKey(e) needed here? As ~9 lines up we do the same check and return 🤔

Copy link
Author

@ittchmh ittchmh Dec 22, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the && !isEnterKey(e) not set, it adding new line and execute Next button actio
7rAOMmPD46
n

@ittchmh ittchmh changed the base branch from master to develop December 22, 2021 18:05
ittchmh added a commit to ittchmh/Pode.Web that referenced this pull request Dec 22, 2021
ittchmh added a commit to ittchmh/Pode.Web that referenced this pull request Dec 22, 2021
@ittchmh
Copy link
Author

ittchmh commented Dec 22, 2021

Hey @Badgerati, I tried to switch to develop brunch and revert master, but something was done wrong by me. 😕
Maybe better to clean up my forked repo and create new PR ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants