Giter Site home page Giter Site logo

listing_for's Introduction

ListingFor Rails Plug-In

Very simple plugin to generate and use a simple rails dsl for
describing ActiveRecord collection listings, it doesn’t add any
awesome behavior, it just looks nice.

Installation

First install the actual plugin:


script/plugin install git://github.com/rha7dotcom/listing_for.git

Then run the generator, to place the theme files in public drectory:


script/generate listing_for

The add a css stylesheet link tag line to your layout, at the appropriate place:


= stylesheet_link_tag 'listings/ui-lightness', :media => "screen, projection"

And that’s all, just follow the example below to get an idea of how it works, hopefully with a bit more time, I’ll add more themes and give more help on usage.

Example

Using HAML, this:


  - listing_for "Products Listing", @products, :will_paginate => true do |list|
    - list.add Product.human_attribute_name(:upc_code) do |product|
      = product.upc_code
    - list.add Product.human_attribute_name(:name) do |product|
      = product.name
    - list.add Product.human_attribute_name(:description) do |product|
      = product.description
    - list.add Product.human_attribute_name(:price) do |product|
      = number_to_currency(product.price)
    - list.add Product.human_attribute_name(:stock), :align => :right do |product|
      = number_to_currency(product.stock)
    - list.add Product.human_attribute_name(:unit), :align => :right do |product|
      = product.unit.name
    - list.add "Actions" do |product|
      = product.upc_code

Produces this:

Contributions

Please feel free to contribute, modify at your heart’s content and send me a pull request, I’d be glad and honored to hear from you.

Greetings,

Gabriel Medina

Copyright © 2009 Gabriel Medina, released under the MIT license

listing_for's People

Contributors

rhaseven7h avatar

Stargazers

 avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.