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
Determine the browser making a request with the BrowserDetector class and related view helpers.
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://gems.github.com sudo gem install midas-guilded
INSTALL FOR RAILS
Add to environment file:
config.gem "guilded", :version => '1.0.0'
script/generate guilded_config script/generate guilded_assets
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 It should be placed in your layout:
<%= g_apply_style %>
<%= g_apply_behavior %>
You also must reset the Guilded singleton that manages everything after each rendering. The best way to do this is a before filter in your application controller:
def reset_guilded Guilded::Guilder.instance.reset! end
Then install one or more Guilded components and you are on your way!
The browser detector uses the HTTP user agent string to determine which browser is making the current request. The detector can determine the name, version, major version, minor version, build version and revision version of the current browser.
If using Rails, there are several view helpers available that use the BrowserDetector: g_browser_name(), g_browser_version(), g_browser_full_name() and g_browser_is?().
The following examples will assume Firefox 3.5.3 on OS/X is being used. The user agent string for Firefox 3.5.3 on OS/X is:
Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:188.8.131.52) Gecko/20090824 Firefox/3.5.3
<% if g_browser_name == 'firefox' %> ...
<% if g_browser_version == '3.5.3' %> ...
<%= g_browser_full_name # Outputs: Firefox 3.5.3 %>
<% if g_browser_is?( :name => 'firefox', :version => '3.5.3' ) %> ... <% if g_browser_is?( :name => 'firefox', :major_version => '3' ) %> ... <% if g_browser_is?( :name => :firefox, :major_version => 3, :minor_version => 5, :build_version => 3 ) %> ... <% if g_browser_is?( :name => :firefox, :major_version => 3, :minor_version => 5, :build_version => 3, :revision_version => 0 ) %> ...
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.