restfulx 1.2.2 → 1.2.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +1 -1
- data/Rakefile +3 -1
- data/VERSION.yml +1 -1
- data/app_generators/rx_app/rx_app_generator.rb +2 -2
- data/app_generators/rx_app/templates/actionscript.properties +1 -1
- data/app_generators/rx_app/templates/actionscriptair.properties +1 -1
- data/app_generators/rx_app/templates/mainapp-config.xml +1 -0
- data/app_generators/rx_app/templates/mainapp.mxml +1 -1
- data/app_generators/rx_app/templates/restfulx.yml +26 -5
- data/lib/restfulx.rb +1 -1
- data/lib/restfulx/active_foo.rb +5 -2
- data/lib/restfulx/active_record_uuid_helper.rb +1 -1
- data/lib/restfulx/configuration.rb +15 -4
- data/lib/restfulx/rails/schema_to_yaml.rb +0 -11
- data/lib/restfulx/rails/schema_to_yaml/settings/core.rb +4 -1
- data/lib/restfulx/rails/swf_helper.rb +7 -3
- data/lib/restfulx/tasks.rb +0 -1
- data/rails_generators/rx_config/rx_config_generator.rb +16 -7
- data/rails_generators/rx_config/templates/actionscript.properties +1 -1
- data/rails_generators/rx_config/templates/actionscriptair.properties +1 -1
- data/rails_generators/rx_config/templates/mainapp-config.xml +1 -0
- data/rails_generators/rx_config/templates/restfulx.erb +45 -8
- data/rails_generators/rx_config/templates/restfulx.yml +4 -4
- data/rails_generators/rx_config/templates/session_store_flash.erb +1 -0
- data/rails_generators/rx_main_app/rx_main_app_generator.rb +2 -2
- data/rails_generators/rx_main_app/templates/mainapp.mxml +1 -1
- data/rails_generators/rx_scaffold/rx_scaffold_generator.rb +15 -6
- data/rails_generators/rx_scaffold/templates/controllers/resource_controller.rb.erb +2 -2
- data/rails_generators/rx_scaffold/templates/functional_test.rb +45 -0
- data/rails_generators/rx_scaffold/templates/helper_test.rb +4 -0
- data/rails_generators/rx_scaffold/templates/layouts/default.erb +7 -5
- data/rails_generators/rx_scaffold/templates/migration.rb.erb +4 -4
- data/rxgen_generators/rx_config/rx_config_generator.rb +2 -0
- data/rxgen_generators/rx_controller/templates/assist.py +1 -1
- data/rxgen_generators/rx_main_app/rx_main_app_generator.rb +2 -2
- data/rxgen_generators/rx_main_app/templates/mainapp.mxml +1 -1
- data/rxgen_generators/rx_scaffold/rx_scaffold_generator.rb +56 -9
- data/rxgen_generators/rx_scaffold/templates/{component.mxml.erb → layouts/default.erb} +56 -10
- data/rxgen_generators/rx_scaffold/templates/model.as.erb +33 -2
- data/test/rails/controllers/{application.rb → application_controller.rb} +0 -0
- data/test/rails/helpers/functional_test_helper.rb +1 -1
- data/test/rails/helpers/test_helper.rb +1 -8
- data/test/rails/helpers/unit_test_helper.rb +2 -3
- data/test/rails/test_active_foo.rb +1 -1
- data/test/rails/test_rails_integration_functional.rb +1 -1
- data/test/rails/test_to_fxml.rb +1 -1
- data/test/rails/test_to_json.rb +1 -1
- metadata +59 -73
@@ -0,0 +1 @@
|
|
1
|
+
ActionController::Dispatcher.middleware.use FlashSessionCookieMiddleware, ActionController::Base.session_options[:key]
|
@@ -43,8 +43,8 @@ class RxMainAppGenerator < Rails::Generator::Base
|
|
43
43
|
end
|
44
44
|
|
45
45
|
@component_names = []
|
46
|
-
if File.exists?("#{flex_root}/#{base_folder}/
|
47
|
-
@component_names = list_mxml_files("#{flex_root}/#{base_folder}/
|
46
|
+
if File.exists?("#{flex_root}/#{base_folder}/views/generated")
|
47
|
+
@component_names = list_mxml_files("#{flex_root}/#{base_folder}/views/generated")
|
48
48
|
end
|
49
49
|
end
|
50
50
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<?xml version="1.0" encoding="utf-8"?>
|
2
2
|
<mx:<%= application_tag %> xmlns:mx="http://www.adobe.com/2006/mxml"
|
3
|
-
xmlns:generated="<%= base_package %>.
|
3
|
+
xmlns:generated="<%= base_package %>.views.generated.*"
|
4
4
|
paddingBottom="8" paddingLeft="8" paddingRight="8" paddingTop="8"
|
5
5
|
layout="horizontal" styleName="plain" initialize="init()">
|
6
6
|
<mx:Script>
|
@@ -139,11 +139,11 @@ class RxScaffoldGenerator < Rails::Generator::NamedBase
|
|
139
139
|
|
140
140
|
if @layout.size > 0
|
141
141
|
m.template "layouts/#{@layout}.erb",
|
142
|
-
File.join("#{@flex_root}", base_folder, "
|
142
|
+
File.join("#{@flex_root}", base_folder, "views", "generated", "#{@class_name}Box.mxml"),
|
143
143
|
:assigns => { :resource_controller_name => "#{file_name.pluralize}" }
|
144
144
|
else
|
145
145
|
m.template "layouts/#{RxSettings.layouts.default}.erb",
|
146
|
-
File.join("#{@flex_root}", base_folder, "
|
146
|
+
File.join("#{@flex_root}", base_folder, "views", "generated", "#{@class_name}Box.mxml"),
|
147
147
|
:assigns => { :resource_controller_name => "#{file_name.pluralize}" }
|
148
148
|
end
|
149
149
|
|
@@ -155,11 +155,20 @@ class RxScaffoldGenerator < Rails::Generator::NamedBase
|
|
155
155
|
unless options[:skip_migration]
|
156
156
|
FileUtils.rm Dir.glob("db/migrate/[0-9]*_create_#{file_path.gsub(/\//, '_').pluralize}.rb"), :force => true
|
157
157
|
m.migration_template 'migration.rb.erb', 'db/migrate', :assigns => {
|
158
|
-
:migration_name => "Create#{
|
158
|
+
:migration_name => "Create#{file_path.gsub(/\//, '_').pluralize.camelcase.gsub(/::/, '')}"
|
159
159
|
}, :migration_file_name => "create_#{file_path.gsub(/\//, '_').pluralize}" unless options[:flex_only]
|
160
160
|
end
|
161
|
-
|
162
|
-
m.
|
161
|
+
|
162
|
+
m.directory(File.join('test/functional', controller_class_path))
|
163
|
+
m.directory(File.join('test/unit', class_path))
|
164
|
+
m.directory(File.join('test/unit/helpers', class_path))
|
165
|
+
|
166
|
+
m.template('functional_test.rb', File.join('test/functional', controller_class_path, "#{controller_file_name}_controller_test.rb"))
|
167
|
+
m.template('helper_test.rb', File.join('test/unit/helpers', controller_class_path, "#{controller_file_name}_helper_test.rb"))
|
168
|
+
|
169
|
+
if File.open('config/routes.rb').grep(/^\s*map.resources :#{controller_file_name}/).empty?
|
170
|
+
m.route_resources controller_file_name
|
171
|
+
end
|
163
172
|
|
164
173
|
m.dependency 'rx_controller', [name] + @args, :collision => :force
|
165
174
|
end
|
@@ -230,4 +239,4 @@ class RxScaffoldGenerator < Rails::Generator::NamedBase
|
|
230
239
|
opt.on("-fv", "--flex-view-only", "Only generate the Flex component files",
|
231
240
|
"Default: false") { |v| options[:flex_view_only] = v }
|
232
241
|
end
|
233
|
-
end
|
242
|
+
end
|
@@ -10,8 +10,8 @@ class <%= controller_class_name %>Controller < ResourceController::Base
|
|
10
10
|
update.failure.wants.fxml { render :fxml => @object.errors }
|
11
11
|
destroy.wants.fxml { render :fxml => @object }
|
12
12
|
|
13
|
-
private
|
14
|
-
|
13
|
+
private
|
14
|
+
|
15
15
|
def collection
|
16
16
|
@collection = end_of_association_chain.all
|
17
17
|
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class <%= controller_class_name %>ControllerTest < ActionController::TestCase
|
4
|
+
test "should get index" do
|
5
|
+
get :index
|
6
|
+
assert_response :success
|
7
|
+
assert_not_nil assigns(:<%= table_name %>)
|
8
|
+
end
|
9
|
+
|
10
|
+
test "should get new" do
|
11
|
+
get :new
|
12
|
+
assert_response :success
|
13
|
+
end
|
14
|
+
|
15
|
+
test "should create <%= file_name %>" do
|
16
|
+
assert_difference('<%= class_name %>.count') do
|
17
|
+
post :create, :<%= file_name %> => { }
|
18
|
+
end
|
19
|
+
|
20
|
+
assert_redirected_to <%= file_name %>_path(assigns(:<%= file_name %>))
|
21
|
+
end
|
22
|
+
|
23
|
+
test "should show <%= file_name %>" do
|
24
|
+
get :show, :id => <%= table_name %>(:one).id
|
25
|
+
assert_response :success
|
26
|
+
end
|
27
|
+
|
28
|
+
test "should get edit" do
|
29
|
+
get :edit, :id => <%= table_name %>(:one).id
|
30
|
+
assert_response :success
|
31
|
+
end
|
32
|
+
|
33
|
+
test "should update <%= file_name %>" do
|
34
|
+
put :update, :id => <%= table_name %>(:one).id, :<%= file_name %> => { }
|
35
|
+
assert_redirected_to <%= file_name %>_path(assigns(:<%= file_name %>))
|
36
|
+
end
|
37
|
+
|
38
|
+
test "should destroy <%= file_name %>" do
|
39
|
+
assert_difference('<%= class_name %>.count', -1) do
|
40
|
+
delete :destroy, :id => <%= table_name %>(:one).id
|
41
|
+
end
|
42
|
+
|
43
|
+
assert_redirected_to <%= table_name %>_path
|
44
|
+
end
|
45
|
+
end
|
@@ -9,12 +9,14 @@
|
|
9
9
|
import <%= base_package %>.models.<%= model.camelcase %>;
|
10
10
|
<% end -%>
|
11
11
|
<% if attachment_field.size > 0 -%>
|
12
|
+
import flash.net.FileReference;
|
12
13
|
import org.restfulx.utils.RxFileReference;
|
13
14
|
<% end -%>
|
14
15
|
|
15
16
|
[Bindable]
|
16
17
|
private var <%= class_name.dcfirst %>:<%= class_name %> = new <%= class_name %>();
|
17
18
|
<% if attachment_field.size > 0 -%>
|
19
|
+
|
18
20
|
[Bindable]
|
19
21
|
private var fileName:String = "None selected";
|
20
22
|
|
@@ -83,10 +85,10 @@
|
|
83
85
|
|
84
86
|
private function chooseFile():void {
|
85
87
|
file = new RxFileReference("<%= attachment_field[0].camelcase(:lower) %>");
|
86
|
-
file.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler, false, 0, true);
|
87
|
-
file.addEventListener(Event.SELECT, selectFile, false, 0, true);
|
88
|
-
file.addEventListener(Event.CANCEL, cancelBrowse, false, 0, true);
|
89
|
-
file.browse();
|
88
|
+
file.reference.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler, false, 0, true);
|
89
|
+
file.reference.addEventListener(Event.SELECT, selectFile, false, 0, true);
|
90
|
+
file.reference.addEventListener(Event.CANCEL, cancelBrowse, false, 0, true);
|
91
|
+
file.reference.browse();
|
90
92
|
}
|
91
93
|
|
92
94
|
private function selectFile(event:Event):void {
|
@@ -98,7 +100,7 @@
|
|
98
100
|
}
|
99
101
|
|
100
102
|
private function fileSelected(event:Event):void {
|
101
|
-
fileName =
|
103
|
+
fileName = FileReference(event.target).name;
|
102
104
|
}
|
103
105
|
|
104
106
|
private function ioErrorHandler(event:Event):void {
|
@@ -19,10 +19,10 @@ class <%= migration_name %> < ActiveRecord::Migration
|
|
19
19
|
<% if attachment_field.size > 0 -%>
|
20
20
|
<% if RxSettings.attachment_plugin == 'paperclip' -%>
|
21
21
|
# For paperclip
|
22
|
-
t.column
|
23
|
-
t.column
|
24
|
-
t.column
|
25
|
-
t.column
|
22
|
+
t.column :<%= attachment_field[0] %>_file_name, :string
|
23
|
+
t.column :<%= attachment_field[0] %>_content_type, :string
|
24
|
+
t.column :<%= attachment_field[0] %>_file_size, :integer
|
25
|
+
t.column :<%= attachment_field[0] %>_updated_at, :datetime
|
26
26
|
<% elsif RxSettings.attachment_plugin == 'attachment_fu' -%>
|
27
27
|
# For attachment_fu
|
28
28
|
t.column :parent_id, :integer
|
@@ -27,7 +27,7 @@ import datetime, iso8601
|
|
27
27
|
|
28
28
|
# Some useful module methods
|
29
29
|
def all(model):
|
30
|
-
items = "".join(str(item.to_xml()) for item in model.all())
|
30
|
+
items = "".join(str(item.to_xml().encode('UTF-8')) for item in model.all())
|
31
31
|
if items == "":
|
32
32
|
return '<entities type="array"/>'
|
33
33
|
else:
|
@@ -32,8 +32,8 @@ class RxMainAppGenerator < RubiGen::Base
|
|
32
32
|
end
|
33
33
|
|
34
34
|
@component_names = []
|
35
|
-
if File.exists?("#{flex_root}/#{base_folder}/
|
36
|
-
@component_names = list_mxml_files("#{flex_root}/#{base_folder}/
|
35
|
+
if File.exists?("#{flex_root}/#{base_folder}/views/generated")
|
36
|
+
@component_names = list_mxml_files("#{flex_root}/#{base_folder}/views/generated")
|
37
37
|
end
|
38
38
|
|
39
39
|
@controller_names = []
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<?xml version="1.0" encoding="utf-8"?>
|
2
2
|
<mx:<%= application_tag %> xmlns:mx="http://www.adobe.com/2006/mxml"
|
3
|
-
xmlns:generated="<%= base_package %>.
|
3
|
+
xmlns:generated="<%= base_package %>.views.generated.*"
|
4
4
|
paddingBottom="8" paddingLeft="8" paddingRight="8" paddingTop="8"
|
5
5
|
layout="horizontal" styleName="plain" initialize="init()">
|
6
6
|
<mx:Script>
|
@@ -70,7 +70,14 @@ class RxScaffoldGenerator < RubiGen::Base
|
|
70
70
|
|
71
71
|
attr_reader :belongs_tos,
|
72
72
|
:has_manies,
|
73
|
-
:has_ones
|
73
|
+
:has_ones,
|
74
|
+
:attachment_field,
|
75
|
+
:has_many_through,
|
76
|
+
:polymorphic,
|
77
|
+
:tree_model,
|
78
|
+
:layout,
|
79
|
+
:ignored_fields,
|
80
|
+
:args_for_generation
|
74
81
|
|
75
82
|
attr_reader :name,
|
76
83
|
:class_name,
|
@@ -98,9 +105,15 @@ class RxScaffoldGenerator < RubiGen::Base
|
|
98
105
|
File.join("#{flex_root}", base_folder, "models", "#{@class_name}.as"),
|
99
106
|
:assigns => { :resource_controller_name => "#{file_name.pluralize}" }
|
100
107
|
|
101
|
-
|
102
|
-
|
103
|
-
|
108
|
+
if @layout.size > 0
|
109
|
+
m.template "layouts/#{@layout}.erb",
|
110
|
+
File.join("#{@flex_root}", base_folder, "views", "generated", "#{@class_name}Box.mxml"),
|
111
|
+
:assigns => { :resource_controller_name => "#{file_name.pluralize}" }
|
112
|
+
else
|
113
|
+
m.template "layouts/#{RxSettings.layouts.default}.erb",
|
114
|
+
File.join("#{@flex_root}", base_folder, "views", "generated", "#{@class_name}Box.mxml"),
|
115
|
+
:assigns => { :resource_controller_name => "#{file_name.pluralize}" }
|
116
|
+
end
|
104
117
|
|
105
118
|
if options[:gae]
|
106
119
|
m.template 'controller.py.erb', "app/controllers/#{file_name.pluralize}.py"
|
@@ -113,23 +126,57 @@ class RxScaffoldGenerator < RubiGen::Base
|
|
113
126
|
|
114
127
|
protected
|
115
128
|
def extract_relationships
|
129
|
+
# arrays
|
116
130
|
@belongs_tos = []
|
117
131
|
@has_ones = []
|
118
132
|
@has_manies = []
|
119
|
-
|
133
|
+
@attachment_field = []
|
134
|
+
@polymorphic = []
|
135
|
+
@tree_model = []
|
136
|
+
@layout = []
|
137
|
+
@ignored_fields = []
|
138
|
+
|
139
|
+
# hashes
|
140
|
+
@has_many_through = {}
|
141
|
+
|
120
142
|
@args.each do |arg|
|
143
|
+
# arrays
|
121
144
|
if arg =~ /^has_one:/
|
122
|
-
# arg = "has_one:arg1,arg2", so all the has_one are together
|
123
145
|
@has_ones = arg.split(':')[1].split(',')
|
124
146
|
elsif arg =~ /^has_many:/
|
125
|
-
# arg = "has_many:arg1,arg2", so all the has_many are together
|
126
147
|
@has_manies = arg.split(":")[1].split(",")
|
127
|
-
elsif arg =~ /^belongs_to:/
|
148
|
+
elsif arg =~ /^belongs_to:/
|
128
149
|
@belongs_tos = arg.split(":")[1].split(',')
|
150
|
+
elsif arg =~ /^attachment_field:/
|
151
|
+
@attachment_field = arg.split(":")[1].split(',')
|
152
|
+
elsif arg =~ /^polymorphic:/
|
153
|
+
@polymorphic = arg.split(":")[1].split(',')
|
154
|
+
elsif arg =~ /^tree_model:/
|
155
|
+
@tree_model = arg.split(":")[1].split(',')
|
156
|
+
elsif arg =~ /^layout:/
|
157
|
+
@layout = arg.split(":")[1].split(',')
|
158
|
+
elsif arg =~ /^ignored_fields:/
|
159
|
+
@ignored_fields = arg.split(":")[1].split(',')
|
160
|
+
# hashes
|
161
|
+
elsif arg =~ /^has_many_through:/
|
162
|
+
hmt_arr = arg.split(":")[1].split(',')
|
163
|
+
@has_many_through[hmt_arr.first] = hmt_arr.last
|
129
164
|
end
|
130
165
|
end
|
131
166
|
|
132
|
-
|
167
|
+
# delete special fields from @args ivar
|
168
|
+
%w(has_one has_many belongs_to attachment_field has_many_through
|
169
|
+
polymorphic tree_model layout ignored_fields).each do |special_field|
|
170
|
+
@args.delete_if { |f| f =~ /^(#{special_field}):/ }
|
171
|
+
end
|
172
|
+
|
173
|
+
@args_for_generation = @args.clone
|
174
|
+
|
175
|
+
# delete ignored_fields from @args ivar
|
176
|
+
@ignored_fields.each do |ignored|
|
177
|
+
@args.delete_if { |f| f =~ /^(#{ignored}):/ }
|
178
|
+
end
|
179
|
+
|
133
180
|
end
|
134
181
|
|
135
182
|
def attributes
|
@@ -8,9 +8,20 @@
|
|
8
8
|
<% for model in belongs_tos -%>
|
9
9
|
import <%= base_package %>.models.<%= model.camelcase %>;
|
10
10
|
<% end -%>
|
11
|
+
<% if attachment_field.size > 0 -%>
|
12
|
+
import flash.net.FileReference;
|
13
|
+
import org.restfulx.utils.RxFileReference;
|
14
|
+
<% end -%>
|
11
15
|
|
12
16
|
[Bindable]
|
13
17
|
private var <%= class_name.dcfirst %>:<%= class_name %> = new <%= class_name %>();
|
18
|
+
<% if attachment_field.size > 0 -%>
|
19
|
+
|
20
|
+
[Bindable]
|
21
|
+
private var fileName:String = "None selected";
|
22
|
+
|
23
|
+
private var file:RxFileReference;
|
24
|
+
<% end -%>
|
14
25
|
|
15
26
|
private function new<%= class_name %>():void {
|
16
27
|
<%= class_name.dcfirst %> = new <%= class_name %>();
|
@@ -41,36 +52,64 @@
|
|
41
52
|
<% else -%>
|
42
53
|
<%= class_name.dcfirst %>.<%= attribute.flex_name %> = <%= attribute.flex_type %>(<%= attribute.flex_name %>TextInput.text);
|
43
54
|
<% end -%>
|
44
|
-
<% end -%>
|
45
|
-
|
55
|
+
<% end -%>
|
46
56
|
<% for model in belongs_tos -%>
|
47
57
|
<%= class_name.dcfirst %>.<%= model.camelcase(:lower) %> = <%= model.camelcase %>(<%= model.camelcase(:lower) %>ComboBox.selectedItem);
|
58
|
+
<% end -%>
|
59
|
+
<% if attachment_field.size > 0 -%>
|
60
|
+
<%= class_name.dcfirst %>.attachment = file;
|
48
61
|
<% end -%>
|
49
62
|
}
|
50
|
-
|
63
|
+
|
51
64
|
private function destroy<%= class_name %>():void {
|
52
65
|
<%= class_name.dcfirst %>.destroy({onSuccess: on<%= class_name %>Destroy});
|
53
66
|
}
|
54
|
-
|
67
|
+
|
55
68
|
private function on<%= class_name %>Select():void {
|
56
69
|
<%= class_name.dcfirst %> = RxUtils.clone(<%= class_name.dcfirst.pluralize %>List.selectedItem) as <%= class_name %>;
|
57
70
|
}
|
58
|
-
|
71
|
+
|
59
72
|
private function on<%= class_name %>Create(result:<%= class_name %>):void {
|
60
73
|
<%= class_name.dcfirst %> = new <%= class_name %>;
|
61
74
|
}
|
62
|
-
|
75
|
+
|
63
76
|
private function on<%= class_name %>Update(result:<%= class_name %>):void {
|
64
77
|
<%= class_name.dcfirst.pluralize %>List.selectedItem = result;
|
65
78
|
on<%= class_name %>Select();
|
66
79
|
}
|
67
|
-
|
80
|
+
|
68
81
|
private function on<%= class_name %>Destroy(result:<%= class_name %>):void {
|
69
82
|
on<%= class_name %>Create(result);
|
83
|
+
}
|
84
|
+
<% if attachment_field.size > 0 -%>
|
85
|
+
|
86
|
+
private function chooseFile():void {
|
87
|
+
file = new RxFileReference("<%= attachment_field[0].camelcase(:lower) %>");
|
88
|
+
file.reference.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler, false, 0, true);
|
89
|
+
file.reference.addEventListener(Event.SELECT, selectFile, false, 0, true);
|
90
|
+
file.reference.addEventListener(Event.CANCEL, cancelBrowse, false, 0, true);
|
91
|
+
file.reference.browse();
|
92
|
+
}
|
93
|
+
|
94
|
+
private function selectFile(event:Event):void {
|
95
|
+
fileSelected(event)
|
96
|
+
}
|
97
|
+
|
98
|
+
private function cancelBrowse(event:Event):void {
|
99
|
+
file = null;
|
70
100
|
}
|
101
|
+
|
102
|
+
private function fileSelected(event:Event):void {
|
103
|
+
fileName = FileReference(event.target).name;
|
104
|
+
}
|
105
|
+
|
106
|
+
private function ioErrorHandler(event:Event):void {
|
107
|
+
fileChooser.errorString = "Failed to selected a file. Please try again.";
|
108
|
+
}
|
109
|
+
<% end -%>
|
71
110
|
]]></mx:Script>
|
72
111
|
<mx:Panel id="<%= class_name.dcfirst.pluralize %>Panel"
|
73
|
-
title="<%= class_name.pluralize %>" cornerRadius="0" dropShadowEnabled="false" borderStyle="solid"
|
112
|
+
title="<%= class_name.pluralize %>" cornerRadius="0" dropShadowEnabled="false" borderStyle="solid"
|
74
113
|
borderThickness="1" backgroundColor="#EEEEEE" width="25%" height="100%">
|
75
114
|
<mx:List id="<%= class_name.dcfirst.pluralize %>List"
|
76
115
|
width="100%" height="100%"
|
@@ -81,7 +120,7 @@
|
|
81
120
|
click="new<%= class_name %>()"/>
|
82
121
|
</mx:ControlBar>
|
83
122
|
</mx:Panel>
|
84
|
-
<mx:Panel title="Edit <%= class_name %>" cornerRadius="0" dropShadowEnabled="false" borderStyle="solid"
|
123
|
+
<mx:Panel title="Edit <%= class_name %>" cornerRadius="0" dropShadowEnabled="false" borderStyle="solid"
|
85
124
|
borderThickness="1" backgroundColor="#EEEEEE" width="75%" height="100%">
|
86
125
|
<mx:Form width="100%" height="100%">
|
87
126
|
<% for attribute in attributes -%>
|
@@ -101,12 +140,19 @@
|
|
101
140
|
<% end -%>
|
102
141
|
</mx:FormItem>
|
103
142
|
<% end -%>
|
143
|
+
<% if attachment_field.size > 0 -%>
|
144
|
+
<mx:FormItem label="<%= attachment_field[0].camelcase %>:" width="100%" id="fileChooser">
|
145
|
+
<mx:Button label="Browse…" id="fileBrowseButton" click="chooseFile()"/>
|
146
|
+
<mx:Label text="{fileName}" maxWidth="190"/>
|
147
|
+
<mx:Image source="{<%= class_name.dcfirst %>.attachmentUrl}"/>
|
148
|
+
</mx:FormItem>
|
149
|
+
<% end -%>
|
104
150
|
<% for model in belongs_tos -%>
|
105
151
|
<mx:FormItem label="<%= model.camelcase %>" width="100%">
|
106
152
|
<mx:ComboBox id="<%= model.camelcase(:lower) %>ComboBox" width="200"
|
107
153
|
labelField="{<%= model.camelcase %>.LABEL}"
|
108
154
|
dataProvider="{Rx.models.index(<%= model.camelcase %>)}" prompt="<%= model.camelcase %> ..."
|
109
|
-
selectedItem="{<%= class_name.dcfirst %>.<%= model.camelcase(:lower) %>}"
|
155
|
+
selectedItem="{<%= class_name.dcfirst %>.<%= model.camelcase(:lower) %>}"/>
|
110
156
|
</mx:FormItem>
|
111
157
|
<% end -%>
|
112
158
|
</mx:Form>
|