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

Form attribute support #802

Merged
merged 29 commits into from
Dec 15, 2016
Merged

Conversation

crhallberg
Copy link
Contributor

@crhallberg crhallberg commented Sep 22, 2016

Add support for the form="id" attribute on input elements. This new feature is then applied to remove the hack that allowed us to use forms within forms for embedded records.

Unfortunately, IE removed support from conditional loading after IE 9. This means we need to load the polyfill for all browsers and skip the logic addition for those that support it. The asset pipeline makes this negligible for production performance.

  • IE testing
    • Duplicate fields if multiple form submits occur (lightbox)
    • Bottom bar not working
    • Print taking a long time
  • Merge master and Run full test suite
  • Fix polyfill
  • Test jQuery serialize
  • Search for more form serialization places
  • Add search form parameter
  • idPrefix
  • IDs or classes (discussion at VuFind) in the wrong PR
  • recaptcha logic consolidation

@@ -1,25 +1,25 @@
<? if((isset($this->showBulkOptions) && $this->showBulkOptions)
|| (isset($this->showCartControls) && $this->showCartControls)): ?>
<div class="bulkActionButtons hidden-print">
<div class="bulkActionButtons hidden-print<?if($this->idPrefix):?> form-inline<? endif; ?>">
Copy link
Member

Choose a reason for hiding this comment

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

Do you think it might make more sense to include a separate attribute for form name, rather than checking idPrefix? We can rely on idPrefix based on current usage, but it's not really an intuitively logical trigger for form attribute functionality.

Copy link
Member

Choose a reason for hiding this comment

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

Looks like you've changed most of the new idPrefix checks to formAttr checks, except for the one right above these comments. Is that intentional or a typo?

@demiankatz
Copy link
Member

I can't seem to add items to my cart in Firefox 49 when using this branch.

@crhallberg
Copy link
Contributor Author

This branch needs the love of the cart fixes.

Chris Hallberg added 2 commits September 27, 2016 14:23
Copy link
Contributor Author

@crhallberg crhallberg left a comment

Choose a reason for hiding this comment

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

Thanks!

@crhallberg
Copy link
Contributor Author

We have a new version of solrmarc being added here. Is that a GitHub weirdness or is that from a merge from master?

@demiankatz
Copy link
Member

That's valid -- it was recently updated to fix a bug.

Chris Hallberg added 2 commits September 29, 2016 12:54
Conflicts:
	themes/bootstrap3/js/cart.js
	themes/bootstrap3/js/hold.js
@demiankatz
Copy link
Member

@crhallberg, this branch seems to have developed a conflict with master. Could you sort that out when you have a chance? Once it's up to date, I'll give it another round of testing. Thanks!

Conflicts:
	themes/bootstrap3/templates/search/results.phtml
@@ -278,7 +278,10 @@ VuFind.register('lightbox', function Lightbox() {
data: data
}).done(function recaptchaReset() {
if (typeof grecaptcha !== 'undefined') {
grecaptcha.reset($(form).find('.g-recaptcha').data('captchaId'));
var captcha = $(form).find('.g-recaptcha');
Copy link
Member

Choose a reason for hiding this comment

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

This captcha-related change appears to pop up several times in this PR. Is this related to the form change, or is this an unrelated improvement? Do we perhaps want a resetReCaptcha(form) function in common.js so we don't have to repeat the same four lines of code multiple times, or is that overkill?

@@ -15,6 +15,7 @@
'vendor/bootstrap.min.js',
'vendor/bootstrap-accessibility.min.js',
'vendor/validator.min.js',
'vendor/form-attr-polyfill.js', // input[form] polyfill, cannot load conditionally, since we need all versions of IE
Copy link
Member

Choose a reason for hiding this comment

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

Does this really belong in the vendor directory if you wrote it? At very least, should it get its own repo somewhere in addition to being dropped here?

Copy link
Contributor Author

@crhallberg crhallberg Oct 14, 2016

Choose a reason for hiding this comment

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

I did not write it, I found it online and updated it. I think maybe we need a new folder for the elements that stand alone, but are custom to VuFind. They exist between vendor and regular scripting. Like autocomplete and the new channels slider.

Copy link
Member

Choose a reason for hiding this comment

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

Might "lib" be an appropriate directory name for this sort of thing?

@crhallberg
Copy link
Contributor Author

Note: Changing the line your comment was on removed your comment.

@crhallberg crhallberg dismissed demiankatz’s stale review October 17, 2016 15:44

Changes requested have been addressed.

Chris Hallberg added 2 commits October 21, 2016 17:17
Conflicts:
	themes/bootstrap3/js/record.js
	themes/bootstrap3/theme.config.php
@demiankatz
Copy link
Member

@crhallberg, where are we on this one? A couple of questions that stand out from a quick review:

1.) I notice that you adjusted _registerUpdate() to have a hard-coded form retrieval inside it, rather than accepting a form as a parameter. Does this reduce any important flexibility?

2.) There's some discussion above about the location of form-attr-polyfill.js, since right now it's not technically a vendor file, since it only exists in its current form as part of VuFind. Do we need to continue that conversation?

@crhallberg
Copy link
Contributor Author

1.) I don't expect this will be any less flexible, but I can add a form option back in for devs who want to bind cart submission to another form.
2.) I think form-attr-polyfill.js may be a good candidate for our new lib folder. I did find the code online, but it was heavily updated.

@crhallberg crhallberg self-assigned this Nov 22, 2016
@crhallberg
Copy link
Contributor Author

Found a few IE bugs. Working on them. See checkboxes in description.

Chris Hallberg added 3 commits December 13, 2016 16:36
- Remove previously added fields for multiple form submissions.
- Removed extraneous jQuery plugin appendFields.
- Faster in IE.
@crhallberg
Copy link
Contributor Author

Can anyone confirm or explain why IE would be taking so long to get to the Print interface?

  1. Turn on bulk actions
  2. Do a search
  3. Check a few boxes
  4. Print from bulk toolbar

It's slow on both master and this branch, taking up to 10 seconds on my machine.

@demiankatz
Copy link
Member

Have you tried replacing the actual print operation with some arbitrary task, like an alert? I'd be interested to know whether the slowness was specifically related to IE's print functionality (in which case, there's not much we can do about it), or if the problem is happening somewhere leading up to that point.

@crhallberg
Copy link
Contributor Author

crhallberg commented Dec 14, 2016

It's using the same form and method as email and export, this leads me to think it is the print process specifically. Also, this is happening in master as well.

@crhallberg
Copy link
Contributor Author

I did just replace the print with an alert and it was immediate, no pause at all. The delay today isn't as bad, which is also why I was looking for confirmation.

@demiankatz demiankatz merged commit f61ded2 into vufind-org:master Dec 15, 2016
@crhallberg crhallberg mentioned this pull request Jun 5, 2017
7 tasks
@crhallberg crhallberg deleted the form-attr-cart branch June 26, 2017 17:04
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.

2 participants