flex_scaffold 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -6,7 +6,7 @@ require 'rake/gempackagetask'
6
6
  require 'rake/contrib/rubyforgepublisher'
7
7
 
8
8
  PKG_NAME = "flex_scaffold"
9
- PKG_VERSION = '0.1.0'
9
+ PKG_VERSION = '0.1.1'
10
10
  RUBYFORGE_PROJECT = 'flexible-rails'
11
11
  RUBYFORGE_USER = ENV['RUBYFORGE_USER']
12
12
 
@@ -382,7 +382,8 @@ class FlexScaffoldGenerator < ScaffoldGenerator
382
382
 
383
383
  m.directory File.join('app/flex', class_path)
384
384
  m.directory File.join('app/flex' ,"#{plural_name}")
385
-
385
+ m.directory File.join('public/swfs', scaffold_name)
386
+
386
387
  m.complex_template '_index.rmxml', File.join('app/flex', "#{plural_name}", "_#{plural_name}.mxml"),
387
388
  :insert => '_form.rhtml',
388
389
  :sandbox => lambda { create_sandbox },
@@ -38,6 +38,7 @@ class FlexScaffoldResourceGenerator < Rails::Generator::NamedBase
38
38
  m.directory File.join('test/functional', class_path)
39
39
 
40
40
  m.directory File.join('app/views/layout')
41
+ m.directory File.join('app/views', scaffold_name)
41
42
  m.directory File.join('app/views', "#{plural_name}")
42
43
 
43
44
  m.template 'index.rhtml', File.join('app/views', scaffold_name, "index.rhtml")
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.0
3
3
  specification_version: 1
4
4
  name: flex_scaffold
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.1.0
7
- date: 2007-04-04 00:00:00 +12:00
6
+ version: 0.1.1
7
+ date: 2007-04-05 00:00:00 +12:00
8
8
  summary: Plugin for scaffolding a Flex view within Rails on REST services.
9
9
  require_paths:
10
10
  - lib
@@ -38,10 +38,8 @@ files:
38
38
  - pkg
39
39
  - public
40
40
  - Rakefile
41
- - rdoc
42
41
  - README
43
42
  - tasks
44
- - themes34
45
43
  - TODO
46
44
  - uninstall.rb
47
45
  - tasks/compile_swf.rake
@@ -82,13 +80,10 @@ files:
82
80
  - generators/flex_scaffold_resource/templates/controller.rb
83
81
  - generators/flex_scaffold_resource/templates/index.rhtml
84
82
  - generators/flex_scaffold_resource/templates/layout.rhtml
85
- - lib/actionscript_helper.rb
86
83
  - lib/action_view_helper.rb
87
84
  - lib/config.rb
88
85
  - lib/flexobject_view_helper.rb
89
86
  - lib/flex_scaffold_plugin.rb
90
- - lib/mtag_helper.rb
91
- - lib/mxml_helper.rb
92
87
  - lib/rest_scaffolding.rb
93
88
  - lib/validations.rb
94
89
  test_files: []
@@ -1,81 +0,0 @@
1
- require File.dirname(__FILE__) + '/tag_helper'
2
-
3
- module ActionView
4
- module Helpers
5
- # Provides functionality for working with ActionScript in your views.
6
- #
7
- module ActionScriptHelper
8
- unless const_defined? :ACTIONSCRIPT_PATH
9
- ACTIONSCRIPT_PATH = File.join(File.dirname(__FILE__), 'as')
10
- end
11
-
12
-
13
-
14
- # Includes the Action Pack JavaScript libraries inside a single <script>
15
- # tag. The function first includes prototype.js and then its core extensions,
16
- # (determined by filenames starting with "prototype").
17
- # Afterwards, any additional scripts will be included in undefined order.
18
- #
19
- # Note: The recommended approach is to copy the contents of
20
- # lib/action_view/helpers/javascripts/ into your application's
21
- # public/javascripts/ directory, and use +javascript_include_tag+ to
22
- # create remote <script> links.
23
- def define_javascript_functions
24
- javascript = '<script type="text/javascript">'
25
-
26
- # load prototype.js and its extensions first
27
- prototype_libs = Dir.glob(File.join(JAVASCRIPT_PATH, 'prototype*')).sort.reverse
28
- prototype_libs.each do |filename|
29
- javascript << "\n" << IO.read(filename)
30
- end
31
-
32
- # load other librairies
33
- (Dir.glob(File.join(JAVASCRIPT_PATH, '*')) - prototype_libs).each do |filename|
34
- javascript << "\n" << IO.read(filename)
35
- end
36
- javascript << '</script>'
37
- end
38
-
39
- # Escape carrier returns and single and double quotes for JavaScript segments.
40
- def escape_actionscript(javascript)
41
- (javascript || '').gsub('\\','\0\0').gsub(/\r\n|\n|\r/, "\\n").gsub(/["']/) { |m| "\\#{m}" }
42
- end
43
-
44
- # Returns a JavaScript tag with the +content+ inside. Example:
45
- # javascript_tag "alert('All is good')"
46
- #
47
- # Returns:
48
- #
49
- # <script type="text/javascript">
50
- # //<![CDATA[
51
- # alert('All is good')
52
- # //]]>
53
- # </script>
54
- #
55
- # +html_options+ may be a hash of attributes for the <script> tag. Example:
56
- # javascript_tag "alert('All is good')", :defer => 'true' # => <script defer="true" type="text/javascript">alert('All is good')</script>
57
- def actionscript_tag(content, html_options = {})
58
- #content_tag("script", javascript_cdata_section(content), html_options.merge(:type => "text/javascript"))
59
- end
60
-
61
- def actionscript_cdata_section(content) #:nodoc:
62
- "\n//#{cdata_section("\n#{content}\n//")}\n"
63
- end
64
-
65
- protected
66
- def options_for_actionscript(options)
67
- '{' + options.map {|k, v| "#{k}:#{v}"}.sort.join(', ') + '}'
68
- end
69
-
70
- def array_or_string_for_actionscript(option)
71
- as_option = if option.kind_of?(Array)
72
- "['#{option.join('\',\'')}']"
73
- elsif !option.nil?
74
- "'#{option}'"
75
- end
76
- as_option
77
- end
78
- end
79
-
80
- end
81
- end
data/lib/mtag_helper.rb DELETED
@@ -1,98 +0,0 @@
1
- require 'cgi'
2
- require 'erb'
3
-
4
- module ActionView
5
- module Helpers #:nodoc:
6
- # Use these methods to generate Flex <mx:> tags programmatically when you can't use
7
- # a Builder. By default, they output XML compliant tags.
8
- module TagHelper
9
- include ERB::Util
10
-
11
- # Returns an empty XML tag of type +name+ which by default is XML
12
- # compliant. Add attributes by passing an attributes
13
- # hash to +options+. For attributes with no value like (disabled and
14
- # readonly), give it a value of true in the +options+ hash. You can use
15
- # symbols or strings for the attribute names.
16
- #
17
- # tag("TextInput")
18
- # # => <mx:TextInput />
19
- # tag("TextInput", { :id => 'field_desc', :width => '274', text => '{ image_grid.selectedItem.desc }' })
20
- # # => <mx:TextInput width="274" text="{ image_grid.selectedItem.desc }" id="field_desc" />
21
- def mx_tag(name, options = nil, open = false)
22
- name = name.to_s.camelize
23
- "<#{tag_ns}#{name}#{tag_options(options) if options} />"
24
- end
25
-
26
- # Returns an XML block tag of type +name+ surrounding the +content+. Add
27
- # attributes by passing an attributes hash to +options+. For attributes
28
- # with no value, give it a value of true in
29
- # the +options+ hash. You can use symbols or strings for the attribute names.
30
- #
31
- # content_tag('FormItem', content_tag('TextInput'), :id => "image_desc")
32
- # # => <mx:FormItem id="image_desc">
33
- # <mx:TextInput />
34
- # </mx:FormItem>
35
- #
36
- # Instead of passing the content as an argument, you can also use a block
37
- # in which case, you pass your +options+ as the second parameter.
38
- #
39
- # <% mx_content_tag 'FormItem', :id => "image_desc" do -%>
40
- # <mx:TextInput />
41
- # <% end -%>
42
- # # => <mx:FormItem id="image_desc"><mx:TextInput /></mx:FormItem>
43
- #
44
- # Alternatively to passed in the tag name as a string, you can pass it in as
45
- # a symbol and it will be CamelCased
46
- #
47
- # content_tag(:form_item, content_tag(:text_input), :id => "image_desc")
48
- # # => <mx:FormItem id="image_desc">
49
- # <mx:TextInput />
50
- # </mx:FormItem>
51
- #
52
- def mx_content_tag(name, content_or_options_with_block = nil, options = nil, &block)
53
- name = name.to_s.camelize
54
- if block_given?
55
- options = content_or_options_with_block if content_or_options_with_block.is_a?(Hash)
56
- content = capture(&block)
57
- concat(mx_content_tag_string(name, content, options), block.binding)
58
- else
59
- content = content_or_options_with_block
60
- mx_content_tag_string(name, content, options)
61
- end
62
- end
63
-
64
- # Returns a CDATA section with the given +content+. CDATA sections
65
- # are used to escape blocks of text containing characters which would
66
- # otherwise be recognized as markup. CDATA sections begin with the string
67
- # <tt><![CDATA[</tt> and end with (and may not contain) the string <tt>]]></tt>.
68
- #
69
- # cdata_section("private function clearForm():void {field_title.text = '';}")
70
- # # => <![CDATA[
71
- # private function clearForm():void {
72
- # field_title.text = '';
73
- # }
74
- # ]]>
75
- def cdata_section(content)
76
- "<![CDATA[#{content}]]>"
77
- end
78
-
79
- # Returns the escaped +xml+ without affecting existing escaped entities.
80
- #
81
- # escape_once("1 > 2 &amp; 3")
82
- # # => "1 &lt; 2 &amp; 3"
83
- def escape_once(html)
84
- fix_double_escape(html_escape(html.to_s))
85
- end
86
-
87
- private
88
- def mx_content_tag_string(name, content, options)
89
- tag_options = options ? tag_options(options) : ""
90
- "<#{tag_ns}#{name}#{tag_options}>#{content}</#{name}>"
91
- end
92
-
93
- def tag_ns
94
- "mx:"
95
- end
96
- end
97
- end
98
- end
data/lib/mxml_helper.rb DELETED
@@ -1,107 +0,0 @@
1
- require File.dirname(__FILE__) + '/mtag_helper'
2
-
3
- module ActionView
4
- module Helpers
5
- # Provides functionality for working with MXML in your views.
6
- #
7
- # If you wish to use this library and its helpers (ActionView::Helpers::MxmlHelper),
8
- # you must:
9
- #
10
- # * Use <tt>flex_scaffold :model</tt> in your controller.
11
-
12
- module MxmlHelper
13
-
14
- # Returns the ActionScript that link to the model to the server as a REST
15
- # +resource+
16
- #
17
- # Example:
18
- # <mx:Script>
19
- # <![CDATA[
20
- #
21
- # private function clearForm():void {
22
- # field_name.text = '';
23
- # field_title.text = '';
24
- # field_size.text = '';
25
- # field_uri.text = '';
26
- # field_desc.text = '';
27
- # }
28
- #
29
- # public function deletegraphics(id:String):void {
30
- # deletegraphic.url = "/graphics/" + id + ".xml";
31
- # deletegraphic.send({_method: "DELETE"});
32
- # }
33
- #
34
- # private function sendgraphicUpdate():void {
35
- #
36
- # var params:Object = new Object();
37
- # params['_method'] = "PUT";
38
- # params['graphic[name]'] = field_name.text;
39
- # params['graphic[title]'] = field_title.text;
40
- # params['graphic[size]'] = field_size.text;
41
- # params['graphic[uri]'] = field_uri.text;
42
- # params['graphic[desc]'] = field_desc.text;
43
- #
44
- # updategraphic.url = "/graphics/" + graphic_grid.selectedItem.id + ".xml";
45
- # updategraphic.send(params);
46
- # }
47
- #
48
- # ]]>
49
- # </mx:Script>
50
- def mx_resource(model, *args)
51
-
52
- end
53
-
54
- # Returns the mx HTTPSService defined for a REST service call to rails
55
- #
56
- # Example:
57
- # <mx:HTTPService id="listimage" url="/images.xml" useProxy="false" method="GET"/>
58
- # <mx:HTTPService id="updateimage" useProxy="false" method="POST" result="listimage.send()"/>
59
- # <mx:HTTPService id="deleteimage" useProxy="false" method="POST" result="listimage.send()"/>
60
- # <mx:HTTPService id="createimage" url="/images.xml" useProxy="false" method="POST" result="listimage.send()"
61
- # contentType="application/xml">
62
- # <mx:request xmlns="">
63
- # <image>
64
- # <title>{field_title.text}</title>
65
- # <filename>{field_filename.text}</filename>
66
- # <desc>{field_desc.text}</desc>
67
- # <size>{field_size.text}</size>
68
- # </image>
69
- # </mx:request>
70
- # </mx:HTTPService>
71
-
72
- def mx_service
73
-
74
- end
75
-
76
- # Returns the application mxml tag
77
- #
78
- # Example:
79
- # <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
80
- # layout="absolute"
81
- # width="100%"
82
- # height="100%"
83
- # creationComplete="{list<%= singular_name %>.send();}"
84
- # xmlns:egenial="*"
85
- # backgroundColor="#808080"
86
- # backgroundGradientColors="[#808080, #ffffff]">
87
-
88
- def mx_application(name, *args, &block)
89
-
90
- end
91
-
92
- # Returns the validators mxml tag
93
- #
94
- # Example:
95
- # <mx:StringValidator source="{field_create_title}" property="text"
96
- # tooShortError="This string is shorter than the minimum allowed length of 4."
97
- # tooLongError="This string is longer than the maximum allowed length of 255."
98
- # minLength="4" maxLength="255"
99
- # trigger="{btn_add_create}" triggerEvent="click" />
100
-
101
- def mx_validators
102
-
103
- end
104
-
105
- end
106
- end
107
- end