equal
deleted
inserted
replaced
105 tabs = self.prune_tabs(tabs) |
105 tabs = self.prune_tabs(tabs) |
106 # select a tab |
106 # select a tab |
107 active_tab = self.active_tab(tabs, default) |
107 active_tab = self.active_tab(tabs, default) |
108 # build the html structure |
108 # build the html structure |
109 w = self.w |
109 w = self.w |
110 if entity: |
110 uid = entity and entity.eid or make_uid('tab') |
111 w(u'<div id="entity-tabs-%s">' % entity.eid) |
111 w(u'<div id="entity-tabs-%s">' % uid) |
112 else: |
112 w(u'<ul class="css-tabs" id="tabs-%s">' % uid) |
113 uid = make_uid('tab') |
|
114 w(u'<div id="entity-tabs-%s">' % uid) |
|
115 w(u'<ul class="css-tabs" id="tabs-%s">' % entity.eid) |
|
116 for tab in tabs: |
113 for tab in tabs: |
117 w(u'<li>') |
114 w(u'<li>') |
118 w(u'<a href="#as-%s">' % tab) |
115 w(u'<a href="#as-%s">' % tab) |
119 w(u'<span onclick="set_tab(\'%s\', \'%s\')">' % (tab, self.cookie_name)) |
116 w(u'<span onclick="set_tab(\'%s\', \'%s\')">' % (tab, self.cookie_name)) |
120 w(self.req._(tab)) |
117 w(self.req._(tab)) |
121 w(u'</span>') |
118 w(u'</span>') |
122 w(u'</a>') |
119 w(u'</a>') |
123 w(u'</li>') |
120 w(u'</li>') |
124 w(u'</ul>') |
121 w(u'</ul>') |
125 w(u'</div>') |
122 w(u'</div>') |
126 w(u'<div id="panes-%s">' % entity.eid) |
123 w(u'<div id="panes-%s">' % uid) |
127 for tab in tabs: |
124 for tab in tabs: |
128 w(u'<div>') |
125 w(u'<div>') |
129 if entity: |
126 if entity: |
130 self.lazyview(tab, eid=entity.eid) |
127 self.lazyview(tab, eid=entity.eid) |
131 else: |
128 else: |
137 # XXX make work history: true |
134 # XXX make work history: true |
138 self.req.add_onload(u''' |
135 self.req.add_onload(u''' |
139 jQuery(function() { |
136 jQuery(function() { |
140 jQuery("#tabs-%(eeid)s").tabs("#panes-%(eeid)s > div", {initialIndex: %(tabindex)s}); |
137 jQuery("#tabs-%(eeid)s").tabs("#panes-%(eeid)s > div", {initialIndex: %(tabindex)s}); |
141 set_tab('%(vid)s', '%(cookiename)s'); |
138 set_tab('%(vid)s', '%(cookiename)s'); |
142 });''' % {'eeid' : entity.eid, |
139 });''' % {'eeid' : (entity and entity.eid or uid), |
143 'vid' : active_tab, |
140 'vid' : active_tab, |
144 'cookiename' : self.cookie_name, |
141 'cookiename' : self.cookie_name, |
145 'tabindex' : tabs.index(active_tab)}) |
142 'tabindex' : tabs.index(active_tab)}) |
146 |
143 |
147 |
144 |