ai tags: disable "Add" button if user doesn't have permission to edit the post.
Disable the "Add" button on the /ai_tags page when the current user doesn't have permission to edit the post, for example if they're not logged in.
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<% if ai_tag.post.nil? %>
|
||||
<% if ai_tag.post.nil? || !policy(ai_tag).update? %>
|
||||
<%= button_to "Add", nil, class: "button-primary button-sm", disabled: true %>
|
||||
<% elsif ai_tag.post_tagged? %>
|
||||
<%= button_to "Remove", tag_ai_tag_path(media_asset_id: ai_tag.media_asset, tag_id: ai_tag.tag), remote: true, method: :put, params: { mode: "remove" }, class: "button-outline-danger button-sm" %>
|
||||
|
||||
Reference in New Issue
Block a user