midas-guilded 0.2.3 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,10 @@
1
+ = 0.2.4 2009-05-29
2
+
3
+ * Added add_data method to the Guilder object allowing named data structures to be passed to the JavaScript
4
+ executing environment.
5
+ * Added a jQuery event to the body DOM element called guildedInitialized. To execute JavaScript code after all
6
+ Guilded components are intialized, simply bind to this event.
7
+
1
8
  = 0.2.0 2009-04-06
2
9
 
3
10
  * Added human attribute hint support for InactiveRecord
data/README.rdoc CHANGED
@@ -1,4 +1,4 @@
1
- = guilded-base
1
+ = guilded
2
2
 
3
3
  http://github.com/midas/guilded/tree/master
4
4
 
@@ -8,8 +8,8 @@ Guilded is a framework for building web based components centered around current
8
8
  framework is written in ruby, but could be ported to other languages.
9
9
 
10
10
  Guilded intends to provide a toolset for creating and consuming reusable web components. Currently, this problem domain is
11
- filled with JavaScript frameworks. These frameworks are wonderful and work very well. However, they do not degrade and are
12
- not accessible. Guilded seeks to provide the same level of "componentization" and ease of use without sacrificing degradability
11
+ filled with JavaScript frameworks. These frameworks are wonderful and work very well. However, they do not degrade gracefully and
12
+ are not accessible. Guilded seeks to provide the same level of "componentization" and ease of use without sacrificing degradability
13
13
  and accessibility. Guilded will achieve these goals by applying each technology at our disposal to do what it was intended.
14
14
 
15
15
  XHTML will be employed for content. CSS used for layout and styling. Behavior will be added to a component with JavaScript
@@ -24,9 +24,9 @@ allow the jQuery plugin to be used outside of the Guilded project, if desired.
24
24
  Guilded also seeks to provide a standardized CSS framework for creating layouts that are reusable and predictable.
25
25
 
26
26
  Guilded will utilize the currently existing RubyGems system to package its components. A new Guilded component will be packaged
27
- in a Gem and have a dependency on the guilded gem.
27
+ in a Gem and have a dependency on the Guilded gem.
28
28
 
29
- The Guilded-Base gem contains the framework to build Guilded components.
29
+ The Guilded gem contains the framework to build Guilded components.
30
30
 
31
31
 
32
32
  == FEATURES
@@ -36,16 +36,23 @@ The Guilded-Base gem contains the framework to build Guilded components.
36
36
  * Automatic addition of Yahoo's reset-min.css.
37
37
  * Redefinition of jQuery's $ method to $j and running jQuery in no conflict mode to allow other libraries to retain control
38
38
  of the $ method.
39
- * Definition of the g namespace to avoid JavaScript name collisions.
39
+ * Definition of the g namespace to avoid JavaScript name collisions. Simply define your custom functions within the g object.
40
+ * Definition of convenience method $j(). Equivalent to jQuery() or $(). Guilded runs jQuery in no conflict mode, giving the $
41
+ back to any other JavaScript frameworks in use. You must use $j() or jQuery() in lieu of $().
40
42
  * Definition of convenience method $jc(). Equivalent to jQuery( '.' + className ).
41
43
  * Definition of convenience method $jid(). Equivalent to jQuery( '#' + idName ).
42
44
  * The assets required for each component are added by the author to a central data store. When the view helper to create
43
45
  the component is called, these assets are added to the asset store. This results in a single method call with some options
44
- to use a Guilded component.
46
+ to use a Guilded component. No need to include JavaScript source files or CSS files. Guilded automatically does this for
47
+ you.
45
48
  * For CSS assets, Guilded simply loops through the collection of CSS assets creating an HTML link tag for each asset, or one
46
49
  HTML link tag for the cached version of these asset(s), when running in production mode.
47
50
  * For JavaScript assets, Guilded loops through the collection of JavaScript assets creating an HTML script tag for each, or a
48
51
  single script tag for the cached version of these asset(s), when running in production mode.
52
+ * Pass named data structures from the server to the client side environment for use with the Guilder.add_data() method. Once Guilded
53
+ is initialized, the data structure will be instantiated for you with the name specified within the g object.
54
+ * Execute custom JavaScript code after all Guilded components are initialized (ensuring everything you wish to use is instantiated)
55
+ using the 'guildedInitialized' custom jQuery event defined on the body DOM element.
49
56
 
50
57
  === Caching of CSS and JavaScript assets needed to render a web page.
51
58
  * The CSS assets are cached to form one file. In addition, the JavaScript assets are cached to form one file. These files are
@@ -56,7 +63,22 @@ The Guilded-Base gem contains the framework to build Guilded components.
56
63
 
57
64
  === Automatic choosing of packed, compressed or minified JavaScript files when in production mode.
58
65
  * In production mode, Guilded automatically looks for a .pack, .compressed or .min version of the JavaScript assets. If one of
59
- these is found, it includes it, otherwise, it includes the version specified by the author in the view helper. This is usually an unpacked version of the file.
66
+ these is found, it includes it, otherwise, it includes the version specified by the author in the view helper. This is usually
67
+ an unpacked version of the file.
68
+
69
+
70
+ == GUILDED COMPONENT PROJECTS
71
+
72
+ * http://github.com/midas/g_already_grid/tree/master
73
+ * http://github.com/midas/g_auto_completer/tree/master
74
+ * http://github.com/midas/g_flash_growler/tree/master
75
+ * http://github.com/midas/g_flot/tree/master
76
+ * http://github.com/midas/g_form_submit_protector/tree/master
77
+ * http://github.com/midas/g_named_scope_filters/tree/master
78
+ * http://github.com/midas/g_nested_select/tree/master
79
+ * http://github.com/midas/g_sectioned_shower/tree/master
80
+ * http://github.com/midas/g_toggle_block/tree/master
81
+
60
82
 
61
83
  == PROBLEMS
62
84
 
@@ -97,7 +119,7 @@ Next you must make a call to the view helper to apply the CSS It should be plac
97
119
 
98
120
  <%= g_apply_style %>
99
121
 
100
- There is also a view helper to apply the JavaScript. You can place this at the bottom of your layouts (so you
122
+ There is also a view helper to apply the JavaScript. You can place this at the bottom of your layout(s) (so you
101
123
  do not have to include it in every template):
102
124
 
103
125
  <%= g_apply_behavior %>
@@ -115,6 +137,7 @@ filter in your application controller:
115
137
  Guilded::Guilder.instance.reset!
116
138
  end
117
139
 
140
+ Then install one or more Guilded components and you are on your way!
118
141
 
119
142
  == LICENSE
120
143
 
data/guilded.gemspec CHANGED
@@ -2,12 +2,12 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{guilded}
5
- s.version = "0.2.3"
5
+ s.version = "0.2.4"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["C. Jason Harrelson (midas)"]
9
- s.date = %q{2009-04-17}
10
- s.description = %q{Guilded is a framework for building web based components centered around current web standards and best practices. The current framework is written in ruby, but could be ported to other languages. Guilded intends to provide a toolset for creating and consuming reusable web components. Currently, this problem domain is filled with JavaScript frameworks. These frameworks are wonderful and work very well. However, they do not degrade and are not accessible. Guilded seeks to provide the same level of "componentization" and ease of use without sacrificing degradability and accessibility. Guilded will achieve these goals by applying each technology at our disposal to do what it was intended. XHTML will be employed for content. CSS used for layout and styling. Behavior will be added to a component with JavaScript through progressive enhancement. The user will have the best experience with a Guilded component when CSS and JavaScript are enabled in their browser, but will still be able to use the component when CSS and JavaScript are disabled. Guilded will use jQuery as it's base JavaScript framework. jQuery was chosen because it lends itself to progressive enhancement due to the way it was authored. In addition, the tight integration of jQuery's selectors with CSS selectors is also highly desirable. When authoring a Guilded component, it is encouraged to write the behavior code as a jQuery plugin. This will allow the jQuery plugin to be used outside of the Guilded project, if desired. Guilded also seeks to provide a standardized CSS framework for creating layouts that are reusable and predictable. Guilded will utilize the currently existing RubyGems system to package its components. A new Guilded component will be packaged in a Gem and have a dependency on the guilded gem. The Guilded-Base gem contains the framework to build Guilded components.}
9
+ s.date = %q{2009-05-29}
10
+ s.description = %q{Guilded is a framework for building web based components centered around current web standards and best practices. The current framework is written in ruby, but could be ported to other languages. Guilded intends to provide a toolset for creating and consuming reusable web components. Currently, this problem domain is filled with JavaScript frameworks. These frameworks are wonderful and work very well. However, they do not degrade gracefully and are not accessible. Guilded seeks to provide the same level of "componentization" and ease of use without sacrificing degradability and accessibility. Guilded will achieve these goals by applying each technology at our disposal to do what it was intended. XHTML will be employed for content. CSS used for layout and styling. Behavior will be added to a component with JavaScript through progressive enhancement. The user will have the best experience with a Guilded component when CSS and JavaScript are enabled in their browser, but will still be able to use the component when CSS and JavaScript are disabled. Guilded will use jQuery as it's base JavaScript framework. jQuery was chosen because it lends itself to progressive enhancement due to the way it was authored. In addition, the tight integration of jQuery's selectors with CSS selectors is also highly desirable. When authoring a Guilded component, it is encouraged to write the behavior code as a jQuery plugin. This will allow the jQuery plugin to be used outside of the Guilded project, if desired. Guilded also seeks to provide a standardized CSS framework for creating layouts that are reusable and predictable. Guilded will utilize the currently existing RubyGems system to package its components. A new Guilded component will be packaged in a Gem and have a dependency on the Guilded gem. The Guilded gem contains the framework to build Guilded components.}
11
11
  s.email = ["jason@lookforwardenterprises.com"]
12
12
  s.extra_rdoc_files = ["History.txt", "Manifest.txt", "PostInstall.txt", "README.rdoc"]
13
13
  s.files = ["History.txt", "Manifest.txt", "PostInstall.txt", "README.rdoc", "Rakefile", "guilded.gemspec", "lib/guilded.rb", "lib/guilded/component_def.rb", "lib/guilded/exceptions.rb", "lib/guilded/guilder.rb", "lib/guilded/rails.rb", "lib/guilded/rails/active_record/human_attribute_hint.rb", "lib/guilded/rails/active_record/human_attribute_override.rb", "lib/guilded/rails/helpers.rb", "lib/guilded/rails/inactive_record/human_attribute_hint.rb", "lib/guilded/rails/view_helpers.rb", "rails_generators/guilded_assets/guilded_assets_generator.rb", "rails_generators/guilded_assets/templates/guilded.js", "rails_generators/guilded_assets/templates/guilded.min.js", "rails_generators/guilded_assets/templates/jquery-1.2.6.js", "rails_generators/guilded_assets/templates/jquery-1.2.6.min.js", "rails_generators/guilded_assets/templates/jquery-1.3.2.js", "rails_generators/guilded_assets/templates/jquery-1.3.2.min.js", "rails_generators/guilded_assets/templates/jquery-url.js", "rails_generators/guilded_assets/templates/jquery-url.min.js", "rails_generators/guilded_assets/templates/reset-min.css", "rails_generators/guilded_config/guilded_config_generator.rb", "rails_generators/guilded_config/templates/load_guilded_settings.rb", "script/console", "script/destroy", "script/generate", "spec/guilded/component_def_spec.rb", "spec/guilded/guilder_spec.rb", "spec/guilded/rails/helpers_spec.rb", "spec/guilded_spec.rb", "spec/spec.opts", "spec/spec_helper.rb", "tasks/rails.rake", "tasks/rspec.rake"]
data/lib/guilded.rb CHANGED
@@ -72,7 +72,7 @@ require 'guilded/rails/inactive_record/human_attribute_hint'
72
72
  # <%= g_load_alerter :skin => 'blueish', :id => 'load_alerter' %>
73
73
  #
74
74
  module Guilded
75
- VERSION = '0.2.3'
75
+ VERSION = '0.2.4'
76
76
  end
77
77
 
78
78
  ActionView::Base.send( :include, Guilded::Rails::ViewHelpers ) if defined?( ActionView )
@@ -34,6 +34,7 @@ module Guilded
34
34
  end
35
35
  @initialized_at = Time.now
36
36
  @g_elements = Hash.new
37
+ @g_data_elements = Hash.new
37
38
  @combined_js_srcs = Array.new
38
39
  @combined_css_srcs = Array.new
39
40
  @assets_combined = false
@@ -49,6 +50,17 @@ module Guilded
49
50
  raise Guilded::Exceptions::DuplicateElementId.new( options[:id] ) if @g_elements.has_key?( options[:id] )
50
51
  @g_elements[ options[:id].to_sym ] = Guilded::ComponentDef.new( element, options, libs, styles )
51
52
  end
53
+
54
+ # Adds a data structure to be passed to the Guilded JavaScript environment for use on the client
55
+ # side. The data is passed using the ruby to_json method on the data structure provided.
56
+ #
57
+ # === Parameters
58
+ # * +name+ - The desired name of the variable on the client side.
59
+ # * +data+ - The data to pass to the Guilded JavaScript environment.
60
+ #
61
+ def add_data( name, data )
62
+ @g_data_elements.merge!( name.to_sym => data )
63
+ end
52
64
 
53
65
  def count #:nodoc:
54
66
  @g_elements.size
@@ -130,15 +142,19 @@ module Guilded
130
142
  def generate_javascript_init #:nodoc:
131
143
  code = "<script type=\"text/javascript\">"
132
144
  code << "var initGuildedElements = function(){"
145
+ @g_data_elements.each do |name, data|
146
+ code << "g.#{name} = #{data.to_json};"
147
+ end
133
148
  @g_elements.each_value do |guilded_def|
134
- code << "g.#{guilded_def.kind.to_s.camelize( :lower )}Init( #{guilded_def.options.to_json} );" unless guilded_def.exclude_js?
149
+ code << "g.#{guilded_def.kind.to_s.camelize( :lower )}Init(#{guilded_def.options.to_json});" unless guilded_def.exclude_js?
135
150
  end
136
- code << "};jQuery('document').ready( initGuildedElements );</script>"
151
+ code << "jQuery('body').trigger('guildedInitialized');};jQuery('document').ready(initGuildedElements);</script>"
137
152
  end
138
153
 
139
154
  # Generates a name to use when caching the current set of Guilded component JavaScript assets. Sorts and concatenates
140
155
  # the name of each JavaScript asset in @combined_js_srcs. Then hashes this string to generate a reproducible, unique
141
156
  # and shorter string.
157
+ #
142
158
  def js_cache_name
143
159
  generate_js_cache_name( @combined_js_srcs )
144
160
  end
@@ -146,6 +162,7 @@ module Guilded
146
162
  # Generates a name to use when caching the current set of Guilded component CSS assets. Sorts and concatenates
147
163
  # the name of each JavaScript asset in @combined_js_srcs. Then hashes this string to generate a reproducible, unique
148
164
  # and shorter string.
165
+ #
149
166
  def css_cache_name
150
167
  generate_css_cache_name( @combined_css_srcs )
151
168
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: midas-guilded
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - C. Jason Harrelson (midas)
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-04-17 00:00:00 -07:00
12
+ date: 2009-05-29 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -32,7 +32,7 @@ dependencies:
32
32
  - !ruby/object:Gem::Version
33
33
  version: 1.8.0
34
34
  version:
35
- description: Guilded is a framework for building web based components centered around current web standards and best practices. The current framework is written in ruby, but could be ported to other languages. Guilded intends to provide a toolset for creating and consuming reusable web components. Currently, this problem domain is filled with JavaScript frameworks. These frameworks are wonderful and work very well. However, they do not degrade and are not accessible. Guilded seeks to provide the same level of "componentization" and ease of use without sacrificing degradability and accessibility. Guilded will achieve these goals by applying each technology at our disposal to do what it was intended. XHTML will be employed for content. CSS used for layout and styling. Behavior will be added to a component with JavaScript through progressive enhancement. The user will have the best experience with a Guilded component when CSS and JavaScript are enabled in their browser, but will still be able to use the component when CSS and JavaScript are disabled. Guilded will use jQuery as it's base JavaScript framework. jQuery was chosen because it lends itself to progressive enhancement due to the way it was authored. In addition, the tight integration of jQuery's selectors with CSS selectors is also highly desirable. When authoring a Guilded component, it is encouraged to write the behavior code as a jQuery plugin. This will allow the jQuery plugin to be used outside of the Guilded project, if desired. Guilded also seeks to provide a standardized CSS framework for creating layouts that are reusable and predictable. Guilded will utilize the currently existing RubyGems system to package its components. A new Guilded component will be packaged in a Gem and have a dependency on the guilded gem. The Guilded-Base gem contains the framework to build Guilded components.
35
+ description: Guilded is a framework for building web based components centered around current web standards and best practices. The current framework is written in ruby, but could be ported to other languages. Guilded intends to provide a toolset for creating and consuming reusable web components. Currently, this problem domain is filled with JavaScript frameworks. These frameworks are wonderful and work very well. However, they do not degrade gracefully and are not accessible. Guilded seeks to provide the same level of "componentization" and ease of use without sacrificing degradability and accessibility. Guilded will achieve these goals by applying each technology at our disposal to do what it was intended. XHTML will be employed for content. CSS used for layout and styling. Behavior will be added to a component with JavaScript through progressive enhancement. The user will have the best experience with a Guilded component when CSS and JavaScript are enabled in their browser, but will still be able to use the component when CSS and JavaScript are disabled. Guilded will use jQuery as it's base JavaScript framework. jQuery was chosen because it lends itself to progressive enhancement due to the way it was authored. In addition, the tight integration of jQuery's selectors with CSS selectors is also highly desirable. When authoring a Guilded component, it is encouraged to write the behavior code as a jQuery plugin. This will allow the jQuery plugin to be used outside of the Guilded project, if desired. Guilded also seeks to provide a standardized CSS framework for creating layouts that are reusable and predictable. Guilded will utilize the currently existing RubyGems system to package its components. A new Guilded component will be packaged in a Gem and have a dependency on the Guilded gem. The Guilded gem contains the framework to build Guilded components.
36
36
  email:
37
37
  - jason@lookforwardenterprises.com
38
38
  executables: []