Skip to content
Snippets Groups Projects
Commit 286bd12e authored by VangelisP's avatar VangelisP
Browse files

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

parent b8142a59
No related branches found
No related tags found
No related merge requests found
......@@ -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) == 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) == 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) == 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