merge improvements
This commit is contained in:
@@ -4,17 +4,32 @@
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="20%"></th>
|
||||
{{#each models}}
|
||||
{{#each dataList}}
|
||||
<th width="5%">
|
||||
<input type="radio" name="check-all" value="{{prop this 'id'}}" data-id="{{id}}" class="pull-right">
|
||||
<input type="radio" name="check-all" value="{{id}}" data-id="{{id}}" class="pull-right">
|
||||
</th>
|
||||
<th width="{{../width}}%">
|
||||
<a href="#{{../scope}}/view/{{prop this 'id'}}">{{get this 'name'}}</a>
|
||||
<a href="#{{../scope}}/view/{{id}}" target="_BLANK">{{name}}</a>
|
||||
</th>
|
||||
{{/each}}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{#if hasCreatedAt}}
|
||||
<tr>
|
||||
<td align="right">
|
||||
{{translate 'createdAt' scope=../scope category='fields'}}
|
||||
</td>
|
||||
{{#each dataList}}
|
||||
<td></td>
|
||||
<td data-id="{{id}}">
|
||||
<div class="field" data-name="createdAt">
|
||||
{{{var createdAtViewName ../../this}}}
|
||||
</div>
|
||||
</td>
|
||||
{{/each}}
|
||||
</tr>
|
||||
{{/if}}
|
||||
{{#each rows}}
|
||||
<tr>
|
||||
<td align="right">
|
||||
@@ -24,8 +39,8 @@
|
||||
<td>
|
||||
<input type="radio" name="{{../name}}" value="{{id}}" data-id="{{id}}" class="pull-right field-radio">
|
||||
</td>
|
||||
<td class="{{id}}">
|
||||
<div class="field" data-name="{{name}}">
|
||||
<td data-id="{{id}}">
|
||||
<div class="field" data-name="{{../name}}">
|
||||
{{{var fieldVariable ../../this}}}
|
||||
</div>
|
||||
</td>
|
||||
|
||||
@@ -52,9 +52,11 @@ Espo.define('views/record/merge', 'view', function (Dep) {
|
||||
}.bind(this));
|
||||
return {
|
||||
rows: rows,
|
||||
models: this.models,
|
||||
modelList: this.models,
|
||||
scope: this.scope,
|
||||
width: Math.round(((80 - this.models.length * 5) / this.models.length * 10)) / 10
|
||||
hasCreatedAt: this.hasCreatedAt,
|
||||
width: Math.round(((80 - this.models.length * 5) / this.models.length * 10)) / 10,
|
||||
dataList: this.getDataList()
|
||||
};
|
||||
},
|
||||
|
||||
@@ -172,7 +174,7 @@ Espo.define('views/record/merge', 'view', function (Dep) {
|
||||
|
||||
this.createView(model.id + '-' + field, viewName, {
|
||||
model: model,
|
||||
el: '.merge .' + model.id + ' .field[data-name="' + field + '"]',
|
||||
el: '.merge [data-id="'+model.id+'"] .field[data-name="' + field + '"]',
|
||||
defs: {
|
||||
name: field,
|
||||
},
|
||||
@@ -182,8 +184,34 @@ Espo.define('views/record/merge', 'view', function (Dep) {
|
||||
}.bind(this));
|
||||
|
||||
}.bind(this));
|
||||
|
||||
this.hasCreatedAt = this.getMetadata().get(['entityDefs', this.scope, 'fields', 'createdAt']);
|
||||
|
||||
if (this.hasCreatedAt) {
|
||||
this.models.forEach(function (model) {
|
||||
this.createView(model.id + '-' + 'createdAt', 'views/fields/datetime', {
|
||||
model: model,
|
||||
el: '.merge [data-id="'+model.id+'"] .field[data-name="createdAt"]',
|
||||
defs: {
|
||||
name: 'createdAt',
|
||||
},
|
||||
mode: 'detail',
|
||||
readOnly: true,
|
||||
});
|
||||
}, this);
|
||||
}
|
||||
},
|
||||
|
||||
getDataList: function () {
|
||||
var dataList = [];
|
||||
this.models.forEach(function (model, i) {
|
||||
var o = {};
|
||||
o.id = model.id;
|
||||
o.name = Handlebars.Utils.escapeExpression(model.get('name'));
|
||||
o.createdAtViewName = model.id + '-' + 'createdAt';
|
||||
dataList.push(o);
|
||||
}, this);
|
||||
return dataList;
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user