Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <%= link_to checking_decreasing_user_notifications_path(
- current_user,
- notifiable_type: notification.notifiable_type,
- notifiable_id: notification.notifiable_id,
- notification_action: notification.action
- ) do %>
- def checking_decreasing
- current_user.decreasing_comment_notification_number(
- params[:notifiable_type],
- params[:notifiable_id]
- )
- redirect_to notification_redirection_path(
- params[:notifiable_type],
- params[:notifiable_id],
- params[:notification_action]
- )
- end
- def notification_redirection_path(notifiable_type, notifiable_id, action)
- if action == "commented"
- if notifiable_type == "ProductCustomer"
- product_customer = ProductCustomer.find(notifiable_id)
- product_id = product_customer.product_id
- elsif notifiable_type == "ProductLead"
- product_lead = ProductLead.find(notifiable_id)
- product_id = product_lead.product_id
- end
- route = case notifiable_type
- when "Post"
- posts_path(anchor: "post_#{notifiable_id}")#{}"/posts#post_#{notifiable_id}"
- when "Product"
- product_path(notifiable_id, anchor: "comment-panel")#/products/#{notifiable_id}#comment-panel"
- when "ProductLead"
- product_product_lead_path(product_id, notifiable_id, anchor: "comment-panel")#{}"/products/#{product_id}/#{notifiable_type}/#{notifiable_id}#comment-panel"
- when "ProductCustomer"
- product_product_customer_path(product_id, notifiable_id, anchor: "comment-panel") #/products/#{product_id}/#{notifiable_type}/#{notifiable_id}#comment-panel"
- end
- elsif action == "invited"
- product_path(notifiable_id, anchor: "product-invitation-well")
- elsif action == "accepted"
- product_product_users_path(notifiable_id)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement