public
Fork of xilinus/prototypeui
Description: Prototype UI
Homepage: http://prototype-ui.com
Clone URL: git://github.com/starpeak/prototypeui.git
Better ajax url handling (now even with options)
Allow to set an id to a tab for $() referencing
starpeak (author)
Mon Jul 14 12:20:05 -0700 2008
commit  e646f439fd9121655a319a824676d46abeda0fb9
tree    9db030c9d70fd3ff56a1c7725a76b3b253a50a5f
parent  ea63108fb4a2ec10cefcba7f4b90ff514eabcce4
...
135
136
137
 
 
138
139
140
...
158
159
160
161
 
 
 
 
 
 
 
 
 
 
 
 
 
162
163
164
...
166
167
168
169
170
 
 
171
172
173
...
135
136
137
138
139
140
141
142
...
160
161
162
 
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
...
180
181
182
 
 
183
184
185
186
187
0
@@ -135,6 +135,8 @@ UI.Tabbox = Class.create(UI.Options, {
0
         }
0
       }
0
       tab.element.addClassName('tabbox_body');
0
+      if(tab.id)
0
+        tab.element.id=tab.id;
0
       tab.element.writeAttribute('pui-tabbox:object',this);
0
           
0
       this.tabs.set(tab.name,tab);    
0
@@ -158,7 +160,19 @@ UI.Tabbox = Class.create(UI.Options, {
0
     if(this.selectedTab.ajaxContent)
0
     {
0
       tab=this.tabs.get(tabName);
0
-      options={onComplete:function(){
0
+      
0
+      var url, options;
0
+      
0
+      if(typeof this.selectedTab.ajaxContent == 'object')
0
+      {
0
+        url = this.selectedTab.ajaxContent.url;
0
+        options = this.selectedTab.ajaxContent.options;
0
+      } else {
0
+        url = this.selectedTab.ajaxContent;
0
+        options = {};
0
+      }
0
+      
0
+      options.onComplete=function(){
0
         this.fire('selected', {
0
           tab: tab
0
         });
0
@@ -166,8 +180,8 @@ UI.Tabbox = Class.create(UI.Options, {
0
         if(tab.ajaxLoadOnce) {
0
           tab.ajaxContent=false;
0
         }
0
-      }.bind(this).bind(tab)};
0
-      new Ajax.Updater(this.selectedTab.element, this.selectedTab.ajaxContent, options);
0
+      }.bind(this).bind(tab);
0
+      new Ajax.Updater(this.selectedTab.element, url, options);
0
     } else {
0
       this.fire('selected', {
0
         tab: tabName

Comments