Skip to content

Commit

Permalink
Admin can edit/destroy topic in front page.
Browse files Browse the repository at this point in the history
  • Loading branch information
huacnlee authored and xdite committed Feb 22, 2012
1 parent 883abbd commit 5e3b2b5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions app/controllers/topics_controller.rb
Expand Up @@ -82,7 +82,7 @@ def new
end

def edit
@topic = current_user.topics.find(params[:id])
@topic = Topic.find(params[:id])
@node = @topic.node
drop_breadcrumb("#{@node.name}", node_topics_path(@node.id))
drop_breadcrumb t("topics.edit_topic")
Expand Down Expand Up @@ -111,7 +111,7 @@ def preview
end

def update
@topic = current_user.topics.find(params[:id])
@topic = Topic.find(params[:id])
pt = params[:topic]
@topic.node_id = pt[:node_id]
@topic.title = pt[:title]
Expand All @@ -125,7 +125,7 @@ def update
end

def destroy
@topic = current_user.topics.find(params[:id])
@topic = Topic.find(params[:id])
@topic.destroy
redirect_to(topics_path, :notice => t("topics.delete_topic_success"))
end
Expand Down
2 changes: 1 addition & 1 deletion app/views/topics/show.html.erb
Expand Up @@ -30,7 +30,7 @@

<div class="tools pull-right">
<%= likeable_tag(@topic) %>
<% if owner?(@topic) %>
<% if owner?(@topic) or admin? %>
<%= link_to "", edit_topic_path(@topic), :class => "icon small_edit", :title => "修改本帖" %>
<%= link_to "", topic_path(@topic.id), :method => :delete, :confirm => t("common.confirm_delete"), :class => "icon small_delete", :title => "删除本帖" %>
<% end %>
Expand Down

0 comments on commit 5e3b2b5

Please sign in to comment.