瀏覽代碼

Merge pull request #127 from mamuesp/master

Bugfix: added the loading of the static form data
dds
Paul Stoffregen 9 年之前
父節點
當前提交
8a21e6e67f
共有 1 個檔案被更改,包括 18 行新增3 行删除
  1. +18
    -3
      gui/red/ui/view.js

+ 18
- 3
gui/red/ui/view.js 查看文件

@@ -1626,16 +1626,31 @@ RED.view = (function() {
}

function getForm(formId, key, callback) {
// server test switched off - test purposes only
var patt = new RegExp(/^[http|https]/);
var server = false && patt.test(location.protocol);
var form = $("<h2>No form found.</h2>");
var frmPlugin = "resources/form/" + key + ".html";
$.get(frmPlugin, function(data) {

if (!server) {
data = $("script[data-template-name|='" + key + "']").html();
form = $("#" + formId);
$(form).empty();
$(form).append(data);
if(typeof callback == 'function') {
callback.call(this, form);
}
});
} else {
var frmPlugin = "resources/form/" + key + ".html";
$.get(frmPlugin, function(data) {
form = $("#" + formId);
$(form).empty();
$(form).append(data);
if(typeof callback == 'function') {
callback.call(this, form);
}
});
}

return form;
}


Loading…
取消
儲存