Merge pull request #2 from dkanada/template

Miscellaneous tweaks
This commit is contained in:
LogicalPhallacy 2019-03-09 23:48:21 -08:00 committed by GitHub
commit b40643a877
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 89 additions and 112 deletions

View File

@ -1,5 +1,6 @@
using MediaBrowser.Model.Plugins; using MediaBrowser.Model.Plugins;
namespace Jellyfin.Plugin.ExamplePlugin.Configuration
namespace Jellyfin.Plugin.Template.Configuration
{ {
public enum SomeOptions public enum SomeOptions
{ {

View File

@ -0,0 +1,75 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Template</title>
</head>
<body>
<div id="TemplateConfigPage" data-role="page" class="page type-interior pluginConfigurationPage" data-require="emby-input,emby-button,emby-select,emby-checkbox">
<div data-role="content">
<div class="content-primary">
<form id="TemplateConfigForm">
<div class="selectContainer">
<label class="selectLabel" for="Options">Several Options</label>
<select is="emby-select" id="Options" name="Options" class="emby-select-withcolor emby-select">
<option id="optOneOption" value="OneOption">One Option</option>
<option id="optAnotherOption" value="AnotherOption">Another Option</option>
</select>
</div>
<div class="inputContainer">
<label class="inputeLabel inputLabelUnfocused" for="AnInteger">An Integer</label>
<input id="AnInteger" name="AnInteger" type="number" is="emby-input" min="0" />
<div class="fieldDescription">A Description</div>
</div>
<div class="checkboxContainer checkboxContainer-withDescripton">
<label class="emby-checkbox-label">
<input id="TrueFalseSetting" name="TrueFalseCheckBox" type="checkbox" is="emby-checkbox" />
<span>A Checkbox</span>
</label>
</div>
<div class="inputContainer">
<label class="inputeLabel inputLabelUnfocused" for="AString">A String</label>
<input id="AString" name="AString" type="text" is="emby-input" />
<div class="fieldDescription">Another Description</div>
</div>
<div>
<button is="emby-button" type="submit" class="raised button-submit block emby-button">
<span>Save</span>
</button>
</div>
</form>
</div>
</div>
<script type="text/javascript">
var TemplateConfig = {
pluginUniqueId: 'eb5d7894-8eef-4b36-aa6f-5d124e828ce1'
};
$('#TemplateConfigPage').on('pageshow', function () {
Dashboard.showLoadingMsg();
ApiClient.getPluginConfiguration(TemplateConfig.pluginUniqueId).then(function (config) {
$('#Options').val(config.Options).change();
$('#AnInteger').val(config.AnInteger).change();
$('#TrueFalseSetting').checked(config.TrueFalseSetting).checkboxradio("refresh");
$('#AString').val(config.AString).change();
Dashboard.hideLoadingMsg();
});
});
$('#TemplateConfigForm').on('submit', function () {
Dashboard.showLoadingMsg();
ApiClient.getPluginConfiguration(TemplateConfig.pluginUniqueId).then(function (config) {
config.Options = $('#Options').val();
config.AnInteger = $('#AnInteger').val();
config.TrueFalseSetting = $('#TrueFalseSetting').prop('checked');
config.AString = $('#AString').val();
ApiClient.updatePluginConfiguration(ExamplePluginConfigurationPage.pluginUniqueId, config).then(function (result) {
Dashboard.processPluginConfigurationUpdateResult(result);
});
});
return false;
});
</script>
</div>
</body>
</html>

View File

@ -2,7 +2,7 @@
<PropertyGroup> <PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework> <TargetFramework>netstandard2.0</TargetFramework>
<RootNamespace>Jellyfin.Plugin.ExamplePlugin</RootNamespace> <RootNamespace>Jellyfin.Plugin.Template</RootNamespace>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View File

@ -1,17 +1,16 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using Jellyfin.Plugin.ExamplePlugin.Configuration; using Jellyfin.Plugin.Template.Configuration;
using MediaBrowser.Common.Configuration; using MediaBrowser.Common.Configuration;
using MediaBrowser.Common.Plugins; using MediaBrowser.Common.Plugins;
using MediaBrowser.Model.Plugins; using MediaBrowser.Model.Plugins;
using MediaBrowser.Model.Serialization; using MediaBrowser.Model.Serialization;
namespace Jellyfin.Plugin.ExamplePlugin namespace Jellyfin.Plugin.Template
{ {
public class Plugin : BasePlugin<PluginConfiguration>, public class Plugin : BasePlugin<PluginConfiguration>, IHasWebPages
IHasWebPages
{ {
public override string Name => "ExamplePlugin"; public override string Name => "Template";
public override Guid Id => Guid.Parse("eb5d7894-8eef-4b36-aa6f-5d124e828ce1"); public override Guid Id => Guid.Parse("eb5d7894-8eef-4b36-aa6f-5d124e828ce1");
public Plugin(IApplicationPaths applicationPaths, IXmlSerializer xmlSerializer) : base(applicationPaths, xmlSerializer) public Plugin(IApplicationPaths applicationPaths, IXmlSerializer xmlSerializer) : base(applicationPaths, xmlSerializer)
{ {

View File

@ -1,98 +0,0 @@
<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title>ExamplePlugin Configuration</title>
</head>
<body>
<div id="ExamplePluginConfigurationPage" data-role="page" class="page type-interior pluginConfigurationPage" data-require="emby-input,emby-button,emby-select,emby-checkbox">
<div data-role="content">
<div class="content-primary">
<form id="ExamplePluginConfigurationForm">
<div class="selectContainer">
<label class="selectLabel" for="Options">Options:</label>
<select is="emby-select" id="Options" name="Options" class="emby-select-withcolor emby-select">
<option id="optOneOption" value="OneOption">One Option</option>
<option id="optAnotherOption" value="AnotherOption">AnotherOption</option>
</select>
</div>
<div class="inputContainer">
<label class="inputeLabel inputLabelUnfocused" for="AnInteger">An Integer:</label>
<input id="AnInteger" name="AnInteger" type="number" is="emby-input" min="0"/>
<div class="fieldDescription">Numbers go here</div>
</div>
<div class="checkboxContainer checkboxContainer-withDescripton">
<label class="emby-checkbox-label">
<input id="TrueFalseSetting" name="TrueFalseCheckBox" type="checkbox" is="emby-checkbox"/>
<span>True or False</span>
</label>
</div>
<div class="inputContainer">
<label class="inputeLabel inputLabelUnfocused" for="AString">A String:</label>
<input id="AString" name="AString" type="text" is="emby-input" />
<div class="fieldDescription">Words go here</div>
</div>
<div>
<button is="emby-button" type="submit" class="raised button-submit block emby-button">
<span>Save</span>
</button>
</div>
</form>
</div>
</div>
<script type="text/javascript">
var ExamplePluginConfigurationPage =
{
pluginUniqueId: "eb5d7894-8eef-4b36-aa6f-5d124e828ce1",
virtualFolders: [],
physicalFolders: [],
loadConfiguration: function() {
Dashboard.showLoadingMsg();
ApiClient.getPluginConfiguration(ExamplePluginConfigurationPage.pluginUniqueId).then(function (config) {
var page = $.mobile.activePage;
$('#Options', page).val(config.Options).change();
$('#AnInteger', page).val(config.AnInteger).change();
$('#TrueFalseSetting', page).checked(config.TrueFalseSetting).checkboxradio("refresh");
$('#AString', page).val(config.AString).change();
Dashboard.hideLoadingMsg();
});
},
saveConfiguration: function() {
Dashboard.showLoadingMsg();
var page = $.mobile.activePage;
ApiClient.getPluginConfiguration(ExamplePluginConfigurationPage.pluginUniqueId).then(function(config) {
config.Options = $('#Options', page).val();
config.AnInteger = $('#AnInteger').val();
config.TrueFalseSetting = $('#TrueFalseSetting').prop('checked');
config.AString = $('#AString').val();
ApiClient.updatePluginConfiguration(ExamplePluginConfigurationPage.pluginUniqueId, config).then(function (result) {
Dashboard.processPluginConfigurationUpdateResult(result);
});
});
},
};
$('#ExamplePluginConfigurationPage').on('pageshow', function () {
ExamplePluginConfigurationPage.loadConfiguration();
});
$('#ExamplePluginConfigurationForm').on('submit', function () {
ExamplePluginConfigurationPage.saveConfiguration();
return false;
});
</script>
</div>
</body>
</html>