|
@ -31,6 +31,7 @@ function DispositivoEdit() { |
|
|
var form_data = { |
|
|
var form_data = { |
|
|
'action' : this.getAttribute('action'), |
|
|
'action' : this.getAttribute('action'), |
|
|
'tipo_pk' : this.getAttribute('tipo_pk'), |
|
|
'tipo_pk' : this.getAttribute('tipo_pk'), |
|
|
|
|
|
'perfil_pk' : this.getAttribute('perfil_pk'), |
|
|
'variacao' : this.getAttribute('variacao'), |
|
|
'variacao' : this.getAttribute('variacao'), |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
@ -72,15 +73,28 @@ function DispositivoEdit() { |
|
|
|
|
|
|
|
|
var dpt = $(this).closest('.dpt'); |
|
|
var dpt = $(this).closest('.dpt'); |
|
|
if (dpt.hasClass('dpt-selected')) { |
|
|
if (dpt.hasClass('dpt-selected')) { |
|
|
|
|
|
if (this.getAttribute('action') == 'editor-close') |
|
|
instance.clearEditSelected(); |
|
|
instance.clearEditSelected(); |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
instance.clearEditSelected(); |
|
|
instance.clearEditSelected(); |
|
|
instance.loadActionsEdit(dpt); |
|
|
instance.loadActionsEdit(dpt); |
|
|
|
|
|
|
|
|
dpt.on('get_form_base', function () { |
|
|
var formtype = dpt.attr('formtype'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dpt.on(formtype, instance[formtype]); |
|
|
|
|
|
|
|
|
|
|
|
instance.loadForm(dpt, formtype); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
instance.get_form_base = function () { |
|
|
var _this = $(this); |
|
|
var _this = $(this); |
|
|
_this.addClass('dpt-selected'); |
|
|
_this.addClass('dpt-selected'); |
|
|
|
|
|
|
|
|
|
|
|
var dpt_form = _this.children().filter('.dpt-form'); |
|
|
|
|
|
dpt_form.find('form').submit(instance.onSubmitEditFormBase); |
|
|
|
|
|
|
|
|
instance.scrollTo(_this); |
|
|
instance.scrollTo(_this); |
|
|
_this.off('get_form_base') |
|
|
_this.off('get_form_base') |
|
|
|
|
|
|
|
@ -93,8 +107,6 @@ function DispositivoEdit() { |
|
|
_this.find('.dpt-actions-bottom').last().append(btns_excluir); |
|
|
_this.find('.dpt-actions-bottom').last().append(btns_excluir); |
|
|
|
|
|
|
|
|
btns_excluir.find('.btn-excluir').on('click', instance.bindActionsClick); |
|
|
btns_excluir.find('.btn-excluir').on('click', instance.bindActionsClick); |
|
|
}); |
|
|
|
|
|
instance.loadForm(dpt, 'get_form_base'); |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
instance.loadActionsEdit = function(dpt) { |
|
|
instance.loadActionsEdit = function(dpt) { |
|
@ -103,6 +115,7 @@ function DispositivoEdit() { |
|
|
$.get(url).done(function(data) { |
|
|
$.get(url).done(function(data) { |
|
|
dpt.find('.dpt-actions').first().html(data); |
|
|
dpt.find('.dpt-actions').first().html(data); |
|
|
dpt.find('.btn-inserts').on('click', instance.bindActionsClick); |
|
|
dpt.find('.btn-inserts').on('click', instance.bindActionsClick); |
|
|
|
|
|
dpt.find('.btn-perfis').on('click', instance.bindActionsClick); |
|
|
dpt.find('.btn-editor-type').on('click', instance.bindActionsEditorType); |
|
|
dpt.find('.btn-editor-type').on('click', instance.bindActionsEditorType); |
|
|
|
|
|
|
|
|
if (editortype == 'construct') |
|
|
if (editortype == 'construct') |
|
@ -112,14 +125,12 @@ function DispositivoEdit() { |
|
|
} |
|
|
} |
|
|
instance.loadForm = function(dpt, trigger) { |
|
|
instance.loadForm = function(dpt, trigger) { |
|
|
var pk = dpt.attr('pk'); |
|
|
var pk = dpt.attr('pk'); |
|
|
|
|
|
|
|
|
var dpt_form = dpt.children().filter('.dpt-form'); |
|
|
var dpt_form = dpt.children().filter('.dpt-form'); |
|
|
if (dpt_form.length == 1) { |
|
|
if (dpt_form.length == 1) { |
|
|
var url = pk+'/refresh?action='+trigger; |
|
|
var url = pk+'/refresh?action='+trigger; |
|
|
$.get(url).done(function(data) { |
|
|
$.get(url).done(function(data) { |
|
|
if (editortype != "construct") { |
|
|
if (editortype != "construct") { |
|
|
dpt_form.html(data); |
|
|
dpt_form.html(data); |
|
|
dpt_form.find('form').submit(instance.onSubmitEditFormBase); |
|
|
|
|
|
if (editortype == 'tinymce' ) { |
|
|
if (editortype == 'tinymce' ) { |
|
|
initTinymce(); |
|
|
initTinymce(); |
|
|
} |
|
|
} |
|
|