Using htmlgrid 1.0.6 fixes the problem, as it does not add additional quotes around an identifier. Fixing htmlgrid 1.1.3.
Yasuhiro added this quoting on July 7, 2016. But why? He was working on davaz.com and there tooltips work. Under http://dev.ywesee.com/Yasu/20160707-migrate-davaz-com-dojo-widgets#tooltip-widget he comments that But dijit/Tooltip does not have href attributue (any more).
Do we use a different dojo version on oddb.org and for davaz.com? 1.9.3 and 1.7.10 (davaz.com). Dojo-Console: dojo.version
Yasuhiro add a method setHrefTooltip in davaz.com/doc/resources/javascript/davaz.js and changed the corresponding calls (eg.davaz.com/src/view/personal/init.rb) accordingly. But he did not fix the htmlgrid/widget/Tooltip.js, which is also different to the oddb.org/doc/resources/javascript/ywesee/widget/Tooltip.js we use.
Must do the same here. Or maybe better we should fix the htmlgrid Tooltip.js and upgrade davaz.com and oddb.org to use a single implementation to ease the burden of maintaining 3 versions.
Removed setting the href in src/view/additional_information, but when looking at the HTML-code there is still a href value added. Why?
Changed in src/view/additional_information.rb ikscat to
url = @lookandfeel._event_url(:ajax_swissmedic_cat, [:reg, model.iksnr, :seq, model.seqnr, :pack, model.ikscd]) txt.css_id = "ikscat_#{@ikscat_count}" tooltip = HtmlGrid::Div.new(model, @session, self) tooltip.value = url txt.dojo_tooltip = tooltip
instead of txt.dojo_tooltip = url
I will adapt doc/resources/javascript/ywesee/widget/Tooltip.js to use the Dojo TooltipDialog. Installed dojo 1.12.1 and running watir smoketests. These look okay.
After trying to change in htmlgril/dojotoolkit Tooltip by TooltipDialog nothing was working. Tried to emit some printf via console.log. But I am only getting syntax errors like "SyntaxError: missing : after property id"
Okay. I finally understood. With htmlgrid 1.1.3 and dynamic_html the data-dojo-type changes from 'ywesee.widget.Tooltip' to 'dijit.Tooltip', therefore the oddb definition of oddb.org is loaded but never activated!
In https://dojotoolkit.org/documentation/tutorials/1.10/dialogs_tooltips/ the difference between Tooltip and TooltipDialog is explained as
The difference between Tooltip and TooltipDialog widget is that the TooltipDialog stays open until the user clicks outside of the widget so that the "Tooltip" can have clickable links, form elements, etc. inside the widget without it closing when you "mouseout" like a Tooltip would. The dijit/TooltipDialog widget features most of the same properties, methods, and events supported by Tooltip and Dialog.
In src/view/public_template.rb replacing ywesee/widget/Tooltip
via dijit/TooltipDialog
in the required dojo packages. This did not fix the problem. The tooltip is not displayed. The details of the deductible is now
<td class="list bold right original"><span id="deductible_1" class="deductible_g">10%<div role="alertdialog" tabindex="-1" class="dijitTooltipDialog" id="deductible_1_widget" widgetid="deductible_1_widget" style="display: none;"> <div class="dijitTooltipContainer" role="presentation"> <div data-dojo-attach-point="contentsNode" class="dijitTooltipContents dijitTooltipFocusNode"> <div data-dojo-attach-point="containerNode">Für dieses Produkt bezahlen Sie 10% <a href="http://www.bag.admin.ch/suchen/index.html?keywords=selbstbehalt&go_search=Suchen&lang=de">Selbstbehalt</a>.<br>Achten Sie auf Ihre Krankenkassen-Abrechnung!</div> </div> </div> <div class="dijitTooltipConnector" role="presentation" data-dojo-attach-point="connectorNode"></div> </div></span></td>
Nothing is display as the @dojo_tooltip
is nil in htmlgril/dojotoolkit.rb.
Created a simple test.html to play with TooltipDialog until I get the desired effect. Now I am happy with the results and remarked that I have to change the link to the Selbstbehalt from http://www.bag.admin.ch/suchen/index.html?keywords=selbstbehalt&go_search=Suchen&lang=de
to https://www.bag.admin.ch/bag/de/home/suche.html#Selbstbehalt
. See Attach:test_1_html.txt
Now it is much clearer for me how the CSS elements are created when loading the HTML-page as the dojo/TooltipDialog add various elements and I did not grasp this by only looking at the Ruby/Javascript code. Will create tomorrow a helper class to generate ToolTipps for oddb.org.