mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
display news on dashboard home page
This commit is contained in:
parent
1fa7dcdb2b
commit
b932873b1d
5 changed files with 205 additions and 88 deletions
13
ApiClient.js
13
ApiClient.js
|
@ -197,6 +197,19 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout, wi
|
|||
return webSocket && (webSocket.readyState === WebSocket.OPEN || webSocket.readyState === WebSocket.CONNECTING);
|
||||
};
|
||||
|
||||
self.getProductNews = function (options) {
|
||||
|
||||
options = options || {};
|
||||
|
||||
var url = self.getUrl("News/Product", options);
|
||||
|
||||
return self.ajax({
|
||||
type: "GET",
|
||||
url: url,
|
||||
dataType: "json"
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Gets an item from the server
|
||||
* Omit itemId to get the root folder.
|
||||
|
|
|
@ -327,7 +327,7 @@ h1 .imageLink {
|
|||
}
|
||||
|
||||
.appLinks img {
|
||||
height: 32px;
|
||||
height: 30px;
|
||||
}
|
||||
|
||||
@media all and (min-width: 450px) {
|
||||
|
@ -780,3 +780,63 @@ progress {
|
|||
#editItemMetadataPage #txtOverview {
|
||||
height: 70px;
|
||||
}
|
||||
|
||||
|
||||
.latestNewsItems {
|
||||
min-height: 100px;
|
||||
min-width: 200px;
|
||||
}
|
||||
|
||||
.newsItem {
|
||||
padding: 1em 0;
|
||||
border-bottom: 1px solid #ddd;
|
||||
}
|
||||
|
||||
.newsItemDescription {
|
||||
max-height: 50px;
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.newsItemHeader {
|
||||
font-size: 15px;
|
||||
text-decoration: none !important;
|
||||
}
|
||||
|
||||
@media all and (max-width: 1440px) {
|
||||
|
||||
.dashboardHomeRightColumn {
|
||||
margin-top: 3em;
|
||||
}
|
||||
}
|
||||
|
||||
.dashboardContent {
|
||||
max-width: 1000px;
|
||||
}
|
||||
|
||||
@media all and (min-width: 1440px) {
|
||||
|
||||
.dashboardHomeLeftColumn {
|
||||
width: 600px;
|
||||
float: left;
|
||||
}
|
||||
|
||||
.latestNewsItems {
|
||||
max-width: 300px;
|
||||
}
|
||||
|
||||
.dashboardHomeRightColumn {
|
||||
float: right;
|
||||
}
|
||||
}
|
||||
|
||||
@media all and (min-width: 1600px) {
|
||||
|
||||
.latestNewsItems {
|
||||
max-width: 400px;
|
||||
}
|
||||
|
||||
.dashboardContent {
|
||||
max-width: 1100px;
|
||||
}
|
||||
}
|
|
@ -13,9 +13,10 @@
|
|||
<a href="dashboardinfopage.html" data-role="button">Info</a>
|
||||
</div>
|
||||
|
||||
<div class="readOnlyContent">
|
||||
<div class="dashboardContent">
|
||||
<div class="readOnlyContent dashboardHomeLeftColumn">
|
||||
|
||||
<div data-role="collapsible" data-collapsed="false" style="margin-top: 2em;">
|
||||
<div data-role="collapsible" data-collapsed="false">
|
||||
<h3>Server Information</h3>
|
||||
<div>
|
||||
<p>
|
||||
|
@ -67,13 +68,17 @@
|
|||
|
||||
<div id="runningTasksCollapsible" data-role="collapsible" data-collapsed="false" style="margin-top: 2em; display: none;">
|
||||
<h3>Running Tasks</h3>
|
||||
<div>
|
||||
<div id="divRunningTasks">
|
||||
</div>
|
||||
<p><a href="scheduledtasks.html">Manage Scheduled Tasks</a></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div style="display: none; margin-top: 4em;" id="contribute">
|
||||
<h2>Help improve Media Browser</h2>
|
||||
<div id="contribute" data-role="collapsible" data-collapsed="false" style="margin-top: 2em; display: none;">
|
||||
<h3>Help Improve Media Browser</h3>
|
||||
<div>
|
||||
<br />
|
||||
<form name="_xclick" action="https://www.paypal.com/cgi-bin/webscr"
|
||||
method="post">
|
||||
<input type="hidden" name="amount" value="10">
|
||||
|
@ -84,9 +89,9 @@
|
|||
<input type="hidden" name="item_number" value="MBSupporter">
|
||||
<input type="hidden" name="notify_url" value="http://mb3admin.com/admin/service/services/ppipn.php">
|
||||
<input type="hidden" name="return" id="paypalReturnUrl" value="#">
|
||||
<a data-role="button" onclick="$(this).parents('form')[0].submit();" data-icon="mail">
|
||||
<a data-role="button" onclick="$(this).parents('form')[0].submit();" data-icon="mail" data-mini="true">
|
||||
<img src="css/images/supporter/donatepaypal.png" /></a>
|
||||
<a href="https://github.com/MediaBrowser/MediaBrowser/wiki" data-role="button" target="_blank" data-icon="user">Join the Development Team</a>
|
||||
<a href="https://github.com/MediaBrowser/MediaBrowser/wiki" data-role="button" target="_blank" data-icon="user" data-mini="true">Join the Development Team</a>
|
||||
|
||||
<p class="appLinks" style="padding-left: 5px;">
|
||||
<a href="http://www.amazon.com/Mark-Linton-Mediabrowser-Android-Client/dp/B00GVH9O0I" target="_blank">
|
||||
|
@ -109,6 +114,18 @@
|
|||
<img src="css/images/clients/mediaportal.png" /></a>
|
||||
</p>
|
||||
</form>
|
||||
<br />
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="readOnlyContent dashboardHomeRightColumn">
|
||||
<div data-role="collapsible" data-collapsed="false">
|
||||
<h3>Latest News</h3>
|
||||
<div class="latestNewsItems">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -21,6 +21,33 @@
|
|||
}
|
||||
|
||||
});
|
||||
|
||||
DashboardPage.reloadNews(page);
|
||||
},
|
||||
|
||||
reloadNews: function (page) {
|
||||
|
||||
ApiClient.getProductNews({
|
||||
|
||||
limit: 5
|
||||
|
||||
}).done(function (result) {
|
||||
|
||||
var html = result.Items.map(function (item) {
|
||||
|
||||
var itemHtml = '';
|
||||
|
||||
itemHtml += '<div class="newsItem">';
|
||||
itemHtml += '<a class="newsItemHeader" href="' + item.Link + '" target="_blank">' + item.Title + '</a>';
|
||||
itemHtml += '<div class="newsItemDescription">' + item.Description + '</div>';
|
||||
itemHtml += '</div>';
|
||||
|
||||
return itemHtml;
|
||||
});
|
||||
|
||||
$('.latestNewsItems', page).html(html.join(''));
|
||||
});
|
||||
|
||||
},
|
||||
|
||||
onPageHide: function () {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="MediaBrowser.ApiClient.Javascript" version="3.0.237" targetFramework="net45" />
|
||||
<package id="MediaBrowser.ApiClient.Javascript" version="3.0.238" targetFramework="net45" />
|
||||
</packages>
|
Loading…
Add table
Add a link
Reference in a new issue