瀏覽代碼

[field_group] [minor] button hilighting / defaults

version-14
Rushabh Mehta 11 年之前
父節點
當前提交
bc8a0685de
共有 1 個檔案被更改,包括 8 行新增2 行删除
  1. +8
    -2
      public/js/wn/ui/field_group.js

+ 8
- 2
public/js/wn/ui/field_group.js 查看文件

@@ -8,15 +8,21 @@ wn.ui.FieldGroup = wn.ui.form.Layout.extend({
$.extend(this, opts); $.extend(this, opts);
this._super(); this._super();
$.each(this.fields || [], function(i, f) { $.each(this.fields || [], function(i, f) {
if(!f.fieldname && f.label) f.fieldname = f.label.replace(/ /g, "_").toLowerCase();
if(!f.fieldname && f.label) {
f.fieldname = f.label.replace(/ /g, "_").toLowerCase();
}
}) })
}, },
make: function() { make: function() {
if(this.fields) { if(this.fields) {
this._super(); this._super();
this.refresh(); this.refresh();
// set default
$.each(this.fields_list, function(i, f) {
if(f.df["default"]) f.set_input(f.df["default"]);
})
if(!this.no_submit_on_enter) { if(!this.no_submit_on_enter) {
$(this.body).find(".btn:first").removeClass("btn-default").addClass("btn-primary");
$(this.body).find(".control-input > .btn").filter(":first").removeClass("btn-default").addClass("btn-primary");
this.catch_enter_as_submit(); this.catch_enter_as_submit();
} }
} }


Loading…
取消
儲存