phone number 2

This commit is contained in:
Yuri Kuznetsov
2014-07-02 16:33:02 +03:00
parent 3d7d4eb7db
commit 8b80df2f91
13 changed files with 62 additions and 15 deletions
@@ -12,7 +12,8 @@
},
"phoneNumber": {
"type": "phone",
"options": ["Office", "Fax", "Other"]
"typeList": ["Office", "Fax", "Other"],
"defaultType": "Office"
},
"type": {
"type": "enum",
@@ -30,7 +30,8 @@
},
"phoneNumber": {
"type": "phone",
"options": ["Mobile", "Office", "Home", "Fax", "Other"]
"typeList": ["Mobile", "Office", "Home", "Fax", "Other"],
"defaultType": "Mobile"
},
"doNotCall": {
"type": "bool"
@@ -69,7 +69,8 @@
},
"phoneNumber": {
"type": "phone",
"options": ["Mobile", "Office", "Home", "Fax", "Other"]
"typeList": ["Mobile", "Office", "Home", "Fax", "Other"],
"defaultType": "Mobile"
},
"doNotCall": {
"type": "bool"
@@ -54,7 +54,8 @@
},
"phoneNumber": {
"type": "phone",
"options": ["Mobile", "Office", "Home", "Fax", "Other"]
"typeList": ["Mobile", "Office", "Home", "Fax", "Other"],
"defaultType": "Mobile"
},
"doNotCall": {
"type": "bool"
@@ -41,7 +41,8 @@
},
"phoneNumber": {
"type": "phone",
"options": ["Mobile", "Office", "Home", "Fax", "Other"]
"typeList": ["Mobile", "Office", "Home", "Fax", "Other"],
"defaultType": "Mobile"
},
"token": {
"type": "varchar",
@@ -6,9 +6,14 @@
"default":false
},
{
"name":"options",
"name":"typeList",
"type":"array",
"options": ["Mobile", "Office", "Home", "Fax", "Other"]
"options": ["Mobile", "Office", "Home", "Fax", "Other"]
},
{
"name":"defaultType",
"type":"varchar",
"default": "Mobile"
}
],
"notActualFields":[
+1 -1
View File
File diff suppressed because one or more lines are too long
@@ -13,7 +13,7 @@
<button class="btn btn-default email-property{{#if invalid}} active{{/if}}" type="button" tabindex="-1" data-action="switchEmailProperty" data-property-type="invalid" data-toggle="tooltip" data-placement="top" title="{{translate 'Invalid' scope='EmailAddress'}}">
<span class="glyphicon glyphicon-exclamation-sign{{#unless invalid}} text-muted{{/unless}}"></span>
</button>
<button class="btn btn-default" style="margin-left: 5px;" type="button" tabindex="-1" data-action="removeEmailAddress" data-property-type="invalid" data-toggle="tooltip" data-placement="top" title="{{translate 'Remove'}}">
<button class="btn btn-link" style="margin-left: 5px;" type="button" tabindex="-1" data-action="removeEmailAddress" data-property-type="invalid" data-toggle="tooltip" data-placement="top" title="{{translate 'Remove'}}">
<span class="glyphicon glyphicon-remove"></span>
</button>
</span>
@@ -1,3 +1,10 @@
{{#if value}}
<a href="tel:{{value}}">{{value}}</a>
{{#if phoneNumberData}}
{{#each phoneNumberData}}
<div>
<a href="tel:{{phoneNumber}}" data-phone-number="{{phoneNumber}}" data-action="dial">{{phoneNumber}}</a>
<span class="text-muted text-small"></span>
</div>
{{/each}}
{{else}}
<a href="tel:{{value}}" data-phone-number="{{value}}" data-action="dial">{{value}}</a>
{{/if}}
@@ -0,0 +1,22 @@
<div>
{{#each phoneNumberData}}
<div class="input-group phone-number-block">
<span class="input-group-btn">
<select data-property-type="type" class="form-control">{{options ../params.typeList type scope=../scope field=../name}}</select>
</span>
<input type="input" class="form-control phone-number" value="{{phoneNumber}}" autocomplete="off">
<span class="input-group-btn">
<button class="btn btn-default phone-property{{#if primary}} active{{/if}}" type="button" tabindex="-1" data-action="switchPhoneProperty" data-property-type="primary" data-toggle="tooltip" data-placement="top" title="{{translate 'Primary' scope='PhoneNumber'}}">
<span class="glyphicon glyphicon-star{{#unless primary}} text-muted{{/unless}}"></span>
</button>
<button class="btn btn-link" style="margin-left: 5px;" type="button" tabindex="-1" data-action="removePhoneNumber" data-property-type="invalid" data-toggle="tooltip" data-placement="top" title="{{translate 'Remove'}}">
<span class="glyphicon glyphicon-remove"></span>
</button>
</span>
</div>
{{/each}}
</div>
<button class="btn btn-default" type="button" data-action="addPhoneNumber"><span class="glyphicon glyphicon-plus"></span></button>
@@ -1 +1 @@
<a href="javascript:" data-email-address="{{value}}" data-action="mailTo">{{value}}</a>
<a href="tel:{{value}}" data-phone-number="{{value}}" data-action="dial">{{value}}</a>
+3 -3
View File
@@ -46,11 +46,11 @@ Espo.define('Views.Fields.Phone', 'Views.Fields.Base', function (Dep) {
data: function () {
var phoneNumberData;
if (this.mode == 'edit') {
phoneNumberData = Espo.Utils.clone(this.model.get(this.dataFieldName));
phoneNumberData = Espo.Utils.cloneDeep(this.model.get(this.dataFieldName));
if (this.model.isNew()) {
if (!this.defaultType) {
this.defaultType = (this.getMetadata().get('entityDefs.' + this.model.name + '.fields.' + this.name + '.options') || [''])[0];
this.defaultType = this.getMetadata().get('entityDefs.' + this.model.name + '.fields.' + this.name + '.defaultType');
}
if (!phoneNumberData || !phoneNumberData.length) {
phoneNumberData = [{
@@ -150,7 +150,7 @@ Espo.define('Views.Fields.Phone', 'Views.Fields.Base', function (Dep) {
this.dataFieldName = this.name + 'Data';
if (this.mode == 'detail' || this.mode == 'edit') {
this.listenTo(this.model, 'change:' + this.dataFieldName, function () {
this.listenTo(this.model, 'change:' + this.dataFieldName, function () {
this.render();
}, this);
}
+8
View File
@@ -256,6 +256,14 @@ select[multiple].input-sm {
height: 90px !important;
}
.input-group-btn > select.form-control {
position: relative;
display: inline-block;
width: auto;
vertical-align: middle;
margin-right: -1px;
}
.panel-body > .list-container > .list-expanded {
margin-left: -15px;
margin-right: -15px;