Skip to content

Commit

Permalink
Updated feature: Use select2 for menus.
Browse files Browse the repository at this point in the history
  • Loading branch information
SamMousa committed Jul 18, 2013
1 parent cd1f868 commit 06d4c52
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 15 deletions.
23 changes: 15 additions & 8 deletions application/extensions/Menu/MenuWidget.php
Expand Up @@ -442,21 +442,28 @@ protected function renderMenu($menu)

protected function renderSelect($item)
{
$result = CHtml::label($item['title'], $item['name']);
if (is_array(current($item['values'])))
if (is_array(current($item['values'])))
{
$listData = CHtml::listData($item['values'], 'id', 'title');
}
else
{
$listData = $item['values'];
}
$result .= CHtml::dropDownList($item['name'], $item['value'], $listData, array(
'id' => $item['name'],
'prompt' => gT('Please choose...')
));

return $result;

return $this->widget('bootstrap.widgets.TbSelect2', array(
'data' => $listData,
'name' => $item['name'],
'value' => $item['value'],
'options' => array(
'placeholder' => gT('Please choose...'),
),
'htmlOptions' => array(
'class' => 'test',
'empty' => ''
)

), true);
}

protected function renderSub($item, $imageUrl, $level)
Expand Down
6 changes: 5 additions & 1 deletion application/extensions/Menu/assets/nav.css
Expand Up @@ -36,7 +36,7 @@ nav ol.level0 > li {
}


nav a {
nav li > a {
display: inline-block;

width: 100%;
Expand Down Expand Up @@ -87,4 +87,8 @@ nav li:hover{

nav label {
display: inline-block;
}

nav .select2-container {
min-width: 150px;
}
6 changes: 0 additions & 6 deletions scripts/admin/admin_core.js
Expand Up @@ -238,12 +238,6 @@ $(document).ready(function(){
// This also works for multiple tabbed interfaces, allowing nesting.
$('.tabs').tabs();

$(".flashmessage").each(function() {
$(this).notify().notify('create','themeroller',{},{custom:true,
speed: 500,
expires: 5000
});
});
/*
if ($("#question_type").not('.none').length > 0 && $("#question_type").attr('type')!='hidden'){
$("#question_type").msDropDown({onInit:qTypeDropdownInit});
Expand Down

0 comments on commit 06d4c52

Please sign in to comment.