fastui 0.1.3 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. checksums.yaml +8 -8
  2. data/README.md +11 -6
  3. data/app/assets/javascripts/fastui/app/view/DataFieldFactory.js +61 -0
  4. data/app/assets/javascripts/fastui/app/view/GridColumnFactory.js +164 -0
  5. data/app/assets/javascripts/fastui/app/view/VCustomForm.js +1 -0
  6. data/app/assets/javascripts/fastui/app/view/VForm.js +43 -49
  7. data/app/assets/javascripts/fastui/app/view/VGrid.js +10 -123
  8. data/app/assets/javascripts/fastui/app/view/VMenu.js +1 -1
  9. data/app/assets/javascripts/fastui/app/view/VSearchWindow.js +10 -10
  10. data/app/assets/javascripts/fastui/app/view/VTab.js +1 -1
  11. data/app/assets/javascripts/fastui/app/view/VTreeGrid.js +8 -85
  12. data/app/assets/javascripts/fastui/app/view/vfield/{VBool.js → VBoolean.js} +1 -1
  13. data/app/assets/javascripts/fastui/app/view/vfield/VFieldFactory.js +19 -9
  14. data/app/assets/javascripts/fastui/app/view/vfield/{VHtmlEditor.js → VHtml.js} +2 -1
  15. data/app/assets/javascripts/fastui/app/view/vfield/VInteger.js +20 -0
  16. data/app/assets/javascripts/fastui/app/view/vfield/VList.js +35 -0
  17. data/app/assets/javascripts/fastui/app/view/vfield/VLookup.js +2 -2
  18. data/app/assets/javascripts/fastui/app/view/vfield/VNumber.js +1 -0
  19. data/app/assets/javascripts/fastui/app/view/vfield/{VTextArea.js → VString.js} +3 -4
  20. data/app/assets/javascripts/fastui/app/view/vfield/VTable.js +50 -0
  21. data/app/assets/javascripts/fastui/app/view/vfield/VText.js +4 -1
  22. data/app/assets/javascripts/fastui/app/view/vfield/VTreeCombobox.js +78 -0
  23. data/app/assets/javascripts/fastui/app/view/vfield/VType.js +83 -5
  24. data/app/assets/javascripts/fastui/application.js +1 -0
  25. data/app/assets/javascripts/fastui/extjs4/locale/ext-lang-zh_CN.js +7 -27
  26. data/app/assets/javascripts/fastui/fastui.js +2 -0
  27. data/app/controllers/fastui/m_list_items_controller.rb +1 -1
  28. data/app/controllers/fastui/m_menu_items_controller.rb +1 -1
  29. data/app/controllers/fastui/m_orgs_controller.rb +2 -2
  30. data/app/models/fastui/m_menu_item.rb +3 -0
  31. data/app/models/fastui/m_org.rb +3 -0
  32. data/lib/fastui/version.rb +1 -1
  33. metadata +11 -6
  34. data/app/assets/javascripts/fastui/app/view/VVWindow.js +0 -72
@@ -1,6 +1,6 @@
1
1
  Ext.define('FastUI.view.VTreeGrid', {
2
2
  extend: 'Ext.tree.Panel',
3
- requires: ['FastUI.store.MListMgr'],
3
+ requires: ['FastUI.store.MListMgr', 'FastUI.view.DataFieldFactory', 'FastUI.view.GridColumnFactory'],
4
4
  collapsible: true,
5
5
  useArrows: true,
6
6
  rootVisible: false,
@@ -17,8 +17,8 @@ Ext.define('FastUI.view.VTreeGrid', {
17
17
  itemclick:function (view, record, item, index, e, eOpts) {
18
18
  this.tab.winCtx.setWinCtx(this.tab.winId, this.tab.rest.getKey(), record.get('id'));
19
19
  this.tab.winCtx.setWinCtx(this.tab.winId, this.tab.rest.getTitle(), record.get('title'));
20
- if (record.get('m_entity_id')) {
21
- this.tab.winCtx.setWinCtx(this.tab.winId, 'm_entity_id', record.get('m_entity_id'));
20
+ if (record.get('entity')) {
21
+ this.tab.winCtx.setWinCtx(this.tab.winId, 'entity', record.get('entity'));
22
22
  }
23
23
  this.tab.getBtn('edit').enable();
24
24
  this.tab.getBtn('del').enable();
@@ -39,6 +39,7 @@ Ext.define('FastUI.view.VTreeGrid', {
39
39
  getTreeGStore: function () {
40
40
  return new Ext.data.TreeStore({
41
41
  autoLoad: true,
42
+ //autoSync: true,
42
43
  proxy:{
43
44
  type: 'ajax',
44
45
  url: this.tab.rest.indexPath(),
@@ -50,7 +51,8 @@ Ext.define('FastUI.view.VTreeGrid', {
50
51
  }
51
52
  },
52
53
  root: {
53
- name:'Root',
54
+ text:'Root',
55
+ id:'',
54
56
  expanded: true
55
57
  },
56
58
  fields: this.getTreeGFields()
@@ -62,93 +64,14 @@ Ext.define('FastUI.view.VTreeGrid', {
62
64
  getTreeGFields: function () {
63
65
  var fields = [];
64
66
  Ext.each(this.getMColumns(), function (column) {
65
- var field = {
66
- name: column.name,
67
- type: 'auto'
68
- };
69
- switch (column.datatype) {
70
- case 'VLookup':
71
- var entity = {
72
- name: column.name.replace('_id', ''),
73
- type: 'auto'
74
- };
75
- fields.push(entity);
76
- }
77
- fields.push(field);
67
+ FastUI.view.DataFieldFactory.buildField(fields,column);
78
68
  }, this);
79
69
  return fields;
80
70
  },
81
71
  getTreeGColumns: function () {
82
72
  var columns = [];
83
73
  Ext.each(this.getMColumns(), function (column) {
84
- switch (column.datatype) {
85
- case 'VTree':
86
- columns.push({
87
- text: column.title,
88
- xtype: 'treecolumn',
89
- flex: 2.5,
90
- dataIndex: column.name
91
- });
92
- break;
93
-
94
- case 'VLookup':
95
- var entity = column.name.replace('_id', '');
96
- columns.push({
97
- text: column.title,
98
- xtype: 'templatecolumn',
99
- dataIndex: column.name,
100
- tpl: new Ext.XTemplate(
101
- '<tpl for="' + entity + '">',
102
- '{title}',
103
- '</tpl>'
104
- )
105
- });
106
- break;
107
-
108
- case 'VSingleChoice':
109
- var list_store = FastUI.store.MListMgr.getStore(column.name);
110
- columns.push({
111
- text: column.title,
112
- dataIndex: column.name,
113
- renderer: function (val) {
114
- var index = list_store.findExact('name', val);
115
- if (index > -1) {
116
- var rs = list_store.getAt(index).data;
117
- return rs.title;
118
- }
119
- return "";
120
- }
121
- });
122
- break;
123
-
124
- case 'VSexSelect':
125
- columns.push({
126
- text: column.title,
127
- dataIndex: column.name,
128
- renderer: function (val) {
129
- return val ? '男' : '女'
130
- }
131
- });
132
- break;
133
-
134
- case 'VYesOrNo':
135
- columns.push({
136
- text: column.title,
137
- dataIndex: column.name,
138
- renderer: function (val) {
139
- return val ? '是' : '否';
140
- }
141
- });
142
- break;
143
-
144
- default:
145
- columns.push({
146
- text: column.title,
147
- dataIndex: column.name
148
- });
149
- break;
150
- }
151
-
74
+ FastUI.view.GridColumnFactory.buildColumn(columns,column);
152
75
  }, this);
153
76
  return columns;
154
77
  }
@@ -1,4 +1,4 @@
1
- Ext.define('FastUI.view.vfield.VBool',{
1
+ Ext.define('FastUI.view.vfield.VBoolean',{
2
2
  extend: 'Ext.form.field.Checkbox',
3
3
  valueObject: {},
4
4
  winCtx:{},
@@ -23,9 +23,10 @@ Ext.define('FastUI.view.vfield.VFieldFactory', {
23
23
 
24
24
  buildField: function (field, winCtx, winId, rest) {
25
25
  field.datatype = field.datatype || '';
26
+ //field.rest = rest;
26
27
  switch (field.datatype) {
27
- case 'VText':
28
- return Ext.create('FastUI.view.vfield.VText', {valueObject: field, winCtx: winCtx, winId: winId, rest: rest});
28
+ case 'VString':
29
+ return Ext.create('FastUI.view.vfield.VString', {valueObject: field, winCtx: winCtx, winId: winId, rest: rest});
29
30
 
30
31
  case 'VTree':
31
32
  return Ext.create('FastUI.view.vfield.VTree', {valueObject: field, winCtx: winCtx, winId: winId, rest: rest});
@@ -33,8 +34,8 @@ Ext.define('FastUI.view.vfield.VFieldFactory', {
33
34
  case 'VDate':
34
35
  return Ext.create('FastUI.view.vfield.VDate', {valueObject: field, winCtx: winCtx, winId: winId, rest: rest});
35
36
 
36
- case 'VHtmlEditor':
37
- return Ext.create('FastUI.view.vfield.VHtmlEditor', {valueObject: field, winCtx: winCtx, winId: winId, rest: rest});
37
+ case 'VHtml':
38
+ return Ext.create('FastUI.view.vfield.VHtml', {valueObject: field, winCtx: winCtx, winId: winId, rest: rest});
38
39
 
39
40
  case 'VSingleChoice':
40
41
  return Ext.create('FastUI.view.vfield.VSingleChoice', {valueObject: field, winCtx: winCtx, winId: winId, rest: rest});
@@ -45,14 +46,17 @@ Ext.define('FastUI.view.vfield.VFieldFactory', {
45
46
  case 'VRadio':
46
47
  return Ext.create('FastUI.view.vfield.VRadio', {valueObject: field, winCtx: winCtx, winId: winId, rest: rest});
47
48
 
48
- case 'VTextArea':
49
- return Ext.create('FastUI.view.vfield.VTextArea', {valueObject: field, winCtx: winCtx, winId: winId, rest: rest});
49
+ case 'VText':
50
+ return Ext.create('FastUI.view.vfield.VText', {valueObject: field, winCtx: winCtx, winId: winId, rest: rest});
50
51
 
51
52
  case 'VNumber':
52
53
  return Ext.create('FastUI.view.vfield.VNumber', {valueObject: field, winCtx: winCtx, winId: winId, rest: rest});
53
54
 
54
- case 'VBool':
55
- return Ext.create('FastUI.view.vfield.VBool', {valueObject: field, winCtx: winCtx, winId: winId, rest: rest});
55
+ case 'VInteger':
56
+ return Ext.create('FastUI.view.vfield.VInteger', {valueObject: field, winCtx: winCtx, winId: winId, rest: rest});
57
+
58
+ case 'VBoolean':
59
+ return Ext.create('FastUI.view.vfield.VBoolean', {valueObject: field, winCtx: winCtx, winId: winId, rest: rest});
56
60
 
57
61
  case 'VCheckbox':
58
62
  return Ext.create('FastUI.view.vfield.VCheckbox', {valueObject: field, winCtx: winCtx, winId: winId, rest: rest});
@@ -67,11 +71,17 @@ Ext.define('FastUI.view.vfield.VFieldFactory', {
67
71
  return Ext.create('FastUI.view.vfield.VYesOrNo', {valueObject: field, winCtx: winCtx, winId: winId, rest: rest});
68
72
 
69
73
  case 'VList':
70
- return Ext.create('FastUI.view.vfield.VCombobox', {valueObject: field, winCtx: winCtx, winId: winId, rest: rest});
74
+ return Ext.create('FastUI.view.vfield.VList', {valueObject: field, winCtx: winCtx, winId: winId, rest: rest});
71
75
 
72
76
  case 'VLookup':
73
77
  return Ext.create('FastUI.view.vfield.VLookup', {valueObject: field, winCtx: winCtx, winId: winId, rest: rest});
74
78
 
79
+ case 'VTable':
80
+ return Ext.create('FastUI.view.vfield.VTable', {valueObject: field, winCtx: winCtx, winId: winId, rest: rest});
81
+
82
+ case 'VTreeCombobox':
83
+ return Ext.create('FastUI.view.vfield.VTreeCombobox', {valueObject: field, winCtx: winCtx, winId: winId, rest: rest});
84
+
75
85
  case 'VGroup':
76
86
  var box = Ext.create('Ext.form.FieldSet',{
77
87
  title: field.title,
@@ -1,4 +1,4 @@
1
- Ext.define('FastUI.view.vfield.VHtmlEditor',{
1
+ Ext.define('FastUI.view.vfield.VHtml',{
2
2
  extend: 'Ext.form.field.HtmlEditor',
3
3
 
4
4
  valueObject: {},
@@ -12,6 +12,7 @@ Ext.define('FastUI.view.vfield.VHtmlEditor',{
12
12
  this.name = this.rest.getTableName() + '[' + this.getFValue('name') + ']';
13
13
  this.disabled = this.getFValue('readonly');
14
14
  this.allowBlank = true;
15
+ this.vtype = this.getFValue('vtype');
15
16
  this.callParent();
16
17
  },
17
18
  getFValue:function (key) {
@@ -0,0 +1,20 @@
1
+ Ext.define('FastUI.view.vfield.VInteger',{
2
+ extend: 'Ext.form.field.Number',
3
+ valueObject: {},
4
+ winCtx:{},
5
+ winId:0,
6
+ rest:{},
7
+
8
+ allowDecimals: false,
9
+ initComponent:function(){
10
+ this.fieldLabel = this.getFValue('title');
11
+ this.name = this.rest.getTableName() + '[' + this.getFValue('name') + ']';
12
+ this.disabled = this.getFValue('readonly');
13
+ this.allowBlank = true;
14
+ this.vtype = this.getFValue('vtype');
15
+ this.callParent();
16
+ },
17
+ getFValue:function (key) {
18
+ return this.valueObject[key];
19
+ }
20
+ });
@@ -0,0 +1,35 @@
1
+ Ext.define('FastUI.view.vfield.VList', {
2
+ extend:'Ext.form.field.ComboBox',
3
+ requires:['FastUI.store.MListMgr'],
4
+ valueObject: {},
5
+ winCtx:{},
6
+ winId:0,
7
+ rest:{},
8
+
9
+ valueField:'name',
10
+ displayField:"title",
11
+ forceSelection:true,
12
+ triggerAction:'all',
13
+ editable:false,
14
+ selectOnFocus:true,
15
+
16
+ initComponent:function () {
17
+ this.fieldLabel = this.getFValue('title');
18
+ this.name = this.rest.getTableName() + '[' + this.getFValue('name') + ']';
19
+ this.disabled = this.getFValue('readonly');
20
+ this.allowBlank = true;
21
+ this.store = FastUI.store.MListMgr.getStore(this.getFValue('name'));
22
+ this.callParent();
23
+ },
24
+ getFValue:function (key) {
25
+ return this.valueObject[key];
26
+ },
27
+ setValue:function (value) {
28
+ if(value && value.name && value.title){
29
+ this.setValue(value.name);
30
+ }else{
31
+ this.callParent(arguments);
32
+ }
33
+ }
34
+
35
+ });
@@ -1,6 +1,6 @@
1
1
  Ext.define('FastUI.view.vfield.VLookup', {
2
2
  extend:'Ext.form.field.ComboBox',
3
- alias:'widget.vlookupwindow',
3
+ alias:'widget.vlookup',
4
4
  valueObject: {},
5
5
  winCtx:{},
6
6
  winId:0,
@@ -40,7 +40,7 @@ Ext.define('FastUI.view.vfield.VLookup', {
40
40
  this.loadWindow();
41
41
  },
42
42
  loadWindow:function () {
43
- this.window = Ext.create('FastUI.view.VSearchWindow',{vlookup:this});
43
+ this.window = Ext.create('FastUI.view.VSearchWindow',{lookup:this});
44
44
  this.window.show();
45
45
  }
46
46
  });
@@ -10,6 +10,7 @@ Ext.define('FastUI.view.vfield.VNumber',{
10
10
  this.name = this.rest.getTableName() + '[' + this.getFValue('name') + ']';
11
11
  this.disabled = this.getFValue('readonly');
12
12
  this.allowBlank = true;
13
+ this.vtype = this.getFValue('vtype');
13
14
  this.callParent();
14
15
  },
15
16
  getFValue:function (key) {
@@ -1,16 +1,15 @@
1
- Ext.define('FastUI.view.vfield.VTextArea',{
2
- extend: 'Ext.form.field.TextArea',
3
-
1
+ Ext.define('FastUI.view.vfield.VString',{
2
+ extend: 'Ext.form.field.Text',
4
3
  valueObject: {},
5
4
  winCtx:{},
6
5
  winId:0,
7
6
  rest:{},
8
-
9
7
  initComponent:function(){
10
8
  this.fieldLabel = this.getFValue('title');
11
9
  this.name = this.rest.getTableName() + '[' + this.getFValue('name') + ']';
12
10
  this.disabled = this.getFValue('readonly');
13
11
  this.allowBlank = true;
12
+ this.vtype = this.getFValue('vtype');
14
13
  this.callParent();
15
14
  },
16
15
  getFValue:function (key) {
@@ -0,0 +1,50 @@
1
+ Ext.define('FastUI.view.vfield.VTable', {
2
+ extend:'Ext.form.field.ComboBox',
3
+ requires:['FastUI.store.MListMgr'],
4
+ valueObject: {},
5
+ winCtx:{},
6
+ winId:0,
7
+ rest:{},
8
+
9
+ valueField:'id',
10
+ displayField:"title",
11
+ forceSelection:true,
12
+ triggerAction:'all',
13
+ editable:false,
14
+ selectOnFocus:true,
15
+
16
+ initComponent:function () {
17
+ this.fieldLabel = this.getFValue('title');
18
+ this.name = this.rest.getTableName() + '[' + this.getFValue('name') + ']';
19
+ this.disabled = this.getFValue('readonly');
20
+ this.allowBlank = true;
21
+ this.store = this.getStore();
22
+ this.callParent();
23
+ },
24
+
25
+ getFValue:function (key) {
26
+ return this.valueObject[key];
27
+ },
28
+
29
+ getMEntity:function(){
30
+ return this.valueObject.ref.entity;
31
+ },
32
+
33
+ getStore:function () {
34
+ var rest = Ext.create('FastUI.view.Rest', this.getMEntity());
35
+ return new Ext.data.JsonStore({
36
+ autoLoad: true,
37
+ fields:['id', 'title'],
38
+ proxy:{
39
+ type:'ajax',
40
+ url:rest.indexPath(),
41
+ reader:{
42
+ type:'json',
43
+ root:'rows',
44
+ totalProperty:"totalCount"
45
+ }
46
+ }
47
+ });
48
+ }
49
+
50
+ });
@@ -1,14 +1,17 @@
1
1
  Ext.define('FastUI.view.vfield.VText',{
2
- extend: 'Ext.form.field.Text',
2
+ extend: 'Ext.form.field.TextArea',
3
+
3
4
  valueObject: {},
4
5
  winCtx:{},
5
6
  winId:0,
6
7
  rest:{},
8
+
7
9
  initComponent:function(){
8
10
  this.fieldLabel = this.getFValue('title');
9
11
  this.name = this.rest.getTableName() + '[' + this.getFValue('name') + ']';
10
12
  this.disabled = this.getFValue('readonly');
11
13
  this.allowBlank = true;
14
+ this.vtype = this.getFValue('vtype');
12
15
  this.callParent();
13
16
  },
14
17
  getFValue:function (key) {
@@ -0,0 +1,78 @@
1
+ Ext.define('FastUI.view.vfield.VTreeCombobox', {
2
+ extend:'Ext.form.field.ComboBox',
3
+ alias:'widget.vtreecombobox',
4
+ valueObject: {},
5
+ winCtx:{},
6
+ winId:0,
7
+ rest:{},
8
+
9
+ editable: false,
10
+ // queryMode: 'local',
11
+ // select: Ext.emptyFn,
12
+ displayField:'title',
13
+ valueField:'id',
14
+ initComponent:function () {
15
+ this.fieldLabel = this.getFValue('title');
16
+ this.name = this.rest.getTableName() + '[' + this.getFValue('name') + ']';
17
+ this.disabled = this.getFValue('readonly');
18
+ this.allowBlank = true;
19
+ this.store = Ext.create('Ext.data.ArrayStore', {
20
+ fields:['id', 'title'],
21
+ data:[]
22
+ });
23
+ this.callParent();
24
+ },
25
+ createPicker: function() {
26
+ var rest = Ext.create('FastUI.view.Rest', this.getMEntity());
27
+ return Ext.create('Ext.tree.Panel', {
28
+ hidden: true,
29
+ floating: true,
30
+ minHeight: 300,
31
+ autoScroll: true,
32
+ store: Ext.create('Ext.data.TreeStore', {
33
+ fields:['id', {name:'text', mapping:'title'}],
34
+ autoLoad: true,
35
+ proxy:{
36
+ type: 'ajax',
37
+ url: rest.indexPath(),
38
+ reader:{
39
+ type:'json',
40
+ root:'',
41
+ record:''
42
+ //successProperty:''
43
+ }
44
+ },
45
+ root: {
46
+ text:'Root',
47
+ id:'',
48
+ expanded: true
49
+ }
50
+ }),
51
+ listeners: {
52
+ itemclick: function (view, record) {
53
+ var id = record.get('id');
54
+ if (!this.store.getById(id)){
55
+ this.store.add({id:id,title:record.get('text')});
56
+ }
57
+ this.setValue(id);
58
+ this.collapse();
59
+ },
60
+ scope:this
61
+ }
62
+ });
63
+ },
64
+ getMEntity:function(){
65
+ return this.valueObject.ref.entity;
66
+ },
67
+ getFValue:function (key) {
68
+ return this.valueObject[key];
69
+ },
70
+ setValue:function(value){
71
+ if(value && value.id && value.title){
72
+ this.store.add(value);
73
+ this.setValue(value.id);
74
+ }else{
75
+ this.callParent(arguments);
76
+ }
77
+ }
78
+ });
@@ -1,7 +1,85 @@
1
- Ext.apply(Ext.form.field.VTypes,{
2
- uniquename: function (v) {
3
- return Ext.form.field.VTypes.uniquenameRegex.test(v);
1
+ Ext.apply(Ext.form.field.VTypes, {
2
+ passwd: function (val, field) {
3
+ if (field.initialPassField) {
4
+ var pwd = Ext.getCmp(field.initialPassField);
5
+ return (val == pwd.getValue());
6
+ }
7
+ return true;
4
8
  },
5
- uniquenameRegex: /^[a-z]{1}[a-z_0-9]*$/,
6
- uniquenameText: 'Invalid unique name'
9
+ passwdText: '两次输入的密码不一致!',
10
+
11
+ chinese: function (val, field) {
12
+ return (/^[\u4e00-\u9fa5]+$/i).test(val);
13
+ },
14
+ chineseText: '请输入中文',
15
+
16
+ age: function (val, field) {
17
+ return parseInt(val) >= 0 && parseInt(val) <= 150;
18
+ },
19
+ ageText: '年龄输入有误',
20
+
21
+ alphanum: function (val, field) {
22
+ return !(/\W/.test(val));
23
+ },
24
+ alphanumText: '请输入英文字母或是数字,其它字符是不允许的.',
25
+
26
+ url: function (val, field) {
27
+ return /^(http|https|ftp):\/\/(([A-Z0-9][A-Z0-9_-]*)(\.[A-Z0-9][A-Z0-9_-]*)+)(:(\d+))?\/?/i.test(val);
28
+ },
29
+ urlText: '请输入有效的URL地址.',
30
+
31
+ max: function (val, field) {
32
+ return parseFloat(val) <= parseFloat(field.max);
33
+ },
34
+ maxText: '超过最大值',
35
+
36
+ min: function (val, field) {
37
+ return parseFloat(val) >= parseFloat(field.min);
38
+ },
39
+ minText: '小于最小值',
40
+
41
+ datecn: function (val, field) {
42
+ return (/^(\d{4})-(\d{2})-(\d{2})$/.test(val));
43
+ },
44
+ datecnText: '请使用这样的日期格式: yyyy-mm-dd. 例如:2008-06-20.',
45
+
46
+ integer: function (val, field) {
47
+ return /^[-+]?[\d]+$/.test(val);
48
+ },
49
+ integerText: '请输入正确的整数',
50
+
51
+ minlength: function (val, field) {
52
+ return val.length >= parseInt(field.minlen);
53
+ },
54
+ minlengthText: '长度过小',
55
+
56
+ maxlength: function (val, field) {
57
+ return val.length <= parseInt(field.maxlen);
58
+ },
59
+ maxlengthText: '长度过大',
60
+
61
+ ip: function (val, field) {
62
+ return /^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/.test(val);
63
+ },
64
+ ipText: '请输入正确的IP地址',
65
+
66
+ phone: function (val, field) {
67
+ return /^((0[1-9]{3})?(0[12][0-9])?[-])?\d{6,8}$/.test(val);
68
+ },
69
+ phoneText: '请输入正确的电话号码,如:0920-29392929',
70
+
71
+ mobilephone: function (val, field) {
72
+ return /(^0?[1][35][0-9]{9}$)/.test(val);
73
+ },
74
+ mobilephoneText: '请输入正确的手机号码',
75
+
76
+ alpha: function (val, field) {
77
+ return /^[a-zA-Z]+$/.test(val);
78
+ },
79
+ alphaText: '请输入英文字母',
80
+
81
+ money: function (val, field) {
82
+ return /^\d+\.\d{2}$/.test(val);
83
+ },
84
+ moneyText: '请输入正确的金额'
7
85
  });
@@ -11,6 +11,7 @@
11
11
  // GO AFTER THE REQUIRES BELOW.
12
12
  //
13
13
  // require ./extjs4/ext-all
14
+ //= require ./app/view/vfield/VType
14
15
  //= require ./extjs4/locale/ext-lang-zh_CN
15
16
  //= require ./app/inflection
16
17
  //= require ./fastui
@@ -1,31 +1,4 @@
1
- /*
2
- This file is part of Ext JS 4.2
3
1
 
4
- Copyright (c) 2011-2013 Sencha Inc
5
-
6
- Contact: http://www.sencha.com/contact
7
-
8
- GNU General Public License Usage
9
- This file may be used under the terms of the GNU General Public License version 3.0 as
10
- published by the Free Software Foundation and appearing in the file LICENSE included in the
11
- packaging of this file.
12
-
13
- Please review the following information to ensure the GNU General Public License version 3.0
14
- requirements will be met: http://www.gnu.org/copyleft/gpl.html.
15
-
16
- If you are unsure which license is appropriate for your use, please contact the sales department
17
- at http://www.sencha.com/contact.
18
-
19
- Build date: 2013-03-11 22:33:40 (aed16176e68b5e8aa1433452b12805c0ad913836)
20
- */
21
- /**
22
- * Simplified Chinese translation
23
- * By DavidHu
24
- * 09 April 2007
25
- *
26
- * update by andy_ghg
27
- * 2009-10-22 15:00:57
28
- */
29
2
  Ext.onReady(function() {
30
3
  var cm = Ext.ClassManager,
31
4
  exists = Ext.Function.bind(cm.get, cm),
@@ -297,6 +270,13 @@ Ext.define("Ext.locale.zh_CN.grid.PropertyColumnModel", {
297
270
  dateFormat: "y年m月d日"
298
271
  });
299
272
 
273
+ Ext.define("Ext.locale.zh_CN.VForm", {
274
+ override: "FastUI.view.VForm",
275
+ successText:'成功',
276
+ failureText:'失败',
277
+ invalidText:'无效'
278
+ });
279
+
300
280
  // This is needed until we can refactor all of the locales into individual files
301
281
  Ext.define("Ext.locale.zh_CN.Component", {
302
282
  override: "Ext.Component"
@@ -11,6 +11,8 @@ Ext.application({
11
11
  appFolder:'/assets/fastui/app',
12
12
 
13
13
 
14
+
15
+
14
16
  launch: function() {
15
17
 
16
18
  //Ext.Viewport.setMasked(false);
@@ -22,7 +22,7 @@ module Fastui
22
22
 
23
23
  def edit
24
24
  @m_list_item = MListItem.find(params[:id])
25
- respond_with(@m_list_item)
25
+ respond_with(@m_list_item.to_json(:include => [:m_list]))
26
26
  end
27
27
 
28
28
  def new
@@ -16,7 +16,7 @@ module Fastui
16
16
  # @m_menu_items = MMenuItem.where({:parent_id => params[:id]}.delete_if { |k, v| v.blank?})
17
17
  #@m_menu_items = paginate(@items)
18
18
  #end
19
- respond_with(@m_menu_items.to_json(:include => [:m_menu, :createdbyorg, :createdby, :updatedby], :methods => [:leaf?, :child?]))
19
+ respond_with(@m_menu_items.to_json(:include => [:m_menu, :createdbyorg, :createdby, :updatedby], :methods => [:leaf, :expanded]))
20
20
  end
21
21
 
22
22
  def show
@@ -6,11 +6,11 @@ module Fastui
6
6
 
7
7
  def index
8
8
  #@m_orgs = MOrg.scoped
9
- @m_orgs = params[:node] == 'root' ? MOrg.roots : MOrg.where({
9
+ @m_orgs = params[:node] == '' ? MOrg.roots : MOrg.where({
10
10
  :parent_id => params[:node]
11
11
  }.delete_if { |k, v| v.blank? })
12
12
 
13
- respond_with(@m_orgs.to_json(:include => [:parent], :methods => [:leaf?, :child?]))
13
+ respond_with(@m_orgs.to_json(:include => [:parent], :methods => [:leaf, :expanded]))
14
14
  end
15
15
 
16
16
  def show
@@ -7,5 +7,8 @@ module Fastui
7
7
 
8
8
  belongs_to :m_menu, :class_name => 'Fastui::MMenu'
9
9
 
10
+ alias :leaf :leaf?
11
+ alias :expanded :child?
12
+
10
13
  end
11
14
  end