소스 검색

[control-link] new selector (started)

version-14
Rushabh Mehta 12 년 전
부모
커밋
c017bd8acf
5개의 변경된 파일69개의 추가작업 그리고 22개의 파일을 삭제
  1. +1
    -0
      public/build.json
  2. +8
    -4
      public/js/wn/form/control.js
  3. +46
    -0
      public/js/wn/form/link_selector.js
  4. +14
    -17
      public/js/wn/ui/appframe.js
  5. +0
    -1
      public/js/wn/ui/field_group.js

+ 1
- 0
public/build.json 파일 보기

@@ -148,6 +148,7 @@
"lib/public/js/wn/form/layout.js",
"lib/public/js/wn/form/script_manager.js",
"lib/public/js/wn/form/control.js",
"lib/public/js/wn/form/link_selector.js",
"lib/public/js/wn/form/editors.js",
"lib/public/js/wn/form/grid.js",
"lib/public/js/wn/form/attachments.js",


+ 8
- 4
public/js/wn/form/control.js 파일 보기

@@ -538,8 +538,11 @@ wn.ui.form.ControlLink = wn.ui.form.ControlData.extend({

// magnifier - search
this.$input_area.find(".btn-search").on("click", function() {
selector.set(me, me.df.options, me.df.label);
selector.show(me.txt);
new wn.ui.form.LinkSelector({
doctype: me.df.options,
target: me,
txt: me.$input.val()
});
});

// open
@@ -617,8 +620,8 @@ wn.ui.form.ControlLink = wn.ui.form.ControlData.extend({
};
},
get_custom_query: function() {
if(this.get_query && this.doctype) {
return this.get_query(this.frm.doc, this.doctype, this.docname);
if(this.get_query) {
return this.get_query(this.frm && this.frm.doc, this.doctype, this.docname);
}
},
validate: function(value, callback) {
@@ -627,6 +630,7 @@ wn.ui.form.ControlLink = wn.ui.form.ControlData.extend({

if(this.df.options=="[Select]") {
callback(value);
return;
}

var fetch = '';


+ 46
- 0
public/js/wn/form/link_selector.js 파일 보기

@@ -0,0 +1,46 @@
wn.ui.form.LinkSelector = Class.extend({
_help: "Dialog box to select a Link Value",
init: function(opts) {
/* help: Options: doctype, get_query, target */
$.extend(this, opts);
var me = this;
if(this.doctype!="[Select]") {
wn.model.with_doctype(this.doctype, function(r) {
me.make();
});
} else {
this.make();
}
},
make: function() {
this.dialog = new wn.ui.Dialog({
"title": "Select " + this.doctype,
"fields": [
{
fieldtype: "Data", fieldname: "txt", label: "Beginning with",
description: "You can use wildcard %"
},
{
fieldtype: "Select", fieldname: "search_field", label: "Search With"
},
{
fieldtype: "Button", fieldname: "search", label: "Search",
},
{
fieldtype: "HTML", fieldname: "results"
}
]
});
var search_fields = wn.model.get_value("DocType", this.doctype, "search_fields");
if(this.doctype!="[Select]" && search_fields) {
this.dialog.fields_dict.search_field.$input.add_options(search_fields.split(","));
} else {
this.dialog.fields_dict.search_field.$wrapper.toggle(false);
}
this.dialog.fields_dict.search.$input.on("click", function() {
})
this.dialog.show();
}
})

+ 14
- 17
public/js/wn/ui/appframe.js 파일 보기

@@ -30,8 +30,9 @@ wn.ui.AppFrame = Class.extend({
<span class="title-icon"></span><span class="title-text"></span></h2></div>\
<div class="sub-title-area text-muted small" \
style="margin-top: -10px;"></div>\
<div class="btn-group appframe-toolbar" \
style="display: none; margin-top: 15px;"></div>\
<div class="appframe-toolbar" \
style="display: none; margin-top: 15px;">\
<span class="btn-group" style="display: inline-block; margin-right: 5px;"></span></div>\
').appendTo(this.$w);
this.$w.find('.close').click(function() {
@@ -187,7 +188,7 @@ wn.ui.AppFrame = Class.extend({
}
this.buttons[label] = $(repl('<button class="btn">\
%(icon)s <span class="hidden-phone">%(label)s</span></button>', args))
.appendTo(title_toolbar ? this.$w.find(".title-button-area") : this.toolbar)
.appendTo(title_toolbar ? this.$w.find(".title-button-area") : this.toolbar.find(".btn-group"))
.attr("title", wn._(label))
.click(click);
return this.buttons[label];
@@ -216,33 +217,29 @@ wn.ui.AppFrame = Class.extend({
});
},
add_label: function(label) {
return $("<span class='label'>"+label+" </span>")
.appendTo($("<li>").appendTo(this.toolbar));
return $("<span class='label col-span-1'>"+label+" </span>")
.appendTo(this.toolbar.toggle(true));
},
add_select: function(label, options) {
this.add_toolbar();
return $("<select class='col-span-2' style='margin-top: 5px;'>")
return $("<select class='col-span-2' style='margin-right: 5px;'>")
.add_options(options)
.appendTo($("<li>").appendTo(this.toolbar));
.appendTo(this.toolbar.toggle(true));
},
add_data: function(label) {
this.add_toolbar();
return $("<input class='col-span-2' style='margin-top: 5px;' type='text' placeholder='"+ label +"'>")
.appendTo($("<li>").appendTo(this.toolbar));
return $("<input class='col-span-2' style='margin-right: 5px;' type='text' placeholder='"+ label +"'>")
.appendTo(this.toolbar.toggle(true));
},
add_date: function(label, date) {
this.add_toolbar();
return $("<input class='col-span-2' style='margin-top: 5px;' type='text'>").datepicker({
return $("<input class='col-span-2' style='margin-right: 5px;' type='text'>").datepicker({
dateFormat: sys_defaults.date_format.replace("yyyy", "yy"),
changeYear: true,
}).val(dateutil.str_to_user(date) || "")
.appendTo($("<li>").appendTo(this.toolbar));
.appendTo(this.toolbar.toggle(true));
},
add_check: function(label) {
this.add_toolbar();
return $("<label style='display: inline;'><input type='checkbox' \
style='margin-top: 5px;'/> " + label + "</label>")
.appendTo($("<li>").appendTo(this.toolbar))
style='margin-right: 5px;'/> " + label + "</label>")
.appendTo(this.toolbar.toggle(true))
.find("input");
},
add_ripped_paper_effect: function(wrapper) {


+ 0
- 1
public/js/wn/ui/field_group.js 파일 보기

@@ -92,7 +92,6 @@ wn.ui.FieldGroup = Class.extend({
var f = this.fields_dict[key];
if(f) {
f.set_input(val);
f.refresh_mandatory();
}
},
set_values: function(dict) {


불러오는 중...
취소
저장