view · edit · sidebar · attach · print · history

< Niklaus.20160706-virbac-calculator | Index | Niklaus.20160704-contenttoggler >>





setup for

The link for toggling the invitation new customer is missing. It uses also the contentToggler depending whether the session.request is open or closed. But on the div with the name "new-customer" setting the attribute hidden does not work. Why?

Debugging showed me that the document.getElementById('new-customer-form').innerText contains the expected fields like Vorname. Whereas document.getElementById('new-customer').innerText is empty. If I change the togglee from 'new-customer' to 'new-customer-form' the innerText is reverted. Why? Solved by creating a different onClick handler. Code works and looks like this

  def new_customer_invite(model)
    togglee = 'new-customer-form'
    link =, model, @session, self)
    script = "
var element = document.getElementById('#{togglee}');
// console.log('new_customer_invite onclick second2: #{togglee} hidden '+ element.hidden);
if (document.getElementById('#{togglee}').hidden) {
  document.getElementById('#{togglee}').hidden = false;
} else {
  document.getElementById('#{togglee}').hidden = true;
    link.set_attribute("onclick", script)

Now I must show on how I can add a tooltip. To test it I go to where "Contralac 20" shows a A-square the where the tooltip should show "Aktion: Aufgrund..", where "Aufgrund" is a link. Do I need dojo to create it or is it easier to create a simple javascript?

Replacing the dojo tooltip is much more work than the contenttoggler, because it would require CSS changes. Therefore investigating whether it is easy to port the dojo tooltip to the new dojo version.

But first I must fix lib/bbmb/html/view/current_order.rb, where we have also use the contenttoggler. This was easy to replace by our javascript approach.

Why does visiting throw the error NoMethodError undefined method `article_number' for nil:NilClass? I am able to avoid this problem (which is present on, too), but the resulting screen looks funny. I think it is an inconsistency in the database.

But the tooltip does not yet show up. Why? Must change the htmlgrid tooltip code. Created a small test_tooltip.html file and discovered that

  • <script type="text/javascript">require(['dojo','javascript/widget/ContentToggler']);</script> works
  • <script type="text/javascript">require(['dojo', 'dijit/form/Button', 'dijit/Tooltip']);</script> DOES NOT WORK. Why?

After fiddling around found, that <script type="text/javascript">require(["dojo/parser", "dijit/Tooltip"]);</script> works. After changing lib/bbmb/virbac/html/view/current_order.rb to define DOJO_REQUIRE = ['dojo/parser', 'dijit/Tooltip'] the tooltips are displayed correctly, but with a different background color.

Pushed the commits:

Testing Kalkulieren. Clicking "With MwSt" gives in the javascript console the following output

calculator.js:5 Uncaught ReferenceError: dojo is not definedcalc @ 
onclick @ (index):13

But the calculated resulted after clicking on the button "Berechnen" show the correct results.

In doc/resources/javascript/calculator I find code like, which I don't understand. Googling around found Does this help me? not much.

The Javascript debugger for showed that the is triggered by a POST request after dojo.js:2614 XHR finished loading:

I think I must completely rework the calculation and pack the with VAT, VAT-rate and factor into session parameters. Maybe helps me. Continue tomorrow.

view · edit · sidebar · attach · print · history
Page last modified on July 05, 2016, at 05:01 PM