Skip to content

Commit

Permalink
Merge pull request #974 from PeterMis/3.0.0-alpha3
Browse files Browse the repository at this point in the history
Adjustments to add and edit action forms
  • Loading branch information
dasgarner authored Sep 3, 2020
2 parents c5c426d + 3727c00 commit 31fd887
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 24 deletions.
17 changes: 17 additions & 0 deletions views/action-designer-javascript.twig
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@
$(dialog).find("#actionType").on('change', function () {
onActionTypeChange(dialog);
});
onTriggerChange(dialog);
$(dialog).find("#triggerType").on('change', function() {
onTriggerChange(dialog);
})
}
function onTargetChange(dialog) {
Expand Down Expand Up @@ -80,6 +85,18 @@
}
}
function onTriggerChange(dialog) {
let triggerType = $(dialog).find("#triggerType").val();
let triggerCode = $(dialog).find(".trigger-code-control");
if (triggerType === 'webhook') {
triggerCode.removeClass('hidden');
} else {
triggerCode.addClass('hidden');
$('#triggerCode').val('');
}
}
function showActionsGrid(source, sourceId) {
// create the table only when we are on Action tab
$('.nav-tabs a').on('shown.bs.tab', function(event) {
Expand Down
26 changes: 16 additions & 10 deletions views/action-form-add.twig
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,21 @@
] %}
{{ forms.dropdown("triggerType", "single", title, "", options, "typeid", "type", helpText) }}

{% if source == 'layout' %}
{% 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) }}
{% endif %}
{% 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 %}
{% set next %}{% trans "Next" %}{% endset %}
{% set previous %}{% trans "Previous" %}{% 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 = [
Expand All @@ -72,7 +77,7 @@
{{ 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 code identifier for the Layout. A Layout can be assigned a Code using Layout Edit." %}{% 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%" },
Expand All @@ -84,7 +89,7 @@
{{ forms.dropdown("layoutCode", "single", title, "", null, "code", "code", helpText, "pagedSelect nav-control-layout", "", "", "", attributes) }}

{% set title %}{% trans "Target" %}{% endset %}
{% set helpText %}{% trans "Where will the Widget be loaded? Usually this will be a Region on this Layout. However if your Widget is a Shell Command you can target the Screen to have the command run without effecting any Regions." %}{% 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 = [
Expand All @@ -93,8 +98,9 @@
] %}
{{ 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", "", "", [{regionId:null, name:""}]|merge(regions), "regionId", "name", helpText, "targetid-control") }}
{{ forms.dropdown("targetId", "single", title, "", [{regionId:null, name:""}]|merge(regions), "regionId", "name", helpText, "targetid-control") }}
</form>
</div>
</div>
Expand Down
26 changes: 16 additions & 10 deletions views/action-form-edit.twig
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,21 @@
] %}
{{ forms.dropdown("triggerType", "single", title, action.triggerType, options, "typeid", "type", helpText) }}

{% if source == 'layout' %}
{% 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, action.triggerCode, helpText) }}
{% endif %}
{% 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, action.triggerCode, helpText, 'trigger-code-control') }}

{% set title %}{% trans "Action Type" %}{% endset %}
{% set helpText %}{% trans "Please select action Type" %}{% endset %}
{% set next %}{% trans "Next" %}{% endset %}
{% set previous %}{% trans "Previous" %}{% 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 = [
Expand All @@ -72,7 +77,7 @@
{{ forms.dropdown("widgetId", "single", title, action.widgetId, [{widgetId:null, name:""}]|merge(widgets), "widgetId", "name", helpText, "nav-control-widget") }}

{% set title %}{% trans "Layout Code" %}{% endset %}
{% set helpText %}{% trans "Please enter code identifier for the Layout. A Layout can be assigned a Code using Layout Edit." %}{% 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%" },
Expand All @@ -84,7 +89,7 @@
{{ forms.dropdown("layoutCode", "single", title, action.layoutCode, layout, "code", "code", helpText, "pagedSelect nav-control-layout", "", "", "", attributes) }}

{% set title %}{% trans "Target" %}{% endset %}
{% set helpText %}{% trans "Where will the Widget be loaded? Usually this will be a Region on this Layout. However if your Widget is a Shell Command you can target the Screen to have the command run without effecting any Regions." %}{% 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 = [
Expand All @@ -93,8 +98,9 @@
] %}
{{ forms.dropdown("target", "single", title,action.target, 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", "", action.targetId, [{regionId:null, name:""}]|merge(regions), "regionId", "name", helpText, "targetid-control") }}
{{ forms.dropdown("targetId", "single", title, action.targetId, [{regionId:null, name:""}]|merge(regions), "regionId", "name", helpText, "targetid-control") }}
</form>
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions views/layout-form-add.twig
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@
{% set helpText %}{% trans "Choose the resolution this Layout should be designed for." %}{% endset %}
{{ forms.dropdown("resolutionId", "single", title, "", resolutions, "resolutionId", "resolution", helpText, "resolution-group") }}

{% set title %}{% trans "Code" %}{% endset %}
{% set helpText %}{% trans "The Code identifier for this Layout - used in Interactive Actions" %}{% endset %}
{% set title %}{% trans "Code Identifier" %}{% endset %}
{% set helpText %}{% trans "Enter a string to be used as the Code to identify this Layout when used with Interactive Actions." %}{% endset %}
{{ forms.input("code", title, "", helpText) }}

{% set title %}{% trans "Enable Stats Collection?" %}{% endset %}
Expand Down
4 changes: 2 additions & 2 deletions views/layout-form-edit.twig
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@
<p>{% trans "This tag requires a set value, please select one from the Tag value dropdown or provide Tag value in the dedicated field." %}</p>
</div>

{% set title %}{% trans "Code" %}{% endset %}
{% set helpText %}{% trans "The Code identifier for this Layout - used in Interactive Actions" %}{% endset %}
{% set title %}{% trans "Code Identifier" %}{% endset %}
{% set helpText %}{% trans "Enter a string to be used as the Code to identify this Layout when used with Interactive Actions." %}{% endset %}
{{ forms.input("code", title, layout.code, helpText) }}

{% set title %}{% trans "Retired" %}{% endset %}
Expand Down

0 comments on commit 31fd887

Please sign in to comment.