GithubHelp home page GithubHelp logo

reddyonrails / formtastic-date-time-money-fields Goto Github PK

View Code? Open in Web Editor NEW

This project forked from slorek/formtastic-date-time-money-fields

1.0 2.0 0.0 248 KB

Formtastic Form Builder for Date, Time and DateTime data types and monetary values

formtastic-date-time-money-fields's Introduction

Formtastic Form Builder for Date, Time and DateTime data types and monetary values

This form builder for Formtastic transforms Date, Time and DateTime data fields into date/time picker UI widgets. It also appends a currency symbol before monetary value data to indicate to the user the type of data required.

Usage

  • Add the following to the end of your Formtastic initializer file:

Formtastic::SemanticFormHelper.builder = SemanticFormBuilder

  • Ensure you have included jQuery and jQuery UI frameworks in your layout. Also include the Timepicker Addon (included).

  • Use the application.js as an example to hook the fields to the time picker. Optionally apply the CSS styles (examples included).

  • Be sure to apply the locale information in the example English file to ensure date/time formats are rendered correctly.

  • In your view, Date, Time and DateTime data will be automatically transformed. For monetary values, use the following as an example:

<%= form.input :price, :label => “Price”, :as => :monetary %>

  • You can change the monetary symbol used in the form builder. This is something that could be improved upon.

  • Note that the time picker addon is not aware of time zones, so you could use the #utc method with time data in your controller to ensure it is saved and read correctly (if time zone data is not important to you). A more elaborate implementation which preserves TZ data would be preferred, of course.

Copyright © 2010 Steve Lorek.

formtastic-date-time-money-fields's People

Contributors

slorek avatar

Stargazers

 avatar

Watchers

 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.