asm-products/verba

View on GitHub
app/views/users/edit.html.haml

Summary

Maintainability
Test Coverage
= render 'layouts/side_bar'

.col-sm-3.col-sm-offset-3
  = link_to "❮ back to my profile".html_safe, profile_path, class: "back"

.col-sm-9.col-sm-offset-3.settings-section
  = flash_message
  %h4 Settings
  = form_for @profile.user, html: { class: "settings-form" } do |f|
    .form-field
      = f.label :email
      = f.text_field :email
      - add_errors_of(@profile.user.errors, :email )
    .form-field
      = f.label :unsubscribe, "Unsubscribe from daily emails"
      = f.check_box :unsubscribe
    %br
    = f.submit "Update settings", class: "button"

  - if feature_active?(:payments)
    - unless @profile.user.paid
      %h4
        Trial:
        = @profile.user.days_left_in_trial
        days remaining.

      = form_tag subscriptions_path do
        %script.stripe-button{ |
          "data-amount" => ENV["BASIC_PLAN_AMOUNT_CENTS"], |
          "data-description" => "Monthly subscription", |
          "data-key" => ENV["STRIPE_PUBLISHABLE_KEY"], |
          "src" => "https://checkout.stripe.com/checkout.js"}
    - else
      %h4 Cancel subscription
      = link_to "Cancel", destroy_subscription_path, class: "button--danger", method: :delete,
        data: { confirm: "Are you sure you want to cancel your subscription? You won't be able to use Verba if you choose to cancel." }

    %p.content--small.breathe.refund-explanation If you write for 30 days in a row, you'll have the option to be refunded your monthly subscription fee.
    = @profile.refund_button