moved portions of the ACP/Plugins page to a pair of partials, and split up the list so the plugins list isn't parsed twice.

v1.18.x
Julian Lam 10 years ago
parent b69ea4564a
commit 02a63c0a45

@ -275,7 +275,12 @@ adminController.plugins.get = function(req, res, next) {
}
res.render('admin/extend/plugins' , {
plugins: plugins
installed: plugins.filter(function(plugin) {
return plugin.installed;
}),
download: plugins.filter(function(plugin) {
return !plugin.installed;
})
});
});
};

@ -4,50 +4,9 @@
<div class="panel-heading"><i class="fa fa-code-fork"></i> Installed Plugins</div>
<div class="panel-body">
<ul>
<!-- BEGIN plugins -->
<!-- IF plugins.installed -->
<!-- IF !plugins.error -->
<li data-plugin-id="{plugins.id}" data-version="{plugins.version}" class="clearfix">
<div class="pull-right">
<!-- IF plugins.isTheme -->
<a href="{config.relative_path}/admin/appearance/themes" class="btn btn-info">Themes</a>
<!-- ELSE -->
<button data-action="toggleActive" class="btn <!-- IF plugins.active --> btn-warning<!-- ELSE --> btn-success<!-- ENDIF plugins.active -->"><i class="fa fa-power-off"></i> <!-- IF plugins.active -->Deactivate<!-- ELSE -->Activate<!-- ENDIF plugins.active --></button>
<!-- ENDIF plugins.isTheme -->
<button data-action="toggleInstall" data-installed="1" class="btn btn-danger"><i class="fa fa-trash-o"></i> Uninstall</button>
</div>
<h2><strong>{plugins.name}</strong></h2>
<!-- IF plugins.description -->
<p>{plugins.description}</p>
<!-- ENDIF plugins.description -->
<!-- IF plugins.outdated --><i class="fa fa-exclamation-triangle text-danger"></i> <!-- ENDIF plugins.outdated --><small>Installed <strong class="currentVersion">{plugins.version}</strong> | Latest <strong class="latestVersion">{plugins.latest}</strong></small>
<!-- IF plugins.outdated -->
<button data-action="upgrade" class="btn btn-success btn-xs"><i class="fa fa-download"></i> Upgrade</button>
<!-- ENDIF plugins.outdated -->
<!-- IF plugins.url -->
<p>For more information: <a target="_blank" href="{plugins.url}">{plugins.url}</a></p>
<!-- ENDIF plugins.url -->
</li>
<!-- ENDIF !plugins.error -->
<!-- IF plugins.error -->
<li data-plugin-id="{plugins.id}" class="clearfix">
<div class="pull-right">
<button class="btn btn-default disabled"><i class="fa fa-exclamation-triangle"></i> Unknown</button>
<button data-action="toggleInstall" data-installed="1" class="btn btn-danger"><i class="fa fa-trash-o"></i> Uninstall</button>
</div>
<h2><strong>{plugins.id}</strong></h2>
<p>
The state of this plugin could not be determined, possibly due to a misconfiguration error.
</p>
</li>
<!-- ENDIF plugins.error -->
<!-- ENDIF plugins.installed -->
<!-- END plugins -->
<!-- BEGIN installed -->
<!-- IMPORT admin/partials/installed_plugin_item.tpl -->
<!-- END installed -->
</ul>
</div>
</div>
@ -56,28 +15,9 @@
<div class="panel-heading"><i class="fa fa-code-fork"></i> Download Plugins</div>
<div class="panel-body">
<ul>
<!-- BEGIN plugins -->
<!-- IF !plugins.installed -->
<li data-plugin-id="{plugins.id}" class="clearfix">
<div class="pull-right">
<button data-action="toggleActive" class="btn btn-success hidden"><i class="fa fa-power-off"></i> Activate</button>
<button data-action="toggleInstall" data-installed="0" class="btn btn-success"><i class="fa fa-download"></i> Install</button>
</div>
<h2><strong>{plugins.name}</strong></h2>
<!-- IF plugins.description -->
<p>{plugins.description}</p>
<!-- ENDIF plugins.description -->
<small>Latest <strong class="latestVersion">{plugins.latest}</strong></small>
<!-- IF plugins.url -->
<p>For more information: <a target="_blank" href="{plugins.url}">{plugins.url}</a></p>
<!-- ENDIF plugins.url -->
</li>
<!-- ENDIF !plugins.installed -->
<!-- END plugins -->
<!-- BEGIN download -->
<!-- IMPORT admin/partials/download_plugin_item.tpl -->
<!-- END download -->
</ul>
</div>
</div>

@ -0,0 +1,18 @@
<li data-plugin-id="{download.id}" class="clearfix">
<div class="pull-right">
<button data-action="toggleActive" class="btn btn-success hidden"><i class="fa fa-power-off"></i> Activate</button>
<button data-action="toggleInstall" data-installed="0" class="btn btn-success"><i class="fa fa-download"></i> Install</button>
</div>
<h2><strong>{download.name}</strong></h2>
<!-- IF download.description -->
<p>{download.description}</p>
<!-- ENDIF download.description -->
<small>Latest <strong class="latestVersion">{download.latest}</strong></small>
<!-- IF download.url -->
<p>For more information: <a target="_blank" href="{download.url}">{download.url}</a></p>
<!-- ENDIF download.url -->
</li>

@ -0,0 +1,40 @@
<!-- IF !installed.error -->
<li data-plugin-id="{installed.id}" data-version="{installed.version}" class="clearfix">
<div class="pull-right">
<!-- IF installed.isTheme -->
<a href="{config.relative_path}/admin/appearance/themes" class="btn btn-info">Themes</a>
<!-- ELSE -->
<button data-action="toggleActive" class="btn <!-- IF installed.active --> btn-warning<!-- ELSE --> btn-success<!-- ENDIF installed.active -->"><i class="fa fa-power-off"></i> <!-- IF installed.active -->Deactivate<!-- ELSE -->Activate<!-- ENDIF installed.active --></button>
<!-- ENDIF installed.isTheme -->
<button data-action="toggleInstall" data-installed="1" class="btn btn-danger"><i class="fa fa-trash-o"></i> Uninstall</button>
</div>
<h2><strong>{installed.name}</strong></h2>
<!-- IF installed.description -->
<p>{installed.description}</p>
<!-- ENDIF installed.description -->
<!-- IF installed.outdated --><i class="fa fa-exclamation-triangle text-danger"></i> <!-- ENDIF installed.outdated --><small>Installed <strong class="currentVersion">{installed.version}</strong> | Latest <strong class="latestVersion">{installed.latest}</strong></small>
<!-- IF installed.outdated -->
<button data-action="upgrade" class="btn btn-success btn-xs"><i class="fa fa-download"></i> Upgrade</button>
<!-- ENDIF installed.outdated -->
<!-- IF installed.url -->
<p>For more information: <a target="_blank" href="{installed.url}">{installed.url}</a></p>
<!-- ENDIF installed.url -->
</li>
<!-- ENDIF !installed.error -->
<!-- IF installed.error -->
<li data-plugin-id="{installed.id}" class="clearfix">
<div class="pull-right">
<button class="btn btn-default disabled"><i class="fa fa-exclamation-triangle"></i> Unknown</button>
<button data-action="toggleInstall" data-installed="1" class="btn btn-danger"><i class="fa fa-trash-o"></i> Uninstall</button>
</div>
<h2><strong>{installed.id}</strong></h2>
<p>
The state of this plugin could not be determined, possibly due to a misconfiguration error.
</p>
</li>
<!-- ENDIF installed.error -->
Loading…
Cancel
Save