plugin catalog list with collapsibles
This commit is contained in:
parent
62ee9f124c
commit
7c98e1dd8f
2 changed files with 58 additions and 31 deletions
|
@ -15,16 +15,26 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div style="display: inline-block; margin: .75em 0;">
|
<div style="display: inline-block; margin: .75em 0;">
|
||||||
<fieldset data-role="controlgroup" data-type="horizontal" id="pluginTabs">
|
<button data-mini="true" data-icon="filter" data-inline="true" onclick="$('#filterPanel', $.mobile.activePage).panel( 'toggle' );">Filter</button>
|
||||||
<a href="#" data-role="button" data-mini="true" class="ui-btn-active" rel="Server">MB Server</a>
|
|
||||||
<a href="#" data-role="button" data-mini="true" rel="MBTheater">MB Theatre</a>
|
|
||||||
<a href="#" data-role="button" data-mini="true" rel="MBClassic">MB Classic</a>
|
|
||||||
</fieldset>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<button data-mini="true" data-icon="filter" data-inline="true" onclick="$('#filterPanel', $.mobile.activePage).panel( 'toggle' );">Filter</button>
|
<div id="noPlugins" class="hide"><div style="text-align:center;margin: 10px;">No available plugins</div></div>
|
||||||
|
|
||||||
|
<div data-role="collapsible" id="pluginServerCollapsible" class="hide">
|
||||||
|
<h3>MB Server</h3>
|
||||||
|
<div id="pluginServerTiles"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div data-role="collapsible" id="pluginTheatreCollapsible" class="hide">
|
||||||
|
<h3>MB Theatre</h3>
|
||||||
|
<div id="pluginTheatreTiles"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div data-role="collapsible" id="pluginClassicCollapsible" class="hide">
|
||||||
|
<h3>MB Classic</h3>
|
||||||
|
<div id="pluginClassicTiles"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div id="pluginTiles"></div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
// The base query options
|
// The base query options
|
||||||
var query = {
|
var query = {
|
||||||
TargetSystems: 'Server'
|
TargetSystems: 'Server,MBTheater,MBClassic'
|
||||||
};
|
};
|
||||||
|
|
||||||
function reloadList(page) {
|
function reloadList(page) {
|
||||||
|
@ -21,24 +21,28 @@
|
||||||
|
|
||||||
function populateList(page, availablePlugins, installedPlugins) {
|
function populateList(page, availablePlugins, installedPlugins) {
|
||||||
|
|
||||||
|
Dashboard.showLoadingMsg();
|
||||||
|
|
||||||
availablePlugins = availablePlugins.filter(function (p) {
|
availablePlugins = availablePlugins.filter(function (p) {
|
||||||
return p.type == "UserInstalled";
|
return p.type == "UserInstalled";
|
||||||
}).sort(function (a, b) {
|
}).sort(function (a, b) {
|
||||||
return a.name > b.name ? 1 : -1;
|
return a.name > b.name ? 1 : -1;
|
||||||
});
|
});
|
||||||
|
|
||||||
var html = "";
|
var serverhtml = '';
|
||||||
|
var theatrehtml = '';
|
||||||
|
var classichtml = "";
|
||||||
|
|
||||||
for (var i = 0, length = availablePlugins.length; i < length; i++) {
|
for (var i = 0, length = availablePlugins.length; i < length; i++) {
|
||||||
|
var html = '';
|
||||||
var plugin = availablePlugins[i];
|
var plugin = availablePlugins[i];
|
||||||
|
|
||||||
html += "<div class='posterViewItem'><a href='addPlugin.html?name=" + encodeURIComponent(plugin.name) + "'>";
|
html += "<div class='posterViewItem'><a href='addPlugin.html?name=" + encodeURIComponent(plugin.name) + "'>";
|
||||||
|
|
||||||
if (plugin.thumbImage) {
|
if (plugin.thumbImage) {
|
||||||
html += "<img src='" + plugin.thumbImage + "' />";
|
html += "<img src='" + plugin.thumbImage + "' style='max-width:185px;' />";
|
||||||
} else {
|
} else {
|
||||||
html += "<img style='background:#444444;' src='css/images/items/list/collection.png' />";
|
html += "<img style='background:#444444;max-width:185px;' src='css/images/items/list/collection.png' />";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (plugin.isPremium) {
|
if (plugin.isPremium) {
|
||||||
|
@ -69,31 +73,52 @@
|
||||||
|
|
||||||
html += "</a></div>";
|
html += "</a></div>";
|
||||||
|
|
||||||
|
if (plugin.targetSystem == "Server") {
|
||||||
|
serverhtml += html;
|
||||||
|
}else if (plugin.targetSystem == "MBTheater") {
|
||||||
|
theatrehtml += html;
|
||||||
|
}else if (plugin.targetSystem == "MBClassic") {
|
||||||
|
classichtml += html;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!availablePlugins.length) {
|
if (!availablePlugins.length) {
|
||||||
html = '<div style="text-align:center;margin: 10px;">No available plugins</div>';
|
$("#noPlugins", page).hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
$('#pluginTiles', page).html(html);
|
$('#pluginServerTiles', page).html(serverhtml);
|
||||||
|
$('#pluginTheatreTiles', page).html(theatrehtml);
|
||||||
|
$('#pluginClassicTiles', page).html(classichtml);
|
||||||
|
|
||||||
|
if (serverhtml) {
|
||||||
|
$('#pluginServerCollapsible', page).show();
|
||||||
|
}else {
|
||||||
|
$('#pluginServerCollapsible', page).hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (theatrehtml) {
|
||||||
|
$('#pluginTheatreCollapsible', page).show();
|
||||||
|
}else {
|
||||||
|
$('#pluginTheatreCollapsible', page).hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (classichtml) {
|
||||||
|
$('#pluginClassicCollapsible', page).show();
|
||||||
|
}else {
|
||||||
|
$('#pluginClassicCollapsible', page).hide();
|
||||||
|
}
|
||||||
|
|
||||||
Dashboard.hideLoadingMsg();
|
Dashboard.hideLoadingMsg();
|
||||||
}
|
}
|
||||||
|
|
||||||
function selectTab(elem, page) {
|
|
||||||
|
|
||||||
$("#pluginTabs a").removeClass("ui-btn-active");
|
|
||||||
$(elem).addClass("ui-btn-active");
|
|
||||||
|
|
||||||
query.TargetSystems = $(elem).attr("rel");
|
|
||||||
|
|
||||||
reloadList(page);
|
|
||||||
}
|
|
||||||
|
|
||||||
$(document).on('pageinit', "#pluginCatalogPage", function () {
|
$(document).on('pageinit', "#pluginCatalogPage", function () {
|
||||||
|
|
||||||
var page = this;
|
var page = this;
|
||||||
|
|
||||||
|
reloadList(page);
|
||||||
|
|
||||||
$('.chkPremiumFilter', page).on('change', function () {
|
$('.chkPremiumFilter', page).on('change', function () {
|
||||||
|
|
||||||
if (this.checked) {
|
if (this.checked) {
|
||||||
|
@ -104,18 +129,10 @@
|
||||||
reloadList(page);
|
reloadList(page);
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#pluginTabs a', page).each(function () {
|
|
||||||
$(this).on('click', function () {
|
|
||||||
selectTab(this, page);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
}).on('pageshow', "#pluginCatalogPage", function () {
|
}).on('pageshow', "#pluginCatalogPage", function () {
|
||||||
|
|
||||||
var page = this;
|
var page = this;
|
||||||
|
|
||||||
selectTab($("#pluginTabs a.ui-btn-active"), page);
|
|
||||||
|
|
||||||
// Reset form values using the last used query
|
// Reset form values using the last used query
|
||||||
$('.chkPremiumFilter', page).each(function () {
|
$('.chkPremiumFilter', page).each(function () {
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue