restfulx 1.2.5 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +3 -3
- data/Rakefile +17 -2
- data/VERSION.yml +2 -3
- data/bin/rx-gen +1 -1
- data/ext/restfulx/ext/amf/serializer/extconf.rb +3 -0
- data/lib/restfulx.rb +43 -81
- data/lib/restfulx/active_record_tasks.rb +8 -6
- data/lib/restfulx/active_record_uuid_helper.rb +9 -10
- data/lib/restfulx/amf.rb +14 -0
- data/lib/restfulx/amf/class_mapping.rb +106 -0
- data/lib/restfulx/amf/ext.rb +11 -0
- data/lib/restfulx/amf/ext/serializer.bundle +0 -0
- data/lib/restfulx/amf/pure.rb +11 -0
- data/lib/restfulx/amf/pure/io_helpers.rb +52 -0
- data/lib/restfulx/amf/pure/serializer.rb +304 -0
- data/lib/restfulx/configuration.rb +16 -12
- data/lib/restfulx/{rails/recipes.rb → recipes.rb} +1 -2
- data/lib/restfulx/rx_action_controller.rb +34 -0
- data/lib/restfulx/rx_active_record.rb +360 -0
- data/lib/restfulx/rx_active_support.rb +139 -0
- data/lib/restfulx/{datamapper_foo.rb → rx_datamapper.rb} +0 -2
- data/lib/restfulx/{rails/schema_to_yaml.rb → schema_to_rx_yaml.rb} +88 -5
- data/lib/restfulx/swf_helper.rb +61 -0
- data/lib/restfulx/tasks.rb +5 -3
- data/rails_generators/rx_config/rx_config_generator.rb +2 -2
- data/rails_generators/rx_config/templates/mainapp.mxml +1 -1
- data/rails_generators/rx_config/templates/restfulx.erb +5 -3
- data/rails_generators/rx_main_app/rx_main_app_generator.rb +2 -2
- data/rails_generators/rx_scaffold/rx_scaffold_generator.rb +7 -7
- data/rails_generators/rx_yaml_scaffold/rx_yaml_scaffold_generator.rb +5 -3
- data/rxgen_generators/rx_config/rx_config_generator.rb +1 -1
- data/test/rails/fixtures/locations.yml +5 -6
- data/test/rails/fixtures/notes.yml +5 -15
- data/test/rails/fixtures/projects.yml +7 -23
- data/test/rails/fixtures/tasks.yml +17 -43
- data/test/rails/fixtures/users.yml +7 -11
- data/test/rails/helpers/functional_test_helper.rb +5 -4
- data/test/rails/helpers/performance_test_helper.rb +5 -0
- data/test/rails/helpers/test_helper.rb +27 -0
- data/test/rails/helpers/unit_test_helper.rb +3 -15
- data/test/rails/test_active_foo.rb +21 -25
- data/test/rails/{test_rails_integration_functional.rb → test_notes_controller_functional.rb} +5 -5
- data/test/rails/test_serialiazation_performance.rb +32 -0
- data/test/rails/test_to_amf.rb +30 -0
- data/test/rails/test_to_fxml.rb +18 -15
- data/test/rails/test_to_json.rb +2 -14
- metadata +30 -19
- data/lib/restfulx/active_foo.rb +0 -178
- data/lib/restfulx/rails/schema_to_yaml/extensions/enumerable.rb +0 -8
- data/lib/restfulx/rails/schema_to_yaml/settings/config.rb +0 -17
- data/lib/restfulx/rails/schema_to_yaml/settings/core.rb +0 -73
- data/lib/restfulx/rails/swf_helper.rb +0 -59
@@ -1,59 +0,0 @@
|
|
1
|
-
# Adds a little helper to make it easier empbedding SWFs in ERB templates.
|
2
|
-
module SWFHelper
|
3
|
-
# Creates a swfObject Javascript call. You must include swfobject.js to use this.
|
4
|
-
# See http://code.google.com/p/swfobject/wiki/documentation for full details and documentation
|
5
|
-
# of the swfobject js library.
|
6
|
-
def swfobject(swf_url, params = {})
|
7
|
-
params.reverse_merge!({:width => '100%',
|
8
|
-
:height => '100%',
|
9
|
-
:id => 'flashContent',
|
10
|
-
:version => '9.0.0',
|
11
|
-
:express_install_swf => '/expressInstall.swf',
|
12
|
-
:flash_vars => nil,
|
13
|
-
:params => { },
|
14
|
-
:attributes => { },
|
15
|
-
:create_div => false,
|
16
|
-
:include_authenticity_token => true,
|
17
|
-
:include_session_token => true
|
18
|
-
})
|
19
|
-
arg_order = [:id, :width, :height, :version, :express_install_swf]
|
20
|
-
js_params = ["'#{swf_url}'"]
|
21
|
-
js_params += arg_order.collect {|arg| "'#{params[arg]}'" }
|
22
|
-
|
23
|
-
# Add authenticity_token and the session key to flashVars. This will only work if flashVars is a Hash or nil
|
24
|
-
# If it's a string representing the name of a Javascript variable, then you need to add them yourself
|
25
|
-
# like this:
|
26
|
-
# <script>
|
27
|
-
# ... other code that defines flashVars and sets some of its parameters
|
28
|
-
# flashVars['authenticity_token'] = <%= form_authenticity_token -%>
|
29
|
-
# flashVars['session_token'] = <%= session.session_id -%>
|
30
|
-
# </script>
|
31
|
-
params[:flash_vars] ||= {}
|
32
|
-
if params[:flash_vars].is_a?(Hash)
|
33
|
-
if params[:include_authenticity_token] && ActionController::Base.allow_forgery_protection
|
34
|
-
params[:flash_vars].reverse_merge!(:authenticity_token => form_authenticity_token)
|
35
|
-
end
|
36
|
-
if params[:include_session_token]
|
37
|
-
if RAILS_GEM_VERSION =~ /^2.3/
|
38
|
-
params[:flash_vars].reverse_merge!(:session_token => request.session_options[:id])
|
39
|
-
else
|
40
|
-
params[:flash_vars].reverse_merge!(:session_token => session.session_id)
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
js_params += [params[:flash_vars], params[:params], params[:attributes]].collect do |hash_or_string|
|
46
|
-
if hash_or_string.is_a?(Hash)
|
47
|
-
hash_or_string.to_json
|
48
|
-
else # If it's not a hash, then it should be a string giving the name of the Javascript variable to use
|
49
|
-
hash_or_string
|
50
|
-
end
|
51
|
-
end.compact
|
52
|
-
|
53
|
-
swf_tag = javascript_tag do
|
54
|
-
"swfobject.embedSWF(#{js_params.join(',')})"
|
55
|
-
end
|
56
|
-
swf_tag += content_tag(:div, nil, :id => params[:id]) if params[:create_div]
|
57
|
-
swf_tag
|
58
|
-
end
|
59
|
-
end
|