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

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



Revision: 5932
          http://sourceforge.net/p/ledger-smb/code/5932
Author:   freelock
Date:     2013-08-03 16:11:15 +0000 (Sat, 03 Aug 2013)
Log Message:
-----------
Add support for include_dojo in template headers, and dojo_type in elements

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

Modified: trunk/UI/lib/elements.html
===================================================================
--- trunk/UI/lib/elements.html	2013-08-03 16:09:32 UTC (rev 5931)
+++ trunk/UI/lib/elements.html	2013-08-03 16:11:15 UTC (rev 5932)
@@ -1,6 +1,6 @@
 <?lsmb 
   default_keys = ['id', 'class', 'title']  # Defaults for all attributes
-  input_keys = ['type', 'name', 'disabled', 'size', 'value']  # Defaults for input attributes 
+  input_keys = ['type', 'name', 'disabled', 'size', 'value', 'dojo_type']  # Defaults for input attributes 
 
   # ELEMENT DEFAULTS
 
@@ -288,7 +288,9 @@
   ?>
   <?lsmb FOREACH element_attribute IN all_keys  # Loop through each allowed attribute. ?>
     <?lsmb 
-      IF attribute_data.defined(element_attribute) and (attribute_data.${element_attribute} != "");  # Add the attribute to the element if it's been set.
+      IF element_attribute == 'dojo_type' and (attribute_data.dojo_type != "");
+        all_attributes = all_attributes _ " " _ 'data-dojo-type="' _ attribute_data.${element_attribute} _ '"';
+      ELSIF attribute_data.defined(element_attribute) and (attribute_data.${element_attribute} != "");  # Add the attribute to the element if it's been set.
         all_attributes = all_attributes _ " " _ element_attribute _ '="' _ attribute_data.${element_attribute} _ '"';
       ELSIF attribute_defaults.defined(element_attribute);  # Fall back to default value if one is supplied.
         all_attributes = all_attributes _ " " _ element_attribute _ '="' _ attribute_defaults.${element_attribute} _ '"';

Modified: trunk/UI/lib/ui-header.html
===================================================================
--- trunk/UI/lib/ui-header.html	2013-08-03 16:09:32 UTC (rev 5931)
+++ trunk/UI/lib/ui-header.html	2013-08-03 16:11:15 UTC (rev 5932)
@@ -22,6 +22,23 @@
 	<?lsmb FOREACH s = include_script ?>
 	<script type="text/javascript" language="JavaScript" src="<?lsmb s ?>" ></script>
 	<?lsmb END ?>
+	<?lsmb IF include_dojo ?>
+	<script type="text/javascript">    
+	  var dojoConfig = {
+	       async: 1,
+	       parseOnLoad: 0,
+	       packages: [{"name":"lsmb","location":"../../.."}]
+	   }
+       </script>
+       <script type="text/javascript" language="JavaScript" src="UI/lib/dojo/dojo/dojo.js"></script>
+        <?lsmb FOREACH s = include_dojo ?>
+       <script type="text/javascript">
+	require(['<?lsmb s ?>','dojo/ready'], function(obj){
+			obj.init();
+			});
+        </script>
+	<?lsmb END ?>
+	<?lsmb END ?>
 	
 	<?lsmb IF warn_expire ?>
 	<script type="text/javascript" language="JavaScript">

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