1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

Add a message to home when no libraries have been created (#798)

* Add a prompt to home when no libraries exist

Resolves: #642

* Replace let with var in homesection.js

* Use centerMessage class in "no library" prompt

* Fix invalid closing tag

* Change \"no library\" prompt description for admins
This commit is contained in:
Andreas B 2020-02-19 15:42:48 +01:00 committed by GitHub
parent 7e6cbe685c
commit 805394d9a3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 40 additions and 16 deletions

View file

@ -40,6 +40,7 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
return getUserViews(apiClient, user.Id).then(function (userViews) { return getUserViews(apiClient, user.Id).then(function (userViews) {
var html = ''; var html = '';
if (userViews.length) {
var sectionCount = 7; var sectionCount = 7;
for (var i = 0; i < sectionCount; i++) { for (var i = 0; i < sectionCount; i++) {
html += '<div class="verticalSection section' + i + '"></div>'; html += '<div class="verticalSection section' + i + '"></div>';
@ -60,6 +61,27 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
returnPromise: false returnPromise: false
}); });
}); });
} else {
var noLibDescription;
if (user['Policy'] && user['Policy']['IsAdministrator']) {
noLibDescription = Globalize.translate("NoCreatedLibraries", '<a id="button-createLibrary" class="button-link">', '</a>')
} else {
noLibDescription = Globalize.translate("AskAdminToCreateLibrary");
}
html += '<div class="centerMessage padded-left padded-right">';
html += '<h2>' + Globalize.translate("MessageNothingHere") + '</h2>';
html += '<p>' + noLibDescription + '</p>'
html += '</div>';
elem.innerHTML = html;
var createNowLink = elem.querySelector("#button-createLibrary")
if (createNowLink) {
createNowLink.addEventListener("click", () => {
Dashboard.navigate("library.html");
});
}
}
}); });
} }

View file

@ -36,6 +36,7 @@
"Artists": "Artists", "Artists": "Artists",
"AsManyAsPossible": "As many as possible", "AsManyAsPossible": "As many as possible",
"Ascending": "Ascending", "Ascending": "Ascending",
"AskAdminToCreateLibrary": "Ask an administrator to create a library.",
"AspectRatio": "Aspect Ratio", "AspectRatio": "Aspect Ratio",
"AttributeNew": "New", "AttributeNew": "New",
"Audio": "Audio", "Audio": "Audio",
@ -1032,6 +1033,7 @@
"Next": "Next", "Next": "Next",
"NextUp": "Next Up", "NextUp": "Next Up",
"No": "No", "No": "No",
"NoCreatedLibraries": "Seems like you haven't created any libraries yet. {0}Would you like to create one now?{1}",
"NoNewDevicesFound": "No new devices found. To add a new tuner, close this dialog and enter the device information manually.", "NoNewDevicesFound": "No new devices found. To add a new tuner, close this dialog and enter the device information manually.",
"NoNextUpItemsMessage": "None found. Start watching your shows!", "NoNextUpItemsMessage": "None found. Start watching your shows!",
"NoPluginConfigurationMessage": "This plugin has no settings to configure.", "NoPluginConfigurationMessage": "This plugin has no settings to configure.",