dokuwiki-template-bootstrap3
dokuwiki-template-bootstrap3 copied to clipboard
qq-upload-button does not have classes "btn" and "btn-default"
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
- Install latest wiki and template
- 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
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?
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.
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?