Skip to content

Commit

Permalink
UX improvements default languages
Browse files Browse the repository at this point in the history
1. Convert default image falgs to button like the stars
2. Add tooltip with language description

Changed in templates and menu items views
  • Loading branch information
andrepereiradasilva committed Dec 31, 2015
1 parent 2b6fc8d commit 63054a2
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 27 deletions.
21 changes: 16 additions & 5 deletions administrator/components/com_menus/views/items/tmpl/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -191,12 +191,23 @@
<?php if ($item->type == 'component') : ?>
<?php if ($item->language == '*' || $item->home == '0') : ?>
<?php echo JHtml::_('jgrid.isdefault', $item->home, $i, 'items.', ($item->language != '*' || !$item->home) && $canChange); ?>
<?php elseif ($canChange) : ?>
<a href="<?php echo JRoute::_('index.php?option=com_menus&task=items.unsetDefault&cid[]=' . $item->id . '&' . JSession::getFormToken() . '=1'); ?>">
<?php echo JHtml::_('image', 'mod_languages/' . $item->image . '.gif', $item->language_title, array('title' => JText::sprintf('COM_MENUS_GRID_UNSET_LANGUAGE', $item->language_title)), true); ?>
</a>
<?php else : ?>
<?php echo JHtml::_('image', 'mod_languages/' . $item->image . '.gif', $item->language_title, array('title' => $item->language_title), true); ?>
<?php
$language_image = JHtml::_('image', 'mod_languages/' . $item->image . '.gif', $item->language_title, array(), true);
$language_image_text = $language_image . '&nbsp;' . $item->language_title;
echo JHtml::_(
'jgrid.isdefault',
true,
$i,
array(
'prefix' => 'items.',
'active_title' => JText::sprintf('COM_MENUS_GRID_UNSET_LANGUAGE', $language_image_text),
'inactive_title' => JText::_('JDEFAULT') . '&nbsp;' . $language_image_text,
'text' => $language_image
),
$canChange
);
?>
<?php endif; ?>
<?php endif; ?>
</td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,8 @@ public function unsetDefault()
// Check for request forgeries
JSession::checkToken('request') or jexit(JText::_('JINVALID_TOKEN'));

$pks = $this->input->get->get('cid', array(), 'array');
$pks = $this->input->get('cid', array(), 'array');

JArrayHelper::toInteger($pks);

try
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<div id="j-main-container" class="span10">
<?php else : ?>
<div id="j-main-container">
<?php endif;?>
<?php endif; ?>
<?php echo JLayoutHelper::render('joomla.searchtools.default', array('view' => $this)); ?>
<div class="clear"> </div>
<?php if (empty($this->items)) : ?>
Expand Down Expand Up @@ -85,26 +85,37 @@
<span class="icon-eye-open hasTooltip" title="<?php echo JHtml::tooltipText(JText::_('COM_TEMPLATES_TEMPLATE_PREVIEW'), $item->title, 0); ?>" ></span></a>
<?php elseif ($item->client_id == '1') : ?>
<span class="icon-eye-close disabled hasTooltip" title="<?php echo JHtml::tooltipText('COM_TEMPLATES_TEMPLATE_NO_PREVIEW_ADMIN'); ?>" ></span>
<?php else: ?>
<?php else : ?>
<span class="icon-eye-close disabled hasTooltip" title="<?php echo JHtml::tooltipText('COM_TEMPLATES_TEMPLATE_NO_PREVIEW'); ?>" ></span>
<?php endif; ?>
<?php if ($canEdit) : ?>
<a href="<?php echo JRoute::_('index.php?option=com_templates&task=style.edit&id=' . (int) $item->id); ?>">
<?php echo $this->escape($item->title);?></a>
<?php echo $this->escape($item->title); ?></a>
<?php else : ?>
<?php echo $this->escape($item->title);?>
<?php echo $this->escape($item->title); ?>
<?php endif; ?>
</td>
<td class="center">
<?php if ($item->home == '0' || $item->home == '1'):?>
<?php echo JHtml::_('jgrid.isdefault', $item->home != '0', $i, 'styles.', $canChange && $item->home != '1');?>
<?php elseif ($canChange):?>
<a href="<?php echo JRoute::_('index.php?option=com_templates&task=styles.unsetDefault&cid[]=' . $item->id . '&' . JSession::getFormToken() . '=1');?>">
<?php echo JHtml::_('image', 'mod_languages/' . $item->image . '.gif', $item->language_title, array('title' => JText::sprintf('COM_TEMPLATES_GRID_UNSET_LANGUAGE', $item->language_title)), true);?>
</a>
<?php else:?>
<?php echo JHtml::_('image', 'mod_languages/' . $item->image . '.gif', $item->language_title, array('title' => $item->language_title), true);?>
<?php endif;?>
<?php if ($item->home == '0' || $item->home == '1') : ?>
<?php echo JHtml::_('jgrid.isdefault', $item->home != '0', $i, 'styles.', $canChange && $item->home != '1'); ?>
<?php else : ?>
<?php
$language_image = JHtml::_('image', 'mod_languages/' . $item->image . '.gif', $item->language_title, array(), true);
$language_image_text = $language_image . '&nbsp;' . $item->language_title;
echo JHtml::_(
'jgrid.isdefault',
true,
$i,
array(
'prefix' => 'styles.',
'active_title' => JText::sprintf('COM_TEMPLATES_GRID_UNSET_LANGUAGE', $language_image_text),
'inactive_title' => JText::_('JDEFAULT') . '&nbsp;' . $language_image_text,
'text' => $language_image
),
$canChange
);
?>
<?php endif; ?>
</td>
<td class="center hidden-phone">
<?php if ($item->assigned > 0) : ?>
Expand All @@ -117,9 +128,9 @@
<?php echo $item->client_id == 0 ? JText::_('JSITE') : JText::_('JADMINISTRATOR'); ?>
</td>
<td class="hidden-phone">
<label for="cb<?php echo $i;?>" class="small">
<a href="<?php echo JRoute::_('index.php?option=com_templates&view=template&id=' . (int) $item->e_id); ?> ">
<?php echo ucfirst($this->escape($item->template));?>
<label for="cb<?php echo $i; ?>" class="small">
<a href="<?php echo JRoute::_('index.php?option=com_templates&view=template&id=' . (int) $item->e_id); ?>">
<?php echo ucfirst($this->escape($item->template)); ?>
</a>
</label>
</td>
Expand All @@ -130,7 +141,7 @@
<?php endforeach; ?>
</tbody>
</table>
<?php endif;?>
<?php endif; ?>

<input type="hidden" name="task" value="" />
<input type="hidden" name="boxchecked" value="0" />
Expand Down
23 changes: 19 additions & 4 deletions libraries/cms/html/jgrid.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,18 @@ public static function action($i, $task, $prefix = '', $text = '', $active_title
$title = JHtml::tooltipText($title, '', 0);
}

if ($text)
{
$text = empty($active_class) ? $text : '';
}

if ($enabled)
{
$html[] = '<a class="btn btn-micro' . ($active_class == 'publish' ? ' active' : '') . ($tip ? ' hasTooltip' : '') . '"';
$html[] = ' href="javascript:void(0);" onclick="return listItemTask(\'' . $checkbox . $i . '\',\'' . $prefix . $task . '\')"';
$html[] = $tip ? ' title="' . $title . '"' : '';
$html[] = '>';
$html[] = '<span class="icon-' . $active_class . '"></span>';
$html[] = '<span class="icon-' . $active_class . '">' . $text . '</span>';
$html[] = '</a>';
}
else
Expand All @@ -79,11 +84,11 @@ public static function action($i, $task, $prefix = '', $text = '', $active_title

if ($active_class == "protected")
{
$html[] = '<span class="icon-lock"></span>';
$html[] = '<span class="icon-lock">' . $text . '</span>';
}
else
{
$html[] = '<span class="icon-' . $inactive_class . '"></span>';
$html[] = '<span class="icon-' . $inactive_class . '">' . $text . '</span>';
}

$html[] = '</a>';
Expand Down Expand Up @@ -253,14 +258,24 @@ public static function isdefault($value, $i, $prefix = '', $enabled = true, $che
$enabled = array_key_exists('enabled', $options) ? $options['enabled'] : $enabled;
$checkbox = array_key_exists('checkbox', $options) ? $options['checkbox'] : $checkbox;
$prefix = array_key_exists('prefix', $options) ? $options['prefix'] : '';
$active_title = array_key_exists('active_title', $options) ? $options['active_title'] : '';
$inactive_title = array_key_exists('inactive_title', $options) ? $options['inactive_title'] : '';
$text = array_key_exists('text', $options) ? $options['text'] : '';
}

$translate = true;
$states = array(
0 => array('setDefault', '', 'JLIB_HTML_SETDEFAULT_ITEM', '', 1, 'unfeatured', 'unfeatured'),
1 => array('unsetDefault', 'JDEFAULT', 'JLIB_HTML_UNSETDEFAULT_ITEM', 'JDEFAULT', 1, 'featured', 'featured'),
);

return static::state($states, $value, $i, $prefix, $enabled, true, $checkbox);
if (!empty($text))
{
$translate = false;
$states[1] = array('unsetDefault', $text, $active_title, $inactive_title, 1, '', '');
}

return static::state($states, $value, $i, $prefix, $enabled, $translate, $checkbox);
}

/**
Expand Down

0 comments on commit 63054a2

Please sign in to comment.