detail view refactor

This commit is contained in:
yuri
2015-12-07 17:08:17 +02:00
parent 0da898a242
commit ea5d27a87f
44 changed files with 488 additions and 303 deletions
+2 -2
View File
File diff suppressed because one or more lines are too long
@@ -1,20 +1,20 @@
<div class="row">
<div class="cell cell-users col-sm-6 form-group">
<label class="field-label-users control-label">{{translate 'users' category='links' scope='TargetList'}}</label>
<div class="field field-users">{{{users}}}</div>
<div class="cell col-sm-6 form-group" data-name="users">
<label class="control-label" data-name="users">{{translate 'users' category='links' scope='TargetList'}}</label>
<div class="field" data-name="users">{{{users}}}</div>
</div>
<div class="cell cell-contacts col-sm-6 form-group">
<label class="field-label-users control-label">{{translate 'contacts' category='links' scope='TargetList'}}</label>
<div class="field field-contacts">{{{contacts}}}</div>
<div class="cell col-sm-6 form-group" data-name="contacts">
<label class="control-label" data-name="contacts">{{translate 'contacts' category='links' scope='TargetList'}}</label>
<div class="field" data-name="contacts">{{{contacts}}}</div>
</div>
</div>
<div class="row">
<div class="cell cell-leads col-sm-6 form-group">
<label class="field-label-users control-label">{{translate 'leads' category='links' scope='TargetList'}}</label>
<div class="field field-leads">{{{leads}}}</div>
<div class="cell col-sm-6 form-group" data-name="leads">
<label class="control-label" data-name="leads">{{translate 'leads' category='links' scope='TargetList'}}</label>
<div class="field" data-name="leads">{{{leads}}}</div>
</div>
<div class="cell cell-accounts col-sm-6 form-group">
<label class="field-label-users control-label">{{translate 'accounts' category='links' scope='TargetList'}}</label>
<div class="field field-accounts">{{{accounts}}}</div>
<div class="cell col-sm-6 form-group" data-name="accounts">
<label class="control-label" data-name="accounts">{{translate 'accounts' category='links' scope='TargetList'}}</label>
<div class="field" data-name="accounts">{{{accounts}}}</div>
</div>
</div>
@@ -11,8 +11,8 @@
</div>
<div class="cell cell-dateStart form-group">
<div class="field field-dateStart">
<div class="cell form-group" data-name="dateStart">
<div class="field" data-name="dateStart">
{{{dateStart}}}
</div>
</div>
@@ -47,7 +47,7 @@ Espo.define('crm:views/mass-email/modals/send-test', ['views/modal', 'model'], f
this.createView('users', 'views/fields/link-multiple', {
model: model,
el: this.options.el + ' .field-users',
el: this.options.el + ' .field[data-name="users"]',
foreignScope: 'User',
defs: {
name: 'users',
@@ -59,7 +59,7 @@ Espo.define('crm:views/mass-email/modals/send-test', ['views/modal', 'model'], f
this.createView('contacts', 'views/fields/link-multiple', {
model: model,
el: this.options.el + ' .field-contacts',
el: this.options.el + ' .field[data-name="contacts"]',
foreignScope: 'Contact',
defs: {
name: 'contacts',
@@ -71,7 +71,7 @@ Espo.define('crm:views/mass-email/modals/send-test', ['views/modal', 'model'], f
this.createView('leads', 'views/fields/link-multiple', {
model: model,
el: this.options.el + ' .field-leads',
el: this.options.el + ' .field[data-name="leads"]',
foreignScope: 'Lead',
defs: {
name: 'leads',
@@ -83,7 +83,7 @@ Espo.define('crm:views/mass-email/modals/send-test', ['views/modal', 'model'], f
this.createView('accounts', 'views/fields/link-multiple', {
model: model,
el: this.options.el + ' .field-accounts',
el: this.options.el + ' .field[data-name="accounts"]',
foreignScope: 'Account',
defs: {
name: 'accounts',
@@ -49,7 +49,7 @@ Espo.define('Crm:Views.Meeting.PopupNotification', 'Views.PopupNotification', fu
this.createView('dateStart', 'Fields.Datetime', {
model: model,
mode: 'detail',
el: this.options.el + ' .field-dateStart',
el: this.options.el + ' .field[data-name="dateStart"]',
defs: {
name: 'dateStart'
},
+4 -6
View File
@@ -1,6 +1,5 @@
<% _.each(layout, function (panel, columnNumber) { %>
<div class="panel panel-default"<% if (panel.name) print(' data-panel-name="'+panel.name+'"') %>>
<div class="panel panel-default<% if (panel.name) { %>{{#if hiddenPanels.<%= panel.name %>}} hidden{{/if}}<% } %>"<% if (panel.name) print(' data-panel-name="'+panel.name+'"') %>>
{{#if "<%= panel.label %>"}}
<div class="panel-heading"><h4 class="panel-title"><%= "{{translate \"" + panel.label + "\" scope=\""+model.name+"\"}}" %></h4></div>
{{/if}}
@@ -9,8 +8,8 @@
<div class="row">
<% _.each(row, function (cell, cellNumber) { %>
<% if (cell != false) { %>
<div class="cell cell-<%= cell.name %> <% if (columnCount == 1 || cell.fullWidth) { %>col-sm-12<% } else {%> col-sm-6 <% } %> form-group">
<label class="field-label-<%= cell.name %> control-label">
<div class="cell <% if (columnCount == 1 || cell.fullWidth) { %>col-sm-12<% } else {%> col-sm-6 <% } %> form-group<% if (cell.name) { %>{{#if hiddenFields.<%= cell.name %>}} hidden-cell{{/if}}<% } %>">
<label class="control-label<% if (cell.name) { %>{{#if hiddenFields.<%= cell.name %>}} hidden{{/if}}<% } %>" data-name="<%= cell.name %>">
<%
if ('customLabel' in cell) {
print (cell.customLabel);
@@ -19,7 +18,7 @@
}
%>
</label>
<div class="field field-<%= cell.name %>">
<div class="field <% if (cell.name) { %>{{#if hiddenFields.<%= cell.name %>}} hidden{{/if}}<% } %>" data-name="<%= cell.name %>">
<%
if ('customCode' in cell) {
print (cell.customCode);
@@ -37,5 +36,4 @@
<% }); %>
</div>
</div>
<% }); %>
@@ -1,43 +1,43 @@
<div class="row">
<div class="cell cell-name form-group col-md-6">
<label class="field-label-name control-label">{{translate 'name' category='fields' scope='EntityManager'}}</label>
<div class="field field-name">
<div class="cell form-group col-md-6" data-name="name">
<label class="control-label" data-name="name">{{translate 'name' category='fields' scope='EntityManager'}}</label>
<div class="field" data-name="name">
{{{name}}}
</div>
</div>
<div class="cell cell-type form-group col-md-6">
<label class="field-label-type control-label">{{translate 'type' category='fields' scope='EntityManager'}}</label>
<div class="field field-type">
<div class="cell form-group col-md-6" data-name="type">
<label class="control-label" data-name="type">{{translate 'type' category='fields' scope='EntityManager'}}</label>
<div class="field" data-name="type">
{{{type}}}
</div>
</div>
</div>
<div class="row">
<div class="cell cell-labelSingular form-group col-md-6">
<label class="field-label-labelSingular control-label">{{translate 'labelSingular' category='fields' scope='EntityManager'}}</label>
<div class="field field-labelSingular">
<div class="cell form-group col-md-6" data-name="labelSingular">
<label class="control-label" data-name="labelSingular">{{translate 'labelSingular' category='fields' scope='EntityManager'}}</label>
<div class="field" data-name="labelSingular">
{{{labelSingular}}}
</div>
</div>
<div class="cell cell-labelPlural form-group col-md-6">
<label class="field-label-labelPlural control-label">{{translate 'labelPlural' category='fields' scope='EntityManager'}}</label>
<div class="field field-labelPlural">
<div class="cell form-group col-md-6" data-name="labelPlural">
<label class="control-label" data-name="labelPlural">{{translate 'labelPlural' category='fields' scope='EntityManager'}}</label>
<div class="field" data-name="labelPlural">
{{{labelPlural}}}
</div>
</div>
</div>
<div class="row">
<div class="cell cell-disabled form-group col-md-6">
<label class="field-label-disabled control-label">{{translate 'disabled' category='fields' scope='EntityManager'}}</label>
<div class="field field-disabled">
<div class="cell form-group col-md-6" data-name="disabled">
<label class="control-label" data-name="disabled">{{translate 'disabled' category='fields' scope='EntityManager'}}</label>
<div class="field" data-name="disabled">
{{{disabled}}}
</div>
</div>
{{#if stream}}
<div class="cell cell-stream form-group col-md-6">
<label class="field-label-stream control-label">{{translate 'stream' category='fields' scope='EntityManager'}}</label>
<div class="field field-stream">
<div class="cell form-group col-md-6" data-name="stream">
<label class="control-label" data-name="stream">{{translate 'stream' category='fields' scope='EntityManager'}}</label>
<div class="field" data-name="stream">
{{{stream}}}
</div>
</div>
@@ -46,15 +46,15 @@
{{#if sortBy}}
<div class="row">
<div class="cell cell-sortBy form-group col-md-6">
<label class="field-label-sortBy control-label">{{translate 'sortBy' category='fields' scope='EntityManager'}}</label>
<div class="field field-sortBy">
<div class="cell form-group col-md-6" data-name="sortBy">
<label class="control-label" data-name="sortBy">{{translate 'sortBy' category='fields' scope='EntityManager'}}</label>
<div class="field" data-name="sortBy">
{{{sortBy}}}
</div>
</div>
<div class="cell cell-sortDirection form-group col-md-6">
<label class="field-label-sortDirection control-label">{{translate 'sortDirection' category='fields' scope='EntityManager'}}</label>
<div class="field field-sortDirection">
<div class="cell form-group col-md-6" data-name="sortDirection">
<label class="control-label" data-name="sortDirection">{{translate 'sortDirection' category='fields' scope='EntityManager'}}</label>
<div class="field" data-name="sortDirection">
{{{sortDirection}}}
</div>
</div>
@@ -7,23 +7,23 @@
<div class="col-sm-6">
<div class="panel panel-default">
<div class="panel-body">
<div class="cell cell-type form-group">
<label class="control-label">{{translate 'type' scope='Admin' category='fields'}}</label>
<div class="field field-type">{{translate type scope='Admin' category='fieldTypes'}}</div>
<div class="cell form-group" data-name="type">
<label class="control-label" data-name="type">{{translate 'type' scope='Admin' category='fields'}}</label>
<div class="field" data-name="type">{{translate type scope='Admin' category='fieldTypes'}}</div>
</div>
<div class="cell cell-name form-group">
<label class="control-label">{{translate 'name' scope='Admin' category='fields'}}</label>
<div class="field field-name">{{{name}}}</div>
<div class="cell form-group" data-name="name">
<label class="control-label" data-name="name">{{translate 'name' scope='Admin' category='fields'}}</label>
<div class="field" data-name="name">{{{name}}}</div>
</div>
<div class="cell cell-label form-group">
<label class="control-label">{{translate 'label' scope='Admin' category='fields'}}</label>
<div class="field field-label">{{{label}}}</div>
<div class="cell form-group" data-name="label">
<label class="control-label" data-name="label">{{translate 'label' scope='Admin' category='fields'}}</label>
<div class="field" data-name="label">{{{label}}}</div>
</div>
{{#each params}}
{{#unless hidden}}
<div class="cell cell-{{../name}} form-group">
<label class="control-label">{{translate ../name scope='Admin' category='fields'}}</label>
<div class="field field-{{../name}}">{{{var ../name ../../this}}}</div>
<div class="cell form-group" data-name="{{../name}}">
<label class="control-label" data-name="{{../name}}">{{translate ../name scope='Admin' category='fields'}}</label>
<div class="field" data-name="{{../name}}">{{{var ../name ../../this}}}</div>
</div>
{{/unless}}
{{/each}}
@@ -4,22 +4,22 @@
</div>
<div class="row">
<div class="col-sm-6">
<div class="cell cell-enabled form-group">
<label class="control-label">{{translate 'enabled' scope='Integration' category='fields'}}</label>
<div class="field field-enabled">{{{enabled}}}</div>
</div>
<div class="col-sm-6">
<div class="cell form-group" data-name="enabled">
<label class="control-label" data-name="enabled">{{translate 'enabled' scope='Integration' category='fields'}}</label>
<div class="field" data-name="enabled">{{{enabled}}}</div>
</div>
{{#each dataFieldList}}
<div class="cell cell-{{./this}} form-group">
<label class="control-label field-label-{{./this}}">{{translate this scope='Integration' category='fields'}}</label>
<div class="field field-{{this}}">{{{var this ../this}}}</div>
<div class="cell form-group" data-name="{{./this}}">
<label class="control-label" data-name="{{./this}}">{{translate this scope='Integration' category='fields'}}</label>
<div class="field" data-name="{{./this}}">{{{var this ../this}}}</div>
</div>
{{/each}}
</div>
<div class="col-sm-6">
{{#if helpText}}
<div class="well">
{{{../helpText}}}
<div class="well">
{{{../helpText}}}
</div>
{{/if}}
</div>
@@ -4,28 +4,28 @@
</div>
<div class="row">
<div class="col-sm-6">
<div class="cell cell-enabled form-group">
<label class="control-label">{{translate 'enabled' scope='Integration' category='fields'}}</label>
<div class="field field-enabled">{{{enabled}}}</div>
</div>
<div class="col-sm-6">
<div class="cell form-group" data-name="enabled">
<label class="control-label" data-name="enabled">{{translate 'enabled' scope='Integration' category='fields'}}</label>
<div class="field" data-name="enabled">{{{enabled}}}</div>
</div>
{{#each dataFieldList}}
<div class="cell cell-{{./this}} form-group">
<label class="control-label field-label-{{./this}}">{{translate this scope='Integration' category='fields'}}</label>
<div class="field field-{{this}}">{{{var this ../this}}}</div>
<div class="cell form-group" data-name="{{./this}}">
<label class="control-label" data-name="{{./this}}">{{translate this scope='Integration' category='fields'}}</label>
<div class="field" data-name="{{./this}}">{{{var this ../this}}}</div>
</div>
{{/each}}
<div class="cell cell-enabled form-group">
<label class="control-label field-label-redirectUri">{{translate 'redirectUri' scope='Integration' category='fields'}}</label>
<div class="field field-enabled">
<div class="cell form-group" data-name="redirectUri">
<label class="control-label" data-name="redirectUri">{{translate 'redirectUri' scope='Integration' category='fields'}}</label>
<div class="field" data-name="redirectUri">
<input type="text" class="form-control" readonly value="{{redirectUri}}">
</div>
</div>
</div>
</div>
<div class="col-sm-6">
{{#if helpText}}
<div class="well">
{{{../helpText}}}
<div class="well">
{{{../helpText}}}
</div>
{{/if}}
</div>
@@ -1,6 +1,6 @@
{{#each attributeList}}
<div class="cell cell-{{./this}} form-group">
<label class="field-label-{{./this}} control-label">{{translate this category='fields' scope='LayoutManager'}}</label>
<div class="field field-{{./this}}">{{{var this ../this}}}</div>
<div class="cell form-group" data-name="{{./this}}">
<label class="control-label" data-name="{{./this}}">{{translate this category='fields' scope='LayoutManager'}}</label>
<div class="field" data-name="{{./this}}">{{{var this ../this}}}</div>
</div>
{{/each}}
@@ -1,67 +1,67 @@
<div class="row">
<div class="cell cell-entityForeign form-group col-md-4 col-md-offset-4">
<label class="field-label-entityForeign control-label">{{translate 'entityForeign' category='fields' scope='EntityManager'}}</label>
<div class="field field-entityForeign">
<div class="cell form-group col-md-4 col-md-offset-4" data-name="entityForeign">
<label class="control-label" data-name="entityForeign">{{translate 'entityForeign' category='fields' scope='EntityManager'}}</label>
<div class="field" data-name="entityForeign">
{{{entityForeign}}}
</div>
</div>
</div>
<div class="row">
<div class="cell cell-linkType form-group col-md-4 col-md-offset-4">
<label class="field-label-linkType control-label">{{translate 'linkType' category='fields' scope='EntityManager'}}</label>
<div class="field field-linkType">
<div class="cell form-group col-md-4 col-md-offset-4" data-name="linkType">
<label class="control-label" data-name="linkType">{{translate 'linkType' category='fields' scope='EntityManager'}}</label>
<div class="field" data-name="linkType">
{{{linkType}}}
</div>
</div>
</div>
<div class="row">
<div class="cell cell-linkForeign form-group col-md-4">
<label class="field-label-linkForeign control-label">{{translate 'name' category='fields' scope='EntityManager'}}</label>
<div class="field field-linkForeign">
<div class="cell form-group col-md-4" data-name="linkForeign">
<label class="control-label" data-name="linkForeign">{{translate 'name' category='fields' scope='EntityManager'}}</label>
<div class="field" data-name="linkForeign">
{{{linkForeign}}}
</div>
</div>
<div class="cell form-group col-md-4 cell-relationName">
<div class="cell form-group col-md-4" data-name="relationName">
{{#if relationName}}
<label class="field-label-relationName control-label">{{translate 'relationName' category='fields' scope='EntityManager'}}</label>
<div class="field field-relationName">
<label class="control-label" data-name="relationName">{{translate 'relationName' category='fields' scope='EntityManager'}}</label>
<div class="field" data-name="relationName">
{{{relationName}}}
</div>
{{/if}}
</div>
<div class="cell cell-link form-group col-md-4">
<label class="field-label-link control-label">{{translate 'name' category='fields' scope='EntityManager'}}</label>
<div class="field field-link">
<div class="cell form-group col-md-4" data-name="link">
<label class="control-label" data-name="link">{{translate 'name' category='fields' scope='EntityManager'}}</label>
<div class="field" data-name="link">
{{{link}}}
</div>
</div>
</div>
<div class="row">
<div class="cell cell-labelForeign form-group col-md-4">
<label class="field-label-labelForeign control-label">{{translate 'label' category='fields' scope='EntityManager'}}</label>
<div class="field field-labelForeign">
<div class="cell form-group col-md-4" data-name="labelForeign">
<label class="control-label" data-name="labelForeign">{{translate 'label' category='fields' scope='EntityManager'}}</label>
<div class="field" data-name="labelForeign">
{{{labelForeign}}}
</div>
</div>
<div class="cell form-group col-md-4"></div>
<div class="cell cell-label form-group col-md-4">
<label class="field-label-label control-label">{{translate 'label' category='fields' scope='EntityManager'}}</label>
<div class="field field-label">
<div class="cell form-group col-md-4" data-name="label">
<label class="control-label" data-name="label">{{translate 'label' category='fields' scope='EntityManager'}}</label>
<div class="field" data-name="label">
{{{label}}}
</div>
</div>
</div>
<div class="row">
<div class="cell cell-linkMultipleFieldForeign form-group col-md-4">
<label class="field-label-linkMultipleFieldForeign control-label">{{translate 'linkMultipleField' category='fields' scope='EntityManager'}}</label>
<div class="field field-linkMultipleFieldForeign">
<div class="cell form-group col-md-4" data-name="linkMultipleFieldForeign">
<label class="control-label" data-name="linkMultipleFieldForeign">{{translate 'linkMultipleField' category='fields' scope='EntityManager'}}</label>
<div class="field" data-name="linkMultipleFieldForeign">
{{{linkMultipleFieldForeign}}}
</div>
</div>
<div class="cell form-group col-md-4"></div>
<div class="cell cell-linkMultipleField form-group col-md-4">
<label class="field-label-linkMultipleField control-label">{{translate 'linkMultipleField' category='fields' scope='EntityManager'}}</label>
<div class="field field-linkMultipleField">
<div class="cell form-group col-md-4" data-name="linkMultipleField">
<label class="control-label" data-name="linkMultipleField">{{translate 'linkMultipleField' category='fields' scope='EntityManager'}}</label>
<div class="field" data-name="linkMultipleField">
{{{linkMultipleField}}}
</div>
</div>
@@ -4,11 +4,11 @@
</div>
<div class="row">
<div class="col-sm-6">
<div class="col-sm-6">
<div>
<div class="cell cell-enabled form-group">
<label class="control-label">{{translate 'enabled' scope='Integration' category='fields'}}</label>
<div class="field field-enabled">{{{enabled}}}</div>
<div class="cell form-group" data-name="enabled">
<label class="control-label" data-name="enabled">{{translate 'enabled' scope='Integration' category='fields'}}</label>
<div class="field" data-name="enabled">{{{enabled}}}</div>
</div>
</div>
<div class="data-panel">
@@ -18,8 +18,8 @@
</div>
<div class="col-sm-6">
{{#if helpText}}
<div class="well">
{{{../helpText}}}
<div class="well">
{{{../helpText}}}
</div>
{{/if}}
</div>
@@ -1,13 +1,13 @@
<div class="cell cell-currentPassword form-group">
<label class="field-label-currentPassword control-label">{{translate 'currentPassword' scope='User' category='fields'}}</label>
<div class="field field-currentPassword">{{{currentPassword}}}</div>
<div class="cell form-group" data-name="currentPassword">
<label class="control-label" data-name="currentPassword">{{translate 'currentPassword' scope='User' category='fields'}}</label>
<div class="field" data-name="currentPassword">{{{currentPassword}}}</div>
</div>
<div class="cell cell-password form-group">
<label class="field-label-password control-label">{{translate 'newPassword' scope='User' category='fields'}}</label>
<div class="field field-password">{{{password}}}</div>
<div class="cell form-group" data-name="password">
<label class="control-label" data-name="password">{{translate 'newPassword' scope='User' category='fields'}}</label>
<div class="field" data-name="password">{{{password}}}</div>
</div>
<div class="cell cell-passwordConfirm form-group">
<label class="field-label-passwordConfirm control-label">{{translate 'passwordConfirm' scope='User' category='fields'}}</label>
<div class="field field-passwordConfirm">{{{passwordConfirm}}}</div>
<div class="cell form-group" data-name="passwordConfirm">
<label class="control-label" data-name="passwordConfirm">{{translate 'passwordConfirm' scope='User' category='fields'}}</label>
<div class="field" data-name="passwordConfirm">{{{passwordConfirm}}}</div>
</div>
@@ -1,6 +1,6 @@
<div class="cell cell-dashboardTabList form-group">
<label class="field-label-dashboardTabList control-label">{{translate 'dashboardTabList' category='fields' scope="Preferences"}}</label>
<div class="field field-dashboardTabList">
<div class="cell form-group" data-name="dashboardTabList">
<label class="control-label" data-name="dashboardTabList">{{translate 'dashboardTabList' category='fields' scope="Preferences"}}</label>
<div class="field" data-name="dashboardTabList">
{{{dashboardTabList}}}
</div>
</div>
@@ -1,13 +1,13 @@
<div class="cell cell-userName form-group">
<label class="field-label-userName control-label">{{translate 'Username' scope='User'}}</label>
<div class="field field-userName">
<div class="cell form-group" data-name="userName">
<label class="control-label" data-name="userName">{{translate 'Username' scope='User'}}</label>
<div class="field" data-name="userName">
<input type="text" name="userName" class="form-control" autocomplete="off" autocorrect="off" autocapitalize="off">
</div>
</div>
<div class="cell cell-emailAddress form-group">
<label class="field-label-emailAddress control-label">{{translate 'Email Address' scope='User'}}</label>
<div class="field field-emailAddress">
<div class="cell form-group" data-name="emailAddress">
<label class="control-label" data-name="emailAddress">{{translate 'Email Address' scope='User'}}</label>
<div class="field" data-name="emailAddress">
<input type="text" name="emailAddress" class="form-control" autocomplete="off" autocorrect="off" autocapitalize="off">
</div>
</div>
@@ -1,6 +1,6 @@
<div class="cell cell-name form-group">
<label class="field-label-name control-label">{{translate 'Name' category='fields'}}</label>
<div class="field field-name">
<div class="cell form-group" data-name="name">
<label class="control-label" data-name="name">{{translate 'Name' category='fields'}}</label>
<div class="field" data-name="name">
{{{name}}}
</div>
</div>
@@ -25,7 +25,7 @@
<input type="radio" name="{{../name}}" value="{{id}}" data-id="{{id}}" class="pull-right field-radio">
</td>
<td class="{{id}}">
<div class="field field-{{name}}">
<div class="field" data-name="{{name}}">
{{{var fieldVariable ../../this}}}
</div>
</td>
@@ -1,8 +1,8 @@
<div class="row">
{{#each fieldList}}
<div class="cell cell-{{./this}} form-group col-sm-6 col-md-12">
<label class="control-label field-label-{{./this}}">{{translate this scope=../model.name category='fields'}}</label>
<div class="field field-{{./this}}">
<div class="cell form-group col-sm-6 col-md-12" data-name="{{./this}}">
<label class="control-label" data-name="{{./this}}">{{translate this scope=../model.name category='fields'}}</label>
<div class="field" data-name="{{./this}}">
{{{var this ../this}}}
</div>
</div>
@@ -14,8 +14,7 @@
<div class="cell form-group col-sm-6 col-md-12">
<label class="control-label">{{translate 'Created'}}</label>
<div class="field">
<span class="field-createdAt">{{{createdAt}}}</span> <span class="text-muted">&raquo;</span> <span class="field-createdBy">{{{createdBy}}}</span>
<span data-name="createdAt">{{{createdAt}}}</span> <span class="text-muted">&raquo;</span> <span data-name="createdBy">{{{createdBy}}}</span>
</div>
</div>
{{/ifAttrNotEmpty}}
@@ -24,7 +23,7 @@
<div class="cell form-group col-sm-6 col-md-12">
<label class="control-label">{{translate 'Modified'}}</label>
<div class="field">
<span class="field-modifiedAt">{{{modifiedAt}}}</span> <span class="text-muted">&raquo;</span> <span class="field-modifiedBy">{{{modifiedBy}}}</span>
<span data-name="modifiedAt">{{{modifiedAt}}}</span> <span class="text-muted">&raquo;</span> <span data-name="modifiedBy">{{{modifiedBy}}}</span>
</div>
</div>
{{/ifAttrNotEmpty}}
@@ -33,9 +32,9 @@
<div class="row">
{{#if followers}}
<div class="cell form-group col-sm-6 col-md-12">
<label class="control-label field-label-followers">{{translate 'Followers'}}</label>
<div class="field field-followers">
<div class="cell form-group col-sm-6 col-md-12" data-name="followers">
<label class="control-label" data-name="followers">{{translate 'Followers'}}</label>
<div class="field" data-name="followers">
{{{followers}}}
</div>
</div>
@@ -1,12 +1,12 @@
<div class="row">
{{#each fieldList}}
<div class="cell cell-{{./this}} form-group col-sm-6 col-md-12">
<label class="control-label field-label-{{./this}}">
{{translate this scope=../model.name category='fields'}}
</label>
<div class="field field-{{./this}}">
{{{var this ../this}}}
{{#each fieldList}}
<div class="cell form-group col-sm-6 col-md-12" data-name="{{./this}}">
<label class="control-label" data-name="{{./this}}">
{{translate this scope=../model.name category='fields'}}
</label>
<div class="field" data-name="{{./this}}">
{{{var this ../this}}}
</div>
</div>
</div>
{{/each}}
{{/each}}
</div>
@@ -1,8 +1,8 @@
<div class="form-group">
<a href="javascript:" class="remove-filter pull-right" data-name="{{name}}">{{#unless notRemovable}}<i class="glyphicon glyphicon-remove"></i>{{/unless}}</a>
<label class="cotrol-label small">{{translate name category='fields' scope=scope}}</label>
<div class="field field-{{name}}">{{{field}}}</div>
<label class="cotrol-label small" data-name="{{name}}">{{translate name category='fields' scope=scope}}</label>
<div class="field" data-name="{{name}}">{{{field}}}</div>
</div>
@@ -1,6 +1,6 @@
<div class="row">
<div class="cell cell-post col-sm-12 form-group">
<div class="field field-post">{{{post}}}</div>
<div class="cell col-sm-12 form-group" data-name="post">
<div class="field" data-name="post">{{{post}}}</div>
</div>
</div>
<div class="row post-control{{#if interactiveMode}} hidden{{/if}}">
@@ -10,19 +10,19 @@
{{#if interactiveMode}}
<button type="button" class="btn btn-primary post pull-left">{{translate 'Post'}}</button>
{{/if}}
<div class="field field-attachments" style="display: inline-block;">{{{attachments}}}</div>
<div class="field" style="display: inline-block;" data-name="attachments">{{{attachments}}}</div>
</div>
</div>
<div class="col-sm-6">
<div class="cell cell-targetType form-group">
<div class="field field-targetType">{{{targetType}}}</div>
<div class="cell form-group" data-name="targetType">
<div class="field" data-name="targetType">{{{targetType}}}</div>
</div>
<div class="cell cell-users form-group">
<div class="field field-users">{{{users}}}</div>
<div class="cell form-group" data-name="users">
<div class="field" data-name="users">{{{users}}}</div>
</div>
<div class="cell cell-teams form-group">
<div class="field field-teams">{{{teams}}}</div>
<div class="cell form-group" data-name="teams">
<div class="field" data-name="teams">{{{teams}}}</div>
</div>
</div>
</div>
+29 -8
View File
@@ -39,7 +39,7 @@
metadata: null,
getParams: function (fieldType) {
getParamList: function (fieldType) {
if (fieldType in this.defs) {
return this.defs[fieldType].params || [];
}
@@ -68,12 +68,12 @@
return false;
},
getEntityAttributes: function (entityName) {
getEntityAttributeList: function (entityType) {
var list = [];
var defs = this.metadata.get('entityDefs.' + entityName + '.fields') || {};
var defs = this.metadata.get('entityDefs.' + entityType + '.fields') || {};
Object.keys(defs).forEach(function (field) {
this.getAttributes(defs[field]['type'], field).forEach(function (attr) {
this.getAttributeList(defs[field]['type'], field).forEach(function (attr) {
if (!~list.indexOf(attr)) {
list.push(attr);
}
@@ -82,7 +82,7 @@
return list;
},
getActualAttributes: function (fieldType, fieldName) {
getActualAttributeList: function (fieldType, fieldName) {
var fieldNames = [];
if (fieldType in this.defs) {
if ('actualFields' in this.defs[fieldType]) {
@@ -108,7 +108,7 @@
return fieldNames;
},
getNotActualAttributes: function (fieldType, fieldName) {
getNotActualAttributeList: function (fieldType, fieldName) {
var fieldNames = [];
if (fieldType in this.defs) {
if ('notActualFields' in this.defs[fieldType]) {
@@ -132,8 +132,8 @@
return fieldNames;
},
getAttributes: function (fieldType, fieldName) {
return _.union(this.getActualAttributes(fieldType, fieldName), this.getNotActualAttributes(fieldType, fieldName));
getAttributeList: function (fieldType, fieldName) {
return _.union(this.getActualAttributeList(fieldType, fieldName), this.getNotActualAttributeList(fieldType, fieldName));
},
getViewName: function (fieldType) {
@@ -144,6 +144,27 @@
}
return 'Fields.' + Espo.Utils.upperCaseFirst(fieldType);
},
getParams: function (fieldType) {
return this.getParamList(fieldType);
},
getEntityAttributes: function (entityType) {
return this.getEntityAttributeList(entityType);
},
getAttributes: function (fieldType, fieldName) {
return this.getAttributeList(fieldType, fieldName);
},
getActualAttributes: function (fieldType, fieldName) {
return this.getActualAttributeList(fieldType, fieldName);
},
getNotActualAttributes: function (fieldType, fieldName) {
return this.getNotActualAttributeList(fieldType, fieldName);
}
});
return FieldManager;
@@ -88,11 +88,12 @@ Espo.define('views/admin/authentication', 'views/settings/record/edit', function
'ldapCreateEspoUser'
]
};
this.handlePanelsVisibility();
},
afterRender: function () {
this.handlePanelsVisibility();
this.listenTo(this.model, 'change:authenticationMethod', function () {
this.handlePanelsVisibility();
}, this);
@@ -89,7 +89,7 @@ Espo.define('views/admin/entity-manager/modals/edit-entity', ['views/modal', 'mo
this.createView('type', 'views/fields/enum', {
model: model,
mode: 'edit',
el: this.options.el + ' .field-type',
el: this.options.el + ' .field[data-name="type"]',
defs: {
name: 'type',
params: {
@@ -104,7 +104,7 @@ Espo.define('views/admin/entity-manager/modals/edit-entity', ['views/modal', 'mo
this.createView('stream', 'views/fields/bool', {
model: model,
mode: 'edit',
el: this.options.el + ' .field-stream',
el: this.options.el + ' .field[data-name="stream"]',
defs: {
name: 'stream'
}
@@ -114,16 +114,16 @@ Espo.define('views/admin/entity-manager/modals/edit-entity', ['views/modal', 'mo
this.createView('disabled', 'views/fields/bool', {
model: model,
mode: 'edit',
el: this.options.el + ' .field-disabled',
el: this.options.el + ' .field[data-name="disabled"]',
defs: {
name: 'disabled'
}
});
this.createView('name', 'Fields.Varchar', {
this.createView('name', 'views/fields/varchar', {
model: model,
mode: 'edit',
el: this.options.el + ' .field-name',
el: this.options.el + ' .field[data-name="name"]',
defs: {
name: 'name',
params: {
@@ -135,7 +135,7 @@ Espo.define('views/admin/entity-manager/modals/edit-entity', ['views/modal', 'mo
this.createView('labelSingular', 'views/fields/varchar', {
model: model,
mode: 'edit',
el: this.options.el + ' .field-labelSingular',
el: this.options.el + ' .field[data-name="labelSingular"]',
defs: {
name: 'labelSingular',
params: {
@@ -146,7 +146,7 @@ Espo.define('views/admin/entity-manager/modals/edit-entity', ['views/modal', 'mo
this.createView('labelPlural', 'views/fields/varchar', {
model: model,
mode: 'edit',
el: this.options.el + ' .field-labelPlural',
el: this.options.el + ' .field[data-name="labelPlural"]',
defs: {
name: 'labelPlural',
params: {
@@ -174,7 +174,7 @@ Espo.define('views/admin/entity-manager/modals/edit-entity', ['views/modal', 'mo
this.createView('sortBy', 'views/fields/enum', {
model: model,
mode: 'edit',
el: this.options.el + ' .field-sortBy',
el: this.options.el + ' .field[data-name="sortBy"]',
defs: {
name: 'sortBy',
params: {
@@ -187,7 +187,7 @@ Espo.define('views/admin/entity-manager/modals/edit-entity', ['views/modal', 'mo
this.createView('sortDirection', 'views/fields/enum', {
model: model,
mode: 'edit',
el: this.options.el + ' .field-sortDirection',
el: this.options.el + ' .field[data-name="sortDirection"]',
defs: {
name: 'sortDirection',
params: {
@@ -149,7 +149,7 @@ Espo.define('views/admin/field-manager/edit', ['view', 'model'], function (Dep,
var viewName = (params || {}).view || this.getFieldManager().getViewName(type);
this.createView(name, viewName, {
model: this.model,
el: this.options.el + ' .field-' + name,
el: this.options.el + ' .field[data-name="' + name + '"]',
defs: {
name: name,
params: params
@@ -99,20 +99,20 @@ Espo.define('views/admin/integrations/edit', ['view', 'model'], function (Dep, M
},
hideField: function (name) {
this.$el.find('label.field-label-' + name).addClass('hide');
this.$el.find('div.field-' + name).addClass('hide');
this.$el.find('label[data-name="'+name+'"]').addClass('hide');
this.$el.find('div.field[data-name="'+name+'"]').addClass('hide');
var view = this.getView(name);
if (view) {
view.enabled = false;
view.disabled = true;
}
},
showField: function (name) {
this.$el.find('label.field-label-' + name).removeClass('hide');
this.$el.find('div.field-' + name).removeClass('hide');
this.$el.find('label[data-name="'+name+'"]').removeClass('hide');
this.$el.find('div.field[data-name="'+name+'"]').removeClass('hide');
var view = this.getView(name);
if (view) {
view.enabled = true;
view.disabled = false;
}
},
@@ -139,7 +139,7 @@ Espo.define('views/admin/integrations/edit', ['view', 'model'], function (Dep, M
createFieldView: function (type, name, readOnly, params) {
this.createView(name, this.getFieldManager().getViewName(type), {
model: this.model,
el: this.options.el + ' .field-' + name,
el: this.options.el + ' .field[data-name="'+name+'"]',
defs: {
name: name,
params: params
@@ -133,7 +133,7 @@ Espo.define('views/admin/link-manager/modals/edit', ['views/modal', 'views/admin
this.createView('entity', 'views/fields/varchar', {
model: model,
mode: 'edit',
el: this.options.el + ' .field-entity',
el: this.options.el + ' .field[data-name="entity"]',
defs: {
name: 'entity'
},
@@ -142,7 +142,7 @@ Espo.define('views/admin/link-manager/modals/edit', ['views/modal', 'views/admin
this.createView('entityForeign', 'views/fields/enum', {
model: model,
mode: 'edit',
el: this.options.el + ' .field-entityForeign',
el: this.options.el + ' .field[data-name="entityForeign"]',
defs: {
name: 'entityForeign',
params: {
@@ -156,7 +156,7 @@ Espo.define('views/admin/link-manager/modals/edit', ['views/modal', 'views/admin
this.createView('linkType', 'views/fields/enum', {
model: model,
mode: 'edit',
el: this.options.el + ' .field-linkType',
el: this.options.el + ' .field[data-name="linkType"]',
defs: {
name: 'linkType',
params: {
@@ -170,7 +170,7 @@ Espo.define('views/admin/link-manager/modals/edit', ['views/modal', 'views/admin
this.createView('link', 'views/fields/varchar', {
model: model,
mode: 'edit',
el: this.options.el + ' .field-link',
el: this.options.el + ' .field[data-name="link"]',
defs: {
name: 'link',
params: {
@@ -182,7 +182,7 @@ Espo.define('views/admin/link-manager/modals/edit', ['views/modal', 'views/admin
this.createView('linkForeign', 'views/fields/varchar', {
model: model,
mode: 'edit',
el: this.options.el + ' .field-linkForeign',
el: this.options.el + ' .field[data-name="linkForeign"]',
defs: {
name: 'linkForeign',
params: {
@@ -194,7 +194,7 @@ Espo.define('views/admin/link-manager/modals/edit', ['views/modal', 'views/admin
this.createView('label', 'views/fields/varchar', {
model: model,
mode: 'edit',
el: this.options.el + ' .field-label',
el: this.options.el + ' .field[data-name="label"]',
defs: {
name: 'label',
params: {
@@ -205,7 +205,7 @@ Espo.define('views/admin/link-manager/modals/edit', ['views/modal', 'views/admin
this.createView('labelForeign', 'views/fields/varchar', {
model: model,
mode: 'edit',
el: this.options.el + ' .field-labelForeign',
el: this.options.el + ' .field[data-name="labelForeign"]',
defs: {
name: 'labelForeign',
params: {
@@ -218,7 +218,7 @@ Espo.define('views/admin/link-manager/modals/edit', ['views/modal', 'views/admin
this.createView('relationName', 'views/fields/varchar', {
model: model,
mode: 'edit',
el: this.options.el + ' .field-relationName',
el: this.options.el + ' .field[data-name="relationName"]',
defs: {
name: 'relationName',
params: {
@@ -232,7 +232,7 @@ Espo.define('views/admin/link-manager/modals/edit', ['views/modal', 'views/admin
this.createView('linkMultipleField', 'views/fields/bool', {
model: model,
mode: 'edit',
el: this.options.el + ' .field-linkMultipleField',
el: this.options.el + ' .field[data-name="linkMultipleField"]',
defs: {
name: 'linkMultipleField'
},
@@ -242,7 +242,7 @@ Espo.define('views/admin/link-manager/modals/edit', ['views/modal', 'views/admin
this.createView('linkMultipleFieldForeign', 'views/fields/bool', {
model: model,
mode: 'edit',
el: this.options.el + ' .field-linkMultipleFieldForeign',
el: this.options.el + ' .field[data-name="linkMultipleFieldForeign"]',
defs: {
name: 'linkMultipleFieldForeign'
},
@@ -336,7 +336,7 @@ Espo.define('views/admin/link-manager/modals/edit', ['views/modal', 'views/admin
hideField: function (name) {
var view = this.getView(name);
if (view) {
view.enabled = false;
view.disabled = true;
}
this.$el.find('.cell-' + name).css('visibility', 'hidden');
},
@@ -344,7 +344,7 @@ Espo.define('views/admin/link-manager/modals/edit', ['views/modal', 'views/admin
showField: function (name) {
var view = this.getView(name);
if (view) {
view.enabled = true;
view.disabled = false;
}
this.$el.find('.cell-' + name).css('visibility', 'visible');
},
@@ -417,7 +417,7 @@ Espo.define('views/admin/link-manager/modals/edit', ['views/modal', 'views/admin
if (!this.hasView(item)) return;
var view = this.getView(item);
if (view.mode != 'edit') return;
if (view.enabled) {
if (!view.disabled) {
notValid = view.validate() || notValid;
}
}, this);
@@ -30,7 +30,7 @@ Espo.define('views/email/modals/body-plain', 'views/modal', function (Dep) {
return Dep.extend({
_template: '<div class="field-bodyPlain">{{{bodyPlain}}}</div>',
_template: '<div class="field" data-name="body-plain">{{{bodyPlain}}}</div>',
setup: function () {
Dep.prototype.setup.call(this);
@@ -41,8 +41,8 @@ Espo.define('views/email/modals/body-plain', 'views/modal', function (Dep) {
this.header = this.model.get('name');
this.createView('bodyPlain', 'Fields.Text', {
el: this.options.el + ' .field-bodyPlain',
this.createView('bodyPlain', 'views/fields/text', {
el: this.options.el + ' .field[data-name="bodyPlain"]',
model: this.model,
defs: {
name: 'bodyPlain',
@@ -26,11 +26,11 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
Espo.define('Views.ExternalAccount.OAuth2', ['View', 'Model'], function (Dep, Model) {
Espo.define('views/external-account/oauth2', ['view', 'model'], function (Dep, Model) {
return Dep.extend({
template: 'external-account.oauth2',
template: 'external-account/oauth2',
events: {
@@ -110,20 +110,20 @@ Espo.define('Views.ExternalAccount.OAuth2', ['View', 'Model'], function (Dep, Mo
},
hideField: function (name) {
this.$el.find('label.field-label-' + name).addClass('hide');
this.$el.find('div.field-' + name).addClass('hide');
this.$el.find('label[data-name="'+name+'"]').addClass('hide');
this.$el.find('div.field[data-name="'+name+'"]').addClass('hide');
var view = this.getView(name);
if (view) {
view.enabled = false;
view.disabled = true;
}
},
showField: function (name) {
this.$el.find('label.field-label-' + name).removeClass('hide');
this.$el.find('div.field-' + name).removeClass('hide');
this.$el.find('label[data-name="'+name+'"]').removeClass('hide');
this.$el.find('div.field[data-name="'+name+'"]').removeClass('hide');
var view = this.getView(name);
if (view) {
view.enabled = true;
view.disabled = false;
}
},
@@ -144,7 +144,7 @@ Espo.define('Views.ExternalAccount.OAuth2', ['View', 'Model'], function (Dep, Mo
createFieldView: function (type, name, readOnly, params) {
this.createView(name, this.getFieldManager().getViewName(type), {
model: this.model,
el: this.options.el + ' .field-' + name,
el: this.options.el + ' .field[data-name="' + name + '"]',
defs: {
name: name,
params: params
+8 -4
View File
@@ -58,7 +58,7 @@ Espo.define('views/fields/base', 'view', function (Dep) {
inlineEditDisabled: false,
enabled: true,
disabled: false,
readOnly: false,
@@ -152,12 +152,12 @@ Espo.define('views/fields/base', 'view', function (Dep) {
this.fieldType = this.model.getFieldParam(this.name, 'type') || this.type;
this.getFieldManager().getParams(this.type).forEach(function (d) {
this.getFieldManager().getParamList(this.type).forEach(function (d) {
var name = d.name;
if (!(name in this.params)) {
this.params[name] = this.model.getFieldParam(this.name, name) || null;
}
}.bind(this));
}, this);
this.mode = this.options.mode || this.mode;
@@ -178,6 +178,10 @@ Espo.define('views/fields/base', 'view', function (Dep) {
this.readOnly = false;
}
if (this.options.disabled) {
this.disabled = true;
}
if (this.mode == 'edit' && this.readOnly) {
this.mode = 'detail';
}
@@ -264,7 +268,7 @@ Espo.define('views/fields/base', 'view', function (Dep) {
$cell.on('mouseenter', function (e) {
e.stopPropagation();
if (!this.enabled || this.readOnly) {
if (this.disabled || this.readOnly) {
return;
}
if (this.mode == 'detail') {
+3 -3
View File
@@ -54,7 +54,7 @@ Espo.define('views/import/step2', 'view', function (Dep) {
if (~index) {
this.additionalFields.splice(index, 1);
}
this.$el.find('.field-' + field).parent().remove();
this.$el.find('.field[data-name="' + field + '"]').parent().remove();
},
},
@@ -259,13 +259,13 @@ Espo.define('views/import/step2', 'view', function (Dep) {
var removeLink = '<a href="javascript:" class="pull-right" data-action="removeField" data-name="'+name+'"><span class="glyphicon glyphicon-remove"></span></a>';
var html = '<div class="cell form-group col-sm-3">'+removeLink+'<label class="control-label">' + label + '</label><div class="field field-'+name+'" /></div>';
var html = '<div class="cell form-group col-sm-3">'+removeLink+'<label class="control-label">' + label + '</label><div class="field" data-name="'+name+'"/></div>';
$('#default-values-container').append(html);
var type = Espo.Utils.upperCaseFirst(this.model.getFieldParam(name, 'type'));
this.createView(name, this.getFieldManager().getViewName(type), {
model: this.model,
el: this.$el.selector + ' .field-' + name,
el: this.$el.selector + ' .field[data-name="' + name + '"]',
defs: {
name: name,
},
+1 -1
View File
@@ -160,7 +160,7 @@ Espo.define('views/list', ['views/main', 'search-manager'], function (Dep, Searc
},
afterRender: function () {
if (!this.isRendered()) {
if (!this.hasView('list')) {
this.loadList();
}
},
@@ -26,7 +26,7 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
Espo.define('Views.Modals.ArrayFieldAdd', 'Views.Modal', function (Dep) {
Espo.define('views/modals/array-field-add', 'views/modal', function (Dep) {
return Dep.extend({
@@ -26,13 +26,13 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
Espo.define('Views.Modals.ChangePassword', 'Views.Modal', function (Dep) {
Espo.define('views/modals/change-password', 'views/modal', function (Dep) {
return Dep.extend({
cssName: 'change-password',
template: 'modals.change-password',
template: 'modals/change-password',
setup: function () {
@@ -61,10 +61,10 @@ Espo.define('Views.Modals.ChangePassword', 'Views.Modal', function (Dep) {
this.getModelFactory().create('User', function (user) {
this.model = user;
this.createView('currentPassword', 'Fields.Password', {
this.createView('currentPassword', 'views/fields/password', {
model: user,
mode: 'edit',
el: this.options.el + ' .field-currentPassword',
el: this.options.el + ' .field[data-name="currentPassword"]',
defs: {
name: 'currentPassword',
params: {
@@ -73,10 +73,10 @@ Espo.define('Views.Modals.ChangePassword', 'Views.Modal', function (Dep) {
}
});
this.createView('password', 'Fields.Password', {
this.createView('password', 'views/fields/password', {
model: user,
mode: 'edit',
el: this.options.el + ' .field-password',
el: this.options.el + ' .field[data-name="password"]',
defs: {
name: 'password',
params: {
@@ -84,10 +84,10 @@ Espo.define('Views.Modals.ChangePassword', 'Views.Modal', function (Dep) {
}
}
});
this.createView('passwordConfirm', 'Fields.Password', {
this.createView('passwordConfirm', 'views/fields/password', {
model: user,
mode: 'edit',
el: this.options.el + ' .field-passwordConfirm',
el: this.options.el + ' .field[data-name="passwordConfirm"]',
defs: {
name: 'passwordConfirm',
params: {
@@ -27,13 +27,13 @@
************************************************************************/
Espo.define('Views.Modals.EditDashboard', ['Views.Modal', 'Model'], function (Dep, Model) {
Espo.define('views/modals/edit-dashboard', ['views/modal', 'model'], function (Dep, Model) {
return Dep.extend({
cssName: 'edit-dashboard',
template: 'modals.edit-dashboard',
template: 'modals/edit-dashboard',
data: function () {
return {
@@ -83,8 +83,8 @@ Espo.define('Views.Modals.EditDashboard', ['Views.Modal', 'Model'], function (De
model.name = 'Preferences';
model.set('dashboardTabList', dashboardTabList);
this.createView('dashboardTabList', 'Fields.Array', {
el: this.options.el + ' .field-dashboardTabList',
this.createView('dashboardTabList', 'views/fields/array', {
el: this.options.el + ' .field[data-name="dashboardTabList"]',
defs: {
name: 'dashboardTabList',
params: {
@@ -112,7 +112,7 @@ Espo.define('views/modals/mass-update', 'views/modal', function (Dep) {
this.notify('Loading...');
var label = this.translate(name, 'fields', this.scope);
var html = '<div class="cell form-group col-sm-6"><label class="control-label">'+label+'</label><div class="field field-'+name+'" /></div>';
var html = '<div class="cell form-group col-sm-6"><label class="control-label">'+label+'</label><div class="field" data-name="'+name+'" /></div>';
this.$el.find('.fields-container').append(html);
var type = Espo.Utils.upperCaseFirst(this.model.getFieldParam(name, 'type'));
@@ -121,7 +121,7 @@ Espo.define('views/modals/mass-update', 'views/modal', function (Dep) {
this.createView(name, viewName, {
model: this.model,
el: this.$el.selector + ' .field-' + name,
el: this.$el.selector + ' .field[data-name="' + name + '"]',
defs: {
name: name,
},
@@ -27,13 +27,13 @@
************************************************************************/
Espo.define('Views.Modals.SaveFilters', ['Views.Modal', 'Model'], function (Dep, Model) {
Espo.define('views/modals/save-filters', ['views/modal', 'model'], function (Dep, Model) {
return Dep.extend({
cssName: 'save-filters',
template: 'modals.save-filters',
template: 'modals/save-filters',
data: function () {
return {
@@ -63,8 +63,8 @@ Espo.define('Views.Modals.SaveFilters', ['Views.Modal', 'Model'], function (Dep,
this.header = this.translate('Save Filters');
var model = new Model();
this.createView('name', 'Fields.Varchar', {
el: this.options.el + ' .field-name',
this.createView('name', 'views/fields/varchar', {
el: this.options.el + ' .field[data-name="name"]',
defs: {
name: 'name',
params: {
@@ -24,16 +24,16 @@
*
* In accordance with Section 7(b) of the GNU General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
************************************************************************/
Espo.define('Views.OutboundEmail.Modals.TestSend', 'Views.Modal', function (Dep) {
Espo.define('views/outbound-email/modals/test-send', 'views/modal', function (Dep) {
return Dep.extend({
cssName: 'test-send',
_template: '<label class="field-label-outboundEmailFromName control-label">{{translate \'Email Address\' scope=\'Email\'}}</label><input type="text" name="emailAddress" value="{{emailAddress}}" class="form-control">',
_template: '<label class="control-label">{{translate \'Email Address\' scope=\'Email\'}}</label><input type="text" name="emailAddress" value="{{emailAddress}}" class="form-control">',
data: function () {
return {
@@ -42,7 +42,7 @@ Espo.define('Views.OutboundEmail.Modals.TestSend', 'Views.Modal', function (Dep)
},
setup: function () {
this.buttons = [
this.buttonList = [
{
name: 'send',
text: this.translate('Send', 'labels', 'Email'),
@@ -63,7 +63,7 @@ Espo.define('Views.OutboundEmail.Modals.TestSend', 'Views.Modal', function (Dep)
}
}
];
},
});
});
+142 -30
View File
@@ -42,54 +42,81 @@ Espo.define('views/record/base', 'view', function (Dep) {
fieldList: null,
fieldStateMap: null,
panelStateMap: null,
hiddenPanels: null,
hiddenFields: null,
defaultFieldStates: {
hidden: false,
readOnly: false
},
defaultPanelStates: {
hidden: false
},
hideField: function (name) {
this.setFieldStateParam(name, 'hidden', true);
this.hiddenFields[name] = true;
var processHtml = function () {
var $field = this.$el.find('div.field-' + name);
var $label = this.$el.find('label.field-label-' + name);
var $field = this.$el.find('div.field[data-name="' + name + '"]');
var $label = this.$el.find('label.control-label[data-name="' + name + '"]');
var $cell = $field.closest('.cell[data-name="' + name + '"]');
$field.addClass('hidden');
$label.addClass('hidden');
$field.closest('.cell-' + name).addClass('hidden-cell');
$cell.addClass('hidden-cell');
}.bind(this);
if (this.isRendered() || this.isBeingRendered()) {
if (this.isRendered()) {
processHtml();
} else {
this.once('after:render', function () {
processHtml();
//processHtml();
}, this);
}
var view = this.getFieldView(name);
if (view) {
view.enabled = false;
view.disabled = true;
}
},
showField: function (name) {
this.setFieldStateParam(name, 'hidden', false);
delete this.hiddenFields[name];
var processHtml = function () {
var $field = this.$el.find('div.field-' + name);
var $label = this.$el.find('label.field-label-' + name);
var $field = this.$el.find('div.field[data-name="' + name + '"]');
var $label = this.$el.find('label.control-label[data-name="' + name + '"]');
var $cell = $field.closest('.cell[data-name="' + name + '"]');
$field.removeClass('hidden');
$label.removeClass('hidden');
$field.closest('.cell-' + name).removeClass('hidden-cell');
$cell.removeClass('hidden-cell');
}.bind(this);
if (this.isRendered() || this.isBeingRendered()) {
if (this.isRendered()) {
processHtml();
} else {
this.once('after:render', function () {
processHtml();
//processHtml();
}, this);
}
var view = this.getFieldView(name);
if (view) {
view.enabled = true;
view.disabled = false;
}
},
setFieldReadOnly: function (name) {
this.setFieldStateParam(name, 'readOnly', true);
var view = this.getFieldView(name);
if (view) {
if (!view.readOnly) {
@@ -103,6 +130,8 @@ Espo.define('views/record/base', 'view', function (Dep) {
},
setFieldNotReadOnly: function (name) {
this.setFieldStateParam(name, 'readOnly', false);
var view = this.getFieldView(name);
if (view) {
if (view.readOnly) {
@@ -117,12 +146,84 @@ Espo.define('views/record/base', 'view', function (Dep) {
}
},
setFieldRequired: function (name) {
this.setFieldStateParam(name, 'required', true);
var view = this.getFieldView(name);
if (view) {
var view = this.getFieldView(name);
if (view) {
view.setRequired();
}
}
},
setFieldNotRequired: function (name) {
this.setFieldStateParam(name, 'required', false);
var view = this.getFieldView(name);
if (view) {
var view = this.getFieldView(name);
if (view) {
view.setNotRequired();
}
}
},
showPanel: function (name) {
this.$el.find('.panel[data-panel-name="'+name+'"]').removeClass('hidden');
this.setPanelStateParam(name, 'hidden', false);
this.hiddenPanels[name] = false;
if (this.isRendered()) {
this.$el.find('.panel[data-panel-name="'+name+'"]').removeClass('hidden');
}
},
hidePanel: function (name) {
this.$el.find('.panel[data-panel-name="'+name+'"]').addClass('hidden');
this.setPanelStateParam(name, 'hidden', true);
delete this.hiddenPanels[name];
if (this.isRendered()) {
this.$el.find('.panel[data-panel-name="'+name+'"]').addClass('hidden');
}
},
setFieldStateParam: function (field, name, value) {
this.fieldStateMap[field] = this.fieldStateMap[field] || {};
this.fieldStateMap[field][name] = value;
},
getFieldStateParam: function (field, name) {
this.fieldStateMap[field] = this.fieldStateMap[field] || {};
if (field in this.fieldStateMap) {
if (name in this.fieldStateMap[field]) {
return this.fieldStateMap[field][name];
}
} else {
if (name in this.defaultFieldStates) {
return this.defaultFieldStates[name];
}
}
return null;
},
setPanelStateParam: function (panel, name, value) {
this.panelStateMap[panel] = this.panelStateMap[panel] || {};
this.panelStateMap[panel][name] = value;
},
getPanelStateParam: function (panel, name) {
this.panelStateMap[panel] = this.panelStateMap[panel] || {};
if (panel in this.panelStateMap) {
if (panel in this.panelStateMap[panel]) {
return this.panelStateMap[panel][name];
}
} else {
if (name in this.defaultPanelStates) {
return this.defaultPanelStates[name];
}
}
return null;
},
setConfirmLeaveOut: function (value) {
@@ -145,7 +246,10 @@ Espo.define('views/record/base', 'view', function (Dep) {
},
data: function () {
return {};
return {
hiddenPanels: this.hiddenPanels,
hiddenFields: this.hiddenFields
};
},
setup: function () {
@@ -153,6 +257,12 @@ Espo.define('views/record/base', 'view', function (Dep) {
throw new Error('Model has not been injected into record view.');
}
this.fieldStateMap = {};
this.panelStateMap = {};
this.hiddenPanels = {};
this.hiddenFields = {};
this.on('remove', function () {
if (this.isChanged) {
this.model.set(this.attributes);
@@ -197,10 +307,7 @@ Espo.define('views/record/base', 'view', function (Dep) {
this._handleDependencyAttribute(attr);
}, this);
}, this);
this.on('after:render', function () {
this._handleDependencyAttributes();
}, this);
this._handleDependencyAttributes();
},
setIsChanged: function () {
@@ -216,7 +323,7 @@ Espo.define('views/record/base', 'view', function (Dep) {
var fields = this.getFields();
for (var i in fields) {
if (fields[i].mode == 'edit') {
if (fields[i].enabled && !fields[i].readOnly) {
if (!fields[i].disabled && !fields[i].readOnly) {
notValid = fields[i].validate() || notValid;
}
}
@@ -355,7 +462,7 @@ Espo.define('views/record/base', 'view', function (Dep) {
var fields = this.getFields();
for (var i in fields) {
if (fields[i].mode == 'edit') {
if (fields[i].enabled && !fields[i].readOnly) {
if (!fields[i].disabled && !fields[i].readOnly) {
_.extend(data, fields[i].fetch());
}
}
@@ -419,18 +526,12 @@ Espo.define('views/record/base', 'view', function (Dep) {
break;
case 'setRequired':
fields.forEach(function (field) {
var fieldView = this.getFieldView(field);
if (fieldView) {
fieldView.setRequired();
}
this.setFieldRequired(field);
}, this);
break;
case 'setNotRequired':
fields.forEach(function (field) {
var fieldView = this.getFieldView(field);
if (fieldView) {
fieldView.setNotRequired();
}
this.setFieldNotRequired(field);
}, this);
break;
case 'setReadOnly':
@@ -450,7 +551,7 @@ Espo.define('views/record/base', 'view', function (Dep) {
var o = {
model: this.model,
mode: mode || 'edit',
el: this.options.el + ' .field-' + name,
el: this.options.el + ' .field[data-name="' + name + '"]',
defs: {
name: name,
params: params || {}
@@ -459,6 +560,17 @@ Espo.define('views/record/base', 'view', function (Dep) {
if (readOnly) {
o.readOnly = true;
}
if (this.getFieldStateParam(name, 'hidden')) {
o.disabled = true;
}
if (this.getFieldStateParam(name, 'readOnly')) {
o.readOnly = true;
}
if (this.getFieldStateParam(name, 'required') !== null) {
o.defs.params.required = this.getFieldStateParam(name, 'required');
}
this.createView(name, view, o);
if (!~this.fieldList.indexOf(name)) {
+54 -12
View File
@@ -160,9 +160,13 @@ Espo.define('views/record/detail', 'views/record/base', function (Dep) {
},
showPanel: function (name) {
this.setPanelStateParam(name, 'hidden', false);
delete this.hiddenPanels[name];
var middleView = this.getView('middle');
if (middleView) {
middleView.$el.find('.panel[data-panel-name="'+name+'"]').removeClass('hidden');
if (this.isRendered()) {
middleView.$el.find('.panel[data-panel-name="'+name+'"]').removeClass('hidden');
}
}
var bottomView = this.getView('bottom');
@@ -181,9 +185,14 @@ Espo.define('views/record/detail', 'views/record/base', function (Dep) {
},
hidePanel: function (name) {
this.setPanelStateParam(name, 'hidden', true);
this.hiddenPanels[name] = true;
var middleView = this.getView('middle');
if (middleView) {
middleView.$el.find('.panel[data-panel-name="'+name+'"]').addClass('hidden');
if (this.isRendered()) {
middleView.$el.find('.panel[data-panel-name="'+name+'"]').addClass('hidden');
}
}
var bottomView = this.getView('bottom');
@@ -367,10 +376,16 @@ Espo.define('views/record/detail', 'views/record/base', function (Dep) {
},
getFieldView: function (name) {
var view = this.getView('middle').getView(name) || null;
if (!view && this.getView('side')) {
var view;
if (this.hasView('middle')) {
view = this.getView('middle').getView(name) || null;
}
if (!view && this.hasView('side')) {
view = (this.getView('side').getFields() || {})[name];
}
if (!view && this.hasView('bottom')) {
view = (this.getView('bottom').getFields() || {})[name];
}
return view || null;
},
@@ -451,6 +466,12 @@ Espo.define('views/record/detail', 'views/record/base', function (Dep) {
throw new Error('Model has not been injected into record view.');
}
this.fieldStateMap = {};
this.panelStateMap = {};
this.hiddenPanels = {};
this.hiddenFields = {};
var collection = this.model.collection;
if (collection) {
this.listenTo(this.model, 'destroy', function () {
@@ -538,7 +559,6 @@ Espo.define('views/record/detail', 'views/record/base', function (Dep) {
this.model.set(this.options.attributes);
}
this.build();
this.listenTo(this.model, 'sync', function () {
this.attributes = this.model.getClonedAttributes();
}, this);
@@ -552,6 +572,9 @@ Espo.define('views/record/detail', 'views/record/base', function (Dep) {
this.dependencyDefs = _.extend(this.getMetadata().get('clientDefs.' + this.model.name + '.formDependency') || {}, this.dependencyDefs);
this._initDependancy();
this.build();
if (this.duplicateAction) {
if (this.getAcl().checkModel(this.model, 'edit')) {
this.dropdownItemList.push({
@@ -738,13 +761,15 @@ Espo.define('views/record/detail', 'views/record/base', function (Dep) {
continue;
}
var type = cellDefs.type || this.model.getFieldType(cellDefs.name) || 'base';
var viewName = cellDefs.view || this.model.getFieldParam(cellDefs.name, 'view') || this.getFieldManager().getViewName(type);
var name = cellDefs.name;
var type = cellDefs.type || this.model.getFieldType(name) || 'base';
var viewName = cellDefs.view || this.model.getFieldParam(name, 'view') || this.getFieldManager().getViewName(type);
var o = {
el: el + ' .middle .field-' + cellDefs.name,
el: el + ' .middle .field[data-name="' + name + '"]',
defs: {
name: cellDefs.name,
name: name,
params: cellDefs.params || {}
},
mode: this.fieldsMode
@@ -769,10 +794,21 @@ Espo.define('views/record/detail', 'views/record/base', function (Dep) {
}
}
if (this.getFieldStateParam(name, 'hidden')) {
o.disabled = true;
}
if (this.getFieldStateParam(name, 'readOnly')) {
o.readOnly = true;
}
if (this.getFieldStateParam(name, 'required') !== null) {
o.defs.params = o.defs.params || {};
o.defs.params.required = this.getFieldStateParam(name, 'required');
}
var cell = {
name: cellDefs.name,
name: name,
view: viewName,
el: el + ' .middle .field-' + cellDefs.name,
el: el + ' .middle .field[data-name="' + name + '"]',
fullWidth: fullWidth,
options: o
};
@@ -842,8 +878,14 @@ Espo.define('views/record/detail', 'views/record/base', function (Dep) {
el: el + ' .middle',
layoutData: {
model: this.model,
columnCount: this.columnCount,
columnCount: this.columnCount
},
data: function () {
return {
hiddenPanels: this.hiddenPanels,
hiddenFields: this.hiddenFields
}
}.bind(this)
}, callback);
}.bind(this));
+3 -3
View File
@@ -86,7 +86,7 @@ Espo.define('views/record/merge', 'view', function (Dep) {
var id = $(el).data('id');
if (model.id != id) {
var fieldType = model.getFieldParam(field, 'type');
var fields = self.getFieldManager().getActualAttributes(fieldType, field);
var fields = self.getFieldManager().getActualAttributeList(fieldType, field);
var modelFrom;
self.models.forEach(function (m) {
if (m.id == id) {
@@ -151,7 +151,7 @@ Espo.define('views/record/merge', 'view', function (Dep) {
for (var field in fieldsDefs) {
var type = fieldsDefs[field].type;
if (fieldManager.isMergable(type) && !this.models[0].isFieldReadOnly(field)) {
var actualFields = fieldManager.getActualAttributes(type, field);
var actualFields = fieldManager.getActualAttributeList(type, field);
var differs = false;
actualFields.forEach(function (field) {
var values = [];
@@ -180,7 +180,7 @@ Espo.define('views/record/merge', 'view', function (Dep) {
this.createView(model.id + '-' + field, viewName, {
model: model,
el: '.merge .' + model.id + ' .field-' + field,
el: '.merge .' + model.id + ' .field[data-name="' + field + '"]',
defs: {
name: field,
},
@@ -111,7 +111,7 @@ Espo.define('views/record/panels/side', 'view', function (Dep) {
var o = {
model: this.model,
el: this.options.el + ' .field-' + field,
el: this.options.el + ' .field[data-name="' + field + '"]',
defs: {
name: field,
params: {},
+8
View File
@@ -52,6 +52,14 @@ blockquote {
margin-bottom: 0;
}
.hidden-cell div.field {
display: none !important;
}
.hidden-cell label.control-label {
display: none !important;
}
.panel-group .panel + .panel {
margin-top: 4px;
}