Module: Newebpay::DonationHelper
- Included in:
- ApplicationHelper
- Defined in:
- app/helpers/newebpay/donation_helper.rb
Instance Method Summary collapse
- #newebpay_donation_pay_button(title, donation_url, options) ⇒ Object
- #render_newebpay_donation_form(donation_form_object, options = {}) ⇒ Object
Instance Method Details
#newebpay_donation_pay_button(title, donation_url, options) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 |
# File 'app/helpers/newebpay/donation_helper.rb', line 24 def (title, donation_url, ) form = Newebpay::Donation::Form.new(donation_url, ) render_newebpay_donation_form( form, title: title, class: [:class], id: [:id], data: [:data] ) end |
#render_newebpay_donation_form(donation_form_object, options = {}) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'app/helpers/newebpay/donation_helper.rb', line 5 def render_newebpay_donation_form(donation_form_object, = {}) unless donation_form_object.is_a? Newebpay::Donation::Form raise ArgumentError, 'The first argument must be a Newebpay::Donation::Form.' end title = [:title] || 'Go' submit_class = [:class] || '' submit_id = [:id] || '' data = [:data] || {} form_tag(donation_form_object.donation_url, method: :post) do donation_form_object.form_attrs.each do |key, value| concat hidden_field_tag key, value end concat title, class: submit_class, id: submit_id, data: data end end |