Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Guilded is a framework for building web based components centered around current web standards and best practices.

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 lib
Octocat-spinner-32 rails_generators
Octocat-spinner-32 script
Octocat-spinner-32 spec
Octocat-spinner-32 tasks
Octocat-spinner-32 .gitignore
Octocat-spinner-32 History.txt
Octocat-spinner-32 Manifest.txt
Octocat-spinner-32 PostInstall.txt
Octocat-spinner-32 README.rdoc
Octocat-spinner-32 Rakefile
Octocat-spinner-32 guilded.gemspec
README.rdoc

guilded-base

github.com/midas/guilded/tree/master

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.

FEATURES

Centralized control of CSS and JavaScript assets needed to render a web page.

  • Automatic addition of jQuery 1.3.2 library.

  • 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 the g namespace to avoid JavaScript name collisions.

  • Definition of convenience method $jc(). Equivalent to jQuery( '.' + className ).

  • Definition of convenience method $jid(). Equivalent to jQuery( '#' + idName ).

  • The assets required for each component are added by the author to a central data store. When the view helper to create the component is called, these assets are added to the asset store. This results in a single method call with some options to use a Guilded component.

  • 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.

  • For JavaScript assets, Guilded loops through the collection of JavaScript assets creating an HTML script tag for each, or a single script tag for the cached version of these asset(s), when running in production mode.

Caching of CSS and JavaScript assets needed to render a web page.

  • The CSS assets are cached to form one file. In addition, the JavaScript assets are cached to form one file. These files are named by sorting and concatenating into a single string the names of each individual respective asset. This string is then hashed to generate a reproducable unique string. This file naming technique allows Guilded to find cached asset files that match a combination of Guilded components, not an action, URI, etc. Thus, one file for a certain combination of Guilded components is generated and then reused on any page where the combination appears.

Automatic choosing of packed, compressed or minified JavaScript files when in production mode.

  • In production mode, Guilded automatically looks for a .pack, .compressed or .min version of the JavaScript assets. If one of 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.

PROBLEMS

REQUIREMENTS

  • jQuery 1.3.2 (included in Guilded)

INSTALL

gem sources -a http://gems.github.com
sudo gem install midas-guilded

INSTALL FOR RAILS

Add to environment file:

config.gem "guilded", :version => '0.1.9'

Run:

sudo rake:gems:install

Generate:

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).

Next you must make a call to the view helper to apply the CSS It should be placed in your layout:

<%= g_apply_style %>

There is also a view helper to apply the JavaScript. You can place this at the bottom of your layouts (so you do not have to include it in every template):

<%= 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:

before_filter :reset_guilded

#...

protected

def reset_guilded
  Guilded::Guilder.instance.reset!
end

LICENSE

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.

Something went wrong with that request. Please try again.