Guest User

Untitled

a guest
Jul 16th, 2018
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.26 KB | None | 0 0
  1. <% if current_user.password.nil? and current_user.services.count == 1 %>
  2. <%= link_to "Disconnect #{service.provider.capitalize}", service, :confirm => 'Remove this service will delete your account, are you sure?', :method => :delete %>
  3. <% else %>
  4. <%= link_to "Disconnect #{service.provider.capitalize}", service, :confirm => 'Are you sure you want to remove this authentication option?', :method => :delete %>
  5. <% end %>
  6.  
  7. ActionView::Template::Error (/Users/benoit/rails_projects/website/app/views/services/index.html.erb:15: syntax error, unexpected ',', expecting ')'
  8. ...e this authentication option?', :method => :delete, :class =...
  9. ... ^):
  10. 12: <% for service in @services %>
  11. 13: <div class="service">
  12. 14: <%= image_tag "logo_#{service.provider}.png", :class => "left" %>
  13. 15: <%= link_to "Disconnect #{service.provider.capitalize}", service, :confirm => current_user.password.nil? and current_user.services.count == 1 ? 'Remove this service will delete your account, are you sure?' : 'Are you sure you want to remove this authentication option?', :method => :delete, :class => "remove" %>
  14. 16:
  15. 17: <div class="clear"></div>
  16. 18: </div>
  17.  
  18. <%= link_to "Disconnect #{service.provider.capitalize}", service, :confirm => current_user.password.nil? and current_user.services.count == 1 ? 'Remove this service will delete your account, are you sure?' : 'Are you sure you want to remove this authentication option?', :method => :delete, :class => "remove" %>
  19.  
  20. <% confirm_message = current_user.password.nil? and current_user.services.count == 1 ? 'Remove this service will delete your account, are you sure?' : 'Are you sure you want to remove this authentication option?' %>
  21.  
  22. <%= link_to "Disconnect #{service.provider.capitalize}", service, :confirm => confirm_message, :method => :delete, :class => "remove" %>
  23.  
  24. def auth_confirm_delete(current_user)
  25. if current_user.password.nil? and current_user.services.count == 1
  26. 'Remove this service will delete your account, are you sure?'
  27. else
  28. 'Are you sure you want to remove this authentication option?'
  29. end
  30. end
  31.  
  32. <%= link_to "Disconnect #{service.provider.capitalize}", service, :confirm => auth_confirm_delete, :method => :delete %>
Add Comment
Please, Sign In to add comment