I cloned the default scald_dnd_library view, made some modifications and assigned my new view to be used by the Scald in the sidebar. Noticed that the reset button wasn't working when enabled through the views UI for the exposed filters. It seems the markup generated by views for the reset button isn't what dnd_library.js is expecting; dnd_library.js seems to be expecting (logically!) that the input would be type=reset but it's type=submit button and thus was acting as a submit button based on the code in dnd_library.js.
Markup generated by views with Reset button enabled:
<div class="views-exposed-widget views-submit-button">
<input type="submit" id="edit-submit-media-library" name="" value="Apply" class="form-submit">
</div>
<div class="views-exposed-widget views-reset-button">
<input type="submit" id="edit-reset" name="op" value="Reset" class="form-submit">
</div>
Notice that both are type=submit. Don't know if this is something to report to views, but would find it less likely to be changed that just making the change here. I fixed some indention for readability, so the patch looks like I redid the whole file, but the gist of the patch is this, on lines 319 and 337 in dnd_library.js (280 and 319 in the patch):
- $('.view-filters input[type=submit]', $this).click(function(e) {
+ $('.view-filters .views-submit-button input', $this).click(function(e) {
- $('.view-filters input[type=reset]', $this).click(function(e) {
+ $('.view-filters .views-reset-button input', $this).click(function(e) {
Not certain, but for the same reason, line 98 may need to be changed to be more specific too? I didn't make this change but may be something to consider based on the above.
$('.dnd-library-wrapper .view-filters input[type="submit"]').click();
Any feedback is welcome. Thx for all you do!
Comment | File | Size | Author |
---|---|---|---|
#14 | scald-views-reset-button-2215761-14.patch | 1.17 KB | scotwith1t |
Comments
Comment #2
scotwith1tNo idea how to interpret the bot's results. Any help is appreciated. :)
Comment #3
DeFr CreditAttribution: DeFr commented@scotself: The patch you provided is relative to your Drupal root ; the testbot for contrib modules is assuming path relative to the module root, and thus patching fail :-)
Comment #4
scotwith1tMaybe this will work.
Comment #5
DeFr CreditAttribution: DeFr commentedIt won't.
Let me clarify what I tried to convey before using concrete things: the patch starts with
Instead it should start with
Comment #7
scotwith1tI created the patch from within the Scald folder, so don't know what to do except manually update those paths. Let's try this again.
Comment #8
scotwith1tHooray! I guess I won't mark my own RTBC, so I'll let someone check it out.
Comment #9
tedstein CreditAttribution: tedstein commentedComment #10
tedstein CreditAttribution: tedstein commentedWill this be included in your next release?
Comment #11
jcisio CreditAttribution: jcisio commented7: scald_views_reset.patch queued for re-testing.
Comment #12
jcisio CreditAttribution: jcisio commentedPatch does not apply here. Could you create a smaller patch without unrelated changes (code indent...). From #0 there are only two lines to be changed. And patch must be rolled against the latest dev, not 1.1.
Comment #13
jcisio CreditAttribution: jcisio commentedHere is the minimal patch rerolled against 1.1. But it does not apply on 1.x.
Comment #14
scotwith1tRe-rolled against 1.x-dev
Comment #16
jcisio CreditAttribution: jcisio commentedI really don't like to add a new Views-specific class into dnd, but because: 1/ it is a bug 2/ it is the simple way to fix that 3/ there are already many Views-specific classes, so let's add another one.
Patch committed and pushed. Thanks scotself.
Comment #17
scotwith1tAwesome. I figure that views will always be used to build the dnd library, so it makes perfect sense to use the views classes. I bet the class names don't even change in D8 with views in core. Thanks!