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 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.
Update: Due to the quality components, etc. being generated by the MooTools community and the general quality of the library, we have decided to include support for it in Guilded as of release 0.3.0.
Automatic addition of jQuery 1.3.2 library.
Automatic addition of MooTools 1.2.3 library if a utilized component defines it as a dependency using the :mootools => true option with the Guilder.add() method when defining the component.
Automatic addition of Yahoo's reset-min.css.
Redefinition of jQuery's $ method to $j and running jQuery in no conflict mode to allow other libraries to retain control of the $ method.
Definition of convenience method $jc(). Equivalent to jQuery( '.' + className ).
Definition of convenience method $jid(). Equivalent to jQuery( '#' + idName ).
For CSS assets, Guilded simply loops through the collection of CSS assets creating an HTML link tag for each asset, or one HTML link tag for the cached version of these asset(s), when running in production mode.
Pass named data structures from the server to the client side environment for use with the Guilder.add_data() method. Once Guilded is initialized, the data structure will be instantiated for you with the name specified within the g object.
Additional common utilities
Extends ActiveRecord to have a attr_human_hint method. This method works similar to the attr_human_name method except a hint to use on forms, etc is being set.
Extends InactiveRecord (github.com/midas/inactive_record/tree/master) to include the attr_human_hint method.
GUILDED COMPONENT PROJECTS
jQuery 1.3.2 (included in Guilded)
MooTools 1.2.3 (included in Guilded)
gem sources -a http://gemcutter.org sudo gem install guilded
INSTALL FOR RAILS
Configure the Gem for use:
gem 'guilded', '1.0.7' # Rails 3 config.gem 'guilded', :version => '1.0.7' # Rails 2
Install the Gem:
bundle install # Rails 3 rake gems:install # Rails 2 gem install guilded # Manual
rails generate guilded_config # Rails 3 rails generate guilded_assets # Rails 3 script/generate guilded_config # Rails 2 script/generate guilded_assets # Rails 2
Edit the settings file at config/initializers/load_guilded_settings.rb. Change any of these settings to reflect how you would like Guilded to be configured. If you change where any file(s) are configured to be located, then also move the respective file(s).
You must make a call to the view helper to apply the CSS. The raw method must be used with Rails 3 as the new default escapes strings. It should be placed in your layout:
<%= raw g_apply_style %> # Rails 3 <%= g_apply_style %> # Rails 2
<% g_inject_styles %>
<% g_inject_styles %>
A before filter is automatically set up in your application controller to reset the Guilded singleton that manages everything after each rendering. The code looks like this:
def reset_guilded Guilded::Guilder.instance.reset! end
You may want to opt out of this before filter in actions that do not use a layout for efficiency.
Next, install one or more Guilded components and you are on your way!
Copyright © 2009 C. Jason Harrelson (midas)
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.