view · edit · sidebar · attach · print · history

Index>

20140716-prescription-preserve-comment

Summary

  • Prettify prescription, add interaction, don't loose comments after adding a new drug

Commits

Index

Keep in Mind
  • Fix dojo error http://www.sitepen.com/blog/2012/10/31/debugging-dojo-common-error-messages/#forgot-dom-ready
  • I removed on May-27 tests for ix_registrationss, fix_sequences, fix_compositions, fix_packages from test/test_plugin/swissmedic.rb,as he could not find any references for them in the src code. Did I erroneously remove stuff when cleaning up the swissmedic import earlier?
  • The whole test for older/newer Packages must be adapted to xlsx. One must compare the rows (e.g. by creating csv files) and do the same stuff in xlsx!
  • One unit-test for searchbar fails and might be a clue why searching does not work correctly.
  • Added two skip in test/test_plugin/rss.rb. Why does the mocking not work there anymore?
  • Make ext/swissindex/test/test_swissindex.rb and skipping tests in migel-gem pass.

---

Don't loose comments after adding a new drug

Working on the proble why adding/deleting a drug removes comments, name, birthday, etc. Improved watir test to check for all fields.

I think I must modify set PrescriptionDrug.prescription_comment to use textarea.set_attribute 'onBlur'/'onFocus to save the value in a global variable of the Javascript. What I found out is that

  1. I cannot use an array to store the data but use somethine like this.comment_value_{0|1|2}
  2. After a reload the value of this variable has gone
  3. Same after adding a new drug

Using https://developer.mozilla.org/en-US/docs/Web/Guide/API/DOM/Storage, which says Mozilla-based browsers, Internet Explorer 8+, Safari 4+, and Chrome all provide a working implementation of the DOM Storage specification.. Now I am ready to get value of the comments after deleting/adding a drug in the domReady-function. Trying onLoad on a single element. This did not work. Must define an ID for each element and set in on the main PrescriptionForm.onload method like

require(["dojo/domReady!"], function(){
  document.getElementById('searchbar').focus();
    console.log ('PrescriptionForm.onload  getItem prescription_comment_0 is : ' + sessionStorage.getItem('prescription_comment_0', "default bemerkung"));
    var x=document.getElementById('id_comment_0');
    console.log ('PrescriptionForm.onload  x is : ' + x);
    if (x != null) {
      x[0].value = sessionStorage.getItem('prescription_comment_0', "default bemerkung");
    }
});

Now must pack this construct into a general javascript function and use it for all concerned field.

  • Also I must find a way to find a way to know how many drugs are displayed at the moment.
  • Also must delete the value if the drug gets destroyed.
  • Also adjust the properties when the first drug is destroyed
  • Must work also for sex (which is kind of special. I cannot use there the onFocus/onBlur methods!)

Solved these problems, but no the comments do not appear on the print page as its ruby counterparts were not updated. Also the comments are missing in the exported csv.

Zeno requested me to push the incomplete change. Done with commit Add interactions to print. Preserve comments when adding/deleting drugs.

Add to fix two syntax errors in javascript with Fix Javascript syntax error when entering comments

Also remarking that I get JavaScript-syntax errors as it seems that my ruby code for (index = #{@index}; index < 99; ++index) { gets translated to for (index = 1; index < 99; ++index) {. Maybe I must use " instead of %( to start a text constant. Banging my head why (and where exactly) I still get Uncaught SyntaxError: Unexpected token ILLEGAL

view · edit · sidebar · attach · print · history
Page last modified on July 16, 2014, at 03:51 PM