Fix dropdown menu in sortable_table.class.php

pull/3890/head
Julio Montoya 4 years ago
parent bb8a90e040
commit 4dca070d82
  1. 32
      public/main/inc/lib/display.lib.php
  2. 1
      public/main/inc/lib/message.lib.php
  3. 37
      public/main/inc/lib/sortable_table.class.php
  4. 6
      public/main/messages/inbox.php

@ -2172,13 +2172,18 @@ class Display
tabindex="-1" tabindex="-1"
> >
<div class="py-1" role="none">'; <div class="py-1" role="none">';
foreach ($elements as $item) { foreach ($elements as $item) {
$html .= self::url( $html .= self::url(
$item['title'], $item['title'],
$item['href'], $item['href'],
['class' => 'text-gray-700 block px-4 py-2 text-sm', 'role' => 'menuitem'] [
); 'class' => 'text-gray-700 block px-4 py-2 text-sm',
} 'role' => 'menuitem',
'onclick' => $item['onclick'] ?? '',
'data-action' => $item['data-action'] ?? '',
]
);
}
$html .= ' $html .= '
</div> </div>
</div> </div>
@ -2889,19 +2894,6 @@ HTML;
return self::return_icon($image, $name, [], $size); return self::return_icon($image, $name, [], $size);
} }
public static function dropdownMenu($items = [], array $attr = [])
{
$links = null;
$url = null;
foreach ($items as $row) {
$url = self::url($row['icon'].$row['item'], $row['url'], ['class' => 'dropdown-item']);
$links .= self::tag('li', $url);
}
$html = self::tag('ul', $links, $attr);
return $html;
}
/** /**
* @param $id * @param $id
* *

@ -2152,7 +2152,6 @@ class MessageManager
$success_read = get_lang('Selected messages have been marked as read'); $success_read = get_lang('Selected messages have been marked as read');
$success_unread = get_lang('Selected messages have been marked as unread'); $success_unread = get_lang('Selected messages have been marked as unread');
$currentUserId = api_get_user_id(); $currentUserId = api_get_user_id();
if (isset($_REQUEST['action'])) { if (isset($_REQUEST['action'])) {
switch ($_REQUEST['action']) { switch ($_REQUEST['action']) {
case 'mark_as_unread': case 'mark_as_unread':

@ -435,8 +435,7 @@ class SortableTable extends HTML_Table
} }
} }
$html .= '<input type="hidden" name="action">'; $html .= '<input type="hidden" name="action">';
$html .= '<div class="q-card p-2 mb-4">';
$html .= '<div class="q-card">';
$html .= '<div class="flex flex-row justify-between">'; $html .= '<div class="flex flex-row justify-between">';
if (count($this->form_actions) > 0) { if (count($this->form_actions) > 0) {
@ -444,30 +443,24 @@ class SortableTable extends HTML_Table
$html .= '<a $html .= '<a
class="btn btn-primary" class="btn btn-primary"
href="?'.$params.'&amp;'.$this->param_prefix.'selectall=1" href="?'.$params.'&amp;'.$this->param_prefix.'selectall=1"
onclick="javascript: setCheckbox(true, \''.$table_id.'\'); return false;">'.get_lang('Select all').'</a>'; onclick="javascript: setCheckbox(true, \''.$table_id.'\'); return false;">'.
get_lang('Select all').'</a>';
$html .= '<a $html .= '<a
class="btn btn-primary" class="btn btn-primary"
href="?'.$params.'" href="?'.$params.'"
onclick="javascript: setCheckbox(false, \''.$table_id.'\'); return false;">'.get_lang('UnSelect all').'</a> '; onclick="javascript: setCheckbox(false, \''.$table_id.'\'); return false;">'.
$html .= '<div class="btn-group" role="group"> get_lang('Deselect all').'</a> ';
<button
id="'.$table_id.'_actions" $items = [];
data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" foreach ($this->form_actions as $action => $label) {
class="btn btn-outline-primary dropdown-toggle" $items[] = [
onclick="javascript:return false;">'. 'href' => 'javascript:void();',
get_lang('Detail').' 'onclick' => "javascript:action_click(this, '$table_id');",
</button> 'title' => $label,
'; 'data-action' => $action,
$html .= '<div class="dropdown-menu" aria-labelledby="'.$table_id.'_actions" >'; ];
foreach ($this->form_actions as $action => &$label) {
$html .= '<a
class="dropdown-item"
data-action ="'.$action.'"
href="#"
onclick="javascript:action_click(this, \''.$table_id.'\');">'.$label.'</a>';
} }
$html .= '</div>'; $html .= Display::groupButtonWithDropDown(get_lang('Detail'), $items);
$html .= '</div>';
} else { } else {
$html .= $form; $html .= $form;
} }

@ -87,7 +87,7 @@ if ($actions) {
// Block Social Avatar // Block Social Avatar
SocialManager::setSocialUserBlock($tpl, api_get_user_id(), 'messages'); SocialManager::setSocialUserBlock($tpl, api_get_user_id(), 'messages');
if ($allowSocial) { /*if ($allowSocial) {
$tpl->assign('social_menu_block', $social_menu_block); $tpl->assign('social_menu_block', $social_menu_block);
$tpl->assign('social_right_content', $social_right_content); $tpl->assign('social_right_content', $social_right_content);
$social_layout = $tpl->get_template('social/inbox.tpl'); $social_layout = $tpl->get_template('social/inbox.tpl');
@ -95,4 +95,6 @@ if ($allowSocial) {
} else { } else {
$tpl->assign('content', $social_right_content); $tpl->assign('content', $social_right_content);
$tpl->display_one_col_template(); $tpl->display_one_col_template();
} }*/
$tpl->assign('content', $social_right_content);
$tpl->display_one_col_template();

Loading…
Cancel
Save