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

Apply suggestions from code review

This commit is contained in:
Matt Montgomery 2020-04-26 16:19:58 -05:00
parent bf03a7ba57
commit aa12a79625
9 changed files with 29 additions and 22 deletions

View file

@ -2,8 +2,8 @@ define(['require', 'apphost', 'layoutManager', 'focusManager', 'globalize', 'loa
"use strict";
function authorizeRequest(event) {
var lookup = event.data.lookup;
var url = ApiClient.getUrl("/QuickConnect/Authorize");
let lookup = event.data.lookup;
let url = ApiClient.getUrl("/QuickConnect/Authorize");
ApiClient.ajax({
type: "POST",
url: url,
@ -23,12 +23,12 @@ define(['require', 'apphost', 'layoutManager', 'focusManager', 'globalize', 'loa
QuickConnectSettings.prototype.list = function(argPage) {
ApiClient.getJSON("/QuickConnect/List").then(json => {
let found = false;
var elem = $(argPage.querySelector("#quickConnectIncoming"));
elem.text("No pending login requests");
var elem = argPage.querySelector('#quickConnectIncoming');
elem.innerText = globalize.translate('QuickConnectNoPending');
for (var i = 0; i < json.length; i++) {
if (!found) {
elem.html("");
elem.innerHTML = "";
found = true;
}
@ -40,13 +40,11 @@ define(['require', 'apphost', 'layoutManager', 'focusManager', 'globalize', 'loa
html += '<div class="listItemBodyText secondary listItemBodyText-nowrap">';
if (!current.Authenticated) {
html += '<a style="color:rgb(15,150,255)" href="#" id="qc' + current.Lookup + '">authorize</a>';
} else {
html += " (authorized)";
html += '<a style="color:rgb(15,150,255)" href="#" id="qc' + current.Lookup + '">' + globalize.translate('Authorize') + '</a>';
}
html += '</div></div></div>';
elem.append(html);
elem.innerHTML += html;
$("#qc" + current.Lookup).click({ lookup: current.Lookup }, authorizeRequest);
$("#div" + current.Lookup).click({ lookup: current.Lookup }, authorizeRequest);
@ -68,7 +66,6 @@ define(['require', 'apphost', 'layoutManager', 'focusManager', 'globalize', 'loa
}).then((json) => {
let message = json.Error;
console.log("message is \"" + message + "\"");
if (message && message !== "") {
console.error("Error activating quick connect. Error: ", json.Error);
@ -81,7 +78,7 @@ define(['require', 'apphost', 'layoutManager', 'focusManager', 'globalize', 'loa
}
require(["toast"], function (toast) {
toast("Successfully activated");
toast(globalize.translate("QuickConnectActivationSuccessful"));
});
return true;

View file

@ -167,8 +167,8 @@ define(["apphost", "appSettings", "dom", "connectionManager", "loading", "layout
}
Dashboard.alert({
message: "Authorize request " + json.Code + " to continue",
title: "Quick Connect Code"
message: Globalize.translate('QuickConnectAuthorizeCode', json.Code),
title: Globalize.translate('QuickConnect')
});
loading.show();

View file

@ -20,7 +20,7 @@ define(["quickConnectSettings", "dom", "globalize", "loading", "userSettings", "
let btn = view.querySelector("#btnQuickConnectActivate");
if (status === "Unavailable") {
btn.textContent = "Quick connect is not available on this server";
btn.textContent = globalize.translate("QuickConnectNotAvailable");
btn.disabled = true;
return false;
} else if (status === "Available") {

View file

@ -44,7 +44,7 @@
</button>
<button is="emby-button" type="button" class="raised cancel block btnQuick">
<span>Use Quick Connect</span>
<span>${ButtonUseQuickConnect}</span>
</button>
<button is="emby-button" type="button" class="raised cancel block btnForgotPassword">

View file

@ -53,7 +53,7 @@
<div class="listItem">
<em class="material-icons listItemIcon listItemIcon-transparent">tap_and_play</em>
<div class="listItemBody">
<div class="listItemBodyText">Quick Connect</div>
<div class="listItemBodyText">${QuickConnect}</div>
</div>
</div>
</a>

View file

@ -1,11 +1,11 @@
<div id="quickConnectPreferencesPage" data-role="page" class="page libraryPage userPreferencesPage noSecondaryNavPage" data-title="${HeaderHome}" data-backbutton="true">
<button is="emby-button" id="btnQuickConnectActivate" type="button" class="raised button-submit block">
<span>Activate</span>
<span>${ButtonActivate}</span>
</button>
<div class="quickConnectSettingsContainer padded-left padded-right padded-bottom-page">
<div id="quickConnectIncoming" class="paperList">
<div>Failed to load incoming requests</div>
<div>${MessagePleaseWait}</div>
</ul>
</div>
</div>

View file

@ -3,16 +3,16 @@
<div class="content-primary">
<div class="verticalSection">
<div class="sectionTitleContainer flex align-items-center">
<h2 class="sectionTitle">Quick Connect</h2>
<h2 class="sectionTitle">${QuickConnect}</h2>
</div>
</div>
Quick connect is: <span id="quickConnectStatus">Failed to load status</span>
${LabelCurrentStatus} <span id="quickConnectStatus"></span>
<div class="checkboxList paperList" style="padding:.5em 1em;">
<label>
<input type="checkbox" is="emby-checkbox" id="chkQuickConnectAvailable" />
<span>Enable quick connect on this server</span>
<span>${EnableQuickConnect}</span>
</label>
</div>

View file

@ -351,7 +351,7 @@ define(["dom", "layoutManager", "inputManager", "connectionManager", "events", "
icon: "devices"
});
links.push({
name: "Quick Connect",
name: globalize.translate("QuickConnect"),
href: "quickconnect.html",
pageIds: ["quickConnectPage", "quickConnectPage"],
icon: "tap_and_play"

View file

@ -48,6 +48,7 @@
"AuthProviderHelp": "Select an Authentication Provider to be used to authenticate this user's password.",
"Auto": "Auto",
"AutoBasedOnLanguageSetting": "Auto (based on language setting)",
"Authorize": "authorize",
"Backdrop": "Backdrop",
"Backdrops": "Backdrops",
"Banner": "Banner",
@ -63,6 +64,7 @@
"Browse": "Browse",
"BrowsePluginCatalogMessage": "Browse our plugin catalog to view available plugins.",
"BurnSubtitlesHelp": "Determines if the server should burn in subtitles when transcoding videos. Avoiding this will greatly improve performance. Select Auto to burn image based formats (VOBSUB, PGS, SUB, IDX) and certain ASS or SSA subtitles.",
"ButtonActivate": "Activate",
"ButtonAdd": "Add",
"ButtonAddImage": "Add Image",
"ButtonAddMediaLibrary": "Add Media Library",
@ -140,6 +142,7 @@
"ButtonTrailer": "Trailer",
"ButtonUninstall": "Uninstall",
"ButtonUp": "Up",
"ButtonUseQuickConnect": "Use Quick Connect",
"ButtonViewWebsite": "View website",
"ButtonWebsite": "Website",
"CancelRecording": "Cancel recording",
@ -231,6 +234,7 @@
"EnableNextVideoInfoOverlayHelp": "At the end of a video, display info about the next video coming up in the current playlist.",
"EnablePhotos": "Display photos",
"EnablePhotosHelp": "Images will be detected and displayed alongside other media files.",
"EnableQuickConnect": "Enable quick connect on this server",
"EnableStreamLooping": "Auto-loop live streams",
"EnableStreamLoopingHelp": "Enable this if live streams only contain a few seconds of data and need to be continuously requested. Enabling this when not needed may cause problems.",
"EnableThemeSongs": "Theme songs",
@ -587,6 +591,7 @@
"LabelCountry": "Country:",
"LabelCriticRating": "Critic rating:",
"LabelCurrentPassword": "Current password:",
"LabelCurrentStatus": "Current status:",
"LabelCustomCertificatePath": "Custom SSL certificate path:",
"LabelCustomCertificatePathHelp": "Path to a PKCS #12 file containing a certificate and private key to enable TLS support on a custom domain.",
"LabelCustomCss": "Custom CSS:",
@ -1260,6 +1265,11 @@
"Programs": "Programs",
"Quality": "Quality",
"QueueAllFromHere": "Queue all from here",
"QuickConnect": "Quick Connect",
"QuickConnectActivationSuccessful": "Successfully activated",
"QuickConnectAuthorizeCode": "Authorize request {0} to continue",
"QuickConnectNoPending": "No pending login requests",
"QuickConnectNotAvailable": "Quick connect is not available on this server",
"Raised": "Raised",
"Rate": "Rate",
"RecentlyWatched": "Recently watched",