summaryrefslogtreecommitdiff
path: root/Configuration/configPage.html
blob: b72df9f7da6a3413a5257ee4bf98f59489e12dea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>Template</title>
</head>
<body>
<div class="page type-interior pluginConfigurationPage" data-require="emby-input,emby-button,emby-select,emby-checkbox" data-role="page"
     id="TemplateConfigPage">
    <div data-role="content">
        <div class="content-primary">
            <form id="TemplateConfigForm">
                <div class="selectContainer">
                    <label class="selectLabel" for="Options">Several Options</label>
                    <select class="emby-select-withcolor emby-select" id="Options" is="emby-select" name="Options">
                        <option id="optOneOption" value="OneOption">One Option</option>
                        <option id="optAnotherOption" value="AnotherOption">Another Option</option>
                    </select>
                </div>
                <div class="inputContainer">
                    <label class="inputLabel inputLabelUnfocused" for="AnInteger">An Integer</label>
                    <input id="AnInteger" is="emby-input" min="0" name="AnInteger" type="number"/>
                    <div class="fieldDescription">A Description</div>
                </div>
                <div class="checkboxContainer checkboxContainer-withDescription">
                    <label class="emby-checkbox-label">
                        <input id="TrueFalseSetting" is="emby-checkbox" name="TrueFalseCheckBox" type="checkbox"/>
                        <span>A Checkbox</span>
                    </label>
                </div>
                <div class="inputContainer">
                    <label class="inputLabel inputLabelUnfocused" for="AString">A String</label>
                    <input id="AString" is="emby-input" name="AString" type="text"/>
                    <div class="fieldDescription">Another Description</div>
                </div>
                <div>
                    <button class="raised button-submit block emby-button" is="emby-button" type="submit">
                        <span>Save</span>
                    </button>
                </div>
            </form>
        </div>
    </div>
    <script type="text/javascript">
        var TemplateConfig = {
            pluginUniqueId: 'eb5d7894-8eef-4b36-aa6f-5d124e828ce1'
        };

        document.querySelector('#TemplateConfigPage')
            .addEventListener('pageshow', function () {
                Dashboard.showLoadingMsg();
                ApiClient.getPluginConfiguration(TemplateConfig.pluginUniqueId).then(function (config) {
                    document.querySelector('#Options').value = config.Options;
                    document.querySelector('#AnInteger').value = config.AnInteger;
                    document.querySelector('#TrueFalseSetting').checked = config.TrueFalseSetting;
                    document.querySelector('#AString').value = config.AString;
                    Dashboard.hideLoadingMsg();
                });
            });

        document.querySelector('#TemplateConfigForm')
            .addEventListener('submit', function (e) {
                Dashboard.showLoadingMsg();
                ApiClient.getPluginConfiguration(TemplateConfig.pluginUniqueId).then(function (config) {
                    config.Options = document.querySelector('#Options').value;
                    config.AnInteger = document.querySelector('#AnInteger').value;
                    config.TrueFalseSetting = document.querySelector('#TrueFalseSetting').checked;
                    config.AString = document.querySelector('#AString').value;
                    ApiClient.updatePluginConfiguration(TemplateConfig.pluginUniqueId, config).then(function (result) {
                        Dashboard.processPluginConfigurationUpdateResult(result);
                    });
                });

                e.preventDefault();
                return false;
            });
    </script>
</div>
</body>
</html>