RailsApps / rails-stripe-membership-saas

An example Rails 4.2 app with Stripe and the Payola gem for a membership or subscription site.

Home Page:http://railsapps.github.io/rails-stripe-membership-saas

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How do you convert the form_for form into simple_form_for?

RailsCod3rFuture opened this issue · comments

I'm unable to change the credit card portion of the form into a compatible field for simple_form_for. Has anyone done this yet?

<% content_for :head do %>
<%= render 'payola/transactions/stripe_header' %>
<% end %>

Sign up

<%= simple_form_for(resource, as: resource_name, url: registration_path(resource_name), :html => {:role => 'form',
:class => 'payola-onestep-subscription-form',
'data-payola-base-path' => payola_path,
'data-payola-plan-type' => resource.subscription_plan.class,
'data-payola-plan-id' => resource.subscription_plan}) do |f| %>

<%= f.error_notification %>
<div>
  <span id="error_explanation" class="payola-payment-error"></span>
</div>
<div class="form-group">
  <div class="col-md-4">
    <%= f.label 'Subscription Plan' %>
    <%= f.input :subscription_plan, collection: SubscriptionPlan.user_plan, label: false, prompt: 'Choose a plan' %>
  </div>
</div>
<div class="form-group">
  <div class="col-md-4">
    <label for="fg-1">Email</label>
    <%= f.input :email, label: false, required: true, autofocus: true, id: 'fg-1' %>
  </div>
</div>

<div class="form-group">
  <div class="col-md-4">
    <label>Credit Card Number</label>
    <%= f.input :card_number, class: 'form-control', data: { stripe: 'number' } %>
  </div>
</div>
<div class="form-group">
  <label>Card Security Code</label>
  <%= f.input :card_code, class: 'form-control', data: { stripe: 'cvc' } %>
</div>
<br />
<div class="form-group">
  <label>Card Expiry</label>
  <%= f.select_month nil, { use_two_digit_numbers: true}, { name: nil, data: { stripe: 'exp-month' } } %>
  <%= f.select_year nil, {start_year: Date.today.year, end_year: Date.today.year+10}, { name: nil, data: { stripe: 'exp-year' } } %>
</div>
<div class="form-group">
  <div class="col-md-4">
    <label for="password-strength">Password</label>
    <%= f.input :password, id: 'password-strength', required: true, hint: ("#{@minimum_password_length} characters minimum" if @minimum_password_length), class: 'form-control', label: false %>
  </div>
</div>

<div class="form-group">
  <div class="col-md-4">
    <label for="password-confirm">Password Confirm</label>
    <%= f.input :password_confirmation, required: true, label: false, id: 'password-confirm' %>
    <%= f.button :submit, "Sign up", :class => 'btn btn-primary' %>
  </div>
</div>

<% end %>