Skip to content

Commit

Permalink
Make tags visible to other users (fixes publiclab#2138) (publiclab#2147
Browse files Browse the repository at this point in the history
)

*  Make tags visible to other users (fixes publiclab#2138)

 publiclab#2138

 The profile tags are currently only visible to the user themselves or
 to admins. The tags should be visible to everyone, while the "add tags" input should maintain its current visibility status (owner or administrator).

* Add a parent param to the tag/tagging partial.

This cleverly hides the input but only if it is rendered inside the
profile view.

* Improve the condition

* If parent is unset, set parent to nil
  • Loading branch information
ryzokuken authored and jywarren committed Feb 1, 2018
1 parent 438131d commit 2218325
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 3 additions & 1 deletion app/views/tag/_tagging.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@ $(function () {
})
</script>

<% parent ||= nil %>
<% if parent != :profile || (current_user && (current_user.id == @user.id || current_user.role == "admin")) %>
<% url = url || "/tag/create/" + @node.id.to_s %>

<% if current_user %>
<form id="tagform" class="form" data-remote="true" action="<%= url %>">
<div class="control-group">
<input name="remote" type="hidden" value="true" />
Expand Down
4 changes: 1 addition & 3 deletions app/views/users/profile.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -234,9 +234,7 @@

<hr />

<% if current_user && (current_user.id == @user.id || current_user.role == "admin") %>
<%= render :partial => "tag/tagging", locals: { url: "/profile/tags/create/#{ @user.id }" } %>
<% end %>
<%= render :partial => "tag/tagging", locals: { url: "/profile/tags/create/#{ @user.id }", parent: :profile } %>

<hr />

Expand Down

0 comments on commit 2218325

Please sign in to comment.