From 8d9b8cfe1662231ca5f9858927f4dcf789e5cfaf Mon Sep 17 00:00:00 2001 From: Cirdes Henrique Date: Tue, 17 Apr 2012 11:41:37 -0300 Subject: [PATCH 1/3] acception class pagseguro_form helper can receive a class now --- app/views/pagseguro/_pagseguro_form.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/pagseguro/_pagseguro_form.html.erb b/app/views/pagseguro/_pagseguro_form.html.erb index 4802d2f..d7c5bcd 100644 --- a/app/views/pagseguro/_pagseguro_form.html.erb +++ b/app/views/pagseguro/_pagseguro_form.html.erb @@ -21,6 +21,6 @@ <%= hidden_field_tag PagSeguro::Order::BILLING_MAPPING[name.to_sym], value %> <% end %> - <%= submit_tag options[:submit] %> + <%= submit_tag options[:submit], :class => options[:class] %> From 89248c9e1aa86e89bc77d6d73063f3c4a125e7e0 Mon Sep 17 00:00:00 2001 From: Cirdes Henrique Date: Tue, 17 Apr 2012 12:24:00 -0300 Subject: [PATCH 2/3] Extend submit_tag submit_tag helper can receive any options now --- Gemfile.lock | 118 +++++++++---------- app/views/pagseguro/_pagseguro_form.html.erb | 2 +- lib/pagseguro/helper.rb | 5 +- 3 files changed, 61 insertions(+), 64 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 42e8c54..01415e3 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -6,101 +6,99 @@ PATH GEM remote: http://rubygems.org/ specs: - actionmailer (3.1.1) - actionpack (= 3.1.1) - mail (~> 2.3.0) - actionpack (3.1.1) - activemodel (= 3.1.1) - activesupport (= 3.1.1) + actionmailer (3.2.3) + actionpack (= 3.2.3) + mail (~> 2.4.4) + actionpack (3.2.3) + activemodel (= 3.2.3) + activesupport (= 3.2.3) builder (~> 3.0.0) erubis (~> 2.7.0) - i18n (~> 0.6) - rack (~> 1.3.2) - rack-cache (~> 1.1) - rack-mount (~> 0.8.2) + journey (~> 1.0.1) + rack (~> 1.4.0) + rack-cache (~> 1.2) rack-test (~> 0.6.1) - sprockets (~> 2.0.2) - activemodel (3.1.1) - activesupport (= 3.1.1) + sprockets (~> 2.1.2) + activemodel (3.2.3) + activesupport (= 3.2.3) builder (~> 3.0.0) - i18n (~> 0.6) - activerecord (3.1.1) - activemodel (= 3.1.1) - activesupport (= 3.1.1) - arel (~> 2.2.1) + activerecord (3.2.3) + activemodel (= 3.2.3) + activesupport (= 3.2.3) + arel (~> 3.0.2) tzinfo (~> 0.3.29) - activeresource (3.1.1) - activemodel (= 3.1.1) - activesupport (= 3.1.1) - activesupport (3.1.1) + activeresource (3.2.3) + activemodel (= 3.2.3) + activesupport (= 3.2.3) + activesupport (3.2.3) + i18n (~> 0.6) multi_json (~> 1.0) - arel (2.2.1) + arel (3.0.2) builder (3.0.0) diff-lcs (1.1.3) erubis (2.7.0) fakeweb (1.3.0) hike (1.2.1) i18n (0.6.0) - json (1.6.1) - mail (2.3.0) + journey (1.0.3) + json (1.6.6) + mail (2.4.4) i18n (>= 0.4.0) mime-types (~> 1.16) treetop (~> 1.4.8) - mime-types (1.17.2) - multi_json (1.0.3) - nokogiri (1.5.0) + mime-types (1.18) + multi_json (1.3.1) + nokogiri (1.5.2) polyglot (0.3.3) - rack (1.3.5) - rack-cache (1.1) + rack (1.4.1) + rack-cache (1.2) rack (>= 0.4) - rack-mount (0.8.3) - rack (>= 1.0.0) rack-ssl (1.3.2) rack rack-test (0.6.1) rack (>= 1.0) - rails (3.1.1) - actionmailer (= 3.1.1) - actionpack (= 3.1.1) - activerecord (= 3.1.1) - activeresource (= 3.1.1) - activesupport (= 3.1.1) + rails (3.2.3) + actionmailer (= 3.2.3) + actionpack (= 3.2.3) + activerecord (= 3.2.3) + activeresource (= 3.2.3) + activesupport (= 3.2.3) bundler (~> 1.0) - railties (= 3.1.1) - railties (3.1.1) - actionpack (= 3.1.1) - activesupport (= 3.1.1) + railties (= 3.2.3) + railties (3.2.3) + actionpack (= 3.2.3) + activesupport (= 3.2.3) rack-ssl (~> 1.3.2) rake (>= 0.8.7) rdoc (~> 3.4) thor (~> 0.14.6) rake (0.9.2.2) - rdoc (3.11) + rdoc (3.12) json (~> 1.4) - rspec (2.7.0) - rspec-core (~> 2.7.0) - rspec-expectations (~> 2.7.0) - rspec-mocks (~> 2.7.0) - rspec-core (2.7.1) - rspec-expectations (2.7.0) - diff-lcs (~> 1.1.2) - rspec-mocks (2.7.0) - rspec-rails (2.7.0) - actionpack (~> 3.0) - activesupport (~> 3.0) - railties (~> 3.0) - rspec (~> 2.7.0) - sprockets (2.0.3) + rspec (2.9.0) + rspec-core (~> 2.9.0) + rspec-expectations (~> 2.9.0) + rspec-mocks (~> 2.9.0) + rspec-core (2.9.0) + rspec-expectations (2.9.1) + diff-lcs (~> 1.1.3) + rspec-mocks (2.9.0) + rspec-rails (2.9.0) + actionpack (>= 3.0) + activesupport (>= 3.0) + railties (>= 3.0) + rspec (~> 2.9.0) + sprockets (2.1.2) hike (~> 1.2) rack (~> 1.0) - tilt (~> 1.1, != 1.3.0) - sqlite3 (1.3.4) + tilt (!= 1.3.0, ~> 1.1) + sqlite3 (1.3.6) thor (0.14.6) tilt (1.3.3) treetop (1.4.10) polyglot polyglot (>= 0.3.1) - tzinfo (0.3.31) + tzinfo (0.3.33) PLATFORMS ruby diff --git a/app/views/pagseguro/_pagseguro_form.html.erb b/app/views/pagseguro/_pagseguro_form.html.erb index d7c5bcd..285ad88 100644 --- a/app/views/pagseguro/_pagseguro_form.html.erb +++ b/app/views/pagseguro/_pagseguro_form.html.erb @@ -21,6 +21,6 @@ <%= hidden_field_tag PagSeguro::Order::BILLING_MAPPING[name.to_sym], value %> <% end %> - <%= submit_tag options[:submit], :class => options[:class] %> + <%= submit_tag value, options%> diff --git a/lib/pagseguro/helper.rb b/lib/pagseguro/helper.rb index 21e3697..8404ea2 100644 --- a/lib/pagseguro/helper.rb +++ b/lib/pagseguro/helper.rb @@ -1,6 +1,5 @@ module PagSeguro::Helper - def pagseguro_form(order, options = {}) - options.reverse_merge!(:submit => "Pagar com PagSeguro") - render :partial => "pagseguro/pagseguro_form", :locals => {:options => options, :order => order} + def pagseguro_form(order, value = "Pagar com PagSeguro", options = {}) + render :partial => "pagseguro/pagseguro_form", :locals => {:value => value, :options => options, :order => order} end end From 166dd2017449e7f0ac0a1d6bfedd225ca73c1727 Mon Sep 17 00:00:00 2001 From: Cirdes Henrique Date: Mon, 23 Apr 2012 13:59:50 -0300 Subject: [PATCH 3/3] Changes to add backwards compatibility MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Modificações na maneira de adicionar a possibilidade de se passar opções para o submit_tag na view do cart para por exemplo: adicionar classes ao botão de forma que o css do twitter bootstrap possa funcionar --- Gemfile.lock | 4 ++-- app/views/pagseguro/_pagseguro_form.html.erb | 2 +- lib/pagseguro/helper.rb | 5 +++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 01415e3..620041d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -47,7 +47,7 @@ GEM mime-types (~> 1.16) treetop (~> 1.4.8) mime-types (1.18) - multi_json (1.3.1) + multi_json (1.3.2) nokogiri (1.5.2) polyglot (0.3.3) rack (1.4.1) @@ -91,7 +91,7 @@ GEM sprockets (2.1.2) hike (~> 1.2) rack (~> 1.0) - tilt (!= 1.3.0, ~> 1.1) + tilt (~> 1.1, != 1.3.0) sqlite3 (1.3.6) thor (0.14.6) tilt (1.3.3) diff --git a/app/views/pagseguro/_pagseguro_form.html.erb b/app/views/pagseguro/_pagseguro_form.html.erb index 285ad88..46fdd57 100644 --- a/app/views/pagseguro/_pagseguro_form.html.erb +++ b/app/views/pagseguro/_pagseguro_form.html.erb @@ -21,6 +21,6 @@ <%= hidden_field_tag PagSeguro::Order::BILLING_MAPPING[name.to_sym], value %> <% end %> - <%= submit_tag value, options%> + <%= submit_tag options[:submit], options.fetch(:html_options, {})%> diff --git a/lib/pagseguro/helper.rb b/lib/pagseguro/helper.rb index 8404ea2..21e3697 100644 --- a/lib/pagseguro/helper.rb +++ b/lib/pagseguro/helper.rb @@ -1,5 +1,6 @@ module PagSeguro::Helper - def pagseguro_form(order, value = "Pagar com PagSeguro", options = {}) - render :partial => "pagseguro/pagseguro_form", :locals => {:value => value, :options => options, :order => order} + def pagseguro_form(order, options = {}) + options.reverse_merge!(:submit => "Pagar com PagSeguro") + render :partial => "pagseguro/pagseguro_form", :locals => {:options => options, :order => order} end end