forked from xibosignage/xibo-cms
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction-form-add.twig
107 lines (93 loc) · 5.64 KB
/
action-form-add.twig
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
{#
* Copyright (C) 2020 Xibo Signage Ltd
*
* Xibo - Digital Signage - http://www.xibo.org.uk
*
* This file is part of Xibo.
*
* Xibo is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* Xibo is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Xibo. If not, see <http://www.gnu.org/licenses/>.
#}
{% extends "form-base.twig" %}
{% import "forms.twig" as forms %}
{% block formTitle %}
{% trans %}Add Action for {{ source }}{% endtrans %}
{% endblock %}
{% block formButtons %}
{% trans "Cancel" %}, XiboDialogClose()
{% trans "Save" %}, $("#actionFormAdd").submit()
{% endblock %}
{% block callBack %}actionFormOpen{% endblock %}
{% block formHtml %}
<div class="row">
<div class="col-md-12">
<form id="actionFormAdd" class="XiboForm form-horizontal" method="post" action="{{ url_for("action.add", {id: id, source: source}) }}">
{% set title %}{% trans "Trigger Type" %}{% endset %}
{% set helpText %}{% trans "How should the Player listen for this Action to be triggered?" %}{% endset %}
{% set touch %}{% trans "Touch/Click" %}{% endset %}
{% set webhook %}{% trans "Web hook" %}{% endset %}
{% set options = [
{ typeid: "touch", type: touch },
{ typeid: "webhook", type: webhook },
] %}
{{ forms.dropdown("triggerType", "single", title, "", options, "typeid", "type", helpText) }}
{% set title %}{% trans "Trigger Code" %}{% endset %}
{% set helpText %}{% trans "If this Action is triggered by a Web Hook then this Trigger Code must be present in the URL `trigger=` parameter." %}{% endset %}
{{ forms.input("triggerCode", title, "", helpText, 'trigger-code-control') }}
{% set title %}{% trans "Action Type" %}{% endset %}
{% set helpText %}{% trans "Please select action Type" %}{% endset %}
{% if source == 'layout' %}
{% set next %}{% trans "Next item in the Schedule" %}{% endset %}
{% set previous %}{% trans "Previous item in the Schedule" %}{% endset %}
{% else %}
{% set next %}{% trans "Next Widget in the Region Timeline" %}{% endset %}
{% set previous %}{% trans "Previous Widget in the Region Timeline" %}{% endset %}
{% endif %}
{% set navLayout %}{% trans "Navigate to Layout" %}{% endset %}
{% set navWidget %}{% trans "Navigate to Widget" %}{% endset %}
{% set options = [
{ typeid: "next", type: next },
{ typeid: "previous", type: previous },
{ typeid: "navLayout", type: navLayout },
{ typeid: "navWidget", type: navWidget },
] %}
{{ forms.dropdown("actionType", "single", title,"", options, "typeid","type", helpText) }}
{% set title %}{% trans "Widget" %}{% endset %}
{% set helpText %}{% trans "Which Widget would you like to Navigate to? The Widget must be in the Interactive drawer for this Layout." %}{% endset %}
{{ forms.dropdown("widgetId", "single", title, "", [{widgetId:null, name:""}]|merge(widgets), "widgetId", "name", helpText, "nav-control-widget") }}
{% set title %}{% trans "Layout Code" %}{% endset %}
{% set helpText %}{% trans "Please enter the Code identifier for the Layout as assigned in the Add / Edit Layout form." %}{% endset %}
{% set attributes = [
{ name: "data-width", value: "100%" },
{ name: "data-search-url", value: url_for("layout.code.search") },
{ name: "data-search-term", value: "code" },
{ name: "data-id-property", value: "code" },
{ name: "data-text-property", value: "code" }
] %}
{{ forms.dropdown("layoutCode", "single", title, "", null, "code", "code", helpText, "pagedSelect nav-control-layout", "", "", "", attributes) }}
{% set title %}{% trans "Target" %}{% endset %}
{% set helpText %}{% trans "If your Widget is a Shell Command you can select to target 'Screen' to run the command without affecting any Regions. For all other Widgets select 'Region' as target." %}{% endset %}
{% set screen %}{% trans "Screen" %}{% endset %}
{% set region %}{% trans "Region" %}{% endset %}
{% set options = [
{ typeid: "screen", type: screen },
{ typeid: "region", type: region },
] %}
{{ forms.dropdown("target", "single", title, "region", options, "typeid", "type", helpText, "target-control") }}
{% set title %}{% trans "Target Region" %}{% endset %}
{% set helpText %}{% trans "Select the Region this Widget will be loaded into." %}{% endset %}
{{ forms.dropdown("targetId", "single", title, "", [{regionId:null, name:""}]|merge(regions), "regionId", "name", helpText, "targetid-control") }}
</form>
</div>
</div>
{% endblock %}