display localized labels for li attrs. added button to return to li list
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 17 Mar 2009 14:53:33 +0000 (14:53 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 17 Mar 2009 14:53:33 +0000 (14:53 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@12558 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/web/css/skin/default/acq.css
Open-ILS/web/js/ui/default/acq/common/li_table.js
Open-ILS/web/templates/default/acq/common/li_table.tt2

index 02e9c9c..09b612f 100644 (file)
@@ -97,4 +97,5 @@
 #acq-lit-table td {padding:2px;}
 .acq-lit-row { border-bottom: 1px solid #AAA; }
 .acq-lit-alt-row td:first-child { width:30px; }
+#acq-lit-info-tbody td {padding:5px;}
 
index 5abe5d8..47e0495 100644 (file)
@@ -12,6 +12,7 @@ function AcqLiTable() {
     this.rowTemplate = this.tbody.removeChild(dojo.byId('acq-lit-row'));
     this.authtoken = openils.User.authtoken;
     dojo.byId('acq-lit-select-toggle').onclick = function(){self.toggleSelect()};
+    dojo.byId('acq-lit-info-back-button').onclick = function(){self.showTable()};
 
     this.reset = function() {
         while(self.tbody.childNodes[0])
@@ -76,9 +77,13 @@ function AcqLiTable() {
     };
 
     this.drawInfo = function(liId) {
-        //if(!this.liAttrDefs)
-
         this.showInfo();
+        openils.acq.Lineitem.fetchAttrDefs(
+            function() { self._fetchLineitem(liId); } 
+        );
+    };
+
+    this._fetchLineitem = function(liId) {
         fieldmapper.standardRequest(
             ['open-ils.acq', 'open-ils.acq.lineitem.retrieve'],
             {   async: true,
@@ -102,10 +107,20 @@ function AcqLiTable() {
         this.infoTbody = dojo.byId('acq-lit-info-tbody');
         if(!this.infoRow)
             this.infoRow = this.infoTbody.removeChild(dojo.byId('acq-lit-info-row'));
+        while(this.infoTbody.childNodes[0])
+            this.infoTbody.removeChild(this.infoTbody.childNodes[0]);
         for(var i = 0; i < li.attributes().length; i++) {
             var attr = li.attributes()[i];
             var row = this.infoRow.cloneNode(true);
-            dojo.query('[name=label]', row)[0].appendChild(document.createTextNode(attr.attr_name()));
+
+            var type = attr.attr_type().replace(/lineitem_(.*)_attr_definition/, '$1');
+            var name = openils.acq.Lineitem.attrDefs[type].filter(
+                function(a) {
+                    return (a.code() == attr.attr_name());
+                }
+            ).pop().description();
+
+            dojo.query('[name=label]', row)[0].appendChild(document.createTextNode(name));
             dojo.query('[name=value]', row)[0].appendChild(document.createTextNode(attr.attr_value()));
             this.infoTbody.appendChild(row);
         }
index 25f41e7..94ae125 100644 (file)
@@ -36,6 +36,7 @@
         </table>
     </div>
     <div id='acq-lit-info-div' class='hidden'>
+        <div dojoType='dijit.form.Button' id='acq-lit-info-back-button'>&#x2196; Return</div>
         <table>
             <tbody id='acq-lit-info-tbody'>
                 <tr id='acq-lit-info-row'><td name='label'/><td name='value'/></tr>