buddypress / next-template-packs

is this the next BuddyPress template pack?
35 stars 9 forks source link

Core code review: inline JS #180

Closed paulgibbs closed 7 years ago

paulgibbs commented 7 years ago

We should not need inline JS. Here is an instance where it should be moved into one of the JS files:

https://github.com/buddypress/next-template-packs/blob/bdc1c5174f58c44314f9b85f3fbab203d03c9f67/bp-templates/bp-nouveau/buddypress/members/single/settings/delete-account.php#L21

hnla commented 7 years ago

Agreed it's ugly and needs updating

Attempting to build a function for this so that we have a more generic approach where we can set any controls to manipulate disabled attr.

Beset by usual issues though of having to deal with buttons as functions, markup structure not conducive to nested element checking, things that make generic approaches harder.

Solution for the time being will be an event listener that looks for a data attr given a value of the id of the submit ( or element that can take a disabled attr ) , the data attr will be set on any form control requiring a disabled toggle.

hnla commented 7 years ago

This approach means that we can set (or should be able to set) a data attr on a given form control and reference as the data an element ID we want to target: data-bp-disable-input="#delete-account-button"

hnla commented 7 years ago

Closing