Wizard: Add input placeholder (M3U, XMLTV)

Wizard: Alert by empty value (M3U, XMLTV)
This commit is contained in:
marmei
2019-08-03 14:52:17 +02:00
parent 5fc5f773d3
commit 4dc9dfabf2
4 changed files with 53 additions and 37 deletions

View File

@@ -63,6 +63,7 @@ var WizardItem = /** @class */ (function (_super) {
break; break;
case "m3u": case "m3u":
var input = content.createInput("text", key, ""); var input = content.createInput("text", key, "");
input.setAttribute("placeholder", "{{.wizard.m3u.placeholder}}");
input.setAttribute("class", "wizard"); input.setAttribute("class", "wizard");
input.id = key; input.id = key;
doc.appendChild(input); doc.appendChild(input);
@@ -70,6 +71,7 @@ var WizardItem = /** @class */ (function (_super) {
break; break;
case "xmltv": case "xmltv":
var input = content.createInput("text", key, ""); var input = content.createInput("text", key, "");
input.setAttribute("placeholder", "{{.wizard.xmltv.placeholder}}");
input.setAttribute("class", "wizard"); input.setAttribute("class", "wizard");
input.id = key; input.id = key;
doc.appendChild(input); doc.appendChild(input);
@@ -117,6 +119,11 @@ function saveWizard() {
case "text": case "text":
name = config[i].name; name = config[i].name;
value = config[i].value; value = config[i].value;
if (value.length == 0) {
var msg = name.toUpperCase() + ": " + "{{.alert.missingInput}}";
alert(msg);
return;
}
wizard[name] = value; wizard[name] = value;
break; break;
} }

View File

@@ -27,7 +27,8 @@
}, },
"alert": { "alert": {
"fileLoadingError": "File couldn't be loaded", "fileLoadingError": "File couldn't be loaded",
"invalidChannelNumber": "Invalid channel number" "invalidChannelNumber": "Invalid channel number",
"missingInput": "Missing input"
}, },
"button":{ "button":{
"back": "Back", "back": "Back",
@@ -381,10 +382,12 @@
}, },
"m3u": { "m3u": {
"title": "M3U Playlist", "title": "M3U Playlist",
"placeholder": "File path or URL of the M3U",
"description": "Local or remote playlists" "description": "Local or remote playlists"
}, },
"xmltv": { "xmltv": {
"title": "XMLTV File", "title": "XMLTV File",
"placeholder": "File path or URL of the XMLTV",
"description": "Local or remote XMLTV file" "description": "Local or remote XMLTV file"
} }
}, },

File diff suppressed because one or more lines are too long

View File

@@ -62,6 +62,7 @@ class WizardItem extends WizardCategory {
case "m3u": case "m3u":
var input = content.createInput("text", key, "") var input = content.createInput("text", key, "")
input.setAttribute("placeholder", "{{.wizard.m3u.placeholder}}")
input.setAttribute("class", "wizard") input.setAttribute("class", "wizard")
input.id = key input.id = key
doc.appendChild(input) doc.appendChild(input)
@@ -72,6 +73,7 @@ class WizardItem extends WizardCategory {
case "xmltv": case "xmltv":
var input = content.createInput("text", key, "") var input = content.createInput("text", key, "")
input.setAttribute("placeholder", "{{.wizard.xmltv.placeholder}}")
input.setAttribute("class", "wizard") input.setAttribute("class", "wizard")
input.id = key input.id = key
doc.appendChild(input) doc.appendChild(input)
@@ -140,6 +142,12 @@ function saveWizard() {
name = (config[i] as HTMLInputElement).name name = (config[i] as HTMLInputElement).name
value = (config[i] as HTMLInputElement).value value = (config[i] as HTMLInputElement).value
if (value.length == 0) {
var msg = name.toUpperCase() + ": " + "{{.alert.missingInput}}"
alert(msg)
return
}
wizard[name] = value wizard[name] = value
break break
} }