Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Render Email input as type="email" #26705

Merged
merged 1 commit into from
Jul 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions CRM/Core/DAO/Email.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*
* Generated from xml/schema/CRM/Core/Email.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
* (GenCodeChecksum:466e1cb583d12b018b7deb2c946c2d44)
* (GenCodeChecksum:df7f07aea847edcfd8aeb02390f2e5ba)
*/

/**
Expand Down Expand Up @@ -288,7 +288,7 @@ public static function &fields() {
'bao' => 'CRM_Core_BAO_Email',
'localizable' => 0,
'html' => [
'type' => 'Text',
'type' => 'Email',
],
'add' => '1.1',
],
Expand Down
3 changes: 2 additions & 1 deletion Civi/Api4/Generic/BasicGetFieldsAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -321,13 +321,14 @@ public function fields() {
'ChainSelect' => ts('Chain-Select'),
'CheckBox' => ts('Checkboxes'),
'Date' => ts('Date Picker'),
'Email' => ts('Email'),
'EntityRef' => ts('Autocomplete Entity'),
'File' => ts('File'),
'Location' => ts('Address Location'),
'Number' => ts('Number'),
'Radio' => ts('Radio Buttons'),
'Select' => ts('Select'),
'Text' => ts('Text'),
'Location' => ts('Address Location'),
],
],
[
Expand Down
6 changes: 6 additions & 0 deletions ext/afform/admin/ang/afGuiEditor/inputType/Email.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<div class="form-inline">
<div class="form-group" ng-repeat="i in $ctrl.getRangeElements('Text')">
<span class="af-field-range-sep" ng-if="i">-</span>
<input autocomplete="off" class="form-control" ng-model="getSet('input_attrs.placeholder' + i)" ng-model-options="$ctrl.editor.debounceWithGetterSetter" type="text" title="{{:: ts('Click to add placeholder text') }}"/>
</div>
</div>
6 changes: 6 additions & 0 deletions ext/afform/core/ang/af/fields/Email.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<input ng-if=":: !$ctrl.defn.search_range" class="form-control" type="email" ng-required="$ctrl.defn.required" id="{{:: fieldId }}" ng-model="getSetValue" ng-model-options="{getterSetter: true}" placeholder="{{:: $ctrl.defn.input_attrs.placeholder }}" >
<div ng-if=":: $ctrl.defn.search_range" class="form-inline">
<input class="form-control" type="email" id="{{:: fieldId }}" ng-model="dataProvider.getFieldData()[$ctrl.fieldName]['>=']" placeholder="{{:: $ctrl.defn.input_attrs.placeholder }}" >
<span class="af-field-range-sep">-</span>
<input class="form-control" type="email" id="{{:: fieldId }}2" ng-model="dataProvider.getFieldData()[$ctrl.fieldName]['<=']" placeholder="{{:: $ctrl.defn.input_attrs.placeholder2 }}" >
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,10 @@
return '~/crmSearchTasks/crmSearchInput/float.html';
}

if (field.input_type === 'Email') {
return '~/crmSearchTasks/crmSearchInput/email.html';
}

return '~/crmSearchTasks/crmSearchInput/text.html';
};

Expand Down
6 changes: 6 additions & 0 deletions ext/search_kit/ang/crmSearchTasks/crmSearchInput/email.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<div class="form-group" ng-if="!$ctrl.isMulti()" >
<input type="email" class="form-control" ng-model="$ctrl.value" ng-required="!$ctrl.field.nullable">
</div>
<div class="form-group" ng-if="$ctrl.isMulti()" >
<input class="form-control" ng-model="$ctrl.value" ng-required="!$ctrl.field.nullable" crm-ui-select="{multiple: true, tags: [], tokenSeparators: [','], formatNoMatches: ''}" ng-list>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ public function testInPlaceEditAndCreate() {
$this->assertEquals('[email protected]', $result[0]['columns'][1]['val']);
$this->assertEquals($email, $result[0]['columns'][1]['edit']['record']['id']);
$this->assertEquals('Email', $result[0]['columns'][1]['edit']['entity']);
$this->assertEquals('Text', $result[0]['columns'][1]['edit']['input_type']);
$this->assertEquals('Email', $result[0]['columns'][1]['edit']['input_type']);
$this->assertEquals('String', $result[0]['columns'][1]['edit']['data_type']);
$this->assertEquals('email', $result[0]['columns'][1]['edit']['value_key']);
$this->assertEquals('update', $result[0]['columns'][1]['edit']['action']);
Expand Down Expand Up @@ -436,7 +436,7 @@ public function testInPlaceEditAndCreate() {
$this->assertNull($result[1]['columns'][1]['val']);
$this->assertEquals(['contact_id' => $contacts[1], 'is_primary' => TRUE], $result[1]['columns'][1]['edit']['record']);
$this->assertEquals('Email', $result[1]['columns'][1]['edit']['entity']);
$this->assertEquals('Text', $result[1]['columns'][1]['edit']['input_type']);
$this->assertEquals('Email', $result[1]['columns'][1]['edit']['input_type']);
$this->assertEquals('String', $result[1]['columns'][1]['edit']['data_type']);
$this->assertEquals('email', $result[1]['columns'][1]['edit']['value_key']);
$this->assertEquals('create', $result[1]['columns'][1]['edit']['action']);
Expand Down
2 changes: 1 addition & 1 deletion xml/schema/Core/Email.xml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
<type>varchar</type>
<length>254</length>
<html>
<type>Text</type>
<type>Email</type>
<size>30</size>
</html>
<import>true</import>
Expand Down