New template button creates new template for broadcast services

This commit is contained in:
Pea Tyczynska
2020-08-10 18:14:36 +01:00
parent bf5ccd044b
commit bdfc0adcc0
2 changed files with 10 additions and 4 deletions

View File

@@ -153,13 +153,19 @@
return changed; return changed;
}; };
this.$broadcastService = (document.querySelector('div[id=add_new_template_form]')).getAttribute("data-broadcast")
this.actionButtonClicked = function(event) { this.actionButtonClicked = function(event) {
event.preventDefault(); event.preventDefault();
this.currentState = $(event.currentTarget).val(); this.currentState = $(event.currentTarget).val();
if (this.stateChanged()) { if (event.currentTarget.value === 'add-new-template' && this.$broadcastService) {
this.render(); return window.location = "/services/" + this.$broadcastService + "/templates/add-broadcast";
} } else {
if (this.stateChanged()) {
this.render();
};
};
}; };
this.selectionStatus = { this.selectionStatus = {

View File

@@ -28,7 +28,7 @@
{{ page_footer('Add new folder', button_name='operation', button_value='add-new-folder') }} {{ page_footer('Add new folder', button_name='operation', button_value='add-new-folder') }}
</fieldset> </fieldset>
</div> </div>
<div id="add_new_template_form"> <div id="add_new_template_form" {% if current_service.has_permission('broadcast') %}data-broadcast="{{current_service.id}}"{% endif %}>
<div class="js-will-stick-at-bottom-when-scrolling"> <div class="js-will-stick-at-bottom-when-scrolling">
{{ radios(templates_and_folders_form.add_template_by_template_type) }} {{ radios(templates_and_folders_form.add_template_by_template_type) }}
</div> </div>