From cc59ce53e52bf48d97de16d66012e8309bf98fe8 Mon Sep 17 00:00:00 2001 From: Azul Date: Tue, 27 May 2014 16:32:50 +0200 Subject: add btn helper for link_to with .btn Also translates the first arg if it's a symbol and adds more btn- classes if given as html_options[:type] --- engines/billing/app/views/subscriptions/destroy.html.haml | 2 +- engines/billing/app/views/subscriptions/index.html.haml | 2 +- engines/billing/app/views/subscriptions/show.html.haml | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) (limited to 'engines/billing/app/views/subscriptions') diff --git a/engines/billing/app/views/subscriptions/destroy.html.haml b/engines/billing/app/views/subscriptions/destroy.html.haml index 44b4333..e6e8578 100644 --- a/engines/billing/app/views/subscriptions/destroy.html.haml +++ b/engines/billing/app/views/subscriptions/destroy.html.haml @@ -4,4 +4,4 @@ Error: = @result.message %p - = link_to 'Customer Information', show_customer_path(@user), :class=> :btn \ No newline at end of file + = btn 'Customer Information', show_customer_path(@user) diff --git a/engines/billing/app/views/subscriptions/index.html.haml b/engines/billing/app/views/subscriptions/index.html.haml index 3d4e8fd..1e3fb25 100644 --- a/engines/billing/app/views/subscriptions/index.html.haml +++ b/engines/billing/app/views/subscriptions/index.html.haml @@ -5,4 +5,4 @@ - pending_active_pastdue = true = render :partial => "subscription_details", :locals => {:subscription => s} - if !pending_active_pastdue and @user == current_user - = link_to 'subscribe to plan', new_subscription_path, :class => :btn \ No newline at end of file + = btn 'subscribe to plan', new_subscription_path diff --git a/engines/billing/app/views/subscriptions/show.html.haml b/engines/billing/app/views/subscriptions/show.html.haml index 2699db9..af1a5a5 100644 --- a/engines/billing/app/views/subscriptions/show.html.haml +++ b/engines/billing/app/views/subscriptions/show.html.haml @@ -3,4 +3,5 @@ Current Subscription = render :partial => "subscription_details", :locals => {:subscription => @subscription} -= link_to t(:cancel_subscription), user_subscription_path(@user, @subscription.id), :confirm => t(:are_you_sure), :method => :delete, :class => 'btn btn-danger' if allow_cancel_subscription(@subscription) +- if allow_cancel_subscription(@subscription) + = btn :cancel_subscription, user_subscription_path(@user, @subscription.id), :confirm => t(:are_you_sure), :method => :delete, :type => 'danger' -- cgit v1.2.3 From df1c2438fcfe39edfb46546be8fcee5021f95fc3 Mon Sep 17 00:00:00 2001 From: Azul Date: Wed, 28 May 2014 09:26:17 +0200 Subject: destroy_btn helper method --- engines/billing/app/views/subscriptions/show.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/billing/app/views/subscriptions') diff --git a/engines/billing/app/views/subscriptions/show.html.haml b/engines/billing/app/views/subscriptions/show.html.haml index af1a5a5..246ebf0 100644 --- a/engines/billing/app/views/subscriptions/show.html.haml +++ b/engines/billing/app/views/subscriptions/show.html.haml @@ -4,4 +4,4 @@ Subscription = render :partial => "subscription_details", :locals => {:subscription => @subscription} - if allow_cancel_subscription(@subscription) - = btn :cancel_subscription, user_subscription_path(@user, @subscription.id), :confirm => t(:are_you_sure), :method => :delete, :type => 'danger' + = destroy_btn :cancel_subscription, user_subscription_path(@user, @subscription.id), type: 'danger' -- cgit v1.2.3