README.md in supercharged-1.0.0 vs README.md in supercharged-2.0.0

- old
+ new

@@ -1,9 +1,9 @@ # Supercharged [![Build Status](https://travis-ci.org/divineforest/supercharged.png?branch=master)](https://travis-ci.org/divineforest/supercharged) -[![CodeClimate](https://codeclimate.com/github/divineforest/supercharged.png)](https://codeclimate.com/github/divineforest/supercharged) +[![Code Climate](https://codeclimate.com/github/divineforest/supercharged.png)](https://codeclimate.com/github/divineforest/supercharged) Complete MVC solution to accept charges from users on your Ruby on Rails site ## Installation @@ -23,10 +23,17 @@ ``` //= require supercharged ``` +And then in some assets file: + +``` +$ -> + new SuperchargedForm("[role='gateway-charge-form']") +``` + Create config/initializers/supercharged.rb ```ruby ActiveMerchant::Billing::Base.integration_mode = Rails.env.production? ? :production : :test ``` @@ -82,10 +89,28 @@ # update user balance with your own update_balance method or other things you want to do after charged approved user.update_balance(real_amount) super end end + + def min_amount + # specify min value for amount field here + # default is 1 + 42 + end end +``` + +## Form + +To display validation, supercharged form class has `onValidationError` callback: + +``` +$ -> + new SuperchargedForm("[role='gateway-charge-form']", { + onValidationError: (errors)-> + console.log "supercharged validation errors: ", errors + }) ``` # Contributing The example app is at https://github.com/divineforest/supercharged-example-app