netzke-basepack 0.5.2 → 0.5.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -0
- data/CHANGELOG.rdoc +197 -183
- data/LICENSE +1 -3
- data/README.rdoc +10 -6
- data/TODO.rdoc +5 -2
- data/VERSION +1 -1
- data/javascripts/basepack.js +20 -10
- data/lib/app/models/netzke_auto_column.rb +1 -1
- data/lib/netzke/basic_app.rb +16 -2
- data/lib/netzke/basic_app_extras/statusbar_ext.js +8 -0
- data/lib/netzke/border_layout_panel.rb +1 -1
- data/lib/netzke/ext.rb +1 -0
- data/lib/netzke/fields_configurator.rb +3 -5
- data/lib/netzke/form_panel.rb +15 -11
- data/lib/netzke/form_panel_js.rb +1 -8
- data/lib/netzke/grid_panel.rb +61 -61
- data/lib/netzke/grid_panel_api.rb +2 -2
- data/lib/netzke/grid_panel_js.rb +200 -177
- data/lib/netzke/plugins/configuration_tool.rb +2 -2
- data/lib/netzke/property_editor.rb +22 -18
- data/lib/netzke/tree_panel.rb +6 -54
- data/stylesheets/basepack.css +5 -0
- data/test/unit/helper_model_test.rb +1 -1
- metadata +3 -4
- data/lib/netzke/grid_panel_extras/javascripts/check-column.js +0 -33
- data/netzke-basepack.gemspec +0 -170
@@ -28,7 +28,7 @@ module Netzke::Plugins
|
|
28
28
|
module ClassMethods
|
29
29
|
def js_extend_properties_with_config_tool
|
30
30
|
js_extend_properties_without_config_tool.merge({
|
31
|
-
:
|
31
|
+
:on_gear => <<-END_OF_JAVASCRIPT.l
|
32
32
|
function(){
|
33
33
|
var w = new Ext.Window({
|
34
34
|
title:'Config - '+ this.dataClassName,
|
@@ -110,7 +110,7 @@ module Netzke::Plugins
|
|
110
110
|
|
111
111
|
def js_config_with_config_tool
|
112
112
|
orig_config = js_config_without_config_tool
|
113
|
-
orig_config.merge(:configurable =>
|
113
|
+
orig_config.merge(:configurable => persistent_config_enabled?)
|
114
114
|
end
|
115
115
|
|
116
116
|
def config_tool_needed?
|
@@ -6,10 +6,8 @@ module Netzke
|
|
6
6
|
@widget = @passed_config[:widget]
|
7
7
|
end
|
8
8
|
|
9
|
-
def
|
10
|
-
|
11
|
-
res[:ext_config][:bbar] = %w{ restore_defaults }
|
12
|
-
res
|
9
|
+
def default_bbar
|
10
|
+
%w{ restore_defaults }
|
13
11
|
end
|
14
12
|
|
15
13
|
def actions
|
@@ -33,7 +31,7 @@ module Netzke
|
|
33
31
|
:label_width => 200,
|
34
32
|
|
35
33
|
# Disable the 'gear' tool for now
|
36
|
-
:
|
34
|
+
:on_gear => <<-END_OF_JAVASCRIPT.l,
|
37
35
|
function(){
|
38
36
|
this.feedback("You can't configure property editor (yet)");
|
39
37
|
}
|
@@ -79,27 +77,33 @@ module Netzke
|
|
79
77
|
fields = @widget.class.property_fields
|
80
78
|
data.each_pair do |property, value|
|
81
79
|
field = fields.detect{ |f| f[:name] == property.to_sym }
|
82
|
-
# default = @widget.config[property].nil? ? field[:default] : @widget.config[property]
|
83
80
|
default = @widget.flat_initial_config(property).nil? ? field[:default] : @widget.flat_initial_config(property)
|
84
|
-
|
81
|
+
|
82
|
+
new_value = normalize_form_value(value, field)
|
83
|
+
|
84
|
+
# Only store the value in persistent config when it's different from the default one
|
85
85
|
if field[:type] == :boolean
|
86
86
|
# handle boolean type separately
|
87
|
-
|
88
|
-
@widget.persistent_config[property] = value ^ default ? value : nil
|
87
|
+
@widget.persistent_config[property] = new_value ^ default ? new_value : nil
|
89
88
|
else
|
90
|
-
|
91
|
-
value = ActiveSupport::JSON.decode(value)
|
92
|
-
end
|
93
|
-
|
94
|
-
# Empty string means "null" for now...
|
95
|
-
# value = nil if value.blank?
|
96
|
-
# logger.debug "!!! value: #{value.inspect}\n"
|
97
|
-
|
98
|
-
@widget.persistent_config[property] = default == value ? nil : value
|
89
|
+
@widget.persistent_config[property] = default == new_value ? nil : new_value
|
99
90
|
end
|
100
91
|
end
|
101
92
|
{}
|
102
93
|
end
|
103
94
|
|
95
|
+
def normalize_form_value(value, field)
|
96
|
+
case field[:type]
|
97
|
+
when :boolean
|
98
|
+
value.to_b
|
99
|
+
when :json
|
100
|
+
ActiveSupport::JSON.decode(value) # no need to check for exceptions, as the value has been validated in browser
|
101
|
+
when :integer
|
102
|
+
value.to_i
|
103
|
+
else
|
104
|
+
value # TODO: support other types like :date and :datetime
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
104
108
|
end
|
105
109
|
end
|
data/lib/netzke/tree_panel.rb
CHANGED
@@ -5,69 +5,21 @@ class Netzke::TreePanel < Netzke::Base
|
|
5
5
|
"Ext.tree.TreePanel"
|
6
6
|
end
|
7
7
|
|
8
|
-
def self.js_common_config_for_constructor
|
9
|
-
super.merge({
|
10
|
-
:root => {:text => '/', :id => 'source'},
|
11
|
-
:loader => {:data_url => "config.api.getChildren".l}
|
12
|
-
})
|
13
|
-
end
|
14
|
-
|
15
8
|
def self.js_extend_properties
|
16
9
|
{
|
17
|
-
:
|
18
|
-
function(){
|
19
|
-
console.info('refresh!');
|
20
|
-
}
|
21
|
-
END_OF_JAVASCRIPT
|
22
|
-
|
23
|
-
:add_handler => <<-END_OF_JAVASCRIPT.l,
|
24
|
-
function(e){
|
25
|
-
console.info(e);
|
26
|
-
}
|
27
|
-
END_OF_JAVASCRIPT
|
28
|
-
|
29
|
-
:edit_handler => <<-END_OF_JAVASCRIPT.l,
|
30
|
-
function(e){
|
31
|
-
console.info(e);
|
32
|
-
|
33
|
-
}
|
34
|
-
END_OF_JAVASCRIPT
|
35
|
-
|
36
|
-
:delete_handler => <<-END_OF_JAVASCRIPT.l
|
37
|
-
function(e){
|
38
|
-
console.info(e);
|
39
|
-
|
40
|
-
}
|
41
|
-
END_OF_JAVASCRIPT
|
42
|
-
}
|
43
|
-
end
|
44
|
-
|
45
|
-
def actions
|
46
|
-
{ :add => {:text => 'Add'},
|
47
|
-
:edit => {:text => 'Edit'},
|
48
|
-
:del => {:text => 'Delete', :disabled => true}
|
10
|
+
:root => {:text => '/', :id => 'source'}
|
49
11
|
}
|
50
12
|
end
|
51
13
|
|
52
|
-
def
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
def tools
|
57
|
-
persistent_config[:tools] ||= config[:tools] == false ? nil : config[:tools] #|| %w{ gear refresh }
|
58
|
-
end
|
59
|
-
|
60
|
-
def tbar
|
61
|
-
persistent_config[:tbar] ||= config[:tbar] == false ? nil : config[:tbar]
|
62
|
-
end
|
63
|
-
|
64
|
-
def menu
|
65
|
-
persistent_config[:menu] ||= config[:menu] == false ? nil : config[:menu] # || [{:text => 'Button', :menu => ['edit', {:text => 'Submenu', :menu => ['delete']}]}]
|
14
|
+
def js_config
|
15
|
+
super.deep_merge({
|
16
|
+
:loader => {:data_url => id_name+"__get_children".l}
|
17
|
+
})
|
66
18
|
end
|
67
19
|
|
68
20
|
def get_children(params)
|
69
21
|
klass = config[:data_class_name].constantize
|
70
22
|
node = params[:node] == 'source' ? klass.find_by_parent_id(nil) : klass.find(params[:node].to_i)
|
71
|
-
node.children.map{|n| {:text => n.name, :id => n.id}}
|
23
|
+
node.children.map{|n| {:text => n.name, :id => n.id, :leaf => n.children.empty?}}
|
72
24
|
end
|
73
25
|
end
|
data/stylesheets/basepack.css
CHANGED
@@ -6,10 +6,10 @@ class HelperModelTest < ActiveSupport::TestCase
|
|
6
6
|
|
7
7
|
test "reading/writing values" do
|
8
8
|
Netzke::FormPanel.config.deep_merge!({
|
9
|
+
:persistent_config => true,
|
9
10
|
:ext_config => {
|
10
11
|
:enable_config_tool => true
|
11
12
|
},
|
12
|
-
:persistent_config => true
|
13
13
|
})
|
14
14
|
form = Netzke::FormPanel.new(:data_class_name => "Book")
|
15
15
|
Netzke::PropertyEditorExtras::HelperModel.widget = form
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: netzke-basepack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sergei Kozlov
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-10-12 00:00:00 -05:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -60,6 +60,7 @@ files:
|
|
60
60
|
- lib/netzke/active_record/basepack.rb
|
61
61
|
- lib/netzke/active_record/data_accessor.rb
|
62
62
|
- lib/netzke/basic_app.rb
|
63
|
+
- lib/netzke/basic_app_extras/statusbar_ext.js
|
63
64
|
- lib/netzke/border_layout_panel.rb
|
64
65
|
- lib/netzke/configuration_panel.rb
|
65
66
|
- lib/netzke/data_accessor.rb
|
@@ -72,7 +73,6 @@ files:
|
|
72
73
|
- lib/netzke/form_panel_js.rb
|
73
74
|
- lib/netzke/grid_panel.rb
|
74
75
|
- lib/netzke/grid_panel_api.rb
|
75
|
-
- lib/netzke/grid_panel_extras/javascripts/check-column.js
|
76
76
|
- lib/netzke/grid_panel_extras/javascripts/filters.js
|
77
77
|
- lib/netzke/grid_panel_extras/javascripts/rows-dd.js
|
78
78
|
- lib/netzke/grid_panel_js.rb
|
@@ -86,7 +86,6 @@ files:
|
|
86
86
|
- lib/netzke/table_editor.rb
|
87
87
|
- lib/netzke/tree_panel.rb
|
88
88
|
- lib/netzke/wrapper.rb
|
89
|
-
- netzke-basepack.gemspec
|
90
89
|
- stylesheets/basepack.css
|
91
90
|
- tasks/netzke_basepack_tasks.rake
|
92
91
|
- test/app_root/app/controllers/application.rb
|
@@ -1,33 +0,0 @@
|
|
1
|
-
// CheckColumn
|
2
|
-
Ext.grid.CheckColumn = function(config){
|
3
|
-
Ext.apply(this, config);
|
4
|
-
if(!this.id){
|
5
|
-
this.id = Ext.id();
|
6
|
-
}
|
7
|
-
this.renderer = this.renderer.createDelegate(this);
|
8
|
-
};
|
9
|
-
|
10
|
-
Ext.grid.CheckColumn.prototype ={
|
11
|
-
init : function(grid){
|
12
|
-
this.grid = grid;
|
13
|
-
if (this.disabled) {return;} // SK
|
14
|
-
this.grid.on('render', function(){
|
15
|
-
var view = this.grid.getView();
|
16
|
-
view.mainBody.on('mousedown', this.onMouseDown, this);
|
17
|
-
}, this);
|
18
|
-
},
|
19
|
-
|
20
|
-
onMouseDown : function(e, t){
|
21
|
-
if(t.className && t.className.indexOf('x-grid3-cc-'+this.id) != -1){
|
22
|
-
e.stopEvent();
|
23
|
-
var index = this.grid.getView().findRowIndex(t);
|
24
|
-
var record = this.grid.store.getAt(index);
|
25
|
-
record.set(this.dataIndex, !record.data[this.dataIndex]);
|
26
|
-
}
|
27
|
-
},
|
28
|
-
|
29
|
-
renderer : function(v, p, record){
|
30
|
-
p.css += ' x-grid3-check-col-td';
|
31
|
-
return '<div class="x-grid3-check-col'+(v?'-on':'')+' x-grid3-cc-'+this.id+'"> </div>';
|
32
|
-
}
|
33
|
-
};
|
data/netzke-basepack.gemspec
DELETED
@@ -1,170 +0,0 @@
|
|
1
|
-
# Generated by jeweler
|
2
|
-
# DO NOT EDIT THIS FILE
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
|
4
|
-
# -*- encoding: utf-8 -*-
|
5
|
-
|
6
|
-
Gem::Specification.new do |s|
|
7
|
-
s.name = %q{netzke-basepack}
|
8
|
-
s.version = "0.5.2"
|
9
|
-
|
10
|
-
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
-
s.authors = ["Sergei Kozlov"]
|
12
|
-
s.date = %q{2009-09-24}
|
13
|
-
s.description = %q{Pre-built Netzke widgets for your RIA}
|
14
|
-
s.email = %q{sergei@playcode.nl}
|
15
|
-
s.extra_rdoc_files = [
|
16
|
-
"LICENSE",
|
17
|
-
"README.rdoc"
|
18
|
-
]
|
19
|
-
s.files = [
|
20
|
-
".autotest",
|
21
|
-
".gitignore",
|
22
|
-
"CHANGELOG.rdoc",
|
23
|
-
"LICENSE",
|
24
|
-
"README.rdoc",
|
25
|
-
"Rakefile",
|
26
|
-
"TODO.rdoc",
|
27
|
-
"VERSION",
|
28
|
-
"autotest/discover.rb",
|
29
|
-
"init.rb",
|
30
|
-
"install.rb",
|
31
|
-
"javascripts/basepack.js",
|
32
|
-
"lib/app/models/netzke_auto_column.rb",
|
33
|
-
"lib/netzke-basepack.rb",
|
34
|
-
"lib/netzke/accordion_panel.rb",
|
35
|
-
"lib/netzke/active_record/basepack.rb",
|
36
|
-
"lib/netzke/active_record/data_accessor.rb",
|
37
|
-
"lib/netzke/basic_app.rb",
|
38
|
-
"lib/netzke/border_layout_panel.rb",
|
39
|
-
"lib/netzke/configuration_panel.rb",
|
40
|
-
"lib/netzke/data_accessor.rb",
|
41
|
-
"lib/netzke/ext.rb",
|
42
|
-
"lib/netzke/field_model.rb",
|
43
|
-
"lib/netzke/fields_configurator.rb",
|
44
|
-
"lib/netzke/form_panel.rb",
|
45
|
-
"lib/netzke/form_panel_api.rb",
|
46
|
-
"lib/netzke/form_panel_extras/javascripts/xcheckbox.js",
|
47
|
-
"lib/netzke/form_panel_js.rb",
|
48
|
-
"lib/netzke/grid_panel.rb",
|
49
|
-
"lib/netzke/grid_panel_api.rb",
|
50
|
-
"lib/netzke/grid_panel_extras/javascripts/check-column.js",
|
51
|
-
"lib/netzke/grid_panel_extras/javascripts/filters.js",
|
52
|
-
"lib/netzke/grid_panel_extras/javascripts/rows-dd.js",
|
53
|
-
"lib/netzke/grid_panel_js.rb",
|
54
|
-
"lib/netzke/masquerade_selector.rb",
|
55
|
-
"lib/netzke/panel.rb",
|
56
|
-
"lib/netzke/plugins/configuration_tool.rb",
|
57
|
-
"lib/netzke/property_editor.rb",
|
58
|
-
"lib/netzke/property_editor_extras/helper_model.rb",
|
59
|
-
"lib/netzke/search_panel.rb",
|
60
|
-
"lib/netzke/tab_panel.rb",
|
61
|
-
"lib/netzke/table_editor.rb",
|
62
|
-
"lib/netzke/tree_panel.rb",
|
63
|
-
"lib/netzke/wrapper.rb",
|
64
|
-
"netzke-basepack.gemspec",
|
65
|
-
"stylesheets/basepack.css",
|
66
|
-
"tasks/netzke_basepack_tasks.rake",
|
67
|
-
"test/app_root/app/controllers/application.rb",
|
68
|
-
"test/app_root/app/models/book.rb",
|
69
|
-
"test/app_root/app/models/category.rb",
|
70
|
-
"test/app_root/app/models/city.rb",
|
71
|
-
"test/app_root/app/models/continent.rb",
|
72
|
-
"test/app_root/app/models/country.rb",
|
73
|
-
"test/app_root/app/models/genre.rb",
|
74
|
-
"test/app_root/config/boot.rb",
|
75
|
-
"test/app_root/config/database.yml",
|
76
|
-
"test/app_root/config/environment.rb",
|
77
|
-
"test/app_root/config/environments/in_memory.rb",
|
78
|
-
"test/app_root/config/environments/mysql.rb",
|
79
|
-
"test/app_root/config/environments/postgresql.rb",
|
80
|
-
"test/app_root/config/environments/sqlite.rb",
|
81
|
-
"test/app_root/config/environments/sqlite3.rb",
|
82
|
-
"test/app_root/config/routes.rb",
|
83
|
-
"test/app_root/db/migrate/20081222033343_create_books.rb",
|
84
|
-
"test/app_root/db/migrate/20081222033440_create_genres.rb",
|
85
|
-
"test/app_root/db/migrate/20081222035855_create_netzke_preferences.rb",
|
86
|
-
"test/app_root/db/migrate/20081223024935_create_categories.rb",
|
87
|
-
"test/app_root/db/migrate/20081223025635_create_countries.rb",
|
88
|
-
"test/app_root/db/migrate/20081223025653_create_continents.rb",
|
89
|
-
"test/app_root/db/migrate/20081223025732_create_cities.rb",
|
90
|
-
"test/app_root/db/migrate/20090102223630_create_netzke_layouts.rb",
|
91
|
-
"test/app_root/script/console",
|
92
|
-
"test/app_root/vendor/plugins/acts_as_list/README",
|
93
|
-
"test/app_root/vendor/plugins/acts_as_list/init.rb",
|
94
|
-
"test/app_root/vendor/plugins/acts_as_list/lib/active_record/acts/list.rb",
|
95
|
-
"test/console_with_fixtures.rb",
|
96
|
-
"test/fixtures/books.yml",
|
97
|
-
"test/fixtures/categories.yml",
|
98
|
-
"test/fixtures/cities.yml",
|
99
|
-
"test/fixtures/continents.yml",
|
100
|
-
"test/fixtures/countries.yml",
|
101
|
-
"test/fixtures/genres.yml",
|
102
|
-
"test/schema.rb",
|
103
|
-
"test/test_helper.rb",
|
104
|
-
"test/unit/accordion_panel_test.rb",
|
105
|
-
"test/unit/active_record_basepack_test.rb",
|
106
|
-
"test/unit/grid_panel_test.rb",
|
107
|
-
"test/unit/helper_model_test.rb",
|
108
|
-
"test/unit/netzke_basepack_test.rb",
|
109
|
-
"test/unit/tab_panel_test.rb",
|
110
|
-
"uninstall.rb"
|
111
|
-
]
|
112
|
-
s.homepage = %q{http://github.com/skozlov/netzke-basepack}
|
113
|
-
s.rdoc_options = ["--charset=UTF-8"]
|
114
|
-
s.require_paths = ["lib"]
|
115
|
-
s.rubyforge_project = %q{netzke-basepack}
|
116
|
-
s.rubygems_version = %q{1.3.5}
|
117
|
-
s.summary = %q{Pre-built Netzke widgets for your RIA}
|
118
|
-
s.test_files = [
|
119
|
-
"test/app_root/app/controllers/application.rb",
|
120
|
-
"test/app_root/app/models/book.rb",
|
121
|
-
"test/app_root/app/models/category.rb",
|
122
|
-
"test/app_root/app/models/city.rb",
|
123
|
-
"test/app_root/app/models/continent.rb",
|
124
|
-
"test/app_root/app/models/country.rb",
|
125
|
-
"test/app_root/app/models/genre.rb",
|
126
|
-
"test/app_root/config/boot.rb",
|
127
|
-
"test/app_root/config/environment.rb",
|
128
|
-
"test/app_root/config/environments/in_memory.rb",
|
129
|
-
"test/app_root/config/environments/mysql.rb",
|
130
|
-
"test/app_root/config/environments/postgresql.rb",
|
131
|
-
"test/app_root/config/environments/sqlite.rb",
|
132
|
-
"test/app_root/config/environments/sqlite3.rb",
|
133
|
-
"test/app_root/config/routes.rb",
|
134
|
-
"test/app_root/db/migrate/20081222033343_create_books.rb",
|
135
|
-
"test/app_root/db/migrate/20081222033440_create_genres.rb",
|
136
|
-
"test/app_root/db/migrate/20081222035855_create_netzke_preferences.rb",
|
137
|
-
"test/app_root/db/migrate/20081223024935_create_categories.rb",
|
138
|
-
"test/app_root/db/migrate/20081223025635_create_countries.rb",
|
139
|
-
"test/app_root/db/migrate/20081223025653_create_continents.rb",
|
140
|
-
"test/app_root/db/migrate/20081223025732_create_cities.rb",
|
141
|
-
"test/app_root/db/migrate/20090102223630_create_netzke_layouts.rb",
|
142
|
-
"test/app_root/vendor/plugins/acts_as_list/init.rb",
|
143
|
-
"test/app_root/vendor/plugins/acts_as_list/lib/active_record/acts/list.rb",
|
144
|
-
"test/console_with_fixtures.rb",
|
145
|
-
"test/schema.rb",
|
146
|
-
"test/test_helper.rb",
|
147
|
-
"test/unit/accordion_panel_test.rb",
|
148
|
-
"test/unit/active_record_basepack_test.rb",
|
149
|
-
"test/unit/grid_panel_test.rb",
|
150
|
-
"test/unit/helper_model_test.rb",
|
151
|
-
"test/unit/netzke_basepack_test.rb",
|
152
|
-
"test/unit/tab_panel_test.rb"
|
153
|
-
]
|
154
|
-
|
155
|
-
if s.respond_to? :specification_version then
|
156
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
157
|
-
s.specification_version = 3
|
158
|
-
|
159
|
-
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
160
|
-
s.add_runtime_dependency(%q<netzke-core>, [">= 0.4.3"])
|
161
|
-
s.add_runtime_dependency(%q<searchlogic>, [">= 2.0.0"])
|
162
|
-
else
|
163
|
-
s.add_dependency(%q<netzke-core>, [">= 0.4.3"])
|
164
|
-
s.add_dependency(%q<searchlogic>, [">= 2.0.0"])
|
165
|
-
end
|
166
|
-
else
|
167
|
-
s.add_dependency(%q<netzke-core>, [">= 0.4.3"])
|
168
|
-
s.add_dependency(%q<searchlogic>, [">= 2.0.0"])
|
169
|
-
end
|
170
|
-
end
|