This page contains a random collection of hints and/or techniques that were discovered during development and which are worthwhile to document.
The development environment used was Chrome under Windows XP. The Chrome browser has server developer friendly features that may or may not be present in other browsers. Since at this stage of development emphasis was on functionality of the system the use of other browsers was not explored.
The use of the View Source facility is worthless in the Triangular (or AngularJS) environment because it shows the source before insertion of the templates.
The inspect element right click on an element
causes Chrome to display the expanded elements as they are current in the Browser. The Triangular template engine inserts markers
for each piece of HTML generated so the source can be tracked and the place where is it manufactured/modified can be determined.
A simple log function was implemented into the 'ut.js' file that forwards the calls to the browser console.log function.
This design allowed for an easy on/off switch based on the presence in localStorage of a '.log' property.
The extensive use of the %o in the display strings allows the display of objects. For arrays a hidden object was sometimes created {array:xxx} so that
the default action to expand the array was avoided.
Note that when a display for an object thus shown is expanded, it shows the current value of the object, not the one at time of logging.
This can be made visible with the shortcut key <:Ctl Shift J>
TRi.js
If there is an error in the Tri.min.js code, replacement of the reference in the relevant .htm file with TRI.js, pressing <REFRESH>
and rerunning the test will pinpoint the place of error in code that is more readable and may give clues as to the cause of the problem. Remember to
change it back to TRI.min.js (performance).
Commands can be entered into the console area. Thus $("div#editor") will display the HTML string for the editor.
In addition the fmt(html string) will format the string to make it easier to read.
<input type=hidden ng-model=...>
In the 'Deps.htm' file a function was used to compute a value. This was stored in a hidden field and made part of the ng-model with the result that the dependant fields were automatically updated by AngularJS.
Upon occasion, especially where external events occur, it is necessary to schedule a $digest cycle at the completion of the event handler.
The statement setTimeout(function(){$rootScope.$digest()},0); when executed does this against the entire page. Use of $scope rather than $rootScope would
limit the $digest cycle to just the current scope (if known).
On an HTML page the this value is equivalent to $scope in the Javascript routines. This feature is extensively used to pass in the $scope to
common routines, especially the Col and Table methods.
Directives were frequent found to be a means to concisely solve user interface problems. It is suggested that the use of directives be learned, especially in the the simpler cases. See directives.
This is used in AppsBase.htm when template a containing macro directives will itself be inserted by a macro directive
as is the case with apps-body.html. The alter= attribute is used to change a value to itself. Then the outer macro
changes the alter string to the desired value using the '!' syntax because of the intermediate '/'.
This is used by Deps.htm to change SINGLE to DOUBLE and ctrlCommEdit to ctrlDepsEdit
In order to pick up a string from a definition and delay the evaluation until the HTML is parsed the $eval function can be used.
For example in the 'AppsBase.htm' file the statement fragment <a class='c-action sz-90' href="" ng-class='$eval(oA.whatClass)' ...>
causes the string extracted from oA.whatClass to be evaluated and returned as the ng-class value.
The AngularJS models behave best when they are dealing with an object. In that way only the object reference has to be added to the $scope and the underlying HTML can easily reference the property fields of the object. This is shown clearly in the example code in Chqs.htm Line 143 ....
A pattern used extensively in the code when there are lists that exceed lines is to add the next one with a leading ',' as opposed to a trailing ','. This makes it easier to add, delete and comment out entries without having to sometimes remember to fix up the previous entry.
For example:
var oTabProp = {
recTitle: 'Messages'
,recName: 'messages'
,recType: 'msg'
,lsName: '-msgs'
...
In the 'Deps.htm' and 'Deps.js' files the autotab and blurEvent directives are used to move the cursor to the most likely next input field. As a result a standard input cycle can be completed with just one mouse click.
Triangular uses several Favorite Icons so, with multiple tabs open, it is easy to know which tab to select.
The general pattern is the base triangle of 3 colors with a white (primary) or blue (secondary) letter displayed in the middle. The present lettering scheme is:
An additional 6 are provided as a convenience for use during app development numbered 1 thru 3 in white and blue.
fav-t1w.ico Number 1 whitefav-t1b.ico Number 1 bluefav-t2w.ico Number 2 whitefav-t2b.ico Number 2 bluefav-t3w.ico Number 3 whitefav-t3b.ico Number 3 blueThe free software GIMP 2 is used to make them. The base information is in the icons folder distributed with the development package.
The steps are:
tri-base2.xrftri-base2.xrfOn the local machine can use the Datastore Viewer to see your raw data. Use the class
com.rsi.cita.gdo.GdoCitaData.
This is accessed from your Google App Signin Page.
The standard GQL will access upto 20 records.
SELECT * FROM com.rsi.cita.gdo.GdoCitaData
To restrict by application use:
SELECT * FROM com.rsi.cita.gdo.GdoCitaData where KeyName > 'deps/' and KeyName < 'deps9'
where deps is the application in question
To restrict by application and record type use:
SELECT * FROM com.rsi.cita.gdo.GdoCitaData where KeyName > 'deps/donors/' and KeyName < 'deps/donors9'
where deps is the application and donors is the record type in question
To just see the KeyName use
SELECT KeyName FROM com.rsi.cita.gdo.GdoCitaData
The data is stored in the TRI-DB directory within the files referenced by run-tri.bat. Refer to Datastore Node.js
to understand the naming scheme.
You will have to have access either to the remote TRI-DB folder or download it so that you do.
Again, refer to Datastore Node.js
to understand the naming scheme.