netzke-basepack 0.7.6 → 0.7.7
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.rdoc +10 -0
- data/README.md +5 -5
- data/Rakefile +19 -19
- data/javascripts/basepack.js +17 -21
- data/javascripts/xdatetime.js +5 -4
- data/lib/netzke/active_record/attributes.rb +5 -2
- data/lib/netzke/basepack/data_adapters/active_record_adapter.rb +30 -1
- data/lib/netzke/basepack/form_panel.rb +1 -1
- data/lib/netzke/basepack/form_panel/javascripts/form_panel.js +1 -3
- data/lib/netzke/basepack/grid_panel.rb +1 -0
- data/lib/netzke/basepack/grid_panel/columns.rb +8 -2
- data/lib/netzke/basepack/grid_panel/javascripts/grid_panel.js +41 -41
- data/lib/netzke/basepack/paging_form_panel/javascripts/paging_form_panel.js +10 -10
- data/lib/netzke/basepack/query_builder.rb +1 -1
- data/lib/netzke/basepack/query_builder/javascripts/query_builder.js +4 -4
- data/lib/netzke/basepack/search_window.rb +1 -1
- data/lib/netzke/basepack/simple_app.rb +5 -0
- data/lib/netzke/basepack/version.rb +1 -1
- data/locales/zh-cn.yml +79 -0
- data/netzke-basepack.gemspec +10 -8
- data/test/basepack_test_app/.rvmrc +1 -1
- data/test/basepack_test_app/Gemfile +1 -1
- data/test/basepack_test_app/Gemfile.lock +53 -53
- data/test/basepack_test_app/app/components/book_grid_with_defaults.rb +6 -0
- data/test/basepack_test_app/app/components/user_form.rb +1 -1
- data/test/basepack_test_app/config/application.rb +1 -1
- data/test/basepack_test_app/features/form_panel.feature +16 -4
- data/test/basepack_test_app/features/grid_panel_with_custom_primary_key.feature +10 -10
- data/test/basepack_test_app/features/step_definitions/form_panel_steps.rb +1 -1
- data/test/basepack_test_app/features/step_definitions/generic_steps.rb +1 -1
- data/test/basepack_test_app/features/step_definitions/grid_panel_steps.rb +4 -4
- metadata +10 -9
data/CHANGELOG.rdoc
CHANGED
@@ -1,3 +1,13 @@
|
|
1
|
+
= 0.7.7 - 2012-10-20
|
2
|
+
* Ext JS 4.1.x support
|
3
|
+
|
4
|
+
* improvements
|
5
|
+
* cleaner handling of association column editing in GridPanel
|
6
|
+
|
7
|
+
* bug fix
|
8
|
+
* models with non-conventional primary keys could not be updated by gridpanel (davide)
|
9
|
+
* GridPanel's default forms respect "read_only" and "editable" config in fields
|
10
|
+
|
1
11
|
= 0.7.6 - 2012-07-27
|
2
12
|
* Fix netzke-core version dependency in gemspec
|
3
13
|
|
data/README.md
CHANGED
@@ -4,9 +4,9 @@ A pack of pre-built [Netzke](http://netzke.org) components - such as grid, form,
|
|
4
4
|
|
5
5
|
## Requirements
|
6
6
|
|
7
|
-
* Ruby 1.9.2
|
7
|
+
* Ruby 1.9.2
|
8
8
|
* Rails ~> 3.1.0
|
9
|
-
* Ext JS
|
9
|
+
* Ext JS ~> 4.1.x
|
10
10
|
|
11
11
|
## Installation
|
12
12
|
|
@@ -16,7 +16,7 @@ In your Gemfile:
|
|
16
16
|
|
17
17
|
For the "edge" stuff, tell bundler to get the gem straight from GitHub:
|
18
18
|
|
19
|
-
gem 'netzke-basepack', :git => "git://github.com/
|
19
|
+
gem 'netzke-basepack', :git => "git://github.com/nomadcoder/netzke-basepack.git"
|
20
20
|
|
21
21
|
## Usage
|
22
22
|
|
@@ -28,9 +28,9 @@ For more examples, see http://demo.netzke.com, and look into test/basepack_test_
|
|
28
28
|
|
29
29
|
## Testing and playing with Netzke Basepack
|
30
30
|
|
31
|
-
Netzke Basepack is bundled with Cucumber and RSpec tests. If you would like to contribute to the project, you may want to learn how to [run the tests](https://github.com/
|
31
|
+
Netzke Basepack is bundled with Cucumber and RSpec tests. If you would like to contribute to the project, you may want to learn how to [run the tests](https://github.com/nomadcoder/netzke-core/wiki/Automated-testing).
|
32
32
|
|
33
|
-
Besides, the bundled test application is a convenient [playground](https://github.com/
|
33
|
+
Besides, the bundled test application is a convenient [playground](https://github.com/nomadcoder/netzke-core/wiki/Playground) for those who search to experiment with the framework.
|
34
34
|
|
35
35
|
After starting up the test app, you can see the list of functional test components on the index page (along with links to the source code):
|
36
36
|
|
data/Rakefile
CHANGED
@@ -4,12 +4,12 @@ begin
|
|
4
4
|
Jeweler::Tasks.new do |gemspec|
|
5
5
|
gemspec.version = Netzke::Basepack::Version::STRING
|
6
6
|
gemspec.name = "netzke-basepack"
|
7
|
-
gemspec.summary = "Pre-built
|
8
|
-
gemspec.description = "A set of full-featured extendible Netzke components (such as FormPanel, GridPanel, Window,
|
7
|
+
gemspec.summary = "Pre-built Netzke for your RIA"
|
8
|
+
gemspec.description = "A set of full-featured extendible Netzke components (such as FormPanel, GridPanel, Window, etc) which can be used as building block for your RIA"
|
9
9
|
gemspec.email = "nmcoder@gmail.com"
|
10
10
|
gemspec.homepage = "http://netzke.org"
|
11
|
-
gemspec.authors = ["
|
12
|
-
gemspec.add_dependency("netzke-core", "~>0.7.
|
11
|
+
gemspec.authors = ["nomadcoder"]
|
12
|
+
gemspec.add_dependency("netzke-core", "~>0.7.7")
|
13
13
|
end
|
14
14
|
Jeweler::GemcutterTasks.new
|
15
15
|
rescue LoadError
|
@@ -23,22 +23,22 @@ Rake::TestTask.new(:test) do |test|
|
|
23
23
|
test.verbose = true
|
24
24
|
end
|
25
25
|
|
26
|
-
|
27
|
-
|
28
|
-
require './lib/netzke/basepack/version'
|
29
|
-
version = Netzke::Basepack::Version::STRING
|
26
|
+
begin
|
27
|
+
require 'yard'
|
30
28
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
rdoc.rdoc_files.include('README*')
|
35
|
-
rdoc.rdoc_files.include('CHANGELOG*')
|
36
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
37
|
-
end
|
29
|
+
YARD::Rake::YardocTask.new do |t|
|
30
|
+
t.options = ['--title', "Netzke Basepack #{Netzke::Basepack::Version::STRING}"]
|
31
|
+
end
|
38
32
|
|
39
|
-
namespace :
|
40
|
-
|
41
|
-
|
42
|
-
|
33
|
+
namespace :yard do
|
34
|
+
desc "Publish docs to api.netzke.org"
|
35
|
+
task :publish => :yard do
|
36
|
+
dir = 'www/api.netzke.org/basepack'
|
37
|
+
puts "Publishing to fl:#{dir}..."
|
38
|
+
`ssh fl "mkdir -p #{dir}"`
|
39
|
+
`scp -r doc/* fl:#{dir}`
|
40
|
+
end
|
43
41
|
end
|
42
|
+
rescue LoadError
|
43
|
+
puts "To enable yard do 'gem install yard'"
|
44
44
|
end
|
data/javascripts/basepack.js
CHANGED
@@ -22,18 +22,24 @@ Ext.apply(Ext.History, new Ext.util.Observable());
|
|
22
22
|
Ext.define('Ext.netzke.ComboBox', {
|
23
23
|
extend : 'Ext.form.field.ComboBox',
|
24
24
|
alias : 'widget.netzkeremotecombo',
|
25
|
-
valueField : '
|
26
|
-
displayField : '
|
25
|
+
valueField : 'value',
|
26
|
+
displayField : 'text',
|
27
27
|
triggerAction : 'all',
|
28
28
|
// WIP: Breaking - should not be 'true' if combobox is not editable
|
29
29
|
// typeAhead : true,
|
30
30
|
|
31
|
+
// getDisplayValue: function() {
|
32
|
+
// return this.getValue() == 0 ? this.emptyText : this.callOverridden();
|
33
|
+
// },
|
34
|
+
|
31
35
|
initComponent : function(){
|
32
36
|
var modelName = this.parentId + "_" + this.name;
|
33
37
|
|
38
|
+
if (this.blankLine == undefined) this.blankLine = "---";
|
39
|
+
|
34
40
|
Ext.define(modelName, {
|
35
41
|
extend: 'Ext.data.Model',
|
36
|
-
fields: ['
|
42
|
+
fields: ['value', 'text']
|
37
43
|
});
|
38
44
|
|
39
45
|
var store = new Ext.data.Store({
|
@@ -48,11 +54,18 @@ Ext.define('Ext.netzke.ComboBox', {
|
|
48
54
|
}
|
49
55
|
});
|
50
56
|
|
51
|
-
// TODO: find a cleaner way to pass this.name to the server
|
52
57
|
store.on('beforeload', function(self, params) {
|
53
58
|
params.params.column = this.name;
|
54
59
|
},this);
|
55
60
|
|
61
|
+
// insert a selectable "blank line" which allows to remove the associated record
|
62
|
+
if (this.blankLine) {
|
63
|
+
store.on('load', function(self, params) {
|
64
|
+
// append a selectable "empty line" which will allow remove the association
|
65
|
+
self.add(Ext.create(modelName, {value: -1, text: this.blankLine}));
|
66
|
+
}, this);
|
67
|
+
}
|
68
|
+
|
56
69
|
// If inline data was passed (TODO: is this actually working?)
|
57
70
|
if (this.store) store.loadData({data: this.store});
|
58
71
|
|
@@ -61,10 +74,6 @@ Ext.define('Ext.netzke.ComboBox', {
|
|
61
74
|
this.callParent();
|
62
75
|
},
|
63
76
|
|
64
|
-
collapse: function(){
|
65
|
-
// HACK: do not hide dropdown menu while loading items
|
66
|
-
if( !this.store.loading ) this.callParent();
|
67
|
-
}
|
68
77
|
});
|
69
78
|
|
70
79
|
Ext.util.Format.mask = function(v){
|
@@ -133,16 +142,3 @@ Ext.override( Ext.form.field.Checkbox, {
|
|
133
142
|
return this.callOverridden() || false; // 'off';
|
134
143
|
}
|
135
144
|
});
|
136
|
-
|
137
|
-
/* We were missing the 'load' event on proxy, implementing it ourselves */
|
138
|
-
Ext.override(Ext.data.proxy.Server, {
|
139
|
-
constructor: function() {
|
140
|
-
this.addEvents('load');
|
141
|
-
this.callOverridden([arguments]);
|
142
|
-
},
|
143
|
-
|
144
|
-
processResponse: function(success, operation, request, response, callback, scope){
|
145
|
-
this.callOverridden(arguments);
|
146
|
-
this.fireEvent('load', this, response, operation);
|
147
|
-
}
|
148
|
-
});
|
data/javascripts/xdatetime.js
CHANGED
@@ -6,6 +6,7 @@
|
|
6
6
|
* @author ontho (http://www.sencha.com/forum/member.php?285806-ontho)
|
7
7
|
* @author jakob.ketterl (http://www.sencha.com/forum/member.php?25102-jakob.ketterl)
|
8
8
|
* @link http://www.sencha.com/forum/showthread.php?134345-Ext.ux.form.field.DateTime
|
9
|
+
* from http://www.sencha.com/forum/showthread.php?134345-Ext.ux.form.field.DateTime&p=863449&viewfull=1#post863449
|
9
10
|
*/
|
10
11
|
Ext.define('Ext.ux.form.field.DateTime', {
|
11
12
|
extend:'Ext.form.FieldContainer',
|
@@ -112,7 +113,7 @@ Ext.define('Ext.ux.form.field.DateTime', {
|
|
112
113
|
|
113
114
|
// this dummy is necessary because Ext.Editor will not check whether an inputEl is present or not
|
114
115
|
this.inputEl = {
|
115
|
-
dom:
|
116
|
+
dom: document.createElement('div'),
|
116
117
|
swallowEvent:function(){}
|
117
118
|
};
|
118
119
|
|
@@ -120,7 +121,7 @@ Ext.define('Ext.ux.form.field.DateTime', {
|
|
120
121
|
},
|
121
122
|
|
122
123
|
focus:function(){
|
123
|
-
this.callParent();
|
124
|
+
this.callParent(arguments);
|
124
125
|
this.dateField.focus();
|
125
126
|
},
|
126
127
|
|
@@ -131,12 +132,12 @@ Ext.define('Ext.ux.form.field.DateTime', {
|
|
131
132
|
this.focussedItem = item;
|
132
133
|
},
|
133
134
|
|
134
|
-
onItemBlur:function(item){
|
135
|
+
onItemBlur:function(item, e){
|
135
136
|
var me = this;
|
136
137
|
if (item != me.focussedItem){ return; }
|
137
138
|
// 100ms to focus a new item that belongs to us, otherwise we will assume the user left the field
|
138
139
|
me.blurTask = new Ext.util.DelayedTask(function(){
|
139
|
-
me.fireEvent('blur', me);
|
140
|
+
me.fireEvent('blur', me, e);
|
140
141
|
});
|
141
142
|
me.blurTask.delay(100);
|
142
143
|
},
|
@@ -117,7 +117,7 @@ module Netzke
|
|
117
117
|
candidates = %w{name title label} << foreign_key_for_assoc(assoc)
|
118
118
|
assoc_method = candidates.detect{|m| (assoc.klass.instance_methods.map(&:to_s) + assoc.klass.column_names).include?(m) }
|
119
119
|
c[:name] = "#{assoc.name}__#{assoc_method}"
|
120
|
-
c[:attr_type] =
|
120
|
+
c[:attr_type] = :integer # when it's an instance method rather than a column, fall back to :string
|
121
121
|
end
|
122
122
|
|
123
123
|
# auto set up the default value from the column settings
|
@@ -231,7 +231,10 @@ module Netzke
|
|
231
231
|
# what should we do in this case?
|
232
232
|
end
|
233
233
|
else
|
234
|
-
|
234
|
+
|
235
|
+
# set the foreign key to the passed value
|
236
|
+
# not that if a negative value is passed, we reset the association (set it to nil)
|
237
|
+
self.send("#{assoc.foreign_key}=", v.to_i < 0 ? nil : v)
|
235
238
|
end
|
236
239
|
else
|
237
240
|
logger.debug "Netzke::Basepack: Association #{assoc} is not known for class #{self.class.name}"
|
@@ -4,6 +4,35 @@ module Netzke::Basepack::DataAdapters
|
|
4
4
|
model_class <= ActiveRecord::Base
|
5
5
|
end
|
6
6
|
|
7
|
+
def primary_key_name
|
8
|
+
@model_class.primary_key.to_s
|
9
|
+
end
|
10
|
+
|
11
|
+
def attr_type(attr_name)
|
12
|
+
@model_class.association_attr?(attr_name) ? :integer : (@model_class.columns_hash[attr_name.to_s].try(:type) || :string)
|
13
|
+
end
|
14
|
+
|
15
|
+
def model_attributes
|
16
|
+
@model_class.column_names.map do |column_name|
|
17
|
+
{:name => column_name, :attr_type => @model_class.columns_hash[column_name].type}.tap do |c|
|
18
|
+
|
19
|
+
# If it's named as foreign key of some association, then it's an association column
|
20
|
+
assoc = @model_class.reflect_on_all_associations.detect { |a| foreign_key_for_assoc(a) == c[:name] }
|
21
|
+
|
22
|
+
if assoc && !assoc.options[:polymorphic]
|
23
|
+
candidates = %w{name title label} << foreign_key_for_assoc(assoc)
|
24
|
+
assoc_method = candidates.detect{|m| (assoc.klass.instance_methods.map(&:to_s) + assoc.klass.column_names).include?(m) }
|
25
|
+
c[:name] = "#{assoc.name}__#{assoc_method}"
|
26
|
+
end
|
27
|
+
|
28
|
+
c[:attr_type] = attr_type(c[:name])
|
29
|
+
|
30
|
+
# auto set up the default value from the column settings
|
31
|
+
c[:default_value] = @model_class.columns_hash[column_name].default if @model_class.columns_hash[column_name].default
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
7
36
|
def get_records(params, columns=[])
|
8
37
|
# build initial relation based on passed params
|
9
38
|
relation = get_relation(params)
|
@@ -130,7 +159,7 @@ module Netzke::Basepack::DataAdapters
|
|
130
159
|
end
|
131
160
|
|
132
161
|
def find_record(id)
|
133
|
-
@model_class.
|
162
|
+
@model_class.where(@model_class.primary_key => id).first
|
134
163
|
end
|
135
164
|
|
136
165
|
# Build a hash of foreign keys and the associated model
|
@@ -106,7 +106,7 @@ module Netzke
|
|
106
106
|
|
107
107
|
# A hash of record data including the meta field
|
108
108
|
def js_record_data
|
109
|
-
record.netzke_hash(fields).merge(:
|
109
|
+
record.netzke_hash(fields).merge(:meta => meta_field).literalize_keys
|
110
110
|
end
|
111
111
|
|
112
112
|
def record
|
@@ -39,8 +39,6 @@
|
|
39
39
|
|
40
40
|
this.initialConfig.errorReader = new ErrorReader();
|
41
41
|
|
42
|
-
// this.getForm().trackResetOnLoad = true;
|
43
|
-
|
44
42
|
// Now let Ext.form.FormPanel do the rest
|
45
43
|
this.callParent(arguments);
|
46
44
|
|
@@ -176,7 +174,7 @@
|
|
176
174
|
},
|
177
175
|
|
178
176
|
setFormValues: function(values){
|
179
|
-
var assocValues = values.
|
177
|
+
var assocValues = values.meta.associationValues || {};
|
180
178
|
for (var assocFieldName in assocValues) {
|
181
179
|
|
182
180
|
var assocField = this.getForm().getFields().filter('name', assocFieldName).first();
|
@@ -76,6 +76,7 @@ module Netzke
|
|
76
76
|
# end
|
77
77
|
#
|
78
78
|
# * +format+ - the format to display data in case of date and datetime columns, e.g. 'Y-m-d g:i:s'.
|
79
|
+
# * +blank_line+ - the blank line for one-to-many association columns, defaults to "---". Set to false to exclude completely.
|
79
80
|
#
|
80
81
|
# Besides these options, a column can receive any meaningful config option understood by Ext.grid.column.Column.
|
81
82
|
#
|
@@ -76,7 +76,7 @@ module Netzke
|
|
76
76
|
def append_meta_column(cols)
|
77
77
|
cols << {}.tap do |c|
|
78
78
|
c.merge!(
|
79
|
-
:name => "
|
79
|
+
:name => "meta",
|
80
80
|
:meta => true,
|
81
81
|
:getter => lambda do |r|
|
82
82
|
meta_data(r)
|
@@ -109,6 +109,10 @@ module Netzke
|
|
109
109
|
@default_columns ||= load_model_level_attrs || data_class.netzke_attributes
|
110
110
|
end
|
111
111
|
|
112
|
+
def set_default_attr_type(c)
|
113
|
+
c[:attr_type] ||= association_attr?(c) ? :integer : data_adapter.attr_type(c.name)
|
114
|
+
end
|
115
|
+
|
112
116
|
# Columns that were overridden with :override_columns config option.
|
113
117
|
def overridden_default_columns
|
114
118
|
if config[:override_columns].present?
|
@@ -336,7 +340,9 @@ module Netzke
|
|
336
340
|
selected_columns.map do |c|
|
337
341
|
field_config = {
|
338
342
|
:name => c[:name],
|
339
|
-
:field_label => c[:text] || c[:header]
|
343
|
+
:field_label => c[:text] || c[:header],
|
344
|
+
:read_only => c[:read_only],
|
345
|
+
:editable => c[:editable]
|
340
346
|
}
|
341
347
|
|
342
348
|
# scopes for combobox options
|
@@ -26,23 +26,19 @@
|
|
26
26
|
this.normalizeRenderer(c);
|
27
27
|
|
28
28
|
// Build the field configuration for this column
|
29
|
-
var fieldConfig = {name: c.name, defaultValue: c.defaultValue};
|
29
|
+
var fieldConfig = {name: c.name, defaultValue: c.defaultValue, useNull: true}; // useNull is needed to not convert nils to 0 in associations!
|
30
30
|
|
31
|
-
if (c.name !== '
|
31
|
+
if (c.name !== 'meta') fieldConfig.type = this.fieldTypeForAttrType(c.attrType); // field type (grid editors need this to function well)
|
32
32
|
|
33
33
|
if (c.attrType == 'datetime') {
|
34
|
-
fieldConfig.dateFormat = 'Y-m-d
|
34
|
+
fieldConfig.dateFormat = 'Y-m-d H:i:s'; // set the format in which we receive datetime from the server (so that the model can parse it)
|
35
35
|
|
36
|
+
// While for 'date' columns the renderer is set up automatically (through using column's xtype), there's no appropriate xtype for our custom datetime column.
|
37
|
+
// Thus, we need to set the renderer manually.
|
38
|
+
// NOTE: for Ext there's no distinction b/w date and datetime; date fields can include time.
|
36
39
|
if (!c.renderer) {
|
37
|
-
|
38
|
-
|
39
|
-
};
|
40
|
-
|
41
|
-
if (c.attrType == 'date') {
|
42
|
-
fieldConfig.dateFormat = 'Y-m-d'; // in this format we receive dates from the server
|
43
|
-
|
44
|
-
if (!c.renderer) {
|
45
|
-
c.renderer = Ext.util.Format.dateRenderer(c.format || fieldConfig.dateFormat); // format in which the data will be rendered
|
40
|
+
// format in which the data will be rendered; if c.format is nil, Ext.Date.defaultFormat extended with time will be used
|
41
|
+
c.renderer = Ext.util.Format.dateRenderer(c.format || Ext.Date.defaultFormat + " H:i:s");
|
46
42
|
}
|
47
43
|
};
|
48
44
|
|
@@ -61,12 +57,12 @@
|
|
61
57
|
|
62
58
|
|
63
59
|
// Set rendeder for association columns (the one displaying associations by the specified method instead of id)
|
60
|
+
|
64
61
|
if (c.assoc) {
|
65
62
|
// Editor for association column
|
66
63
|
c.editor = Ext.apply({
|
67
64
|
parentId: this.id,
|
68
|
-
name: c.name
|
69
|
-
selectOnFocus: true // ?
|
65
|
+
name: c.name
|
70
66
|
}, c.editor);
|
71
67
|
|
72
68
|
// Renderer for association column
|
@@ -79,15 +75,12 @@
|
|
79
75
|
|
80
76
|
// Setting the default filter type
|
81
77
|
if (c.filterable && !c.filter) {
|
82
|
-
c.filter = {type: this.fieldTypeForAttrType(c.attrType)};
|
78
|
+
c.filter = {type: c.assoc ? 'string' : this.fieldTypeForAttrType(c.attrType)};
|
83
79
|
}
|
84
80
|
|
85
81
|
// setting dataIndex
|
86
82
|
c.dataIndex = c.name;
|
87
83
|
|
88
|
-
// HACK: somehow this is not set by Ext (while it should be)
|
89
|
-
if (c.xtype == 'datecolumn') c.format = c.format || Ext.util.Format.dateFormat;
|
90
|
-
|
91
84
|
}, this);
|
92
85
|
|
93
86
|
/* ... and done with the columns */
|
@@ -124,14 +117,12 @@
|
|
124
117
|
// ... instead, define own column model
|
125
118
|
this.columns = colModelConfig;
|
126
119
|
|
120
|
+
var reader = Ext.create('Ext.data.reader.Array', {root: 'data', totalProperty: 'total'});
|
121
|
+
|
127
122
|
// DirectProxy that uses our Ext.direct provider
|
128
|
-
var proxy = {
|
129
|
-
type: 'direct',
|
123
|
+
var proxy = Ext.create('Ext.data.proxy.Direct', {
|
130
124
|
directFn: Netzke.providers[this.id].getData,
|
131
|
-
reader:
|
132
|
-
type: 'array',
|
133
|
-
root: 'data'
|
134
|
-
},
|
125
|
+
reader: reader,
|
135
126
|
listeners: {
|
136
127
|
exception: {
|
137
128
|
fn: this.loadExceptionHandler,
|
@@ -149,19 +140,17 @@
|
|
149
140
|
scope: this
|
150
141
|
}
|
151
142
|
}
|
152
|
-
}
|
143
|
+
});
|
153
144
|
|
154
|
-
this.store = Ext.create('
|
145
|
+
this.store = Ext.create('Ext.data.Store', {
|
155
146
|
model: this.id,
|
156
147
|
proxy: proxy,
|
157
|
-
data: this.inlineData && [this.inlineData.data] || [], // TODO: Inline data *might* contain commands to execute
|
158
148
|
pruneModifiedRecords: true,
|
159
149
|
remoteSort: true,
|
160
150
|
pageSize: this.rowsPerPage
|
161
151
|
});
|
162
152
|
|
163
|
-
|
164
|
-
this.store.totalCount = this.inlineData && this.inlineData[this.store.getProxy().getReader().totalProperty];
|
153
|
+
if (this.inlineData) this.store.loadRawData(this.inlineData);
|
165
154
|
|
166
155
|
// Drag'n'Drop
|
167
156
|
if (this.enableRowsReordering){
|
@@ -183,7 +172,7 @@
|
|
183
172
|
xtype: 'pagingtoolbar',
|
184
173
|
dock: 'bottom',
|
185
174
|
store: this.store,
|
186
|
-
items: this.bbar && ["-"].concat(this.bbar) // append the old bbar
|
175
|
+
items: this.bbar && ["-"].concat(this.bbar) // append the old bbar
|
187
176
|
});
|
188
177
|
} else if (this.bbar) {
|
189
178
|
this.dockedItems.push({
|
@@ -234,14 +223,26 @@
|
|
234
223
|
// WIP: GridView
|
235
224
|
this.getView().getRowClass = this.defaultGetRowClass;
|
236
225
|
|
226
|
+
// this.on('edit', function(editor, e) {
|
227
|
+
// if (e.column.assoc && e.record.get('meta')) {
|
228
|
+
// console.log("editor:", editor);
|
229
|
+
// editor.setRawValue("");
|
230
|
+
// }
|
231
|
+
// });
|
232
|
+
|
237
233
|
// When starting editing as assocition column, pre-load the combobox store from the meta column, so that we don't see the real value of this cell (the id of the associated record), but rather the associated record by the configured method.
|
238
|
-
this.on('beforeedit', function(e){
|
239
|
-
if (e.column.assoc && e.record.get('
|
240
|
-
var
|
241
|
-
|
242
|
-
|
243
|
-
|
234
|
+
this.on('beforeedit', function(editor, e){
|
235
|
+
if (e.column.assoc && e.record.get('meta')) {
|
236
|
+
var c = e.column,
|
237
|
+
combo = c.getEditor(),
|
238
|
+
store = combo.store,
|
239
|
+
id = e.record.get(e.field);
|
240
|
+
|
241
|
+
// initial load of 1 single record for the combobox store, which contains the display text (stored in the meta field) for the current value
|
242
|
+
if (id && -1 == store.find('value', id)) {
|
243
|
+
store.loadData([[e.record.get(e.field), e.record.get('meta').associationValues[e.field]]], true);
|
244
244
|
}
|
245
|
+
|
245
246
|
}
|
246
247
|
}, this);
|
247
248
|
|
@@ -417,14 +418,13 @@
|
|
417
418
|
c.renderer = function(value, a, r, ri, ci){
|
418
419
|
var column = this.headerCt.items.getAt(ci),
|
419
420
|
editor = column.getEditor && column.getEditor(),
|
420
|
-
|
421
|
-
recordFromStore = editor && editor.isXType('combobox') && editor.store.findRecord('field1', value),
|
421
|
+
recordFromStore = editor && editor.isXType('combobox') && editor.getStore().findRecord('value', value),
|
422
422
|
renderedValue;
|
423
423
|
|
424
424
|
if (recordFromStore) {
|
425
|
-
renderedValue = recordFromStore.get('
|
426
|
-
} else if (c.assoc && r.get('
|
427
|
-
renderedValue = r.get('
|
425
|
+
renderedValue = recordFromStore.get('text');
|
426
|
+
} else if (c.assoc && r.get('meta')) {
|
427
|
+
renderedValue = r.get('meta').associationValues[c.name] || c.emptyText;
|
428
428
|
} else {
|
429
429
|
renderedValue = value;
|
430
430
|
}
|
@@ -30,13 +30,15 @@
|
|
30
30
|
},
|
31
31
|
|
32
32
|
afterRender: function() {
|
33
|
+
// delete this.record so our parent FormPanel doesn't have to load it - we do it ourselves
|
34
|
+
var record = this.record;
|
35
|
+
delete (this.record);
|
36
|
+
|
33
37
|
this.callParent();
|
34
38
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
// Line 18214"
|
39
|
-
// new Ext.LoadMask(this.bwrap, Ext.apply(this.applyMask, {store: this.store}));
|
39
|
+
if (record) this.store.loadRawData({records: [record], total: this.totalRecords});
|
40
|
+
|
41
|
+
new Ext.LoadMask(this, Ext.apply(this.applyMask, {store: this.store}));
|
40
42
|
},
|
41
43
|
|
42
44
|
initComponent: function() {
|
@@ -49,10 +51,8 @@
|
|
49
51
|
var store = new Ext.data.DirectStore({
|
50
52
|
directFn: Netzke.providers[this.id].getData,
|
51
53
|
root: 'records',
|
52
|
-
fields: this.fieldNames.concat('
|
53
|
-
pageSize: 1
|
54
|
-
// HACK: we must let the store know totalCount, but this property is not public (yet?)
|
55
|
-
totalCount: this.totalRecords
|
54
|
+
fields: this.fieldNames.concat('meta'),
|
55
|
+
pageSize: 1
|
56
56
|
});
|
57
57
|
|
58
58
|
store.on('load', function(st, r){
|
@@ -73,4 +73,4 @@
|
|
73
73
|
|
74
74
|
this.callParent();
|
75
75
|
}
|
76
|
-
}
|
76
|
+
}
|
@@ -73,7 +73,7 @@ module Netzke
|
|
73
73
|
:listeners => {:before_select => {
|
74
74
|
:fn => "function(combo, record){
|
75
75
|
var form = Ext.getCmp('#{global_id}');
|
76
|
-
form.buildFormFromQuery(record.data.
|
76
|
+
form.buildFormFromQuery(record.data.value);
|
77
77
|
}".l
|
78
78
|
}}
|
79
79
|
}, :save_preset.action, :delete_preset.action
|
@@ -102,20 +102,20 @@
|
|
102
102
|
|
103
103
|
if (searchName !== "") {
|
104
104
|
var presetsComboStore = this.presetsCombo.getStore();
|
105
|
-
var existingPresetIndex = presetsComboStore.find('
|
105
|
+
var existingPresetIndex = presetsComboStore.find('text', searchName);
|
106
106
|
if (existingPresetIndex !== -1) {
|
107
107
|
// overwriting
|
108
108
|
Ext.Msg.confirm(this.i18n.overwriteConfirmTitle, this.i18n.overwriteConfirm, function(btn, text){
|
109
109
|
if (btn == 'yes') {
|
110
110
|
var r = presetsComboStore.getAt(existingPresetIndex);
|
111
|
-
r.set('
|
111
|
+
r.set('value', this.getQuery(true));
|
112
112
|
r.commit();
|
113
113
|
this.doSavePreset(searchName);
|
114
114
|
}
|
115
115
|
}, this);
|
116
116
|
} else {
|
117
117
|
this.doSavePreset(searchName);
|
118
|
-
presetsComboStore.add({
|
118
|
+
presetsComboStore.add({value: this.getQuery(true), text: searchName});
|
119
119
|
}
|
120
120
|
}
|
121
121
|
},
|
@@ -147,7 +147,7 @@
|
|
147
147
|
|
148
148
|
removePresetFromList: function(name){
|
149
149
|
var presetsComboStore = this.presetsCombo.getStore();
|
150
|
-
presetsComboStore.removeAt(presetsComboStore.find('
|
150
|
+
presetsComboStore.removeAt(presetsComboStore.find('text', name));
|
151
151
|
this.presetsCombo.reset();
|
152
152
|
}
|
153
153
|
}
|
@@ -40,6 +40,11 @@ module Netzke
|
|
40
40
|
|
41
41
|
js_mixin :simple_app
|
42
42
|
|
43
|
+
# In Ext 4.1 calling `render` on a viewport causes an error
|
44
|
+
def js_component_render
|
45
|
+
""
|
46
|
+
end
|
47
|
+
|
43
48
|
def configuration
|
44
49
|
super.merge(
|
45
50
|
:items => [main_panel_config, menu_bar_config, status_bar_config]
|
data/locales/zh-cn.yml
ADDED
@@ -0,0 +1,79 @@
|
|
1
|
+
zh-cn:
|
2
|
+
netzke:
|
3
|
+
basepack:
|
4
|
+
grid_panel:
|
5
|
+
actions:
|
6
|
+
add: "增加"
|
7
|
+
edit: "编辑"
|
8
|
+
del: "删除"
|
9
|
+
apply: "保存"
|
10
|
+
add_in_form: "表格添加"
|
11
|
+
edit_in_form: "表格编辑"
|
12
|
+
search: "搜索"
|
13
|
+
|
14
|
+
deleted_n_records: "删除了 %{n} 条记录"
|
15
|
+
cannot_delete: "本用户无权限删除"
|
16
|
+
confirmation: "确认"
|
17
|
+
are_you_sure: "确认改操作吗?"
|
18
|
+
|
19
|
+
record_form_window:
|
20
|
+
actions:
|
21
|
+
ok: "确定"
|
22
|
+
cancel: "取消"
|
23
|
+
|
24
|
+
search_window:
|
25
|
+
title: "高级搜索"
|
26
|
+
actions:
|
27
|
+
search: "搜索"
|
28
|
+
cancel: "取消"
|
29
|
+
|
30
|
+
form_panel:
|
31
|
+
actions:
|
32
|
+
edit: "编辑"
|
33
|
+
edit_tooltip: "编辑"
|
34
|
+
cancel: "取消"
|
35
|
+
cancel_tooltip: "取消编辑"
|
36
|
+
apply: "保存"
|
37
|
+
apply_tooltip: "保存修改"
|
38
|
+
|
39
|
+
search_panel:
|
40
|
+
presets: "呈现"
|
41
|
+
equals: "等于"
|
42
|
+
greater_than: "大于"
|
43
|
+
less_than: "小于"
|
44
|
+
contains: "包含"
|
45
|
+
matches: "匹配"
|
46
|
+
date_equals: "On"
|
47
|
+
before: "之前"
|
48
|
+
after: "之后"
|
49
|
+
|
50
|
+
paging_form_panel:
|
51
|
+
actions:
|
52
|
+
search: "搜索"
|
53
|
+
search_tooltip: "高级搜索"
|
54
|
+
|
55
|
+
query_builder:
|
56
|
+
presets: "预设"
|
57
|
+
preset_saved: "预设成功保存"
|
58
|
+
preset_deleted: "预设成功删除"
|
59
|
+
overwrite_confirm: "确定覆盖已存在的预设 '{0}' 吗?"
|
60
|
+
overwrite_confirm_title: "覆盖已存在预设"
|
61
|
+
delete_confirm: "确定删除预设 '{0}' 吗?"
|
62
|
+
delete_confirm_title: "删除预设确认"
|
63
|
+
actions:
|
64
|
+
clear_all: "清除"
|
65
|
+
clear_all_tooltip: "清除所有条件"
|
66
|
+
reset: "重置"
|
67
|
+
reset_tooltip: "重置条件值"
|
68
|
+
save_preset: "保存预设"
|
69
|
+
save_preset_tooltip: "保存预设"
|
70
|
+
delete_preset: "删除预设"
|
71
|
+
delete_preset_tooltip: "删除预设"
|
72
|
+
apply: "保存"
|
73
|
+
apply_tooltip: "应用条件"
|
74
|
+
|
75
|
+
|
76
|
+
formats:
|
77
|
+
date: Y-m-d
|
78
|
+
datetime: Y-m-d H:i:s
|
79
|
+
time: H:i:s
|
data/netzke-basepack.gemspec
CHANGED
@@ -5,12 +5,12 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "netzke-basepack"
|
8
|
-
s.version = "0.7.
|
8
|
+
s.version = "0.7.7"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
-
s.authors = ["
|
12
|
-
s.date = "2012-
|
13
|
-
s.description = "A set of full-featured extendible Netzke components (such as FormPanel, GridPanel, Window,
|
11
|
+
s.authors = ["nomadcoder"]
|
12
|
+
s.date = "2012-10-20"
|
13
|
+
s.description = "A set of full-featured extendible Netzke components (such as FormPanel, GridPanel, Window, etc) which can be used as building block for your RIA"
|
14
14
|
s.email = "nmcoder@gmail.com"
|
15
15
|
s.extra_rdoc_files = [
|
16
16
|
"LICENSE",
|
@@ -100,6 +100,7 @@ Gem::Specification.new do |s|
|
|
100
100
|
"lib/tasks/netzke_basepack_tasks.rake",
|
101
101
|
"locales/de.yml",
|
102
102
|
"locales/en.yml",
|
103
|
+
"locales/zh-cn.yml",
|
103
104
|
"netzke-basepack.gemspec",
|
104
105
|
"stylesheets/basepack.css",
|
105
106
|
"stylesheets/datetimefield.css",
|
@@ -122,6 +123,7 @@ Gem::Specification.new do |s|
|
|
122
123
|
"test/basepack_test_app/app/components/book_grid_with_column_actions.rb",
|
123
124
|
"test/basepack_test_app/app/components/book_grid_with_custom_columns.rb",
|
124
125
|
"test/basepack_test_app/app/components/book_grid_with_default_values.rb",
|
126
|
+
"test/basepack_test_app/app/components/book_grid_with_defaults.rb",
|
125
127
|
"test/basepack_test_app/app/components/book_grid_with_extra_feedback.rb",
|
126
128
|
"test/basepack_test_app/app/components/book_grid_with_extra_filters.rb",
|
127
129
|
"test/basepack_test_app/app/components/book_grid_with_nested_attributes.rb",
|
@@ -289,18 +291,18 @@ Gem::Specification.new do |s|
|
|
289
291
|
s.homepage = "http://netzke.org"
|
290
292
|
s.require_paths = ["lib"]
|
291
293
|
s.rubygems_version = "1.8.10"
|
292
|
-
s.summary = "Pre-built
|
294
|
+
s.summary = "Pre-built Netzke for your RIA"
|
293
295
|
|
294
296
|
if s.respond_to? :specification_version then
|
295
297
|
s.specification_version = 3
|
296
298
|
|
297
299
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
298
|
-
s.add_runtime_dependency(%q<netzke-core>, ["~> 0.7.
|
300
|
+
s.add_runtime_dependency(%q<netzke-core>, ["~> 0.7.7"])
|
299
301
|
else
|
300
|
-
s.add_dependency(%q<netzke-core>, ["~> 0.7.
|
302
|
+
s.add_dependency(%q<netzke-core>, ["~> 0.7.7"])
|
301
303
|
end
|
302
304
|
else
|
303
|
-
s.add_dependency(%q<netzke-core>, ["~> 0.7.
|
305
|
+
s.add_dependency(%q<netzke-core>, ["~> 0.7.7"])
|
304
306
|
end
|
305
307
|
end
|
306
308
|
|
@@ -1 +1 @@
|
|
1
|
-
rvm 1.9.
|
1
|
+
rvm 1.9.3
|
@@ -11,7 +11,7 @@ GIT
|
|
11
11
|
PATH
|
12
12
|
remote: vendor/gems/netzke-core
|
13
13
|
specs:
|
14
|
-
netzke-core (0.7.
|
14
|
+
netzke-core (0.7.6)
|
15
15
|
activesupport (>= 3.0.0)
|
16
16
|
|
17
17
|
PATH
|
@@ -49,9 +49,9 @@ GEM
|
|
49
49
|
activesupport (3.2.1)
|
50
50
|
i18n (~> 0.6)
|
51
51
|
multi_json (~> 1.0)
|
52
|
-
addressable (2.2
|
52
|
+
addressable (2.3.2)
|
53
53
|
arel (3.0.2)
|
54
|
-
builder (3.0.
|
54
|
+
builder (3.0.3)
|
55
55
|
capybara (1.1.2)
|
56
56
|
mime-types (>= 1.16)
|
57
57
|
nokogiri (>= 1.3.3)
|
@@ -59,57 +59,58 @@ GEM
|
|
59
59
|
rack-test (>= 0.5.4)
|
60
60
|
selenium-webdriver (~> 2.0)
|
61
61
|
xpath (~> 0.1.4)
|
62
|
-
capybara-screenshot (0.
|
62
|
+
capybara-screenshot (0.2.2)
|
63
63
|
capybara (>= 1.0)
|
64
|
-
childprocess (0.3.
|
65
|
-
ffi (~> 1.0.6)
|
66
|
-
coderay (1.0.
|
67
|
-
cucumber (1.1
|
64
|
+
childprocess (0.3.5)
|
65
|
+
ffi (~> 1.0, >= 1.0.6)
|
66
|
+
coderay (1.0.8)
|
67
|
+
cucumber (1.2.1)
|
68
68
|
builder (>= 2.1.2)
|
69
|
-
diff-lcs (>= 1.1.
|
70
|
-
gherkin (~> 2.
|
69
|
+
diff-lcs (>= 1.1.3)
|
70
|
+
gherkin (~> 2.11.0)
|
71
71
|
json (>= 1.4.6)
|
72
|
-
term-ansicolor (>= 1.0.6)
|
73
72
|
cucumber-rails (1.3.0)
|
74
73
|
capybara (>= 1.1.2)
|
75
74
|
cucumber (>= 1.1.8)
|
76
75
|
nokogiri (>= 1.5.0)
|
77
|
-
daemons (1.1.
|
78
|
-
database_cleaner (0.
|
76
|
+
daemons (1.1.9)
|
77
|
+
database_cleaner (0.9.1)
|
79
78
|
diff-lcs (1.1.3)
|
80
79
|
erubis (2.7.0)
|
81
|
-
eventmachine (0.
|
82
|
-
factory_girl (
|
80
|
+
eventmachine (1.0.0)
|
81
|
+
factory_girl (4.1.0)
|
83
82
|
activesupport (>= 3.0.0)
|
84
|
-
ffi (1.
|
85
|
-
gherkin (2.
|
83
|
+
ffi (1.1.5)
|
84
|
+
gherkin (2.11.5)
|
86
85
|
json (>= 1.4.6)
|
87
86
|
hike (1.2.1)
|
88
|
-
i18n (0.6.
|
89
|
-
journey (1.0.
|
90
|
-
json (1.
|
91
|
-
launchy (2.1.
|
92
|
-
addressable (~> 2.
|
87
|
+
i18n (0.6.1)
|
88
|
+
journey (1.0.4)
|
89
|
+
json (1.7.5)
|
90
|
+
launchy (2.1.2)
|
91
|
+
addressable (~> 2.3)
|
92
|
+
libwebsocket (0.1.5)
|
93
|
+
addressable
|
93
94
|
mail (2.4.4)
|
94
95
|
i18n (>= 0.4.0)
|
95
96
|
mime-types (~> 1.16)
|
96
97
|
treetop (~> 1.4.8)
|
97
|
-
method_source (0.
|
98
|
-
mime-types (1.
|
99
|
-
multi_json (1.
|
98
|
+
method_source (0.8)
|
99
|
+
mime-types (1.19)
|
100
|
+
multi_json (1.3.6)
|
100
101
|
mysql2 (0.3.11)
|
101
|
-
nokogiri (1.5.
|
102
|
+
nokogiri (1.5.5)
|
102
103
|
polyglot (0.3.3)
|
103
|
-
pry (0.9.
|
104
|
+
pry (0.9.10)
|
104
105
|
coderay (~> 1.0.5)
|
105
|
-
method_source (~> 0.
|
106
|
-
slop (
|
106
|
+
method_source (~> 0.8)
|
107
|
+
slop (~> 3.3.1)
|
107
108
|
rack (1.4.1)
|
108
109
|
rack-cache (1.2)
|
109
110
|
rack (>= 0.4)
|
110
111
|
rack-ssl (1.3.2)
|
111
112
|
rack
|
112
|
-
rack-test (0.6.
|
113
|
+
rack-test (0.6.2)
|
113
114
|
rack (>= 1.0)
|
114
115
|
rails (3.2.1)
|
115
116
|
actionmailer (= 3.2.1)
|
@@ -129,48 +130,47 @@ GEM
|
|
129
130
|
rake (0.9.2.2)
|
130
131
|
rdoc (3.12)
|
131
132
|
json (~> 1.4)
|
132
|
-
rspec (2.
|
133
|
-
rspec-core (~> 2.
|
134
|
-
rspec-expectations (~> 2.
|
135
|
-
rspec-mocks (~> 2.
|
136
|
-
rspec-core (2.
|
137
|
-
rspec-expectations (2.
|
133
|
+
rspec (2.11.0)
|
134
|
+
rspec-core (~> 2.11.0)
|
135
|
+
rspec-expectations (~> 2.11.0)
|
136
|
+
rspec-mocks (~> 2.11.0)
|
137
|
+
rspec-core (2.11.1)
|
138
|
+
rspec-expectations (2.11.3)
|
138
139
|
diff-lcs (~> 1.1.3)
|
139
|
-
rspec-mocks (2.
|
140
|
-
rspec-rails (2.
|
140
|
+
rspec-mocks (2.11.3)
|
141
|
+
rspec-rails (2.11.4)
|
141
142
|
actionpack (>= 3.0)
|
142
143
|
activesupport (>= 3.0)
|
143
144
|
railties (>= 3.0)
|
144
|
-
rspec (~> 2.
|
145
|
-
rubyzip (0.9.
|
146
|
-
selenium-webdriver (2.
|
145
|
+
rspec (~> 2.11.0)
|
146
|
+
rubyzip (0.9.9)
|
147
|
+
selenium-webdriver (2.25.0)
|
147
148
|
childprocess (>= 0.2.5)
|
148
|
-
|
149
|
-
multi_json (~> 1.0
|
149
|
+
libwebsocket (~> 0.1.3)
|
150
|
+
multi_json (~> 1.0)
|
150
151
|
rubyzip
|
151
|
-
slop (
|
152
|
-
spork (0.9.
|
153
|
-
sprockets (2.1.
|
152
|
+
slop (3.3.3)
|
153
|
+
spork (0.9.2)
|
154
|
+
sprockets (2.1.3)
|
154
155
|
hike (~> 1.2)
|
155
156
|
rack (~> 1.0)
|
156
157
|
tilt (~> 1.1, != 1.3.0)
|
157
|
-
sqlite3 (1.3.
|
158
|
+
sqlite3 (1.3.6)
|
158
159
|
sqlite3-ruby (1.3.3)
|
159
160
|
sqlite3 (>= 1.3.3)
|
160
|
-
|
161
|
-
thin (1.3.1)
|
161
|
+
thin (1.5.0)
|
162
162
|
daemons (>= 1.0.9)
|
163
163
|
eventmachine (>= 0.12.6)
|
164
164
|
rack (>= 1.0.0)
|
165
165
|
thor (0.14.6)
|
166
166
|
tilt (1.3.3)
|
167
|
-
treetop (1.4.
|
167
|
+
treetop (1.4.11)
|
168
168
|
polyglot
|
169
169
|
polyglot (>= 0.3.1)
|
170
|
-
tzinfo (0.3.
|
170
|
+
tzinfo (0.3.33)
|
171
171
|
xpath (0.1.4)
|
172
172
|
nokogiri (~> 1.3)
|
173
|
-
yard (0.
|
173
|
+
yard (0.8.3)
|
174
174
|
|
175
175
|
PLATFORMS
|
176
176
|
ruby
|
@@ -190,7 +190,7 @@ DEPENDENCIES
|
|
190
190
|
pry
|
191
191
|
rails (= 3.2.1)
|
192
192
|
rspec-rails
|
193
|
-
selenium-webdriver
|
193
|
+
selenium-webdriver
|
194
194
|
spork
|
195
195
|
sqlite3-ruby
|
196
196
|
thin
|
@@ -48,7 +48,7 @@ module RailsApp
|
|
48
48
|
# config.netzke.basepack.grid_panel.extended_search_available = false
|
49
49
|
|
50
50
|
# to build links to the code on github
|
51
|
-
config.repo_root = "https://github.com/
|
51
|
+
config.repo_root = "https://github.com/nomadcoder/netzke-basepack/blob/master/test/basepack_test_app"
|
52
52
|
|
53
53
|
# Enable the asset pipeline
|
54
54
|
config.assets.enabled = true
|
@@ -12,10 +12,10 @@ Scenario: UserForm should be rendered properly along with the data for the first
|
|
12
12
|
And I should see "writer"
|
13
13
|
|
14
14
|
@javascript
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
15
|
+
Scenario: A form should be rendered properly along with the data for the specified record
|
16
|
+
Given a book exists with title: "Great Book", last_read_at: "2005-01-23 11:12:13"
|
17
|
+
When I go to the BookFormWithDefaults test page
|
18
|
+
Then the form should show title: "Great Book", last_read_at: "2005-01-23 11:12:13"
|
19
19
|
|
20
20
|
@javascript
|
21
21
|
Scenario: Editing the record
|
@@ -37,6 +37,18 @@ Scenario: Editing the record
|
|
37
37
|
And I should not see "Osminogov"
|
38
38
|
And I should not see "musician"
|
39
39
|
|
40
|
+
@javascript
|
41
|
+
Scenario: Resetting an association
|
42
|
+
Given a role exists with name: "musician"
|
43
|
+
And a user exists with first_name: "Paul", last_name: "Bley", role: that role
|
44
|
+
When I go to the UserForm test page
|
45
|
+
And I expand combobox "Role name"
|
46
|
+
And I select "---" from combobox "Role name"
|
47
|
+
And I press "Apply"
|
48
|
+
And I go to the UserForm test page
|
49
|
+
Then I should see "Select a role"
|
50
|
+
But I should not see "musician"
|
51
|
+
|
40
52
|
Scenario: UserFormWithDefaultFields should render properly
|
41
53
|
Given a role exists with name: "writer"
|
42
54
|
And a user exists with first_name: "Carlos", last_name: "Castaneda", role: that role
|
@@ -3,13 +3,13 @@ Feature: Grid panel with custom primary key
|
|
3
3
|
As a role
|
4
4
|
I want feature
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
6
|
+
@javascript
|
7
|
+
Scenario: Inline editing
|
8
|
+
Given a book_with_custom_primary_key exists with title: "Book you are to write"
|
9
|
+
When I go to the BookWithCustomPrimaryKeyGrid test page
|
10
|
+
And I edit row 1 of the grid with title: "My fight club"
|
11
|
+
And I press "Apply"
|
12
|
+
And I wait for the response from the server
|
13
|
+
Then the grid should have 0 modified records
|
14
|
+
And a book_with_custom_primary_key should exist with title: "My fight club"
|
15
|
+
But a book should not exist with title: "Book you are to write"
|
@@ -5,7 +5,7 @@ When /^I expand combobox "([^"]*)"$/ do |combo_label|
|
|
5
5
|
combo.onTriggerClick();
|
6
6
|
JS
|
7
7
|
|
8
|
-
|
8
|
+
step "I wait for the response from the server"
|
9
9
|
end
|
10
10
|
|
11
11
|
When /^I select "([^"]*)" from combobox "([^"]*)"$/ do |value, combo_label|
|
@@ -36,7 +36,7 @@ Then /^the "([^"]*)" component should be hidden$/ do |id|
|
|
36
36
|
end
|
37
37
|
|
38
38
|
Then /^I should see "([^"]*)" within paging toolbar$/ do |text|
|
39
|
-
|
39
|
+
step %Q{I should see "#{text}"}
|
40
40
|
# Not working, as it checks the initial text property, not the actual one
|
41
41
|
# page.driver.browser.execute_script(<<-JS).should == true
|
42
42
|
# Ext.ComponentQuery.query('pagingtoolbar')[0].query('tbtext[text="#{text}"]').length >= 1
|
@@ -46,7 +46,7 @@ When /^I enable filter on column "([^"]*)" with value "([^"]*)"$/ do |column, va
|
|
46
46
|
page.driver.browser.execute_script <<-JS
|
47
47
|
var grid = Ext.ComponentQuery.query('gridpanel')[0],
|
48
48
|
filter;
|
49
|
-
grid.
|
49
|
+
grid.filters.createFilters();
|
50
50
|
filter = grid.filters.getFilter('#{column}');
|
51
51
|
filter.setValue(#{value});
|
52
52
|
filter.setActive(true);
|
@@ -60,7 +60,7 @@ When /^I enable date filter on column "([^"]*)" with value "([^"]*)"$/ do |colum
|
|
60
60
|
page.driver.browser.execute_script <<-JS
|
61
61
|
var grid = Ext.ComponentQuery.query('gridpanel')[0],
|
62
62
|
filter, value;
|
63
|
-
grid.
|
63
|
+
grid.filters.createFilters();
|
64
64
|
filter = grid.filters.getFilter('#{column}');
|
65
65
|
value = filter.getValue();
|
66
66
|
value.#{operand} = new Date('#{date}'); // merge the new value with the current one
|
@@ -127,7 +127,7 @@ When /^I (?:drag|move) "([^"]*)" column before "([^"]*)"$/ do |header1, header2|
|
|
127
127
|
cmp = Ext.ComponentQuery.query('gridpanel')[0];
|
128
128
|
cmp.onColumnMove(null, null, #{indexi[0]}, #{indexi[1]});
|
129
129
|
JS
|
130
|
-
|
130
|
+
step "I wait for the response from the server"
|
131
131
|
end
|
132
132
|
|
133
133
|
Then /^I should see columns in order: "([^"]*)", "([^"]*)", "([^"]*)"$/ do |header1, header2, header3|
|
@@ -157,7 +157,7 @@ Then /^the grid should have records sorted by "([^"]*)"\s?(asc|desc)?$/ do |colu
|
|
157
157
|
columnValues = [];
|
158
158
|
|
159
159
|
grid.getStore().each(function(r){
|
160
|
-
var value = column.assoc ? r.get('
|
160
|
+
var value = column.assoc ? r.get('meta').associationValues[fieldName] : r.get(fieldName);
|
161
161
|
if (value) columnValues.#{dir == "asc" ? "push" : "unshift"}(value);
|
162
162
|
});
|
163
163
|
|
metadata
CHANGED
@@ -1,30 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: netzke-basepack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.7
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
|
-
-
|
8
|
+
- nomadcoder
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-10-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: netzke-core
|
16
|
-
requirement: &
|
16
|
+
requirement: &70189321485600 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 0.7.
|
21
|
+
version: 0.7.7
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70189321485600
|
25
25
|
description: A set of full-featured extendible Netzke components (such as FormPanel,
|
26
|
-
GridPanel, Window,
|
27
|
-
your RIA
|
26
|
+
GridPanel, Window, etc) which can be used as building block for your RIA
|
28
27
|
email: nmcoder@gmail.com
|
29
28
|
executables: []
|
30
29
|
extensions: []
|
@@ -115,6 +114,7 @@ files:
|
|
115
114
|
- lib/tasks/netzke_basepack_tasks.rake
|
116
115
|
- locales/de.yml
|
117
116
|
- locales/en.yml
|
117
|
+
- locales/zh-cn.yml
|
118
118
|
- netzke-basepack.gemspec
|
119
119
|
- stylesheets/basepack.css
|
120
120
|
- stylesheets/datetimefield.css
|
@@ -137,6 +137,7 @@ files:
|
|
137
137
|
- test/basepack_test_app/app/components/book_grid_with_column_actions.rb
|
138
138
|
- test/basepack_test_app/app/components/book_grid_with_custom_columns.rb
|
139
139
|
- test/basepack_test_app/app/components/book_grid_with_default_values.rb
|
140
|
+
- test/basepack_test_app/app/components/book_grid_with_defaults.rb
|
140
141
|
- test/basepack_test_app/app/components/book_grid_with_extra_feedback.rb
|
141
142
|
- test/basepack_test_app/app/components/book_grid_with_extra_filters.rb
|
142
143
|
- test/basepack_test_app/app/components/book_grid_with_nested_attributes.rb
|
@@ -323,5 +324,5 @@ rubyforge_project:
|
|
323
324
|
rubygems_version: 1.8.10
|
324
325
|
signing_key:
|
325
326
|
specification_version: 3
|
326
|
-
summary: Pre-built
|
327
|
+
summary: Pre-built Netzke for your RIA
|
327
328
|
test_files: []
|