Giter Club home page Giter Club logo

javascript_util_asset_pack's Introduction

Rails 3.1 javascript - Util asset pack

Sets up a window.Util object which includes

  • Spinner, with methods to set spinner next to element or hide the spinner

  • AjaxForm, to ajax enable simple forms

  • jQuery ajaxError global handler, exception data during development and friendly message in production

Usage

spinner (js version)

window.Util.spinner.nextTo('#my_button');
window.Util.spinner.nextTo('#my_button', 3, 4); // selector, top offset, left offset
window.Util.spinner.hide();

ajax form (coffee script version)

jQuery ->
    new window.Util.AjaxForm '#my_form', ->
        log "my_form submit success callback"

Install

Update the Gemfile in your rails project, add the following line

gem 'javascript_util_asset_pack'

Run the generator

rails generate javascript_util_asset_pack

does the following:

  • Copy spinner.gif to /app/assets/images

  • Update application.html.erb adding javascript create window.Rails.env variable

  • Update application.html.erb adding image_tag for spinner.gif

  • Update application.js adding util_pack

WARNING

  • 0.0.10 and 0.0.11 are bad versions, use 0.0.12 or above

Coming Soon

  • configuration object

    • text in ajaxError overrides

    • spinner id override

Resources

License

The Unlicense (aka: public domain) unlicense.org

Ruby Gems

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.