remove links that are not usable by anon users, fixes #977

This commit is contained in:
albert
2013-03-22 10:18:05 -07:00
parent b21dcc47a7
commit 8bfd7b408f
9 changed files with 31 additions and 19 deletions

View File

@@ -85,7 +85,7 @@ protected
end
end
%w(member banned privileged platinum contributor janitor moderator admin).each do |level|
%w(member banned builder privileged platinum contributor janitor moderator admin).each do |level|
define_method("#{level}_only") do
if CurrentUser.user.__send__("is_#{level}?")
true

View File

@@ -37,7 +37,9 @@
</ul>
</td>
<td>
<%= link_to "Revert", revert_artist_path(artist_version.artist_id, :version_id => artist_version.id), :method => :put, :confirm => "Are you sure you want to revert this artist?" %>
<% if CurrentUser.is_member? %>
<%= link_to "Revert", revert_artist_path(artist_version.artist_id, :version_id => artist_version.id), :method => :put, :confirm => "Are you sure you want to revert this artist?" %>
<% end %>
</td>
</tr>
<% end %>

View File

@@ -10,7 +10,9 @@
<li>|</li>
<li><%= link_to "Posts", posts_path(:tags => @artist.name) %></li>
<li><%= link_to "Show", artist_path(@artist) %></li>
<li><%= link_to "Edit", edit_artist_path(@artist) %></li>
<% if CurrentUser.is_member? %>
<li><%= link_to "Edit", edit_artist_path(@artist) %></li>
<% end %>
<li><%= link_to "History", artist_versions_path(:search => {:artist_id => @artist.id}) %></li>
<% if CurrentUser.is_admin? %>
<%= link_to "Ban", ban_artist_path(@artist), :method => :put %>

View File

@@ -21,8 +21,10 @@
<div class="clearfix"></div>
<div class="new-comment">
<p><%= link_to "Post comment", new_comment_path, :class => "expand-comment-response" %></p>
<%= render "comments/partials/new/form", :post => post %>
</div>
<% if CurrentUser.is_member? %>
<div class="new-comment">
<p><%= link_to "Post comment", new_comment_path, :class => "expand-comment-response" %></p>
<%= render "comments/partials/new/form", :post => post %>
</div>
<% end %>
</div>

View File

@@ -20,10 +20,10 @@
<% end %>
<menu>
<li>ID: <%= forum_post.id %></li>
<% if @forum_topic %>
<% if CurrentUser.is_member? && @forum_topic %>
<li><%= link_to "Quote", new_forum_post_path(:post_id => forum_post.id), :method => :get, :remote => true %></li>
<% end %>
<% if CurrentUser.user.is_janitor? %>
<% if CurrentUser.is_janitor? %>
<% if forum_post.is_deleted %>
<li><%= link_to "Undelete", undelete_forum_post_path(forum_post.id), :method => :post, :remote => true %></li>
<% else %>

View File

@@ -1,11 +1,15 @@
<% content_for(:secondary_links) do %>
<menu>
<li><%= link_to "Listing", forum_topics_path %></li>
<li><%= link_to "New", new_forum_topic_path %></li>
<% if CurrentUser.is_member? %>
<li><%= link_to "New", new_forum_topic_path %></li>
<li><%= link_to "Mark all as read", mark_all_as_read_forum_topics_path, :method => :post %></li>
<% end %>
<li><%= link_to "Search", search_forum_posts_path %></li>
<li><%= link_to "Mark all as read", mark_all_as_read_forum_topics_path, :method => :post %></li>
<li><%= link_to "Help", wiki_pages_path(:title => "help:forum") %></li>
<% if @forum_topic && !@forum_topic.new_record? %>
<% if CurrentUser.is_member? && @forum_topic && !@forum_topic.new_record? %>
<li>|</li>
<li><%= link_to "Reply", new_forum_post_path(:topic_id => @forum_topic.id) %></li>
<% if !@forum_topic.new_record? && @forum_topic.editable_by?(CurrentUser.user) %>

View File

@@ -15,11 +15,13 @@
<%= render "forum_posts/listing", :forum_posts => @forum_posts %>
<p><%= link_to "Reply &raquo;".html_safe, new_forum_post_path(:topic_id => @forum_topic.id), :id => "new-response-link" %></p>
<% if CurrentUser.is_member? %>
<p><%= link_to "Reply &raquo;".html_safe, new_forum_post_path(:topic_id => @forum_topic.id), :id => "new-response-link" %></p>
<div style="display: none;" id="topic-response">
<%= render "forum_posts/form", :forum_post => ForumPost.new(:topic_id => @forum_topic.id) %>
</div>
<div style="display: none;" id="topic-response">
<%= render "forum_posts/form", :forum_post => ForumPost.new(:topic_id => @forum_topic.id) %>
</div>
<% end %>
<%= numbered_paginator(@forum_posts) %>
</div>

View File

@@ -4,7 +4,7 @@
<li><%= link_to "Listing", pools_path %></li>
<li><%= link_to "Search", search_pools_path %></li>
<li><%= link_to "New", new_pool_path %></li>
<% if @pool && !@pool.new_record? %>
<% if CurrentUser.is_member? && @pool && !@pool.new_record? %>
<li>|</li>
<li><%= link_to "Show", pool_path(@pool) %></li>
<li><%= link_to "Posts", posts_path(:tags => "pool:#{@pool.id}") %></li>

View File

@@ -51,7 +51,7 @@
<menu id="post-sections">
<li><a href="#comments">Comments</a></li>
<% if Danbooru.config.can_user_see_post?(CurrentUser.user, @post) %>
<% if CurrentUser.is_member? && Danbooru.config.can_user_see_post?(CurrentUser.user, @post) %>
<li><a href="#edit" id="post-edit-link">Edit</a></li>
<% end %>
<li><a href="#share">Share</a></li>
@@ -65,7 +65,7 @@
<%= render :partial => "notes/note", :collection => @post.notes.active %>
</section>
<% if Danbooru.config.can_user_see_post?(CurrentUser.user, @post) %>
<% if CurrentUser.is_member? && Danbooru.config.can_user_see_post?(CurrentUser.user, @post) %>
<section id="edit" style="display: none;">
<%= render "posts/partials/show/edit", :post => @post %>
</section>