link create button changes
This commit is contained in:
@@ -16,6 +16,10 @@
|
||||
{
|
||||
"name": "readOnlyAfterCreate",
|
||||
"type": "bool"
|
||||
},
|
||||
{
|
||||
"name": "createButton",
|
||||
"type": "bool"
|
||||
}
|
||||
],
|
||||
"actualFields": [
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
{{#if createButton}}
|
||||
<button
|
||||
data-action="createLink"
|
||||
class="btn btn-default btn-icon"
|
||||
class="btn btn-default btn-icon{{#if idValue}} hidden{{/if}}"
|
||||
type="button"
|
||||
title="{{translate 'Create'}}"
|
||||
><i class="fas fa-plus"></i></button>
|
||||
|
||||
@@ -376,6 +376,8 @@ class LinkFieldView extends BaseFieldView {
|
||||
|
||||
this.trigger('change');
|
||||
|
||||
this.controlCreateButtonVisibility();
|
||||
|
||||
this.getSelectFieldHandler().then(handler => {
|
||||
handler.getAttributes(model)
|
||||
.then(attributes => {
|
||||
@@ -393,14 +395,29 @@ class LinkFieldView extends BaseFieldView {
|
||||
|
||||
this.trigger('change');
|
||||
|
||||
this.controlCreateButtonVisibility();
|
||||
|
||||
this.getSelectFieldHandler().then(handler => {
|
||||
handler.getClearAttributes()
|
||||
.then(attributes => {
|
||||
this.model.set(attributes)
|
||||
this.model.set(attributes);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/** @private */
|
||||
controlCreateButtonVisibility() {
|
||||
if (!this.createButton) {
|
||||
return;
|
||||
}
|
||||
|
||||
const $btn = this.$el.find('[data-action="createLink"]');
|
||||
|
||||
this.model.get(this.idName) ?
|
||||
$btn.addClass('hidden') :
|
||||
$btn.removeClass('hidden');
|
||||
}
|
||||
|
||||
/**
|
||||
* @private
|
||||
* @return {Promise<{
|
||||
|
||||
Reference in New Issue
Block a user