Skip to content
Snippets Groups Projects
Commit 4a5d8aa8 authored by jaapjansma's avatar jaapjansma
Browse files

Merge branch '1.x-dev#preset_field_titles' into 'master'

Adds title names automatically on field/filter add (only on new). Implements #1

Closes #1

See merge request extensions/dataprocessor!8
parents b8142a59 df10507c
No related branches found
Tags 1.72
1 merge request!8Adds title names automatically on field/filter add (only on new). Implements #1
......@@ -19,6 +19,11 @@
<div class="content">{$form.type.html}</div>
<div class="clear"></div>
</div>
<div id="type_configuration">
{if ($configuration_template)}
{include file=$configuration_template}
{/if}
</div>
<div class="crm-section">
<div class="label">{$form.title.label}</div>
<div class="content">
......@@ -38,12 +43,6 @@
<div class="content">{$form.name.html}</div>
<div class="clear"></div>
</div>
<div id="type_configuration">
{if ($configuration_template)}
{include file=$configuration_template}
{/if}
</div>
</div>
<div class="crm-submit-buttons">
......@@ -56,6 +55,13 @@
var id = {/literal}{if ($field)}{$field.id}{else}false{/if}{literal};
var data_processor_id = {/literal}{$data_processor_id}{literal};
$(document).on('change','#type_configuration select.crm-form-select',function () {
{/literal}{if $action eq 1}{literal}
var titlepreset = $.trim($('#type_configuration select.crm-form-select option:selected').text().split("::").pop());
$('#title').val(titlepreset).trigger('blur');
{/literal}{/if}{literal};
});
$('#type').on('change', function() {
var type = $('#type').val();
if (type) {
......
......@@ -24,6 +24,11 @@
<div class="content">{$form.type.html}</div>
<div class="clear"></div>
</div>
<div id="type_configuration">
{if ($configuration_template)}
{include file=$configuration_template}
{/if}
</div>
<div class="crm-section">
<div class="label">{$form.title.label}</div>
<div class="content">
......@@ -48,12 +53,6 @@
<div class="content">{$form.is_required.html}</div>
<div class="clear"></div>
</div>
<div id="type_configuration">
{if ($configuration_template)}
{include file=$configuration_template}
{/if}
</div>
</div>
<script type="text/javascript">
......@@ -62,6 +61,13 @@
var id = {/literal}{if ($filter)}{$filter.id}{else}false{/if}{literal};
var data_processor_id = {/literal}{$data_processor_id}{literal};
$(document).on('change','#type_configuration select.crm-form-select',function () {
{/literal}{if $action eq 1}{literal}
var titlepreset = $.trim($('#type_configuration select.crm-form-select option:selected').text().split("::").pop());
$('#title').val(titlepreset).trigger('blur');
{/literal}{/if}{literal};
});
$('#type').on('change', function() {
var type = $('#type').val();
if (type) {
......
......@@ -58,6 +58,10 @@
CRM.$(function($) {
$('#type').on('change', function() {
{/literal}{if $action eq 1}{literal}
var titlepreset = $.trim($('#type option:selected').text().split("::").pop());
$('#title').val(titlepreset).trigger('blur');
{/literal}{/if}{literal};
var type = $('#type').val();
var join_type = $('#join_type').val();
var id = {/literal}{if ($source)}{$source.id}{else}false{/if}{literal};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment