dokuwiki-template-bootstrap3 icon indicating copy to clipboard operation
dokuwiki-template-bootstrap3 copied to clipboard

qq-upload-button does not have classes "btn" and "btn-default"

Open issmirnov opened this issue 6 years ago • 2 comments

Description

The "Select files..." button in the media manager is not styled as a button. The hack at template.js#L471 does not seem to be working.

Steps to reproduce

  1. Install latest wiki and template
  2. Open Media Manager

Expected behavior: Button with div id qq-upload-button should be styled as a button (.btn .btn-default)

Actual behavior: It is not.

Versions

  • [Bootstrap3 Template] latest
  • [DokuWiki] latest
  • [Plugins] minor set, none that would conflict with this
  • [Browser] Chrome (latest)

Screenshots or Logs

upload

Sample page or snippet

Any media manager page.

More information

This code is coming from splitbrain/dokuwiki:lib/scripts/fileuploaderextended.js#L82. Running jQuery('.qq-upload-button').addClass('btn btn-default'); in the console after page load adds the desired styles. Perhaps the template hacks are not firing at the right time?

issmirnov avatar Jun 02 '18 01:06 issmirnov

I noticed in my console that I'm getting the following error:

Uncaught TypeError: Cannot read property 'top' of undefined
    at HTMLDocument.<anonymous> (js.php?t=bootstrap3&tseed=4aa93bfaaa0f79c6f45f6115c18cf54c:1)
    at HTMLDocument.dispatch (jquery.php?tseed=23f888679b4f1dc26eef34902aca964f:3)
    at HTMLDocument.q.handle (jquery.php?tseed=23f888679b4f1dc26eef34902aca964f:3)
    at Object.trigger (jquery.php?tseed=23f888679b4f1dc26eef34902aca964f:4)
    at HTMLDocument.<anonymous> (jquery.php?tseed=23f888679b4f1dc26eef34902aca964f:4)
    at Function.each (jquery.php?tseed=23f888679b4f1dc26eef34902aca964f:2)
    at a.fn.init.each (jquery.php?tseed=23f888679b4f1dc26eef34902aca964f:2)
    at a.fn.init.trigger (jquery.php?tseed=23f888679b4f1dc26eef34902aca964f:4)
    at js.php?t=bootstrap3&tseed=4aa93bfaaa0f79c6f45f6115c18cf54c:1

It looks like jQuery('main').position() is undefined, so when top : (jQuery('main').position().top), happens the script fails. It could be that this error is causing the template patching to fail.

It's unclear why jQuery('main').position() would be undefined - it's definitely present on regular pages (returns {top: 164, left: 15}) but in the media uploader that div does not exist.

issmirnov avatar Jun 02 '18 01:06 issmirnov

Running jQuery(document).trigger('bootstrap3:media-manager'); manually in the console also got the styles looking good. At this point I'm fairly certain it's the undefined reference to jQuery('main').position() that's causing the js/template.js to fail early and not fix all the styles.

@LotarProject can you share your original design behind that file? Would it make sense to add error checks to all refs on jQuery('main'), or is that legacy code now?

issmirnov avatar Jun 02 '18 01:06 issmirnov