My favorites | Sign in
yii
Project Home Downloads Issues Source
New issue   Search
for
  Advanced search   Search tips   Subscriptions
Issue 2885: Title not set in CJuiTabs widget under some conditions
3 people starred this issue and may be notified of changes. Back to list
Status:  WontFix
Owner:  sebathi
Closed:  Dec 2011
Cc:  qiang.xue


Sign in to add a comment
 
Reported by markscar...@gmail.com, Oct 20, 2011
What steps will reproduce the problem?
1. Display a zii CJuiTabs widget with only content and id set in tabs array

$tabs['myTab'] = array('content' => 'testContent','id'=>'testId');
$this->widget('zii.widgets.jui.CJuiTabs', array('tabs'=>$tabs));


What is the expected output? What do you see instead?
EXPECTED
<div id="yw0">

<ul>
<li><a href="#testId" title="testId">myTab</a></li>
</ul>
<div id="testId">testContent</div>
</div>


INSTEAD (NOTE UN-REPLACED TOKEN {id})
<div id="yw0">

<ul>
<li><a href="#testId" title="{id}">myTab</a></li>
</ul>
<div id="testId">testContent</div>
</div>




What version of the product are you using? On what operating system?
1.1.8

Please provide any additional information below.

Line 111 of CJuiTabs.php needs to pass the id parameter:
$tabsOut .= strtr($this->headerTemplate, array('{title}'=>$title, '{url}'=>'#'.$tabId, '{id}'=>$tabId))."\n";


It would be nice to be able to set the title explicitly which it seems you cannot do now (the id is used for the title instead of its own parameter). Perhaps fixing it by adding this feature would be better. Thanks for your time and attention.
Oct 22, 2011
Project Member #1 qiang.xue
(No comment was entered for this change.)
Owner: sebathi
Labels: -Priority-Medium Priority-Low Type-Defect
Nov 17, 2011
#2 bmade...@gmail.com
Tag 'title' is different from tab label

I change CJuitabs.php:

On line 70: 
- public $headerTemplate='<li><a href="{url}" title="{id}">{title}</a></li>';
+ public $headerTemplate='<li><a href="{url}" title="{title}">{label}</a></li>';

On line 96:
- foreach($this->tabs as $title=>$content)
+ foreach($this->tabs as $label=>$content)

On line 100:
+ $title = (is_array($content) && isset($content['title']))?$content['title']:'';

On line 102:
- $tabsOut .= strtr($this->headerTemplate, array('{title}'=>$title, '{url}'=>'#'.$tabId, '{id}'=>'#' . $tabId))."\n";
+ $tabsOut .= strtr($this->headerTemplate, array('{label}'=>$label, '{title}'=>$title, '{url}'=>'#'.$tabId))."\n";

On line 107:
- $tabsOut .= strtr($this->headerTemplate, array('{title}'=>$title, '{url}'=>CHtml::normalizeUrl($content['ajax']), '{id}'=>'#' . $tabId))."\n";
+ $tabsOut .= strtr($this->headerTemplate, array('{label}'=>$label, '{title}'=>$title, '{url}'=>CHtml::normalizeUrl($content['ajax'])))."\n";

On line 111:
- $tabsOut .= strtr($this->headerTemplate, array('{title}'=>$title, '{url}'=>'#'.$tabId))."\n";
+ $tabsOut .= strtr($this->headerTemplate, array('{label}'=>$label, '{title}'=>$title, '{url}'=>'#'.$tabId))."\n";
Nov 25, 2011
Project Member #3 sebathi
Hi... 

@markscarbrough
I've tested the example you give and the following has been returned:
<div id="yw0">
  <ul>
    <li><a href="#testId" title="testId">myTab</a></li>
  </ul>
  <div id="testId">testContent</div>
</div>

@bmadeiro

I was seeing your update and i like it, but this will break BC with people that overrides headerTemplate for CJuiTabs.

Let me think a little more about it..


Cc: qiang.xue
Dec 12, 2011
Project Member #4 sebathi
I thought about it but it wont be updated

I'll try to update it in futher versions where BC is not a problem.
Status: WontFix
Sign in to add a comment

Powered by Google Project Hosting