Replace link with buttons in follow button
This commit is contained in:
@@ -1,19 +1,19 @@
|
|||||||
<div class="js-follow">
|
<div class="js-follow">
|
||||||
<span class="followable-content">
|
<span class="followable-content">
|
||||||
<% if follow.followable.followed_by?(current_user) %>
|
<% if follow.followable.followed_by?(current_user) %>
|
||||||
<%= link_to t("shared.following"),
|
<%= button_to t("shared.following"),
|
||||||
follow_path(follow),
|
follow_path(follow),
|
||||||
method: :delete, remote: true,
|
method: :delete, remote: true,
|
||||||
title: unfollow_text(follow.followable),
|
title: unfollow_text(follow.followable),
|
||||||
class: "button expanded" %>
|
class: "button expanded" %>
|
||||||
|
|
||||||
<% else %>
|
<% else %>
|
||||||
<%= link_to follow_text(follow.followable),
|
<%= button_to follow_text(follow.followable),
|
||||||
follows_path(followable_id: follow.followable.id,
|
follows_path(followable_id: follow.followable.id,
|
||||||
followable_type: follow.followable.class.name),
|
followable_type: follow.followable.class.name),
|
||||||
method: :post, remote: true,
|
remote: true,
|
||||||
title: follow_text(follow.followable),
|
title: follow_text(follow.followable),
|
||||||
class: "button hollow expanded" %>
|
class: "button hollow expanded" %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ shared_examples "followable" do |followable_class_name, followable_path, followa
|
|||||||
visit send(followable_path, arguments)
|
visit send(followable_path, arguments)
|
||||||
|
|
||||||
within "##{dom_id(followable)}" do
|
within "##{dom_id(followable)}" do
|
||||||
expect(page).not_to have_link("Follow")
|
expect(page).not_to have_button("Follow")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -28,7 +28,7 @@ shared_examples "followable" do |followable_class_name, followable_path, followa
|
|||||||
visit send(followable_path, arguments)
|
visit send(followable_path, arguments)
|
||||||
|
|
||||||
within "##{dom_id(followable)}" do
|
within "##{dom_id(followable)}" do
|
||||||
expect(page).to have_link("Follow #{followable.model_name.human.downcase}")
|
expect(page).to have_button("Follow #{followable.model_name.human.downcase}")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -37,7 +37,7 @@ shared_examples "followable" do |followable_class_name, followable_path, followa
|
|||||||
login_as(user)
|
login_as(user)
|
||||||
|
|
||||||
visit send(followable_path, arguments)
|
visit send(followable_path, arguments)
|
||||||
expect(page).to have_link("Follow #{followable.model_name.human.downcase}")
|
expect(page).to have_button("Follow #{followable.model_name.human.downcase}")
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario "Should display unfollow after user clicks on follow button" do
|
scenario "Should display unfollow after user clicks on follow button" do
|
||||||
@@ -46,10 +46,10 @@ shared_examples "followable" do |followable_class_name, followable_path, followa
|
|||||||
|
|
||||||
visit send(followable_path, arguments)
|
visit send(followable_path, arguments)
|
||||||
within "##{dom_id(followable)}" do
|
within "##{dom_id(followable)}" do
|
||||||
click_link("Follow #{followable.model_name.human.downcase}")
|
click_button("Follow #{followable.model_name.human.downcase}")
|
||||||
|
|
||||||
expect(page).not_to have_link("Follow")
|
expect(page).not_to have_button("Follow")
|
||||||
expect(page).to have_link("Following")
|
expect(page).to have_button("Following")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -59,7 +59,7 @@ shared_examples "followable" do |followable_class_name, followable_path, followa
|
|||||||
|
|
||||||
visit send(followable_path, arguments)
|
visit send(followable_path, arguments)
|
||||||
within "##{dom_id(followable)}" do
|
within "##{dom_id(followable)}" do
|
||||||
click_link("Follow #{followable.model_name.human.downcase}")
|
click_button("Follow #{followable.model_name.human.downcase}")
|
||||||
end
|
end
|
||||||
|
|
||||||
expect(page).to have_content "We will notify you of changes as they occur"
|
expect(page).to have_content "We will notify you of changes as they occur"
|
||||||
@@ -71,7 +71,7 @@ shared_examples "followable" do |followable_class_name, followable_path, followa
|
|||||||
|
|
||||||
visit send(followable_path, arguments)
|
visit send(followable_path, arguments)
|
||||||
|
|
||||||
expect(page).to have_link("Following")
|
expect(page).to have_button("Following")
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario "Updates follow button & show destroy notice after unfollow button is clicked" do
|
scenario "Updates follow button & show destroy notice after unfollow button is clicked" do
|
||||||
@@ -80,10 +80,10 @@ shared_examples "followable" do |followable_class_name, followable_path, followa
|
|||||||
|
|
||||||
visit send(followable_path, arguments)
|
visit send(followable_path, arguments)
|
||||||
within "##{dom_id(followable)}" do
|
within "##{dom_id(followable)}" do
|
||||||
click_link("Unfollow #{followable.model_name.human.downcase}")
|
click_button("Unfollow #{followable.model_name.human.downcase}")
|
||||||
|
|
||||||
expect(page).not_to have_link("Unfollow")
|
expect(page).not_to have_button("Unfollow")
|
||||||
expect(page).to have_link("Follow #{followable.model_name.human.downcase}")
|
expect(page).to have_button("Follow #{followable.model_name.human.downcase}")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -93,7 +93,7 @@ shared_examples "followable" do |followable_class_name, followable_path, followa
|
|||||||
|
|
||||||
visit send(followable_path, arguments)
|
visit send(followable_path, arguments)
|
||||||
within "##{dom_id(followable)}" do
|
within "##{dom_id(followable)}" do
|
||||||
click_link("Unfollow #{followable.model_name.human.downcase}")
|
click_button("Unfollow #{followable.model_name.human.downcase}")
|
||||||
end
|
end
|
||||||
|
|
||||||
expect(page).to have_content "You will no longer receive notifications"
|
expect(page).to have_content "You will no longer receive notifications"
|
||||||
|
|||||||
Reference in New Issue
Block a user