[+] BO : Modal module list

This commit is contained in:
Jerome Nadaud
2013-08-13 15:22:18 +02:00
parent e33cd2d13b
commit 5e2a3e3c13
5 changed files with 57 additions and 74 deletions
@@ -69,16 +69,24 @@
</p>
</td>
{else if !isset($module->not_on_disk)}
<td>
<p>{$module->optionsHtml}</p>
</td>
<td>&nbsp;</td>
<td align="right">
<p>
<a href="#" class="btn btn-default action_tab_module" data-option="select_{$module->name}">
<i class="icon-ok"></i>
{l s='Submit'}
</a>
</p>
{if $module->optionsHtml|count > 0}
<div id="list-action-button" class="btn-group">
{assign var=option value=$module->optionsHtml[0]}
{$option}
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" >
<span class="caret">&nbsp;</span>
</button>
<ul class="dropdown-menu">
{foreach $module->optionsHtml key=key item=option}
{if $key != 0}
<li>{$option}</li>
{/if}
{/foreach}
</ul>
</div>
{/if}
</td>
{else}
<td>&nbsp;</td>
@@ -25,54 +25,19 @@
*}
{if isset($tab_modules_list) && !empty($tab_modules_list)}
<script type="text/javascript">
$(document).ready(function() {
$('#nav_tabs_modules_installed').click(function () { showInstalledModules() });
$('#nav_tabs_modules_not_installed').click(function () { showNotInstalledModules() });
{if count($tab_modules_list.installed)}
showInstalledModules();
{else}
showNotInstalledModules();
{/if}
bindTabModuleListAction();
});
function showInstalledModules(element)
{
$('#tab_modules_list_not_installed').hide();
$('#tab_modules_list_installed').show();
$('#nav_tabs_modules_installed').parent('li').addClass('active');
$('#nav_tabs_modules_not_installed').parent('li').removeClass('active');
return false;
}
function showNotInstalledModules(element)
{
$('#tab_modules_list_installed').hide();
$('#tab_modules_list_not_installed').show();
$(element).parent('li').addClass('active');
$('#nav_tabs_modules_not_installed').parent('li').removeClass('active');
return false;
}
</script>
<div class="row">
<div class="col-lg-12">
<ul class="nav">
<ul class="nav nav-tabs">
{if count($tab_modules_list.installed)}
<li>
<a id="nav_tabs_modules_installed" class="panel-content" href="#" onclick="">
<i class="icon-plus-sign-alt"></i>
<li class="active">
<a href="#tab_modules_list_installed" data-toggle="tab">
{l s='Installed'}
</a>
</li>
{/if}
{if count($tab_modules_list.not_installed)}
<li>
<a href="#" id="nav_tabs_modules_not_installed" class="panel-content">
<i class="icon-minus-sign-alt"></i>
<li{if count($tab_modules_list.installed) == 0} class="active"{/if}>
<a href="#tab_modules_list_not_installed" data-toggle="tab">
{l s='Not Installed'}
</a>
</li>
@@ -80,21 +45,25 @@
</ul>
</div>
</div>
<div id="modules_list_container_content">
{if count($tab_modules_list.installed)}
<table id="tab_modules_list_installed" class="table">
{foreach from=$tab_modules_list.installed item=module}
{include file='controllers/modules/tab_module_line.tpl' class_row={cycle values=",rowalt"}}
{/foreach}
</table>
{/if}
{if count($tab_modules_list.not_installed)}
<table id="tab_modules_list_not_installed" class="table">
{foreach from=$tab_modules_list.not_installed item=module}
{include file='controllers/modules/tab_module_line.tpl' class_row={cycle values=",rowalt"}}
{/foreach}
</table>
{/if}
<div id="modules_list_container_content" class="tab-content">
<div class="tab-pane{if count($tab_modules_list.installed)} active{/if}" id="tab_modules_list_installed">
{if count($tab_modules_list.installed)}
<table id="tab_modules_list_installed" class="table">
{foreach from=$tab_modules_list.installed item=module}
{include file='controllers/modules/tab_module_line.tpl' class_row={cycle values=",rowalt"}}
{/foreach}
</table>
{/if}
</div>
<div class="tab-pane{if count($tab_modules_list.installed) == 0} active{/if}" id="tab_modules_list_not_installed">
{if count($tab_modules_list.not_installed)}
<table id="tab_modules_list_not_installed" class="table">
{foreach from=$tab_modules_list.not_installed item=module}
{include file='controllers/modules/tab_module_line.tpl' class_row={cycle values=",rowalt"}}
{/foreach}
</table>
{/if}
</div>
</div>
{/if}
<div class="alert alert-block">
+13 -6
View File
@@ -42,12 +42,19 @@
<div {if isset($btn.force_desc) && $btn.force_desc == true } class="locked" {/if}>{$btn.desc}</div>
</a>
{if $k == 'modules-list'}
<div id="modules_list_container" style="display:none">
<div style="float:right;margin:5px">
<a href="#" onclick="$('#modules_list_container').slideUp();return false;"><img alt="X" src="../img/admin/close.png"></a>
<div class="modal fade" id="modules_list_container">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h4 class="modal-title">{l s='Modules'}</h4>
</div>
<div class="modal-body">
<div id="modules_list_container_tab" style="display:none;"></div>
<div id="modules_list_loader"><img src="../img/loader.gif" alt="" border="0"></div>
</div>
</div>
</div>
<div id="modules_list_loader"><img src="../img/loader.gif" alt="" border="0"></div>
<div id="modules_list_container_tab" style="display:none;"></div>
</div>
{/if}
</li>
@@ -137,7 +144,7 @@
function openModulesList()
{
$('#modules_list_container').slideDown();
$('#modules_list_container').modal('show');
if (!modules_list_loaded)
{
$.ajax({
+2 -3
View File
@@ -1727,7 +1727,6 @@ class AdminControllerCore extends Controller
_PS_JS_DIR_.'ajax.js',
_PS_JS_DIR_.'toolbar.js',
));
//loads specific javascripts for the admin theme, bootstrap.js should be moved into /js root directory
$this->addJS(__PS_BASE_URI__.$admin_webpath.'/themes/'.$this->bo_theme.'/js/vendor/bootstrap.js');
$this->addJS(__PS_BASE_URI__.$admin_webpath.'/themes/'.$this->bo_theme.'/js/admin-theme.js');
@@ -2918,7 +2917,7 @@ class AdminControllerCore extends Controller
$module->logo = 'logo.gif';
if (file_exists('../modules/'.$module->name.'/logo.png'))
$module->logo = 'logo.png';
$module->optionsHtml = $this->displayModuleOptions($module, $output_type);
$module->optionsHtml = $this->displayModuleOptions($module, $output_type, $back);
$link_admin_modules = $this->context->link->getAdminLink('AdminModules', true);
$module->options['install_url'] = $link_admin_modules.'&install='.urlencode($module->name).'&tab_module='.$module->tab.'&module_name='.$module->name.'&anchor=anchor'.ucfirst($module->name);
@@ -3003,7 +3002,7 @@ class AdminControllerCore extends Controller
if ($option['cond'])
{
if ($output_type == 'link')
$return .= '<li><a class="'.$option_name.' action_module" href="'.$option['href'].(!is_null($back) ? '&back='.urlencode($back) : '').'" onclick="'.$option['onclick'].'" title="'.$option['title'].'"><i class="icon-'.(isset($option['icon']) && $option['icon'] ? $option['icon']:'cog' ).'"></i> '.$option['text'].'</a></li>';
$return .= '<li><a class="'.$option_name.' action_module" href="'.$option['href'].(!is_null($back) ? '&back='.urlencode($back) : '').'" onclick="'.$option['onclick'].'" title="'.$option['title'].'"><i class="icon-'.(isset($option['icon']) && $option['icon'] ? $option['icon']:'cog' ).'"></i>&nbsp;'.$option['text'].'</a></li>';
elseif ($output_type == 'array')
{
if (!is_array($return))
+1 -1
View File
@@ -263,7 +263,7 @@ class AdminModulesControllerCore extends AdminController
}
if ($perm)
{
$this->fillModuleData($module, 'select', $back);
$this->fillModuleData($module, 'array');
if ($module->id)
$modules_list['installed'][] = $module;
else