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

Disable frequency/interval fields if not required on backend contribution forms #17889

Merged
merged 1 commit into from
Jan 10, 2021

Conversation

mattwire
Copy link
Contributor

@mattwire mattwire commented Jul 18, 2020

Overview

Follow up to #17526

Freeze the recur frequency interval/unit fields if recur is not selected. This does the same thing that #17526 did for the contribution frontend form.

Support js validation on frequency interval field on backend contribution page.

Before

Fields not disabled when recurring is not selected. Recur fields sometimes do not load for the default processor when there are multiple processors on the form and the default supports recurring.

After

Disabled:
image

Enabled:
image

Fields appear for the default processor if it supports recur.

Technical Details

Comments

Seems that the fields only appear if your default payment processor has some paymentfields defined (eg. creditcard or bank details). Stripe, gocardless etc. do not... But the authorizenet extension does (as would the core version). Then just open the standard "submit credit card" form on the contribution tab and you should see options to enter "every x month/year"

@civibot
Copy link

civibot bot commented Jul 18, 2020

(Standard links)

@civibot civibot bot added the master label Jul 18, 2020
@mattwire mattwire force-pushed the freezerecur branch 2 times, most recently from 812f8d1 to d29c263 Compare July 18, 2020 16:09
@mattwire mattwire changed the title Fix recurring fields on backend contribution forms Freeze recurring fields on backend contribution forms Jul 18, 2020
@mattwire mattwire changed the title Freeze recurring fields on backend contribution forms Disable frequency/interval fields if not required on backend contribution forms Jul 18, 2020
@eileenmcnaughton
Copy link
Contributor

@mattwire the principle for the main part seems fine & it just needs an r-run

However, I don't have a framework for processing the tpl changes. Obviously the nbsp were put there for a reason - maybe a bad one - but a reason. If we are going to start stripping them out I think we need to have at least some form of discussion around that - probably in gitlab.

@eileenmcnaughton
Copy link
Contributor

@colemanw @agh1 @vingle - does anyone feel like we have a clear position on removing nbsp from the templates (it's currently blocking review as it was added in as a side-cleanup but I don't know if it is agreed)

@vingle
Copy link
Contributor

vingle commented Jul 27, 2020

@eileenmcnaughton not that I know of. The worst consequence I think would be someone with a custom theme having worse padding / a minor overlap - but if it looks ok with Grenwich, I don't think there's a goal to support custom themes / overrides.

That said, this PR is a good reminder that the .inform-icon and .icon class - are one of those places loading an image sprite rather than FontAwesome – if there was a 'good Civi markup styleguide' agreed, then it might be a good time to tidy up that too.

@mattwire
Copy link
Contributor Author

@agh1 In the case of .inform-icon and .icon is there a recommended replacement?

@vingle
Copy link
Contributor

vingle commented Jul 27, 2020

@mattwire – I used https://fontawesome.com/icons/info-circle in Finsbury, but could have used https://fontawesome.com/icons/info. Do you reckon UI framework docs is the best place to document recommended key icons for consistency?

@mattwire
Copy link
Contributor Author

@mattwire – I used https://fontawesome.com/icons/info-circle in Finsbury, but could have used https://fontawesome.com/icons/info. Do you reckon UI framework docs is the best place to document recommended key icons for consistency?

Yes, it would be good to replace this https://docs.civicrm.org/dev/en/latest/framework/ui/#older-icon-system with a mapping from old to new.

@eileenmcnaughton
Copy link
Contributor

OK so for this to get merged I guess we need an r-run on the actual issue and someone, not necessarily the same person, to OK the tpl changes

@vingle
Copy link
Contributor

vingle commented Jul 28, 2020

Digging a bit deeper into non-breaking spaces, I realise that their designed use is not for fixed/guaranteed spacing as I suggested above, but to keep words together when wrapping (e.g. 5 km or J R R Tolkein will wrap as if one word).

So the question here more I guess is: is there anything in the tpl that if it now wraps where it wouldn't before, that could cause a problem? E.g. line 262: ({ts}Soft Credit{/ts} {help id="id-soft_credit"}).

@eileenmcnaughton
Copy link
Contributor

test this please

@eileenmcnaughton
Copy link
Contributor

Shall we split this in 2?

I'm OK to review the js part but I can't review the other part

@mattwire
Copy link
Contributor Author

@eileenmcnaughton I've removed the @nbsp; changes - someone else can tackle those! This is now just the js part with a couple of blank line cleanups and wrapping a "label" around the is_recur element so it aligns more easily.

@JoeMurray
Copy link
Contributor

@monishdeb could you do a review including a r-run? Thx.

@eileenmcnaughton
Copy link
Contributor

test this please

@eileenmcnaughton
Copy link
Contributor

I tested this & the disabling / enabling was nice and clear. The validation took a bit more work to test. I enabled the (hidden) core processor for Eway and it turned out to be pretty bad both before and after. If I checked the recur box and then switched to eway the box was hidden. I got a processor error without this patch and after I got a jquery validation error but the checkbox was hidden so it was unclear how to resolve it. On this issue the patch is no worse than without the patch so disregarding that I think it's mergable based on the disable part working & the code seeming sensible

@eileenmcnaughton eileenmcnaughton merged commit 186fea2 into civicrm:master Jan 10, 2021
@mattwire mattwire deleted the freezerecur branch January 10, 2021 20:34
@mattwire
Copy link
Contributor Author

Thanks @eileenmcnaughton - agree the form is still a bit broken / buggy and I may look at that when I get chance. But that can build on top of this :-)

@eileenmcnaughton
Copy link
Contributor

cool - I guess the idea would be to unset the recurring check box when it's hidden but it's probably not a big real world issue

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

Successfully merging this pull request may close these issues.

4 participants