[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SF.net SVN: ledger-smb:[5947] trunk/UI/lib



Revision: 5947
          http://sourceforge.net/p/ledger-smb/code/5947
Author:   freelock
Date:     2013-08-18 15:39:28 +0000 (Sun, 18 Aug 2013)
Log Message:
-----------
Add new TT elements for currency, date, textarea to leverage Dojo objects.

Add DateTextBox wrapper to convert LSMB date patterns to Dojo date patterns (m -> M).

Modified Paths:
--------------
    trunk/UI/lib/elements.html

Added Paths:
-----------
    trunk/UI/lib/DateTextBox.js

Added: trunk/UI/lib/DateTextBox.js
===================================================================
--- trunk/UI/lib/DateTextBox.js	                        (rev 0)
+++ trunk/UI/lib/DateTextBox.js	2013-08-18 15:39:28 UTC (rev 5947)
@@ -0,0 +1,15 @@
+define([
+    'dijit/form/DateTextBox',
+    'dojo/_base/declare'
+    ],
+    function(DateTextBox, declare) {
+      return declare('lsmb/lib/DateTextBox',
+        [DateTextBox],
+        {
+          postMixInProperties: function() {
+            this.constraints.datePattern = this.constraints.datePattern.replace(/m/g, 'M');
+            this.inherited(arguments);
+          }
+        });
+    }
+    );

Modified: trunk/UI/lib/elements.html
===================================================================
--- trunk/UI/lib/elements.html	2013-08-18 11:41:48 UTC (rev 5946)
+++ trunk/UI/lib/elements.html	2013-08-18 15:39:28 UTC (rev 5947)
@@ -1,6 +1,6 @@
 <?lsmb 
   default_keys = ['id', 'class', 'title']  # Defaults for all attributes
-  input_keys = ['type', 'name', 'disabled', 'size', 'value', 'dojo_type', 'dojo_params']  # Defaults for input attributes 
+  input_keys = ['type', 'name', 'disabled', 'size', 'value', 'dojo_type', 'dojo_params', 'data-dojo-type','data-dojo-props']  # Defaults for input attributes 
 
   # ELEMENT DEFAULTS
 
@@ -24,11 +24,24 @@
     size = '60',
     maxlength = '255'
   }
+
+  # default currency
+  currency_defaults = {
+    "data-dojo-type" = 'dijit/form/CurrencyTextBox',
+    "data-dojo-props" = "currency:'USD'"
+  }    
+
+  # date
+  date_defaults = {
+    "data-dojo-type" = 'lsmb/lib/DateTextBox',
+    'data-dojo-props' = "constraints: {datePattern: '$USER.dateformat'}"
+  }
   
   # textarea
   textarea_defaults = {
-    rows = '5',
-    cols = '60'
+    rows = '1',
+    cols = '60',
+    "data-dojo-type" = 'dijit/form/Textarea'
   }
   
   #button
@@ -64,6 +77,12 @@
 	      CASE 'text';
 	        input_type_keys = input_keys.merge(['maxlength', 'readonly']);
 	        input_defaults = text_defaults;
+	      CASE 'currency';
+	        input_type_keys = input_keys;
+		input_defaults = currency_defaults;
+ 	      CASE 'date';
+	        input_type_keys = input_keys;
+		input_defaults = date_defaults;
 	      CASE;
 	        input_type_keys = input_keys;
 	    END;
@@ -96,7 +115,7 @@
 	  <?lsmb PROCESS attributes  # Process regular attributes.
 	    attribute_data=element_data 
 	    attribute_defaults = textarea_defaults
-	    element_keys = ['name', 'cols', 'rows', 'disabled', 'readonly', 'tabindex', 'accesskey', 'value']  # Attributes that apply to textareas.
+	    element_keys = ['name', 'cols', 'rows', 'disabled', 'readonly', 'tabindex', 'accesskey', 'value', 'data-dojo-type', 'data-dojo-props']  # Attributes that apply to textareas.
 	  ?>
 	  <?lsmb PROCESS custom_attributes  # Process custom attributes.
 	    custom_attribute_data=element_data.attributes 
@@ -314,7 +333,7 @@
 <?lsmb BLOCK auto_id  # Automatically builds the id tag for the element if possible. ?>
   <?lsmb UNLESS element_data.defined('id') # id attribute should always be set, so auto-set it if it's not defined. ?>
     <?lsmb element_id = "" ?>
-    <?lsmb  # Labal id's default to [for]-label.
+    <?lsmb  # Label id's default to [for]-label.
       IF element_type == 'label' AND element_data.defined('for');
         element_id = element_data.for _ "-label";
       ELSIF ((element_type == 'input' AND element_data.type == 'radio') OR element_type == 'button') AND element_data.defined('name') AND element_data.defined('value');
@@ -360,7 +379,7 @@
    ELSIF id; 
        CLASS = 'saved';
    END;
-?><div id='statusdiv' class='<?lsmb CLASS ?>'>
+?><div id="statusdiv" class="<?lsmb CLASS ?>">
 <div id="history"><?lsmb text('Action: [_1], ID: [_2]', action, id); ?></div>
 <?lsmb END ?>
 

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.


------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with <2% overhead. 
Download for free and get started troubleshooting in minutes. 
http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk
_______________________________________________
Ledger-smb-commits mailing list
..hidden..
https://lists.sourceforge.net/lists/listinfo/ledger-smb-commits