Code Monkey home page Code Monkey logo

formula's Introduction

Formula

Formula is a Rails form helper that generates awesome markup. The project lets users create semantically beautiful forms without introducing too much syntax.

Requirements

The gem is tested with:

  • Ruby on Rails 4.1.8

  • Ruby 2.1.5

  • Ruby 2.0.0

  • Ruby 1.9.3

  • JRuby

Installation

gem install formula

Examples

<% formula_form_for @user do |f| %>
  <%= f.input :email %>
  <%= f.input :password %>
  <%= f.button 'Save' %>
<% end %>

<% formula_form_for @user do |f| %>
  <%= f.input :email, label: "Email:", hint: "We promise never to bother you." %>
  <%= f.input :password, label: "Password:", hint: "Must be at least six characters." %>
  <%= f.button 'Save' %>
<% end %>

<% formula_form_for @company do |f|
  <%= f.input :url,   container: { class: 'third' }, input: { class: 'fill' } %>
  <%= f.input :phone, container: { class: 'third' }, input: { class: 'fill' } %>
  <%= f.input :email, container: { class: 'third' }, input: { class: 'fill' } %>
  <%= f.button 'Save', button: { class: 'fancy' } %>
<% end %>

<% formula_form_for @user do |f| %>
  <%= f.input :email, label: "Email:" %>
  <%= f.input :password, label: "Password:" %>
  <%= f.input :gender, label: 'Gender:', as: :select, choices: User::GENDERS %>
  <% formula_fields_for @user.payment do |payment_f| %>
    <%= payment_f.input :credit_card_number, label: 'Number:' %>
    <%= payment_f.input :credit_card_expiration, label: 'Expiration:' %>
  <% end %>
  <%= f.button 'Save', button: { class: 'fancy' } %>
<% end %>

<% formula_form_for @user do |f| %>
  <%= f.block :favourite %>
    <% @favourites.each do |favourite| %>
      ...
    <% end %>
  <% end %>
  <%= f.button 'Save', button: { class: 'fancy' } %>
<% end %>

Contributors

  • Iliya Grushevskiy

Status

<img src=“http://img.shields.io/gemnasium/ksylvest/formula.svg” /> <img src=“http://img.shields.io/travis/ksylvest/formula.svg” /> <img src=“http://img.shields.io/codeclimate/github/ksylvest/formula.svg” />

Copyright © 2010 - 2014 Kevin Sylvestre. See LICENSE for details.

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.