[PostSets] Move invite link from helper to partial

This commit is contained in:
Earlopain 2021-05-14 13:20:35 +02:00
parent f4e2cace14
commit 9111987abd
No known key found for this signature in database
GPG Key ID: 6CFB948E15246897
3 changed files with 11 additions and 17 deletions

View File

@ -1,16 +0,0 @@
module PostSetMaintainerHelper
def invite_links(m)
html = ""
if m.status == "pending"
html << link_to("Accept", approve_post_set_maintainer_path(m), data: {confirm: "Are you sure you want to accept this invite?"})
html << " " + link_to("Ignore", deny_post_set_maintainer_path(m), data: {confirm: "Are you sure you want to ignore this invite?"})
html << " " + link_to("Block", block_post_set_maintainer_path(m), data: {confirm: "Are you sure you want to ignore and block future invites for this set?"})
elsif m.status == "approved"
html << link_to("Remove", deny_post_set_maintainer_path(m), data: {confirm: "Are you sure you want to remove yourself as maintainer of this set?"})
html << " " + link_to("Block", block_post_set_maintainer_path(m), data: {confirm: "Are you sure you want to remove yourself and block future invites for this set?"})
elsif m.status == "blocked"
html << link_to("Unblock", deny_post_set_maintainer_path(m), data: {confirm: "Are you sure you want to unblock invites for this set?"})
end
html.html_safe
end
end

View File

@ -0,0 +1,10 @@
<% if invite.status == "pending" %>
<%= link_to("Accept", approve_post_set_maintainer_path(invite), data: {confirm: "Are you sure you want to accept this invite?"}) %>
<%= link_to("Ignore", deny_post_set_maintainer_path(invite), data: {confirm: "Are you sure you want to ignore this invite?"}) %>
<%= link_to("Block", block_post_set_maintainer_path(invite), data: {confirm: "Are you sure you want to ignore and block future invites for this set?"}) %>
<% elsif invite.status == "approved" %>
<%= link_to("Remove", deny_post_set_maintainer_path(invite), data: {confirm: "Are you sure you want to remove yourself as maintainer of this set?"}) %>
<%= link_to("Block", block_post_set_maintainer_path(invite), data: {confirm: "Are you sure you want to remove yourself and block future invites for this set?"}) %>
<% elsif invite.status == "blocked" %>
<%= link_to("Unblock", deny_post_set_maintainer_path(invite), data: {confirm: "Are you sure you want to unblock invites for this set?"}) %>
<% end %>

View File

@ -15,7 +15,7 @@
<td><%= link_to m.post_set.name, post_set_path(m.post_set) %></td>
<td><%= m.status.capitalize %></td>
<td><%= compact_time m.updated_at %></td>
<td><%= invite_links m %></td>
<td><%= render "post_set_maintainers/invite_links", invite: m %></td>
</tr>
<% end %>
<% end %>